diff options
Diffstat (limited to 'libcli/smb')
-rw-r--r-- | libcli/smb/smbXcli_base.c | 27 | ||||
-rw-r--r-- | libcli/smb/smbXcli_base.h | 2 |
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); |