From 556f66bd56415d83be936e28d41946c39e379914 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 20 Sep 2013 04:33:07 +0200 Subject: auth:credentials: avoid talloc_reference in cli_credentials_set_netlogon_creds() Typically cli_credentials_set_netlogon_creds() should be used directly before the DCERPC bind. And cli_credentials_get_netlogon_creds() should be only used by the gensec layer, which only needs a copy. Signed-off-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett Autobuild-User(master): Andrew Bartlett Autobuild-Date(master): Wed Oct 16 23:56:01 CEST 2013 on sn-devel-104 --- auth/credentials/credentials.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/auth/credentials/credentials.c b/auth/credentials/credentials.c index 642eef7932..78b59556ea 100644 --- a/auth/credentials/credentials.c +++ b/auth/credentials/credentials.c @@ -836,7 +836,11 @@ _PUBLIC_ void cli_credentials_guess(struct cli_credentials *cred, _PUBLIC_ void cli_credentials_set_netlogon_creds(struct cli_credentials *cred, struct netlogon_creds_CredentialState *netlogon_creds) { - cred->netlogon_creds = talloc_reference(cred, netlogon_creds); + TALLOC_FREE(cred->netlogon_creds); + if (netlogon_creds == NULL) { + return; + } + cred->netlogon_creds = netlogon_creds_copy(cred, netlogon_creds); } /** -- cgit