summaryrefslogtreecommitdiff
path: root/source4/torture/raw
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-01-08 12:29:11 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:49:51 -0500
commit53091bf83e7e84c00372d75075df308a111888a0 (patch)
treea1f18ef4892e1e4cc875f8e4e8e819c57ede6272 /source4/torture/raw
parent1162b37ff0ce46a578b7e8a6cd92f66a5a1982d9 (diff)
downloadsamba-53091bf83e7e84c00372d75075df308a111888a0.tar.gz
samba-53091bf83e7e84c00372d75075df308a111888a0.tar.bz2
samba-53091bf83e7e84c00372d75075df308a111888a0.zip
r12764: Add a test for lsa_lookup. This will be expanded when I get around to add
trusted domains. Volker (This used to be commit 8b8bb85ad365721bfa1cf5309d53d851f2013c22)
Diffstat (limited to 'source4/torture/raw')
-rw-r--r--source4/torture/raw/oplock.c87
1 files changed, 86 insertions, 1 deletions
diff --git a/source4/torture/raw/oplock.c b/source4/torture/raw/oplock.c
index 64da410bd2..0dcbda3cb5 100644
--- a/source4/torture/raw/oplock.c
+++ b/source4/torture/raw/oplock.c
@@ -471,13 +471,70 @@ done:
return ret;
}
+static BOOL test_bug3349(struct smbcli_state *cli,
+ struct smbcli_state *cli2,
+ TALLOC_CTX *mem_ctx)
+{
+ const char *fname = "\\test_oplock.dat";
+ NTSTATUS status;
+ BOOL ret = True;
+ union smb_open io;
+ struct smb_unlink unl;
+ uint16_t fnum=0, fnum2=0;
+
+ /* cleanup */
+ smbcli_unlink(cli->tree, fname);
+
+ smbcli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree);
+
+ /*
+ base ntcreatex parms
+ */
+ io.generic.level = RAW_OPEN_NTCREATEX;
+ io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
+ io.ntcreatex.in.alloc_size = 0;
+ io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
+ io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_NONE;
+ io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN_IF;
+ io.ntcreatex.in.create_options = 0;
+ io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
+ io.ntcreatex.in.security_flags = 0;
+ io.ntcreatex.in.fname = fname;
+
+ printf("if we close on break then the unlink can succeed\n");
+ ZERO_STRUCT(break_info);
+ smbcli_oplock_handler(cli->transport, oplock_handler_close, cli->tree);
+ io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
+ NTCREATEX_FLAGS_REQUEST_OPLOCK |
+ NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
+ status = smb_raw_open(cli->tree, mem_ctx, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ fnum = io.ntcreatex.out.fnum;
+ CHECK_VAL(io.ntcreatex.out.oplock_level, BATCH_OPLOCK_RETURN);
+
+ unl.in.pattern = fname;
+ unl.in.attrib = 0;
+ ZERO_STRUCT(break_info);
+ status = smb_raw_unlink(cli2->tree, &unl);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ CHECK_VAL(break_info.fnum, fnum);
+ CHECK_VAL(break_info.level, 1);
+ CHECK_VAL(break_info.count, 1);
+done:
+ smbcli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum2);
+ smbcli_unlink(cli->tree, fname);
+ return ret;
+}
/*
basic testing of oplocks
*/
BOOL torture_raw_oplock(void)
{
- struct smbcli_state *cli1;
+ struct smbcli_state *cli1, *cli2;
BOOL ret = True;
TALLOC_CTX *mem_ctx;
@@ -487,10 +544,38 @@ BOOL torture_raw_oplock(void)
mem_ctx = talloc_init("torture_raw_oplock");
+ {
+ struct cli_credentials *creds;
+ NTSTATUS status;
+
+ creds = cli_credentials_init(mem_ctx);
+ cli_credentials_set_conf(creds);
+ cli_credentials_parse_string(creds, "user1000%asdf",
+ CRED_SPECIFIED);
+ status = smbcli_full_connection(
+ mem_ctx, &cli2, lp_parm_string(-1, "torture", "host"),
+ lp_parm_string(-1, "torture", "share"), "????",
+ creds, cli1->transport->socket->event.ctx);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("opening 2nd connection failed: %s\n",
+ nt_errstr(status));
+ return False;
+ }
+ }
+
+ if (!test_bug3349(cli1, cli2, mem_ctx)) {
+ ret = False;
+ }
+
+ goto done;
+
if (!test_oplock(cli1, mem_ctx)) {
ret = False;
}
+ done:
+
torture_close_connection(cli1);
talloc_free(mem_ctx);
return ret;