diff options
author | Volker Lendecke <vl@samba.org> | 2019-06-03 11:00:25 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2019-06-20 17:18:18 +0000 |
commit | 2f1a459b7425db316d6c066115889134e67fa2cd (patch) | |
tree | 4f0810948ed85301bd29600c1dc6d20a153a6fd0 /source3/torture | |
parent | 7dec53ed0c1c58b4ab7b7483b2da3e4cd58750fa (diff) | |
download | samba-2f1a459b7425db316d6c066115889134e67fa2cd.tar.gz |
torture3: Test LOCKINGX_CANCEL without locks
Tested against W2012R2
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/torture')
-rw-r--r-- | source3/torture/torture.c | 56 |
1 files changed, 56 insertions, 0 deletions
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) @@ -12218,6 +12270,10 @@ static struct { .fn = run_locktest10, }, { + .name = "LOCK11", + .fn = run_locktest11, + }, + { .name = "UNLINK", .fn = run_unlinktest, }, |