auth:credentials: avoid talloc_reference in cli_credentials_set_netlogon_creds()
authorStefan Metzmacher <metze@samba.org>
Fri, 20 Sep 2013 02:33:07 +0000 (04:33 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 16 Oct 2013 21:56:01 +0000 (23:56 +0200)
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 <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Oct 16 23:56:01 CEST 2013 on sn-devel-104

auth/credentials/credentials.c

index 642eef7932854c824ab1cee247ff9452833203a2..78b59556eae953b2f92ee1d687dbb750bf474ebe 100644 (file)
@@ -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);
 }
 
 /**