diff options
author | Stefan Metzmacher <metze@samba.org> | 2012-08-01 08:59:01 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2012-08-01 14:17:12 +0200 |
commit | 5f25567c2efd24a27bbb30f35a593bd3d9c3784f (patch) | |
tree | 0dbf4bae16d33be331e939bebe505666ebbe3fe0 /libcli/smb | |
parent | ac1452c4f927af621b33cb1c544b30dcf29c1903 (diff) | |
download | samba-5f25567c2efd24a27bbb30f35a593bd3d9c3784f.tar.gz samba-5f25567c2efd24a27bbb30f35a593bd3d9c3784f.tar.bz2 samba-5f25567c2efd24a27bbb30f35a593bd3d9c3784f.zip |
libcli/smb: add smbXcli_session_application_key()
metze
Diffstat (limited to 'libcli/smb')
-rw-r--r-- | libcli/smb/smbXcli_base.c | 30 | ||||
-rw-r--r-- | libcli/smb/smbXcli_base.h | 3 |
2 files changed, 33 insertions, 0 deletions
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c index ff24688f08..ea6f647b76 100644 --- a/libcli/smb/smbXcli_base.c +++ b/libcli/smb/smbXcli_base.c @@ -4294,6 +4294,36 @@ struct smbXcli_session *smbXcli_session_create(TALLOC_CTX *mem_ctx, return session; } +NTSTATUS smbXcli_session_application_key(struct smbXcli_session *session, + TALLOC_CTX *mem_ctx, + DATA_BLOB *key) +{ + const DATA_BLOB *application_key; + + *key = data_blob_null; + + if (session->conn == NULL) { + return NT_STATUS_NO_USER_SESSION_KEY; + } + + if (session->conn->protocol >= PROTOCOL_SMB2_02) { + application_key = &session->smb2->application_key; + } else { + application_key = &session->smb1.application_key; + } + + if (application_key->length == 0) { + return NT_STATUS_NO_USER_SESSION_KEY; + } + + *key = data_blob_dup_talloc(mem_ctx, *application_key); + if (key->data == NULL) { + return NT_STATUS_NO_MEMORY; + } + + return NT_STATUS_OK; +} + uint16_t smb1cli_session_current_id(struct smbXcli_session *session) { return session->smb1.session_id; diff --git a/libcli/smb/smbXcli_base.h b/libcli/smb/smbXcli_base.h index 2f78247c60..c35811ac0b 100644 --- a/libcli/smb/smbXcli_base.h +++ b/libcli/smb/smbXcli_base.h @@ -248,6 +248,9 @@ NTSTATUS smbXcli_negprot(struct smbXcli_conn *conn, struct smbXcli_session *smbXcli_session_create(TALLOC_CTX *mem_ctx, struct smbXcli_conn *conn); +NTSTATUS smbXcli_session_application_key(struct smbXcli_session *session, + TALLOC_CTX *mem_ctx, + DATA_BLOB *key); uint16_t smb1cli_session_current_id(struct smbXcli_session* session); void smb1cli_session_set_id(struct smbXcli_session* session, uint16_t session_id); |