diff options
Diffstat (limited to 'libcli')
-rw-r--r-- | libcli/smb/smbXcli_base.c | 25 | ||||
-rw-r--r-- | libcli/smb/smbXcli_base.h | 3 |
2 files changed, 28 insertions, 0 deletions
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c index 8f871c3448..c17254f0a8 100644 --- a/libcli/smb/smbXcli_base.c +++ b/libcli/smb/smbXcli_base.c @@ -133,6 +133,7 @@ struct smbXcli_session { struct { uint64_t session_id; uint16_t session_flags; + DATA_BLOB application_key; DATA_BLOB signing_key; bool should_sign; DATA_BLOB channel_signing_key; @@ -4073,6 +4074,24 @@ uint64_t smb2cli_session_current_id(struct smbXcli_session *session) return session->smb2.session_id; } +NTSTATUS smb2cli_session_application_key(struct smbXcli_session *session, + TALLOC_CTX *mem_ctx, + DATA_BLOB *key) +{ + *key = data_blob_null; + + if (session->smb2.application_key.length == 0) { + return NT_STATUS_NO_USER_SESSION_KEY; + } + + *key = data_blob_dup_talloc(mem_ctx, session->smb2.application_key); + if (key->data == NULL) { + return NT_STATUS_NO_MEMORY; + } + + return NT_STATUS_OK; +} + void smb2cli_session_set_id_and_flags(struct smbXcli_session *session, uint64_t session_id, uint16_t session_flags) @@ -4117,6 +4136,12 @@ NTSTATUS smb2cli_session_set_session_key(struct smbXcli_session *session, return NT_STATUS_NO_MEMORY; } + session->smb2.application_key = data_blob_dup_talloc(session, + session->smb2.signing_key); + if (session->smb2.application_key.data == NULL) { + return NT_STATUS_NO_MEMORY; + } + session->smb2.channel_signing_key = data_blob_dup_talloc(session, session->smb2.signing_key); if (session->smb2.channel_signing_key.data == NULL) { diff --git a/libcli/smb/smbXcli_base.h b/libcli/smb/smbXcli_base.h index c919f88b12..27f3425cad 100644 --- a/libcli/smb/smbXcli_base.h +++ b/libcli/smb/smbXcli_base.h @@ -246,6 +246,9 @@ struct smbXcli_session *smbXcli_session_create(TALLOC_CTX *mem_ctx, struct smbXcli_conn *conn); uint8_t smb2cli_session_security_mode(struct smbXcli_session *session); uint64_t smb2cli_session_current_id(struct smbXcli_session *session); +NTSTATUS smb2cli_session_application_key(struct smbXcli_session *session, + TALLOC_CTX *mem_ctx, + DATA_BLOB *key); void smb2cli_session_set_id_and_flags(struct smbXcli_session *session, uint64_t session_id, uint16_t session_flags); |