1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

s4:librpc/dcerpc_smb2: make use of smb2cli_session_application_key()

metze
This commit is contained in:
Stefan Metzmacher 2012-02-27 09:16:28 +01:00
parent a1ef9c761a
commit 07b1de98cd

View File

@ -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);