1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

torture3: Test LOCKINGX_CANCEL without locks

Tested against W2012R2

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2019-06-03 11:00:25 +02:00 committed by Jeremy Allison
parent 7dec53ed0c
commit 2f1a459b74
3 changed files with 58 additions and 0 deletions

View File

@ -9,6 +9,7 @@
^samba3.smbtorture_s3.crypt_server\(nt4_dc\).SMB2-SESSION-REAUTH # expected to give ACCESS_DENIED SMB2.1 doesn't have encryption
^samba3.smbtorture_s3.crypt_server\(nt4_dc\).SMB2-SESSION-RECONNECT # expected to give CONNECTION_DISCONNECTED, we need to fix the test
^samba3.smbtorture_s3.plain.*SMB2-DIR-FSYNC.*\(ad_dc_ntvfs\)
^samba3.smbtorture_s3.plain.LOCK11.*\(ad_dc_ntvfs\)
^samba3.smb2.session enc.reconnect # expected to give CONNECTION_DISCONNECTED, we need to fix the test
^samba3.raw.session enc # expected to give ACCESS_DENIED as SMB1 encryption isn't used
^samba3.smbtorture_s3.crypt_server # expected to give ACCESS_DENIED as SMB1 encryption isn't used

View File

@ -80,6 +80,7 @@ plantestsuite("samba3.blackbox.registry.upgrade", "nt4_dc:local", [os.path.join(
tests = ["FDPASS", "LOCK1", "LOCK2", "LOCK3", "LOCK4", "LOCK5", "LOCK6", "LOCK7", "LOCK9",
"LOCK10",
"LOCK11",
"UNLINK", "BROWSE", "ATTR", "TRANS2", "TORTURE",
"OPLOCK1", "OPLOCK2", "OPLOCK4", "STREAMERROR",
"DIR", "DIR1", "DIR-CREATETIME", "TCON", "TCONDEV", "RW1", "RW2", "RW3", "LARGE_READX", "RW-SIGNING",

View File

@ -2894,6 +2894,58 @@ static void locktest10_read_andx_done(struct tevent_req *subreq)
TALLOC_FREE(subreq);
}
static bool run_locktest11(int dummy)
{
struct cli_state *cli1;
const char *fname = "\\lockt11.lck";
NTSTATUS status;
uint16_t fnum;
bool ret = false;
if (!torture_open_connection(&cli1, 0)) {
return false;
}
smbXcli_conn_set_sockopt(cli1->conn, sockops);
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
status = cli_openx(cli1, fname, O_CREAT|O_RDWR, DENY_NONE, &fnum);
if (!NT_STATUS_IS_OK(status)) {
d_fprintf(stderr,
"cli_openx returned %s\n",
nt_errstr(status));
return false;
}
/*
* Test that LOCKING_ANDX_CANCEL_LOCK without any locks
* returns NT_STATUS_OK
*/
status = cli_lockingx(
cli1, /* cli */
fnum, /* fnum */
LOCKING_ANDX_CANCEL_LOCK, /* typeoflock */
0, /* newoplocklevel */
0, /* timeout */
0, /* num_unlocks */
NULL, /* unlocks */
0, /* num_locks */
NULL); /* locks */
if (!NT_STATUS_IS_OK(status)) {
d_printf("cli_lockingX returned %s\n", nt_errstr(status));
goto fail;
}
ret = true;
fail:
cli_close(cli1, fnum);
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
return ret;
}
/*
test whether fnums and tids open on one VC are available on another (a major
security hole)
@ -12217,6 +12269,10 @@ static struct {
.name = "LOCK10",
.fn = run_locktest10,
},
{
.name = "LOCK11",
.fn = run_locktest11,
},
{
.name = "UNLINK",
.fn = run_unlinktest,