summaryrefslogtreecommitdiffstats
path: root/source4/torture/raw/lock.c
diff options
context:
space:
mode:
authorSteven Danneman <steven.danneman@isilon.com>2009-11-24 16:58:25 -0800
committerSteven Danneman <steven.danneman@isilon.com>2009-12-02 17:28:51 -0800
commit438b7c41aecaad55f03d2f19a0f33bb57decefa9 (patch)
treed432eb236b24df0a0945b378a26901db2f211f86 /source4/torture/raw/lock.c
parent9a3d9abdd8e9737245e3cdd7f31d453c2062dba9 (diff)
downloadsamba-438b7c41aecaad55f03d2f19a0f33bb57decefa9.tar.gz
samba-438b7c41aecaad55f03d2f19a0f33bb57decefa9.tar.xz
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/torture/raw/lock.c')
-rw-r--r--source4/torture/raw/lock.c33
1 files changed, 27 insertions, 6 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;