pvfs: fix handling of create_option flags
authorStefan Metzmacher <metze@samba.org>
Thu, 14 Aug 2008 10:37:31 +0000 (12:37 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 14 Aug 2008 11:13:51 +0000 (13:13 +0200)
metze
(This used to be commit 3c6cadf76861d6522c5ec41953df1ba2fac4910d)

source4/ntvfs/posix/pvfs_open.c

index 6114b2052c1cf2f95f84fd202cd3d63f8651e90c..c127885a68f3cae149cb6321d19cdf0076c4206c 100644 (file)
@@ -1181,6 +1181,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
        int fd;
        struct odb_lock *lck;
        uint32_t create_options;
+       uint32_t create_options_must_ignore_mask;
        uint32_t share_access;
        uint32_t access_mask;
        uint32_t create_action = NTCREATEX_ACTION_EXISTED;
@@ -1206,13 +1207,22 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
                return NT_STATUS_INVALID_PARAMETER;
        }
 
-       /* These options are ignored */
-       create_options &= ~NTCREATEX_OPTIONS_MUST_IGNORE_MASK;
+       /*
+        * These options are ignored,
+        * but we reuse some of them as private values for the generic mapping
+        */
+       create_options_must_ignore_mask = NTCREATEX_OPTIONS_MUST_IGNORE_MASK;
+       create_options_must_ignore_mask &= ~NTCREATEX_OPTIONS_PRIVATE_MASK;
+       create_options &= ~create_options_must_ignore_mask;
 
        if (create_options & NTCREATEX_OPTIONS_NOT_SUPPORTED_MASK) {
                return NT_STATUS_NOT_SUPPORTED;
        }
 
+       if (create_options & NTCREATEX_OPTIONS_INVALID_PARAM_MASK) {
+               return NT_STATUS_INVALID_PARAMETER;
+       }
+
        /* TODO: When we implement HSM, add a hook here not to pull
         * the actual file off tape, when this option is passed from
         * the client */