From 286e249737a40a575a9f13d8af4ef5e4e273c873 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 1 Aug 2012 09:09:34 +0200 Subject: s4:librpc/dcerpc_smb: make use of smbXcli_session_application_key() metze --- source4/librpc/rpc/dcerpc_smb.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'source4/librpc') diff --git a/source4/librpc/rpc/dcerpc_smb.c b/source4/librpc/rpc/dcerpc_smb.c index f4f44577f4..e718725a74 100644 --- a/source4/librpc/rpc/dcerpc_smb.c +++ b/source4/librpc/rpc/dcerpc_smb.c @@ -32,6 +32,7 @@ struct smb_private { uint16_t fnum; struct smbcli_tree *tree; + DATA_BLOB session_key; const char *server_name; bool dead; }; @@ -429,11 +430,13 @@ static NTSTATUS smb_session_key(struct dcecli_connection *c, DATA_BLOB *session_ struct smb_private *smb = (struct smb_private *)c->transport.private_data; if (smb == NULL) return NT_STATUS_CONNECTION_DISCONNECTED; - if (smb->tree->session->user_session_key.data) { - *session_key = smb->tree->session->user_session_key; - return NT_STATUS_OK; + + if (smb->session_key.length == 0) { + return NT_STATUS_NO_USER_SESSION_KEY; } - return NT_STATUS_NO_USER_SESSION_KEY; + + *session_key = smb->session_key; + return NT_STATUS_OK; } struct pipe_open_smb_state { @@ -555,6 +558,14 @@ static void pipe_open_recv(struct smbcli_request *req) if (composite_nomem(smb->server_name, ctx)) return; smb->dead = false; + ctx->status = smbXcli_session_application_key(state->tree->session->smbXcli, + smb, &smb->session_key); + if (NT_STATUS_EQUAL(ctx->status, NT_STATUS_NO_USER_SESSION_KEY)) { + smb->session_key = data_blob_null; + ctx->status = NT_STATUS_OK; + } + if (!composite_is_ok(ctx)) return; + c->transport.private_data = smb; composite_done(ctx); -- cgit