The branch, master has been updated
       via  f8bd055... Proper fix for #6898 - Samba duplicates file content on 
appending. Pointed out by Volker.Restores the pathname handling for 
FILE_FLAG_POSIX_SEMANTICS but still prevents the O_APPEND problems. Jeremy.
      from  8353d47... s3: add dbwrap_torture - a tool to stress test tdb 
transactions through dbwrap

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit f8bd0559ada056722d7d5ae0286753e7c591650b
Author: Jeremy Allison <[email protected]>
Date:   Mon Nov 23 15:01:34 2009 -0800

    Proper fix for #6898 - Samba duplicates file content on appending. Pointed 
out by Volker.Restores the pathname handling for FILE_FLAG_POSIX_SEMANTICS but 
still prevents the O_APPEND problems. Jeremy.

-----------------------------------------------------------------------

Summary of changes:
 source3/include/smb.h   |    1 +
 source3/smbd/filename.c |    3 ++-
 source3/smbd/nttrans.c  |   30 ++++++++++++++++++------------
 3 files changed, 21 insertions(+), 13 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/smb.h b/source3/include/smb.h
index a3acb7c..0968984 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -1954,6 +1954,7 @@ struct smb_file_time {
 #define UCF_SAVE_LCOMP                 0x00000001
 #define UCF_ALWAYS_ALLOW_WCARD_LCOMP   0x00000002
 #define UCF_COND_ALLOW_WCARD_LCOMP     0x00000004
+#define UCF_POSIX_PATHNAMES            0x00000008
 
 /*
  * smb_filename
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index 5d6661d..16e3631 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -238,7 +238,8 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
                }
        }
 
-       posix_pathnames = lp_posix_pathnames();
+       posix_pathnames = (lp_posix_pathnames() ||
+                               (ucf_flags & UCF_POSIX_PATHNAMES));
 
        /*
         * Strip off the stream, and add it back when we're done with the
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 5c6d780..9e98291 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -418,11 +418,6 @@ void reply_ntcreate_and_X(struct smb_request *req)
        flags = IVAL(req->vwv+3, 1);
        access_mask = IVAL(req->vwv+7, 1);
        file_attributes = IVAL(req->vwv+13, 1);
-       /*
-        * Bug #6898 - clients using Windows opens should
-        * never be able to set this attribute.
-        */
-       file_attributes &= ~FILE_FLAG_POSIX_SEMANTICS;
        share_access = IVAL(req->vwv+15, 1);
        create_disposition = IVAL(req->vwv+17, 1);
        create_options = IVAL(req->vwv+19, 1);
@@ -483,7 +478,8 @@ void reply_ntcreate_and_X(struct smb_request *req)
                                conn,
                                req->flags2 & FLAGS2_DFS_PATHNAMES,
                                fname,
-                               0,
+                               (file_attributes & FILE_FLAG_POSIX_SEMANTICS) ?
+                                       UCF_POSIX_PATHNAMES : 0,
                                NULL,
                                &smb_fname);
 
@@ -498,6 +494,13 @@ void reply_ntcreate_and_X(struct smb_request *req)
                goto out;
        }
 
+       /*
+        * Bug #6898 - clients using Windows opens should
+        * never be able to set this attribute into the
+        * VFS.
+        */
+       file_attributes &= ~FILE_FLAG_POSIX_SEMANTICS;
+
        status = SMB_VFS_CREATE_FILE(
                conn,                                   /* conn */
                req,                                    /* req */
@@ -918,11 +921,6 @@ static void call_nt_transact_create(connection_struct 
*conn,
        flags = IVAL(params,0);
        access_mask = IVAL(params,8);
        file_attributes = IVAL(params,20);
-       /*
-        * Bug #6898 - clients using Windows opens should
-        * never be able to set this attribute.
-        */
-       file_attributes &= ~FILE_FLAG_POSIX_SEMANTICS;
        share_access = IVAL(params,24);
        create_disposition = IVAL(params,28);
        create_options = IVAL(params,32);
@@ -1004,7 +1002,8 @@ static void call_nt_transact_create(connection_struct 
*conn,
                                conn,
                                req->flags2 & FLAGS2_DFS_PATHNAMES,
                                fname,
-                               0,
+                               (file_attributes & FILE_FLAG_POSIX_SEMANTICS) ?
+                                       UCF_POSIX_PATHNAMES : 0,
                                NULL,
                                &smb_fname);
 
@@ -1025,6 +1024,13 @@ static void call_nt_transact_create(connection_struct 
*conn,
                        ? BATCH_OPLOCK : 0;
        }
 
+       /*
+        * Bug #6898 - clients using Windows opens should
+        * never be able to set this attribute into the
+        * VFS.
+        */
+       file_attributes &= ~FILE_FLAG_POSIX_SEMANTICS;
+
        status = SMB_VFS_CREATE_FILE(
                conn,                                   /* conn */
                req,                                    /* req */


-- 
Samba Shared Repository

Reply via email to