diff options
author | Andrew Bartlett <abartlet@samba.org> | 2010-10-27 15:22:46 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2010-10-27 05:24:22 +0000 |
commit | 51dd83a50cbfc6d1bf17eb95095bac4d223cc637 (patch) | |
tree | a315dbd92cae25485b1f26c775a54e3f49c09177 /source4/auth | |
parent | d9b7123cb7dd4ed04f266aa48c35e70569ae258e (diff) | |
download | samba-51dd83a50cbfc6d1bf17eb95095bac4d223cc637.tar.gz samba-51dd83a50cbfc6d1bf17eb95095bac4d223cc637.tar.bz2 samba-51dd83a50cbfc6d1bf17eb95095bac4d223cc637.zip |
auth/credentials Give a sensible behaviour for resetting the krb5 context
This extra code isn't used at the moment, but I noticed the old API
was rather supprising in it's behaviour, and might catch someone out
at some later time.
Andrew Bartlett
Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Wed Oct 27 05:24:22 UTC 2010 on sn-devel-104
Diffstat (limited to 'source4/auth')
-rw-r--r-- | source4/auth/credentials/credentials_krb5.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/source4/auth/credentials/credentials_krb5.c b/source4/auth/credentials/credentials_krb5.c index fb4b440281..97b18140af 100644 --- a/source4/auth/credentials/credentials_krb5.c +++ b/source4/auth/credentials/credentials_krb5.c @@ -51,13 +51,18 @@ _PUBLIC_ int cli_credentials_get_krb5_context(struct cli_credentials *cred, return 0; } -/* This needs to be called directly after the cli_credentials_init(), - * otherwise we might have problems with the krb5 context already - * being here. +/* For most predictable behaviour, this needs to be called directly after the cli_credentials_init(), + * otherwise we may still have references to the old smb_krb5_context in a credential cache etc */ _PUBLIC_ NTSTATUS cli_credentials_set_krb5_context(struct cli_credentials *cred, struct smb_krb5_context *smb_krb5_context) { + if (smb_krb5_context == NULL) { + talloc_unlink(cred, cred->smb_krb5_context); + cred->smb_krb5_context = NULL; + return NT_STATUS_OK; + } + if (!talloc_reference(cred, smb_krb5_context)) { return NT_STATUS_NO_MEMORY; } |