]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:ntvfs: Correctly acknowledge PVFS_FLAG_STRICT_SYNC flag (CID 241154)
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Fri, 6 Oct 2023 03:00:46 +0000 (16:00 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 13 Oct 2023 02:18:31 +0000 (02:18 +0000)
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/ntvfs/posix/pvfs_open.c

index de6c0efdb3d0bf606b2ea993386fa1b5268a51fd..860861d8c21de7106a9e31f6497bd08818662b3e 100644 (file)
@@ -1280,7 +1280,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
 
        /* Open the file with sync, if they asked for it, but
           'strict sync = no' turns this client request into a no-op */
-       if (create_options & (NTCREATEX_OPTIONS_WRITE_THROUGH) && !(pvfs->flags | PVFS_FLAG_STRICT_SYNC)) {
+       if (create_options & (NTCREATEX_OPTIONS_WRITE_THROUGH) && pvfs->flags & PVFS_FLAG_STRICT_SYNC) {
                flags |= O_SYNC;
        }
 
@@ -1368,7 +1368,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
        case NTCREATEX_DISP_SUPERSEDE:
        case NTCREATEX_DISP_OVERWRITE_IF:
                if (name->stream_name == NULL) {
-                       flags = O_TRUNC;
+                       flags |= O_TRUNC;
                } else {
                        stream_truncate = true;
                }
@@ -1379,7 +1379,6 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
                if (!name->stream_exists) {
                        return NT_STATUS_OBJECT_NAME_NOT_FOUND;
                }
-               flags = 0;
                break;
 
        case NTCREATEX_DISP_OVERWRITE:
@@ -1387,7 +1386,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
                        return NT_STATUS_OBJECT_NAME_NOT_FOUND;
                }
                if (name->stream_name == NULL) {
-                       flags = O_TRUNC;
+                       flags |= O_TRUNC;
                } else {
                        stream_truncate = true;
                }
@@ -1398,11 +1397,9 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
                if (name->stream_exists) {
                        return NT_STATUS_OBJECT_NAME_COLLISION;
                }
-               flags = 0;
                break;
 
        case NTCREATEX_DISP_OPEN_IF:
-               flags = 0;
                break;
 
        default: