diff options
-rw-r--r-- | source3/include/proto.h | 3 | ||||
-rw-r--r-- | source3/smbd/open.c | 11 | ||||
-rw-r--r-- | source3/smbd/trans2.c | 20 |
3 files changed, 19 insertions, 15 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index a22305991b..f685152de8 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -7004,7 +7004,8 @@ NTSTATUS get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn, NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx, connection_struct *conn, files_struct *fsp, const char *fname, char ***pnames, size_t *pnum_names); -NTSTATUS set_ea(connection_struct *conn, files_struct *fsp, const char *fname, struct ea_list *ea_list); +NTSTATUS set_ea(connection_struct *conn, files_struct *fsp, + const struct smb_filename *smb_fname, struct ea_list *ea_list); struct ea_list *read_ea_list_entry(TALLOC_CTX *ctx, const char *pdata, size_t data_size, size_t *pbytes_used); void send_trans2_replies(connection_struct *conn, struct smb_request *req, diff --git a/source3/smbd/open.c b/source3/smbd/open.c index eb70344224..aafedf4ce4 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -2955,7 +2955,6 @@ static NTSTATUS create_file_unixpath(connection_struct *conn, int info = FILE_WAS_OPENED; files_struct *base_fsp = NULL; files_struct *fsp = NULL; - char *fname = NULL; NTSTATUS status; DEBUG(10,("create_file_unixpath: access_mask = 0x%x " @@ -2971,12 +2970,6 @@ static NTSTATUS create_file_unixpath(connection_struct *conn, (unsigned int)oplock_request, ea_list, sd, smb_fname_str_dbg(smb_fname))); - status = get_full_smb_filename(talloc_tos(), smb_fname, - &fname); - if (!NT_STATUS_IS_OK(status)) { - goto fail; - } - if (create_options & FILE_OPEN_BY_FILE_ID) { status = NT_STATUS_NOT_SUPPORTED; goto fail; @@ -3244,8 +3237,8 @@ static NTSTATUS create_file_unixpath(connection_struct *conn, } if ((ea_list != NULL) && - ((info == FILE_WAS_CREATED) || (info == FILE_WAS_OVERWRITTEN))) { - status = set_ea(conn, fsp, fname, ea_list); + ((info == FILE_WAS_CREATED) || (info == FILE_WAS_OVERWRITTEN))) { + status = set_ea(conn, fsp, smb_fname, ea_list); if (!NT_STATUS_IS_OK(status)) { goto fail; } diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index a7d5c427d3..8bd37633d0 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -404,12 +404,22 @@ static void canonicalize_ea_name(connection_struct *conn, files_struct *fsp, con Set or delete an extended attribute. ****************************************************************************/ -NTSTATUS set_ea(connection_struct *conn, files_struct *fsp, const char *fname, struct ea_list *ea_list) +NTSTATUS set_ea(connection_struct *conn, files_struct *fsp, + const struct smb_filename *smb_fname, struct ea_list *ea_list) { + char *fname = NULL; + NTSTATUS status; + if (!lp_ea_support(SNUM(conn))) { return NT_STATUS_EAS_NOT_SUPPORTED; } + status = get_full_smb_filename(talloc_tos(), smb_fname, + &fname); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + for (;ea_list; ea_list = ea_list->next) { int ret; fstring unix_ea_name; @@ -5146,7 +5156,7 @@ static NTSTATUS smb_info_set_ea(connection_struct *conn, const char *pdata, int total_data, files_struct *fsp, - const char *fname) + const struct smb_filename *smb_fname) { struct ea_list *ea_list = NULL; TALLOC_CTX *ctx = NULL; @@ -5176,7 +5186,7 @@ static NTSTATUS smb_info_set_ea(connection_struct *conn, if (!ea_list) { return NT_STATUS_INVALID_PARAMETER; } - status = set_ea(conn, fsp, fname, ea_list); + status = set_ea(conn, fsp, smb_fname, ea_list); return status; } @@ -6964,7 +6974,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn, pdata, total_data, fsp, - fname); + smb_fname); break; } @@ -7300,7 +7310,7 @@ static void call_trans2mkdir(connection_struct *conn, struct smb_request *req, /* Try and set any given EA. */ if (ea_list) { - status = set_ea(conn, NULL, smb_dname->base_name, ea_list); + status = set_ea(conn, NULL, smb_dname, ea_list); if (!NT_STATUS_IS_OK(status)) { reply_nterror(req, status); goto out; |