diff --git a/selftest/knownfail b/selftest/knownfail index 81fe4e6df8e..3f62bb5047a 100644 --- a/selftest/knownfail +++ b/selftest/knownfail @@ -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 diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py index 9bc5bdd0e5f..9dec692cb5a 100755 --- a/source3/selftest/tests.py +++ b/source3/selftest/tests.py @@ -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", diff --git a/source3/torture/torture.c b/source3/torture/torture.c index fee101791d4..a74598f68c2 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -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,