1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-10 13:57:47 +03:00

Merge remote branch 'origin/master' into alpha11release

This commit is contained in:
Andrew Bartlett 2010-01-11 17:10:32 +11:00
commit c32b0b6b02
3 changed files with 87 additions and 44 deletions

View File

@ -80,10 +80,14 @@
#define TARGET_SUPPORTS_INVALID_LOCK_RANGE(_tctx) \ #define TARGET_SUPPORTS_INVALID_LOCK_RANGE(_tctx) \
(torture_setting_bool(_tctx, "invalid_lock_range_support", true)) (torture_setting_bool(_tctx, "invalid_lock_range_support", true))
#define TARGET_SUPPORTS_SMBEXIT(_tctx) \
(torture_setting_bool(_tctx, "smbexit_pdu_support", true))
#define TARGET_SUPPORTS_SMBLOCK(_tctx) \ #define TARGET_SUPPORTS_SMBLOCK(_tctx) \
(torture_setting_bool(_tctx, "smblock_pdu_support", true)) (torture_setting_bool(_tctx, "smblock_pdu_support", true))
#define TARGET_SUPPORTS_OPENX_DENY_DOS(_tctx) \ #define TARGET_SUPPORTS_OPENX_DENY_DOS(_tctx) \
(torture_setting_bool(_tctx, "openx_deny_dos_support", true)) (torture_setting_bool(_tctx, "openx_deny_dos_support", true))
#define TARGET_RETURNS_RANGE_NOT_LOCKED(_tctx) \
(torture_setting_bool(_tctx, "range_not_locked_on_file_close", true))
/* /*
test SMBlock and SMBunlock ops test SMBlock and SMBunlock ops
*/ */
@ -786,7 +790,10 @@ static bool test_async(struct torture_context *tctx,
CHECK_STATUS(status, NT_STATUS_OK); CHECK_STATUS(status, NT_STATUS_OK);
status = smbcli_request_simple_recv(req); status = smbcli_request_simple_recv(req);
if (TARGET_RETURNS_RANGE_NOT_LOCKED(tctx))
CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED); CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
else
CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
torture_assert(tctx,!(time(NULL) > t+2), talloc_asprintf(tctx, torture_assert(tctx,!(time(NULL) > t+2), talloc_asprintf(tctx,
"lock cancel by close was not immediate (%s)\n", __location__)); "lock cancel by close was not immediate (%s)\n", __location__));
@ -816,6 +823,7 @@ static bool test_async(struct torture_context *tctx,
tree->tid = tcon.tconx.out.tid; tree->tid = tcon.tconx.out.tid;
torture_comment(tctx, "testing cancel by exit\n"); torture_comment(tctx, "testing cancel by exit\n");
if (TARGET_SUPPORTS_SMBEXIT(tctx)) {
fname = BASEDIR "\\test_exit.txt"; fname = BASEDIR "\\test_exit.txt";
fnum = smbcli_open(tree, fname, O_RDWR|O_CREAT, DENY_NONE); fnum = smbcli_open(tree, fname, O_RDWR|O_CREAT, DENY_NONE);
torture_assert(tctx,(fnum != -1), talloc_asprintf(tctx, torture_assert(tctx,(fnum != -1), talloc_asprintf(tctx,
@ -846,16 +854,26 @@ static bool test_async(struct torture_context *tctx,
t = time(NULL); t = time(NULL);
req = smb_raw_lock_send(tree, &io); req = smb_raw_lock_send(tree, &io);
torture_assert(tctx,(req != NULL), talloc_asprintf(tctx, torture_assert(tctx,(req != NULL), talloc_asprintf(tctx,
"Failed to setup timed lock (%s)\n", __location__)); "Failed to setup timed lock (%s)\n",
__location__));
status = smb_raw_exit(session); status = smb_raw_exit(session);
CHECK_STATUS(status, NT_STATUS_OK); CHECK_STATUS(status, NT_STATUS_OK);
status = smbcli_request_simple_recv(req); status = smbcli_request_simple_recv(req);
if (TARGET_RETURNS_RANGE_NOT_LOCKED(tctx))
CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED); CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
else
CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
torture_assert(tctx,!(time(NULL) > t+2), talloc_asprintf(tctx, torture_assert(tctx,!(time(NULL) > t+2), talloc_asprintf(tctx,
"lock cancel by exit was not immediate (%s)\n", __location__)); "lock cancel by exit was not immediate (%s)\n",
__location__));
}
else {
torture_comment(tctx,
" skipping test, SMBExit not supported\n");
}
torture_comment(tctx, "testing cancel by ulogoff\n"); torture_comment(tctx, "testing cancel by ulogoff\n");
fname = BASEDIR "\\test_ulogoff.txt"; fname = BASEDIR "\\test_ulogoff.txt";
@ -894,15 +912,20 @@ static bool test_async(struct torture_context *tctx,
CHECK_STATUS(status, NT_STATUS_OK); CHECK_STATUS(status, NT_STATUS_OK);
status = smbcli_request_simple_recv(req); status = smbcli_request_simple_recv(req);
if (TARGET_RETURNS_RANGE_NOT_LOCKED(tctx)) {
if (NT_STATUS_EQUAL(NT_STATUS_FILE_LOCK_CONFLICT, status)) { if (NT_STATUS_EQUAL(NT_STATUS_FILE_LOCK_CONFLICT, status)) {
torture_result(tctx, TORTURE_FAIL, torture_result(tctx, TORTURE_FAIL,
"lock not canceled by ulogoff - %s (ignored because of vfs_vifs fails it)\n", "lock not canceled by ulogoff - %s "
"(ignored because of vfs_vifs fails it)\n",
nt_errstr(status)); nt_errstr(status));
smb_tree_disconnect(tree); smb_tree_disconnect(tree);
smb_raw_exit(session); smb_raw_exit(session);
goto done; goto done;
} }
CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED); CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
} else {
CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
}
torture_assert(tctx,!(time(NULL) > t+2), talloc_asprintf(tctx, torture_assert(tctx,!(time(NULL) > t+2), talloc_asprintf(tctx,
"lock cancel by ulogoff was not immediate (%s)\n", __location__)); "lock cancel by ulogoff was not immediate (%s)\n", __location__));
@ -942,7 +965,10 @@ static bool test_async(struct torture_context *tctx,
CHECK_STATUS(status, NT_STATUS_OK); CHECK_STATUS(status, NT_STATUS_OK);
status = smbcli_request_simple_recv(req); status = smbcli_request_simple_recv(req);
if (TARGET_RETURNS_RANGE_NOT_LOCKED(tctx))
CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED); CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
else
CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
torture_assert(tctx,!(time(NULL) > t+2), talloc_asprintf(tctx, torture_assert(tctx,!(time(NULL) > t+2), talloc_asprintf(tctx,
"lock cancel by tdis was not immediate (%s)\n", __location__)); "lock cancel by tdis was not immediate (%s)\n", __location__));

View File

@ -550,8 +550,11 @@ int main(int argc,char *argv[])
lp_set_cmdline(cmdline_lp_ctx, "torture:onefs", "true"); lp_set_cmdline(cmdline_lp_ctx, "torture:onefs", "true");
lp_set_cmdline(cmdline_lp_ctx, "torture:openx_deny_dos_support", lp_set_cmdline(cmdline_lp_ctx, "torture:openx_deny_dos_support",
"false"); "false");
lp_set_cmdline(cmdline_lp_ctx, "torture:range_not_locked_on_file_close", "false");
lp_set_cmdline(cmdline_lp_ctx, "torture:sacl_support", "false"); lp_set_cmdline(cmdline_lp_ctx, "torture:sacl_support", "false");
lp_set_cmdline(cmdline_lp_ctx, "torture:ea_support", "false"); lp_set_cmdline(cmdline_lp_ctx, "torture:ea_support", "false");
lp_set_cmdline(cmdline_lp_ctx, "torture:smbexit_pdu_support",
"false");
lp_set_cmdline(cmdline_lp_ctx, "torture:smblock_pdu_support", lp_set_cmdline(cmdline_lp_ctx, "torture:smblock_pdu_support",
"false"); "false");
lp_set_cmdline(cmdline_lp_ctx, "torture:2_step_break_to_none", lp_set_cmdline(cmdline_lp_ctx, "torture:2_step_break_to_none",

View File

@ -74,6 +74,15 @@ bool torture_register_suite(struct torture_suite *suite);
* This parameter specifies whether the server supports the DENY_DOS open mode * This parameter specifies whether the server supports the DENY_DOS open mode
* of the SMBOpenX PDU. */ * of the SMBOpenX PDU. */
/* torture:range_not_locked_on_file_close
*
* When a byte range lock is pending, and the file which is being locked is
* closed, Windows servers return the error NT_STATUS_RANGE_NOT_LOCKED. This
* is strange, as this error is meant to be returned only for unlock requests.
* When true, torture will expect the Windows behavior, otherwise it will
* expect the more logical NT_STATUS_LOCK_NOT_GRANTED.
*/
/* torture:sacl_support /* torture:sacl_support
* *
* This parameter specifies whether the server supports the setting and * This parameter specifies whether the server supports the setting and
@ -81,6 +90,10 @@ bool torture_register_suite(struct torture_suite *suite);
* supports the use of the SEC_FLAG_SYSTEM_SECURITY bit in the open access * supports the use of the SEC_FLAG_SYSTEM_SECURITY bit in the open access
* mask.*/ * mask.*/
/* torture:smbexit_pdu_support
*
* This parameter specifies whether the server supports the SMBExit (0x11) PDU. */
/* torture:smblock_pdu_support /* torture:smblock_pdu_support
* *
* This parameter specifies whether the server supports the SMBLock (0x0C) PDU. */ * This parameter specifies whether the server supports the SMBLock (0x0C) PDU. */
@ -119,4 +132,5 @@ bool torture_register_suite(struct torture_suite *suite);
* denied. When true, torture will expect NT_STATUS_OBJECT_NAME_NOT_FOUND * denied. When true, torture will expect NT_STATUS_OBJECT_NAME_NOT_FOUND
* rather than NT_STATUS_ACCESS_DENIED when trying to open one of these files. * rather than NT_STATUS_ACCESS_DENIED when trying to open one of these files.
*/ */
#endif /* __SMBTORTURE_H__ */ #endif /* __SMBTORTURE_H__ */