summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorLuk Claes <luk@debian.org>2012-05-10 18:32:49 +0200
committerStefan Metzmacher <metze@samba.org>2012-05-12 00:44:41 +0200
commitf6db3d7bef750d48079ff56535f48c9923e5f4c8 (patch)
tree35a53ec537bd5fe9a2fd396956d455552ba58acf /source3
parent14473f37f5a3cd4749f5c4f937fef37cc5ea8c47 (diff)
downloadsamba-f6db3d7bef750d48079ff56535f48c9923e5f4c8.tar.gz
samba-f6db3d7bef750d48079ff56535f48c9923e5f4c8.tar.bz2
samba-f6db3d7bef750d48079ff56535f48c9923e5f4c8.zip
s3/libsmb: Generalise cli_state in smb2 close 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.c22
-rw-r--r--source3/libsmb/smb2cli.h14
-rw-r--r--source3/libsmb/smb2cli_close.c29
-rw-r--r--source3/torture/test_smb2.c18
4 files changed, 60 insertions, 23 deletions
diff --git a/source3/libsmb/cli_np_tstream.c b/source3/libsmb/cli_np_tstream.c
index d52997fbdf..07ccccdd76 100644
--- a/source3/libsmb/cli_np_tstream.c
+++ b/source3/libsmb/cli_np_tstream.c
@@ -95,7 +95,10 @@ static int tstream_cli_np_destructor(struct tstream_cli_np *cli_nps)
if (cli_nps->is_smb1) {
status = cli_close(cli_nps->cli, cli_nps->fnum);
} else {
- status = smb2cli_close(cli_nps->cli, 0,
+ status = smb2cli_close(cli_nps->cli->conn,
+ cli_nps->cli->timeout,
+ cli_nps->cli->smb2.session,
+ cli_nps->cli->smb2.tid, 0,
cli_nps->fid_persistent,
cli_nps->fid_volatile);
}
@@ -548,7 +551,11 @@ static void tstream_cli_np_writev_disconnect_now(struct tevent_req *req,
subreq = cli_close_send(state, state->ev, cli_nps->cli,
cli_nps->fnum);
} else {
- subreq = smb2cli_close_send(state, state->ev, cli_nps->cli,
+ subreq = smb2cli_close_send(state, state->ev,
+ cli_nps->cli->conn,
+ cli_nps->cli->timeout,
+ cli_nps->cli->smb2.session,
+ cli_nps->cli->smb2.tid,
0, /* flags */
cli_nps->fid_persistent,
cli_nps->fid_volatile);
@@ -1003,7 +1010,11 @@ static void tstream_cli_np_readv_disconnect_now(struct tevent_req *req,
subreq = cli_close_send(state, state->ev, cli_nps->cli,
cli_nps->fnum);
} else {
- subreq = smb2cli_close_send(state, state->ev, cli_nps->cli,
+ subreq = smb2cli_close_send(state, state->ev,
+ cli_nps->cli->conn,
+ cli_nps->cli->timeout,
+ cli_nps->cli->smb2.session,
+ cli_nps->cli->smb2.tid,
0, /* flags */
cli_nps->fid_persistent,
cli_nps->fid_volatile);
@@ -1136,7 +1147,10 @@ static struct tevent_req *tstream_cli_np_disconnect_send(TALLOC_CTX *mem_ctx,
subreq = cli_close_send(state, ev, cli_nps->cli,
cli_nps->fnum);
} else {
- subreq = smb2cli_close_send(state, ev, cli_nps->cli,
+ subreq = smb2cli_close_send(state, ev, cli_nps->cli->conn,
+ cli_nps->cli->timeout,
+ cli_nps->cli->smb2.session,
+ cli_nps->cli->smb2.tid,
0, /* flags */
cli_nps->fid_persistent,
cli_nps->fid_volatile);
diff --git a/source3/libsmb/smb2cli.h b/source3/libsmb/smb2cli.h
index 12f061524e..34a6103d2f 100644
--- a/source3/libsmb/smb2cli.h
+++ b/source3/libsmb/smb2cli.h
@@ -74,13 +74,21 @@ NTSTATUS smb2cli_create(struct cli_state *cli,
struct tevent_req *smb2cli_close_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,
uint16_t flags,
uint64_t fid_persistent,
uint64_t fid_volatile);
NTSTATUS smb2cli_close_recv(struct tevent_req *req);
-NTSTATUS smb2cli_close(struct cli_state *cli, uint16_t flags,
- uint64_t fid_persistent, uint64_t fid_volatile);
+NTSTATUS smb2cli_close(struct smbXcli_conn *conn,
+ uint32_t timeout_msec,
+ struct smbXcli_session *session,
+ uint32_t tcon_id,
+ uint16_t flags,
+ uint64_t fid_persistent,
+ uint64_t fid_volatile);
struct tevent_req *smb2cli_flush_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
diff --git a/source3/libsmb/smb2cli_close.c b/source3/libsmb/smb2cli_close.c
index 246d9048b6..5c69fee9b4 100644
--- a/source3/libsmb/smb2cli_close.c
+++ b/source3/libsmb/smb2cli_close.c
@@ -33,7 +33,10 @@ static void smb2cli_close_done(struct tevent_req *subreq);
struct tevent_req *smb2cli_close_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,
uint16_t flags,
uint64_t fid_persistent,
uint64_t fid_volatile)
@@ -53,12 +56,12 @@ struct tevent_req *smb2cli_close_send(TALLOC_CTX *mem_ctx,
SBVAL(fixed, 8, fid_persistent);
SBVAL(fixed, 16, fid_volatile);
- subreq = smb2cli_req_send(state, ev, cli->conn, SMB2_OP_CLOSE,
+ subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_CLOSE,
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),
NULL, 0);
if (tevent_req_nomem(subreq, req)) {
@@ -94,15 +97,20 @@ NTSTATUS smb2cli_close_recv(struct tevent_req *req)
return tevent_req_simple_recv_ntstatus(req);
}
-NTSTATUS smb2cli_close(struct cli_state *cli, uint16_t flags,
- uint64_t fid_persistent, uint64_t fid_volatile)
+NTSTATUS smb2cli_close(struct smbXcli_conn *conn,
+ uint32_t timeout_msec,
+ struct smbXcli_session *session,
+ uint32_t tcon_id,
+ uint16_t flags,
+ uint64_t fid_persistent,
+ uint64_t fid_volatile)
{
TALLOC_CTX *frame = talloc_stackframe();
struct event_context *ev;
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
*/
@@ -113,7 +121,8 @@ NTSTATUS smb2cli_close(struct cli_state *cli, uint16_t flags,
if (ev == NULL) {
goto fail;
}
- req = smb2cli_close_send(frame, ev, cli, flags,
+ req = smb2cli_close_send(frame, ev, conn, timeout_msec,
+ session, tcon_id, flags,
fid_persistent, fid_volatile);
if (req == NULL) {
goto fail;
diff --git a/source3/torture/test_smb2.c b/source3/torture/test_smb2.c
index 1a4eed95cc..90e065e94f 100644
--- a/source3/torture/test_smb2.c
+++ b/source3/torture/test_smb2.c
@@ -122,7 +122,8 @@ bool run_smb2_basic(int dummy)
return false;
}
- status = smb2cli_close(cli, 0, fid_persistent, fid_volatile);
+ status = smb2cli_close(cli->conn, cli->timeout, cli->smb2.session,
+ cli->smb2.tid, 0, fid_persistent, fid_volatile);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_close returned %s\n", nt_errstr(status));
return false;
@@ -155,7 +156,8 @@ bool run_smb2_basic(int dummy)
return false;
}
- status = smb2cli_close(cli, 0, fid_persistent, fid_volatile);
+ status = smb2cli_close(cli->conn, cli->timeout, cli->smb2.session,
+ cli->smb2.tid, 0, fid_persistent, fid_volatile);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_close returned %s\n", nt_errstr(status));
return false;
@@ -1336,7 +1338,8 @@ bool run_smb2_multi_channel(int dummy)
return false;
}
- status = smb2cli_close(cli3, 0, fid_persistent, fid_volatile);
+ status = smb2cli_close(cli3->conn, cli3->timeout, cli3->smb2.session,
+ cli3->smb2.tid, 0, fid_persistent, fid_volatile);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_close returned %s\n", nt_errstr(status));
return false;
@@ -1769,7 +1772,8 @@ bool run_smb2_session_reauth(int dummy)
return false;
}
- status = smb2cli_close(cli, 0, fid_persistent, fid_volatile);
+ status = smb2cli_close(cli->conn, cli->timeout, cli->smb2.session,
+ cli->smb2.tid, 0, fid_persistent, fid_volatile);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_close returned %s\n", nt_errstr(status));
return false;
@@ -1800,13 +1804,15 @@ bool run_smb2_session_reauth(int dummy)
return false;
}
- status = smb2cli_close(cli, 0, dir_persistent, dir_volatile);
+ status = smb2cli_close(cli->conn, cli->timeout, cli->smb2.session,
+ cli->smb2.tid, 0, dir_persistent, dir_volatile);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_close returned %s\n", nt_errstr(status));
return false;
}
- status = smb2cli_close(cli, 0, fid_persistent, fid_volatile);
+ status = smb2cli_close(cli->conn, cli->timeout, cli->smb2.session,
+ cli->smb2.tid, 0, fid_persistent, fid_volatile);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_close returned %s\n", nt_errstr(status));
return false;