1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

libcli/smb: s/smbXcli_session_copy/smbXcli_session_shallow_copy

We should make clear that this is a function for testing only,
with possible strange side effects.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
Stefan Metzmacher 2019-06-11 17:42:38 +02:00
parent 4d81e48a17
commit 317054f6eb
3 changed files with 10 additions and 5 deletions

View File

@ -5558,7 +5558,7 @@ 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 *smbXcli_session_shallow_copy(TALLOC_CTX *mem_ctx,
struct smbXcli_session *src)
{
struct smbXcli_session *session;
@ -5573,6 +5573,11 @@ struct smbXcli_session *smbXcli_session_copy(TALLOC_CTX *mem_ctx,
return NULL;
}
/*
* Note we keep a pointer to the session keys of the
* main session and rely on the caller to free the
* shallow copy first!
*/
session->conn = src->conn;
*session->smb2 = *src->smb2;
session->smb2_channel = src->smb2_channel;

View File

@ -466,7 +466,7 @@ NTSTATUS smb2cli_validate_negotiate_info_recv(struct tevent_req *req);
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 *smbXcli_session_shallow_copy(TALLOC_CTX *mem_ctx,
struct smbXcli_session *src);
bool smbXcli_session_is_guest(struct smbXcli_session *session);
bool smbXcli_session_is_authenticated(struct smbXcli_session *session);

View File

@ -262,7 +262,7 @@ static bool test_compound_related1(struct torture_context *tctx,
0, /* capabilities */
0 /* maximal_access */);
tree->session->smbXcli = smbXcli_session_copy(tree->session,
tree->session->smbXcli = smbXcli_session_shallow_copy(tree->session,
tree->session->smbXcli);
smb2cli_session_set_id_and_flags(tree->session->smbXcli, UINT64_MAX, 0);
@ -341,7 +341,7 @@ static bool test_compound_related2(struct torture_context *tctx,
0, /* capabilities */
0 /* maximal_access */);
tree->session->smbXcli = smbXcli_session_copy(tree->session,
tree->session->smbXcli = smbXcli_session_shallow_copy(tree->session,
tree->session->smbXcli);
smb2cli_session_set_id_and_flags(tree->session->smbXcli, UINT64_MAX, 0);
@ -930,7 +930,7 @@ static bool test_compound_invalid2(struct torture_context *tctx,
0, /* capabilities */
0 /* maximal_access */);
tree->session->smbXcli = smbXcli_session_copy(tree->session,
tree->session->smbXcli = smbXcli_session_shallow_copy(tree->session,
tree->session->smbXcli);
smb2cli_session_set_id_and_flags(tree->session->smbXcli, UINT64_MAX, 0);