summaryrefslogtreecommitdiffstats
path: root/source3
diff options
context:
space:
mode:
authorLuk Claes <luk@debian.org>2012-05-10 18:34:40 +0200
committerStefan Metzmacher <metze@samba.org>2012-05-12 00:45:21 +0200
commit87d890fdd92195acca3e099c3f7b60aea91ac04e (patch)
treeaa4634437342c38fc9f68608a718975a44678c54 /source3
parentf6db3d7bef750d48079ff56535f48c9923e5f4c8 (diff)
downloadsamba-87d890fdd92195acca3e099c3f7b60aea91ac04e.tar.gz
samba-87d890fdd92195acca3e099c3f7b60aea91ac04e.tar.xz
samba-87d890fdd92195acca3e099c3f7b60aea91ac04e.zip
s3/libsmb: Generalise cli_state in smb2 create calls
Signed-off-by: Luk Claes <luk@debian.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/cli_np_tstream.c4
-rw-r--r--source3/libsmb/smb2cli.h10
-rw-r--r--source3/libsmb/smb2cli_create.c25
-rw-r--r--source3/torture/test_smb2.c48
4 files changed, 59 insertions, 28 deletions
diff --git a/source3/libsmb/cli_np_tstream.c b/source3/libsmb/cli_np_tstream.c
index 07ccccdd762..612a2c3fb2c 100644
--- a/source3/libsmb/cli_np_tstream.c
+++ b/source3/libsmb/cli_np_tstream.c
@@ -160,7 +160,9 @@ struct tevent_req *tstream_cli_np_open_send(TALLOC_CTX *mem_ctx,
0,
0);
} else {
- subreq = smb2cli_create_send(state, ev, cli,
+ subreq = smb2cli_create_send(state, ev, cli->conn,
+ cli->timeout, cli->smb2.session,
+ cli->smb2.tid,
npipe,
SMB2_OPLOCK_LEVEL_NONE,
SMB2_IMPERSONATION_IMPERSONATION,
diff --git a/source3/libsmb/smb2cli.h b/source3/libsmb/smb2cli.h
index 34a6103d2f9..139ff44b0e8 100644
--- a/source3/libsmb/smb2cli.h
+++ b/source3/libsmb/smb2cli.h
@@ -46,7 +46,10 @@ NTSTATUS smb2cli_tdis(struct cli_state *cli);
struct tevent_req *smb2cli_create_send(
TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
- struct cli_state *cli,
+ struct smbXcli_conn *conn,
+ uint32_t timeout_msec,
+ struct smbXcli_session *session,
+ uint32_t tcon_id,
const char *filename,
uint8_t oplock_level, /* SMB2_OPLOCK_LEVEL_* */
uint32_t impersonation_level, /* SMB2_IMPERSONATION_* */
@@ -59,7 +62,10 @@ struct tevent_req *smb2cli_create_send(
NTSTATUS smb2cli_create_recv(struct tevent_req *req,
uint64_t *fid_persistent,
uint64_t *fid_volatile);
-NTSTATUS smb2cli_create(struct cli_state *cli,
+NTSTATUS smb2cli_create(struct smbXcli_conn *conn,
+ uint32_t timeout_msec,
+ struct smbXcli_session *session,
+ uint32_t tcon_id,
const char *filename,
uint8_t oplock_level, /* SMB2_OPLOCK_LEVEL_* */
uint32_t impersonation_level, /* SMB2_IMPERSONATION_* */
diff --git a/source3/libsmb/smb2cli_create.c b/source3/libsmb/smb2cli_create.c
index 4fa782f2ae5..f4fa45a46a6 100644
--- a/source3/libsmb/smb2cli_create.c
+++ b/source3/libsmb/smb2cli_create.c
@@ -48,7 +48,10 @@ static void smb2cli_create_done(struct tevent_req *subreq);
struct tevent_req *smb2cli_create_send(
TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
- struct cli_state *cli,
+ struct smbXcli_conn *conn,
+ uint32_t timeout_msec,
+ struct smbXcli_session *session,
+ uint32_t tcon_id,
const char *filename,
uint8_t oplock_level, /* SMB2_OPLOCK_LEVEL_* */
uint32_t impersonation_level, /* SMB2_IMPERSONATION_* */
@@ -136,12 +139,12 @@ struct tevent_req *smb2cli_create_send(
data_blob_free(&blob);
}
- subreq = smb2cli_req_send(state, ev, cli->conn, SMB2_OP_CREATE,
+ subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_CREATE,
0, 0, /* flags */
- cli->timeout,
- cli->smb2.pid,
- cli->smb2.tid,
- cli->smb2.session,
+ timeout_msec,
+ 0xFEFF, /* pid */
+ tcon_id,
+ session,
state->fixed, sizeof(state->fixed),
dyn, dyn_len);
if (tevent_req_nomem(subreq, req)) {
@@ -227,7 +230,10 @@ NTSTATUS smb2cli_create_recv(struct tevent_req *req,
return NT_STATUS_OK;
}
-NTSTATUS smb2cli_create(struct cli_state *cli,
+NTSTATUS smb2cli_create(struct smbXcli_conn *conn,
+ uint32_t timeout_msec,
+ struct smbXcli_session *session,
+ uint32_t tcon_id,
const char *filename,
uint8_t oplock_level, /* SMB2_OPLOCK_LEVEL_* */
uint32_t impersonation_level, /* SMB2_IMPERSONATION_* */
@@ -245,7 +251,7 @@ NTSTATUS smb2cli_create(struct cli_state *cli,
struct tevent_req *req;
NTSTATUS status = NT_STATUS_NO_MEMORY;
- if (cli_has_async_calls(cli)) {
+ if (smbXcli_conn_has_async_calls(conn)) {
/*
* Can't use sync call while an async call is in flight
*/
@@ -256,7 +262,8 @@ NTSTATUS smb2cli_create(struct cli_state *cli,
if (ev == NULL) {
goto fail;
}
- req = smb2cli_create_send(frame, ev, cli, filename, oplock_level,
+ req = smb2cli_create_send(frame, ev, conn, timeout_msec, session,
+ tcon_id, filename, oplock_level,
impersonation_level, desired_access,
file_attributes, share_access,
create_disposition, create_options,
diff --git a/source3/torture/test_smb2.c b/source3/torture/test_smb2.c
index 90e065e94f4..9cedef84e0a 100644
--- a/source3/torture/test_smb2.c
+++ b/source3/torture/test_smb2.c
@@ -72,7 +72,8 @@ bool run_smb2_basic(int dummy)
return false;
}
- status = smb2cli_create(cli, "smb2-basic.txt",
+ status = smb2cli_create(cli->conn, cli->timeout, cli->smb2.session,
+ cli->smb2.tid, "smb2-basic.txt",
SMB2_OPLOCK_LEVEL_NONE, /* oplock_level, */
SMB2_IMPERSONATION_IMPERSONATION, /* impersonation_level, */
SEC_STD_ALL | SEC_FILE_ALL, /* desired_access, */
@@ -129,7 +130,8 @@ bool run_smb2_basic(int dummy)
return false;
}
- status = smb2cli_create(cli, "",
+ status = smb2cli_create(cli->conn, cli->timeout, cli->smb2.session,
+ cli->smb2.tid, "",
SMB2_OPLOCK_LEVEL_NONE, /* oplock_level, */
SMB2_IMPERSONATION_IMPERSONATION, /* impersonation_level, */
SEC_STD_SYNCHRONIZE|
@@ -317,7 +319,8 @@ bool run_smb2_session_reconnect(int dummy)
return false;
}
- status = smb2cli_create(cli1, "session-reconnect.txt",
+ status = smb2cli_create(cli1->conn, cli1->timeout, cli1->smb2.session,
+ cli1->smb2.tid, "session-reconnect.txt",
SMB2_OPLOCK_LEVEL_NONE, /* oplock_level, */
SMB2_IMPERSONATION_IMPERSONATION, /* impersonation_level, */
SEC_STD_ALL | SEC_FILE_ALL, /* desired_access, */
@@ -540,7 +543,8 @@ bool run_smb2_session_reconnect(int dummy)
return false;
}
- status = smb2cli_create(cli2, "session-reconnect.txt",
+ status = smb2cli_create(cli2->conn, cli2->timeout, cli2->smb2.session,
+ cli2->smb2.tid, "session-reconnect.txt",
SMB2_OPLOCK_LEVEL_NONE, /* oplock_level, */
SMB2_IMPERSONATION_IMPERSONATION, /* impersonation_level, */
SEC_STD_ALL | SEC_FILE_ALL, /* desired_access, */
@@ -593,7 +597,8 @@ bool run_smb2_session_reconnect(int dummy)
return false;
}
- status = smb2cli_create(cli2, "session-reconnect.txt",
+ status = smb2cli_create(cli2->conn, cli2->timeout, cli2->smb2.session,
+ cli2->smb2.tid, "session-reconnect.txt",
SMB2_OPLOCK_LEVEL_NONE, /* oplock_level, */
SMB2_IMPERSONATION_IMPERSONATION, /* impersonation_level, */
SEC_STD_ALL | SEC_FILE_ALL, /* desired_access, */
@@ -617,7 +622,8 @@ bool run_smb2_session_reconnect(int dummy)
return false;
}
- status = smb2cli_create(cli2, "session-reconnect.txt",
+ status = smb2cli_create(cli2->conn, cli2->timeout, cli2->smb2.session,
+ cli2->smb2.tid, "session-reconnect.txt",
SMB2_OPLOCK_LEVEL_NONE, /* oplock_level, */
SMB2_IMPERSONATION_IMPERSONATION, /* impersonation_level, */
SEC_STD_ALL | SEC_FILE_ALL, /* desired_access, */
@@ -708,7 +714,8 @@ bool run_smb2_tcon_dependence(int dummy)
return false;
}
- status = smb2cli_create(cli, "tcon_depedence.txt",
+ status = smb2cli_create(cli->conn, cli->timeout, cli->smb2.session,
+ cli->smb2.tid, "tcon_depedence.txt",
SMB2_OPLOCK_LEVEL_NONE, /* oplock_level, */
SMB2_IMPERSONATION_IMPERSONATION, /* impersonation_level, */
SEC_STD_ALL | SEC_FILE_ALL, /* desired_access, */
@@ -1110,7 +1117,8 @@ bool run_smb2_multi_channel(int dummy)
cli3->smb2.tid = cli2->smb2.tid;
- status = smb2cli_create(cli2, "multi-channel.txt",
+ status = smb2cli_create(cli2->conn, cli2->timeout, cli2->smb2.session,
+ cli2->smb2.tid, "multi-channel.txt",
SMB2_OPLOCK_LEVEL_NONE, /* oplock_level, */
SMB2_IMPERSONATION_IMPERSONATION, /* impersonation_level, */
SEC_STD_ALL | SEC_FILE_ALL, /* desired_access, */
@@ -1262,7 +1270,8 @@ bool run_smb2_multi_channel(int dummy)
return false;
}
- status = smb2cli_create(cli1, "multi-channel-invalid.txt",
+ status = smb2cli_create(cli1->conn, cli1->timeout, cli1->smb2.session,
+ cli1->smb2.tid, "multi-channel-invalid.txt",
SMB2_OPLOCK_LEVEL_NONE, /* oplock_level, */
SMB2_IMPERSONATION_IMPERSONATION, /* impersonation_level, */
SEC_STD_ALL | SEC_FILE_ALL, /* desired_access, */
@@ -1278,7 +1287,8 @@ bool run_smb2_multi_channel(int dummy)
return false;
}
- status = smb2cli_create(cli2, "multi-channel-invalid.txt",
+ status = smb2cli_create(cli2->conn, cli2->timeout, cli2->smb2.session,
+ cli2->smb2.tid, "multi-channel-invalid.txt",
SMB2_OPLOCK_LEVEL_NONE, /* oplock_level, */
SMB2_IMPERSONATION_IMPERSONATION, /* impersonation_level, */
SEC_STD_ALL | SEC_FILE_ALL, /* desired_access, */
@@ -1294,7 +1304,8 @@ bool run_smb2_multi_channel(int dummy)
return false;
}
- status = smb2cli_create(cli3, "multi-channel-invalid.txt",
+ status = smb2cli_create(cli3->conn, cli3->timeout, cli3->smb2.session,
+ cli3->smb2.tid, "multi-channel-invalid.txt",
SMB2_OPLOCK_LEVEL_NONE, /* oplock_level, */
SMB2_IMPERSONATION_IMPERSONATION, /* impersonation_level, */
SEC_STD_ALL | SEC_FILE_ALL, /* desired_access, */
@@ -1421,7 +1432,8 @@ bool run_smb2_session_reauth(int dummy)
return false;
}
- status = smb2cli_create(cli, "session-reauth.txt",
+ status = smb2cli_create(cli->conn, cli->timeout, cli->smb2.session,
+ cli->smb2.tid, "session-reauth.txt",
SMB2_OPLOCK_LEVEL_NONE, /* oplock_level, */
SMB2_IMPERSONATION_IMPERSONATION, /* impersonation_level, */
SEC_STD_ALL | SEC_FILE_ALL, /* desired_access, */
@@ -1437,7 +1449,8 @@ bool run_smb2_session_reauth(int dummy)
return false;
}
- status = smb2cli_create(cli, "",
+ status = smb2cli_create(cli->conn, cli->timeout, cli->smb2.session,
+ cli->smb2.tid, "",
SMB2_OPLOCK_LEVEL_NONE, /* oplock_level, */
SMB2_IMPERSONATION_IMPERSONATION, /* impersonation_level, */
SEC_STD_SYNCHRONIZE|
@@ -1618,7 +1631,8 @@ bool run_smb2_session_reauth(int dummy)
return false;
}
- status = smb2cli_create(cli, "session-reauth-invalid.txt",
+ status = smb2cli_create(cli->conn, cli->timeout, cli->smb2.session,
+ cli->smb2.tid, "session-reauth-invalid.txt",
SMB2_OPLOCK_LEVEL_NONE, /* oplock_level, */
SMB2_IMPERSONATION_IMPERSONATION, /* impersonation_level, */
SEC_STD_ALL | SEC_FILE_ALL, /* desired_access, */
@@ -1634,7 +1648,8 @@ bool run_smb2_session_reauth(int dummy)
return false;
}
- status = smb2cli_create(cli, "",
+ status = smb2cli_create(cli->conn, cli->timeout, cli->smb2.session,
+ cli->smb2.tid, "",
SMB2_OPLOCK_LEVEL_NONE, /* oplock_level, */
SMB2_IMPERSONATION_IMPERSONATION, /* impersonation_level, */
SEC_STD_SYNCHRONIZE|
@@ -1779,7 +1794,8 @@ bool run_smb2_session_reauth(int dummy)
return false;
}
- status = smb2cli_create(cli, "session-reauth.txt",
+ status = smb2cli_create(cli->conn, cli->timeout, cli->smb2.session,
+ cli->smb2.tid, "session-reauth.txt",
SMB2_OPLOCK_LEVEL_NONE, /* oplock_level, */
SMB2_IMPERSONATION_IMPERSONATION, /* impersonation_level, */
SEC_STD_ALL | SEC_FILE_ALL, /* desired_access, */