s4/torture: Add target functionality parameters to SMBv1 BRL tests
authorSteven Danneman <steven.danneman@isilon.com>
Wed, 25 Nov 2009 00:58:25 +0000 (16:58 -0800)
committerSteven Danneman <steven.danneman@isilon.com>
Thu, 3 Dec 2009 01:28:51 +0000 (17:28 -0800)
Abstract the server requirements to pass some BRL tests.

* The new default for >64bit lock tests, is that the server should
  return STATUS_INVALID_LOCK_RANGE.
* Add parameter for targets that don't implement DENY_DOS

source4/torture/raw/lock.c
source4/torture/smbtorture.c
source4/torture/smbtorture.h

index 610cac9f45a239468daf4d9a0fcd71906c607198..f364d98bc3490190cd8303a41007efdd8fd453bb 100644 (file)
        }} while (0)
 #define BASEDIR "\\testlock"
 
+#define TARGET_SUPPORTS_SMBLOCK(_tctx) \
+    (torture_setting_bool(_tctx, "smblock_pdu_support", true))
+#define TARGET_SUPPORTS_OPENX_DENY_DOS(_tctx) \
+    (torture_setting_bool(_tctx, "openx_deny_dos_support", true))
+#define TARGET_SUPPORTS_INVALID_LOCK_RANGE(_tctx) \
+    (torture_setting_bool(_tctx, "invalid_lock_range_support", true))
+#define TARGET_IS_W2K8(_tctx) (torture_setting_bool(_tctx, "w2k8", false))
+#define TARGET_IS_WIN7(_tctx) (torture_setting_bool(_tctx, "win7", false))
+#define TARGET_IS_SAMBA3(_tctx) (torture_setting_bool(_tctx, "samba3", false))
+#define TARGET_IS_SAMBA4(_tctx) (torture_setting_bool(_tctx, "samba4", false))
+
 /*
   test SMBlock and SMBunlock ops
 */
@@ -80,6 +91,9 @@ static bool test_lock(struct torture_context *tctx, struct smbcli_state *cli)
        int fnum;
        const char *fname = BASEDIR "\\test.txt";
 
+       if (!TARGET_SUPPORTS_SMBLOCK(tctx))
+               torture_skip(tctx, "Target does not support the SMBlock PDU");
+
        if (!torture_setup_dir(cli, BASEDIR)) {
                return false;
        }
@@ -361,7 +375,7 @@ static bool test_lockx(struct torture_context *tctx, struct smbcli_state *cli)
        lock[0].pid++;
        lock[0].count = 2;
        status = smb_raw_lock(cli->tree, &io);
-       if (TARGET_IS_WIN7(tctx) || TARGET_IS_SAMBA4(tctx))
+       if (TARGET_SUPPORTS_INVALID_LOCK_RANGE(tctx))
                CHECK_STATUS(status, NT_STATUS_INVALID_LOCK_RANGE);
        else
                CHECK_STATUS(status, NT_STATUS_OK);
@@ -780,6 +794,7 @@ static bool test_errorcode(struct torture_context *tctx,
        time_t start;
        int t;
        int delay;
+       uint16_t deny_mode = 0;
 
        if (!torture_setup_dir(cli, BASEDIR)) {
                return false;
@@ -796,14 +811,20 @@ static bool test_errorcode(struct torture_context *tctx,
         * the second with t > 0 (=1)
         */
 next_run:
-       /* 
-        * use the DENY_DOS mode, that creates two fnum's of one low-level file handle,
-        * this demonstrates that the cache is per fnum
+       /*
+        * use the DENY_DOS mode, that creates two fnum's of one low-level
+        * file handle, this demonstrates that the cache is per fnum, not
+        * per file handle
         */
+       if (TARGET_SUPPORTS_OPENX_DENY_DOS(tctx))
+           deny_mode = OPENX_MODE_DENY_DOS;
+       else
+           deny_mode = OPENX_MODE_DENY_NONE;
+
        op.openx.level = RAW_OPEN_OPENX;
        op.openx.in.fname = fname;
        op.openx.in.flags = OPENX_FLAGS_ADDITIONAL_INFO;
-       op.openx.in.open_mode = OPENX_MODE_ACCESS_RDWR | OPENX_MODE_DENY_DOS;
+       op.openx.in.open_mode = OPENX_MODE_ACCESS_RDWR | deny_mode;
        op.openx.in.open_func = OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE;
        op.openx.in.search_attrs = 0;
        op.openx.in.file_attrs = 0;
@@ -1054,7 +1075,7 @@ next_run:
        /* 
         * demonstrate the a successful lock in a different range, 
         * doesn't reset the cache, the failing lock on the 2nd handle
-        * resets the resets the cache
+        * resets the cache
         */
        lock[0].offset = 120;
        lock[0].count = 15;
index b9ed52111aee89055f9a4bd924568d30082be534..cdf68bd2cab845e8a3911d3fd746d21017e13e3a 100644 (file)
@@ -532,9 +532,14 @@ int main(int argc,char *argv[])
        } else if (strcmp(target, "win7") == 0) {
                lp_set_cmdline(cmdline_lp_ctx, "torture:win7", "true");
                lp_set_cmdline(cmdline_lp_ctx, "torture:cn_max_buffer_size",
-                    "0x00010000");
+                   "0x00010000");
        } else if (strcmp(target, "onefs") == 0) {
+               lp_set_cmdline(cmdline_lp_ctx, "torture:onefs", "true");
+               lp_set_cmdline(cmdline_lp_ctx, "torture:openx_deny_dos_support",
+                   "false");
                lp_set_cmdline(cmdline_lp_ctx, "torture:sacl_support", "false");
+               lp_set_cmdline(cmdline_lp_ctx, "torture:smblock_pdu_support",
+                   "false");
        }
 
        if (max_runtime) {
index 862adc308c6661c252f224fea62c37d89f0f016d..97678040e14c01d1ad8502703cf9564de087a9da 100644 (file)
@@ -69,6 +69,11 @@ bool torture_register_suite(struct torture_suite *suite);
  * before Win7, this request would return STATUS_OK, but the actual lock
  * behavior was undefined. */
 
+/* torture:openx_deny_dos_support
+ *
+ * This parameter specifies whether the server supports the DENY_DOS open mode
+ * of the SMBOpenX PDU. */
+
 /* torture:sacl_support
  *
  * This parameter specifies whether the server supports the setting and
@@ -76,4 +81,8 @@ bool torture_register_suite(struct torture_suite *suite);
  * supports the use of the SEC_FLAG_SYSTEM_SECURITY bit in the open access
  * mask.*/
 
+/* torture:smblock_pdu_support
+ *
+ * This parameter specifies whether the server supports the SMBLock (0x0C) PDU. */
+
 #endif /* __SMBTORTURE_H__ */