Ensure we do pathname processing before SD and EA processing in NTTRANS_CREATE.
authorJeremy Allison <jra@samba.org>
Tue, 16 Jul 2013 18:05:10 +0000 (11:05 -0700)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 19 Jul 2013 07:52:45 +0000 (17:52 +1000)
Bug 9992 - Windows error 0x800700FE when copying files with xattr names containing ":"

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/smbd/nttrans.c

index 1c3e3b8a452394f7ba6fb29613566a0e6878a86b..c8116b0a43aa5ae20ff8788ce692780d68f63044 100644 (file)
@@ -1092,6 +1092,44 @@ static void call_nt_transact_create(connection_struct *conn,
         */
        create_options &= ~NTCREATEX_OPTIONS_MUST_IGNORE_MASK;
 
+       srvstr_get_path(ctx, params, req->flags2, &fname,
+                       params+53, parameter_count-53,
+                       STR_TERMINATE, &status);
+       if (!NT_STATUS_IS_OK(status)) {
+               reply_nterror(req, status);
+               goto out;
+       }
+
+       if (file_attributes & FILE_FLAG_POSIX_SEMANTICS) {
+               case_state = set_posix_case_semantics(ctx, conn);
+               if (!case_state) {
+                       reply_nterror(req, NT_STATUS_NO_MEMORY);
+                       goto out;
+               }
+       }
+
+       status = filename_convert(ctx,
+                               conn,
+                               req->flags2 & FLAGS2_DFS_PATHNAMES,
+                               fname,
+                               (create_disposition == FILE_CREATE)
+                                 ? UCF_CREATING_FILE : 0,
+                               NULL,
+                               &smb_fname);
+
+       TALLOC_FREE(case_state);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
+                       reply_botherror(req,
+                               NT_STATUS_PATH_NOT_COVERED,
+                               ERRSRV, ERRbadpath);
+                       goto out;
+               }
+               reply_nterror(req, status);
+               goto out;
+       }
+
        /* Ensure the data_len is correct for the sd and ea values given. */
        if ((ea_len + sd_len > data_count)
            || (ea_len > data_count) || (sd_len > data_count)
@@ -1164,44 +1202,6 @@ static void call_nt_transact_create(connection_struct *conn,
                }
        }
 
-       srvstr_get_path(ctx, params, req->flags2, &fname,
-                       params+53, parameter_count-53,
-                       STR_TERMINATE, &status);
-       if (!NT_STATUS_IS_OK(status)) {
-               reply_nterror(req, status);
-               goto out;
-       }
-
-       if (file_attributes & FILE_FLAG_POSIX_SEMANTICS) {
-               case_state = set_posix_case_semantics(ctx, conn);
-               if (!case_state) {
-                       reply_nterror(req, NT_STATUS_NO_MEMORY);
-                       goto out;
-               }
-       }
-
-       status = filename_convert(ctx,
-                               conn,
-                               req->flags2 & FLAGS2_DFS_PATHNAMES,
-                               fname,
-                               (create_disposition == FILE_CREATE)
-                                 ? UCF_CREATING_FILE : 0,
-                               NULL,
-                               &smb_fname);
-
-       TALLOC_FREE(case_state);
-
-       if (!NT_STATUS_IS_OK(status)) {
-               if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
-                       reply_botherror(req,
-                               NT_STATUS_PATH_NOT_COVERED,
-                               ERRSRV, ERRbadpath);
-                       goto out;
-               }
-               reply_nterror(req, status);
-               goto out;
-       }
-
        oplock_request = (flags & REQUEST_OPLOCK) ? EXCLUSIVE_OPLOCK : 0;
        if (oplock_request) {
                oplock_request |= (flags & REQUEST_BATCH_OPLOCK)