r17248: Ensure we definately add the WRITE_DATA on O_TRUNC.
authorJeremy Allison <jra@samba.org>
Wed, 26 Jul 2006 02:15:01 +0000 (02:15 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:38:22 +0000 (11:38 -0500)
Jeremy.

source/smbd/open.c

index 95c70dff542877192a711f4198d5304f222e8d8c..fd2f1ae54f1993ce023ec8ad324e9a68a7f154b2 100644 (file)
@@ -1297,9 +1297,6 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
        /* This is a nasty hack - must fix... JRA. */
        if (access_mask == MAXIMUM_ALLOWED_ACCESS) {
                open_access_mask = access_mask = FILE_GENERIC_ALL;
-               if (flags2 & O_TRUNC) {
-                       open_access_mask |= FILE_WRITE_DATA; /* This will cause oplock breaks. */
-               }
        }
 
        /*
@@ -1309,6 +1306,10 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
        se_map_generic(&access_mask, &file_generic_mapping);
        open_access_mask = access_mask;
 
+       if (flags2 & O_TRUNC) {
+               open_access_mask |= FILE_WRITE_DATA; /* This will cause oplock breaks. */
+       }
+
        DEBUG(10, ("open_file_ntcreate: fname=%s, after mapping "
                   "access_mask=0x%x\n", fname, access_mask ));