summaryrefslogtreecommitdiff
path: root/libcli/smb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2013-01-28 16:51:25 -0800
committerRichard Sharpe <realrichardsharpe@gmail.com>2013-01-30 17:15:59 -0800
commit1624d83fdeb675ee4032f5d3cabcf86d5b05a3cb (patch)
treeea06c3ef92c082b298e1552d293bf1befffe7bec /libcli/smb
parent7b0b1d6d48d31a729f0ad176a8b53f8c3a8d2d16 (diff)
downloadsamba-1624d83fdeb675ee4032f5d3cabcf86d5b05a3cb.tar.gz
samba-1624d83fdeb675ee4032f5d3cabcf86d5b05a3cb.tar.bz2
samba-1624d83fdeb675ee4032f5d3cabcf86d5b05a3cb.zip
Add new function smbXcli_session_copy(), to be used when creating compound SMB2 requests.
Copies the signing state needed to make client compound requests work on signed connections. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
Diffstat (limited to 'libcli/smb')
-rw-r--r--libcli/smb/smbXcli_base.c27
-rw-r--r--libcli/smb/smbXcli_base.h2
2 files changed, 29 insertions, 0 deletions
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index c547515d59..421e884c90 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -4482,6 +4482,33 @@ struct smbXcli_session *smbXcli_session_create(TALLOC_CTX *mem_ctx,
return session;
}
+struct smbXcli_session *smbXcli_session_copy(TALLOC_CTX *mem_ctx,
+ struct smbXcli_session *src)
+{
+ struct smbXcli_session *session;
+
+ session = talloc_zero(mem_ctx, struct smbXcli_session);
+ if (session == NULL) {
+ return NULL;
+ }
+ session->smb2 = talloc_zero(session, struct smb2cli_session);
+ if (session->smb2 == NULL) {
+ talloc_free(session);
+ return NULL;
+ }
+
+ session->conn = src->conn;
+ *session->smb2 = *src->smb2;
+ session->smb2_channel = src->smb2_channel;
+ session->disconnect_expired = src->disconnect_expired;
+
+ DLIST_ADD_END(src->conn->sessions, session, struct smbXcli_session *);
+ talloc_set_destructor(session, smbXcli_session_destructor);
+
+ return session;
+}
+
+
NTSTATUS smbXcli_session_application_key(struct smbXcli_session *session,
TALLOC_CTX *mem_ctx,
DATA_BLOB *key)
diff --git a/libcli/smb/smbXcli_base.h b/libcli/smb/smbXcli_base.h
index b720bc6e8c..f7b60d30bb 100644
--- a/libcli/smb/smbXcli_base.h
+++ b/libcli/smb/smbXcli_base.h
@@ -260,6 +260,8 @@ NTSTATUS smbXcli_negprot(struct smbXcli_conn *conn,
struct smbXcli_session *smbXcli_session_create(TALLOC_CTX *mem_ctx,
struct smbXcli_conn *conn);
+struct smbXcli_session *smbXcli_session_copy(TALLOC_CTX *mem_ctx,
+ struct smbXcli_session *src);
NTSTATUS smbXcli_session_application_key(struct smbXcli_session *session,
TALLOC_CTX *mem_ctx,
DATA_BLOB *key);