summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuk Claes <luk@debian.org>2012-05-10 18:39:11 +0200
committerStefan Metzmacher <metze@samba.org>2012-05-12 01:01:33 +0200
commitc140c5e4590ab49c0bd8ccce791450b0dbcc74aa (patch)
tree0741438af6db97a19a9bc57dfa28af5051f14e7e
parentc7a129262857ede4d4985a1c368b7066811ed2c3 (diff)
downloadsamba-c140c5e4590ab49c0bd8ccce791450b0dbcc74aa.tar.gz
samba-c140c5e4590ab49c0bd8ccce791450b0dbcc74aa.tar.bz2
samba-c140c5e4590ab49c0bd8ccce791450b0dbcc74aa.zip
s3/libsmb: Generalise cli_state in smb2 logoff calls
Signed-off-by: Luk Claes <luk@debian.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
-rw-r--r--source3/libsmb/smb2cli.h8
-rw-r--r--source3/libsmb/smb2cli_session.c23
-rw-r--r--source3/torture/test_smb2.c4
3 files changed, 20 insertions, 15 deletions
diff --git a/source3/libsmb/smb2cli.h b/source3/libsmb/smb2cli.h
index 6fa77f4ff3..bd6b131669 100644
--- a/source3/libsmb/smb2cli.h
+++ b/source3/libsmb/smb2cli.h
@@ -26,9 +26,13 @@ struct cli_state;
struct tevent_req *smb2cli_logoff_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);
NTSTATUS smb2cli_logoff_recv(struct tevent_req *req);
-NTSTATUS smb2cli_logoff(struct cli_state *cli);
+NTSTATUS smb2cli_logoff(struct smbXcli_conn *conn,
+ uint32_t timeout_msec,
+ struct smbXcli_session *session);
struct tevent_req *smb2cli_tcon_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
diff --git a/source3/libsmb/smb2cli_session.c b/source3/libsmb/smb2cli_session.c
index 0de82f6d83..077ba9a52e 100644
--- a/source3/libsmb/smb2cli_session.c
+++ b/source3/libsmb/smb2cli_session.c
@@ -28,7 +28,6 @@
#include "../auth/ntlmssp/ntlmssp.h"
struct smb2cli_logoff_state {
- struct cli_state *cli;
uint8_t fixed[4];
};
@@ -36,7 +35,9 @@ static void smb2cli_logoff_done(struct tevent_req *subreq);
struct tevent_req *smb2cli_logoff_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)
{
struct tevent_req *req, *subreq;
struct smb2cli_logoff_state *state;
@@ -46,16 +47,15 @@ struct tevent_req *smb2cli_logoff_send(TALLOC_CTX *mem_ctx,
if (req == NULL) {
return NULL;
}
- state->cli = cli;
SSVAL(state->fixed, 0, 4);
subreq = smb2cli_req_send(state, ev,
- cli->conn, SMB2_OP_LOGOFF,
+ conn, SMB2_OP_LOGOFF,
0, 0, /* flags */
- cli->timeout,
- cli->smb2.pid,
+ timeout_msec,
+ 0xFEFF, /* pid */
0, /* tid */
- cli->smb2.session,
+ session,
state->fixed, sizeof(state->fixed),
NULL, 0);
if (tevent_req_nomem(subreq, req)) {
@@ -85,7 +85,6 @@ static void smb2cli_logoff_done(struct tevent_req *subreq)
status = smb2cli_req_recv(subreq, state, &iov,
expected, ARRAY_SIZE(expected));
TALLOC_FREE(subreq);
- TALLOC_FREE(state->cli->smb2.session);
if (tevent_req_nterror(req, status)) {
return;
}
@@ -97,14 +96,16 @@ NTSTATUS smb2cli_logoff_recv(struct tevent_req *req)
return tevent_req_simple_recv_ntstatus(req);
}
-NTSTATUS smb2cli_logoff(struct cli_state *cli)
+NTSTATUS smb2cli_logoff(struct smbXcli_conn *conn,
+ uint32_t timeout_msec,
+ struct smbXcli_session *session)
{
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
*/
@@ -115,7 +116,7 @@ NTSTATUS smb2cli_logoff(struct cli_state *cli)
if (ev == NULL) {
goto fail;
}
- req = smb2cli_logoff_send(frame, ev, cli);
+ req = smb2cli_logoff_send(frame, ev, conn, timeout_msec, session);
if (req == NULL) {
goto fail;
}
diff --git a/source3/torture/test_smb2.c b/source3/torture/test_smb2.c
index 12f32aa07f..8aff588cc7 100644
--- a/source3/torture/test_smb2.c
+++ b/source3/torture/test_smb2.c
@@ -183,7 +183,7 @@ bool run_smb2_basic(int dummy)
}
saved_uid = smb2cli_session_current_id(cli->smb2.session);
- status = smb2cli_logoff(cli);
+ status = smb2cli_logoff(cli->conn, cli->timeout, cli->smb2.session);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_logoff returned %s\n", nt_errstr(status));
return false;
@@ -197,7 +197,7 @@ bool run_smb2_basic(int dummy)
smb2cli_session_set_id_and_flags(cli->smb2.session, saved_uid, 0);
- status = smb2cli_logoff(cli);
+ status = smb2cli_logoff(cli->conn, cli->timeout, cli->smb2.session);
if (!NT_STATUS_EQUAL(status, NT_STATUS_USER_SESSION_DELETED)) {
printf("2nd smb2cli_logoff returned %s\n", nt_errstr(status));
return false;