diff options
author | Steven Danneman <steven.danneman@isilon.com> | 2009-11-24 16:58:25 -0800 |
---|---|---|
committer | Steven Danneman <steven.danneman@isilon.com> | 2009-12-02 17:28:51 -0800 |
commit | 438b7c41aecaad55f03d2f19a0f33bb57decefa9 (patch) | |
tree | d432eb236b24df0a0945b378a26901db2f211f86 /source4 | |
parent | 9a3d9abdd8e9737245e3cdd7f31d453c2062dba9 (diff) | |
download | samba-438b7c41aecaad55f03d2f19a0f33bb57decefa9.tar.gz samba-438b7c41aecaad55f03d2f19a0f33bb57decefa9.tar.bz2 samba-438b7c41aecaad55f03d2f19a0f33bb57decefa9.zip |
s4/torture: Add target functionality parameters to SMBv1 BRL tests
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
Diffstat (limited to 'source4')
-rw-r--r-- | source4/torture/raw/lock.c | 33 | ||||
-rw-r--r-- | source4/torture/smbtorture.c | 7 | ||||
-rw-r--r-- | source4/torture/smbtorture.h | 9 |
3 files changed, 42 insertions, 7 deletions
diff --git a/source4/torture/raw/lock.c b/source4/torture/raw/lock.c index 610cac9f45..f364d98bc3 100644 --- a/source4/torture/raw/lock.c +++ b/source4/torture/raw/lock.c @@ -69,6 +69,17 @@ }} 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; diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c index b9ed52111a..cdf68bd2ca 100644 --- a/source4/torture/smbtorture.c +++ b/source4/torture/smbtorture.c @@ -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) { diff --git a/source4/torture/smbtorture.h b/source4/torture/smbtorture.h index 862adc308c..97678040e1 100644 --- a/source4/torture/smbtorture.h +++ b/source4/torture/smbtorture.h @@ -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__ */ |