summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/librpc/rpc/dcerpc_smb2.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/source4/librpc/rpc/dcerpc_smb2.c b/source4/librpc/rpc/dcerpc_smb2.c
index ecc250412a..b822c44fda 100644
--- a/source4/librpc/rpc/dcerpc_smb2.c
+++ b/source4/librpc/rpc/dcerpc_smb2.c
@@ -34,6 +34,7 @@
struct smb2_private {
struct smb2_handle handle;
struct smb2_tree *tree;
+ DATA_BLOB session_key;
const char *server_name;
bool dead;
};
@@ -388,10 +389,12 @@ static NTSTATUS smb2_session_key(struct dcecli_connection *c, DATA_BLOB *session
{
struct smb2_private *smb = talloc_get_type(c->transport.private_data,
struct smb2_private);
- *session_key = smb->tree->session->session_key;
- if (session_key->data == NULL) {
+
+ if (smb->session_key.length == 0) {
return NT_STATUS_NO_USER_SESSION_KEY;
}
+
+ *session_key = smb->session_key;
return NT_STATUS_OK;
}
@@ -493,6 +496,14 @@ static void pipe_open_recv(struct smb2_request *req)
if (composite_nomem(smb->server_name, ctx)) return;
smb->dead = false;
+ ctx->status = smb2cli_session_application_key(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);