summaryrefslogtreecommitdiff
path: root/libcli
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-02-27 09:03:54 +0100
committerStefan Metzmacher <metze@samba.org>2012-02-27 12:51:34 +0100
commita1ef9c761a6ccc16d6b1193ebcb95fa4493ac1ed (patch)
tree8f5ba283ca1c12c61ddf5d462a6c08279363b5dc /libcli
parentaa4331be9e6e3db3bd14c9abd024e95f6aec8bdb (diff)
downloadsamba-a1ef9c761a6ccc16d6b1193ebcb95fa4493ac1ed.tar.gz
samba-a1ef9c761a6ccc16d6b1193ebcb95fa4493ac1ed.tar.bz2
samba-a1ef9c761a6ccc16d6b1193ebcb95fa4493ac1ed.zip
libcli/smb/smbXcli: add smb2cli_session_application_key()
metze
Diffstat (limited to 'libcli')
-rw-r--r--libcli/smb/smbXcli_base.c25
-rw-r--r--libcli/smb/smbXcli_base.h3
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);