s4:torture:smb2: add smb2_generic_create_share() that also takes the sharemode as...
authorMichael Adam <obnox@samba.org>
Tue, 8 Nov 2011 17:15:12 +0000 (18:15 +0100)
committerMichael Adam <obnox@samba.org>
Wed, 9 Nov 2011 00:02:08 +0000 (01:02 +0100)
source4/torture/smb2/util.c

index 748a4243442969783ce2369bb34262f1c0b73656..973e76db31742f661ea8d0c24ecb1a2a7ab3e824 100644 (file)
@@ -569,10 +569,11 @@ uint8_t smb2_util_oplock_level(const char *op)
  * Helper functions to fill a smb2_create struct for several
  * open scenarios.
  */
-void smb2_generic_create(struct smb2_create *io, struct smb2_lease *ls,
-                        bool dir, const char *name, uint32_t disposition,
-                        uint8_t oplock, uint64_t leasekey,
-                        uint32_t leasestate)
+void smb2_generic_create_share(struct smb2_create *io, struct smb2_lease *ls,
+                              bool dir, const char *name, uint32_t disposition,
+                              uint32_t share_access,
+                              uint8_t oplock, uint64_t leasekey,
+                              uint32_t leasestate)
 {
        ZERO_STRUCT(*io);
        io->in.security_flags           = 0x00;
@@ -582,9 +583,7 @@ void smb2_generic_create(struct smb2_create *io, struct smb2_lease *ls,
        io->in.reserved                 = 0x00000000;
        io->in.desired_access           = SEC_RIGHTS_FILE_ALL;
        io->in.file_attributes          = FILE_ATTRIBUTE_NORMAL;
-       io->in.share_access             = NTCREATEX_SHARE_ACCESS_READ |
-                                         NTCREATEX_SHARE_ACCESS_WRITE |
-                                         NTCREATEX_SHARE_ACCESS_DELETE;
+       io->in.share_access             = share_access;
        io->in.create_disposition       = disposition;
        io->in.create_options           = NTCREATEX_OPTIONS_SEQUENTIAL_ONLY |
                                          NTCREATEX_OPTIONS_ASYNC_ALERT |
@@ -608,6 +607,17 @@ void smb2_generic_create(struct smb2_create *io, struct smb2_lease *ls,
        }
 }
 
+void smb2_generic_create(struct smb2_create *io, struct smb2_lease *ls,
+                        bool dir, const char *name, uint32_t disposition,
+                        uint8_t oplock, uint64_t leasekey,
+                        uint32_t leasestate)
+{
+       smb2_generic_create_share(io, ls, dir, name, disposition,
+                                 smb2_util_share_access("RWD"),
+                                 oplock,
+                                 leasekey, leasestate);
+}
+
 void smb2_lease_create(struct smb2_create *io, struct smb2_lease *ls,
                       bool dir, const char *name, uint64_t leasekey,
                       uint32_t leasestate)