diff options
author | Andrew Bartlett <abartlet@samba.org> | 2010-05-12 12:34:15 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2010-05-14 23:25:45 +1000 |
commit | bb2f7e3aee7e9b8437d7313800be0c2370da5ca1 (patch) | |
tree | 11b5bb3316e4448fb7619079ca578f3b99257187 | |
parent | 81407b1bffed137c02790d908893bac7b99ce956 (diff) | |
download | samba-bb2f7e3aee7e9b8437d7313800be0c2370da5ca1.tar.gz samba-bb2f7e3aee7e9b8437d7313800be0c2370da5ca1.tar.bz2 samba-bb2f7e3aee7e9b8437d7313800be0c2370da5ca1.zip |
s4:credentials Allow setting of an empty Kerberos CCACHE
This allows us to tell the credentials code where we want the
credentials put.
Andrew Bartlett
-rw-r--r-- | source4/auth/credentials/credentials_krb5.c | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/source4/auth/credentials/credentials_krb5.c b/source4/auth/credentials/credentials_krb5.c index 12bf610bf8..f4ee2641d9 100644 --- a/source4/auth/credentials/credentials_krb5.c +++ b/source4/auth/credentials/credentials_krb5.c @@ -182,28 +182,22 @@ _PUBLIC_ int cli_credentials_set_ccache(struct cli_credentials *cred, ret = krb5_cc_get_principal(ccc->smb_krb5_context->krb5_context, ccc->ccache, &princ); - if (ret) { - (*error_string) = talloc_asprintf(cred, "failed to get principal from default ccache: %s\n", - smb_get_krb5_error_message(ccc->smb_krb5_context->krb5_context, - ret, ccc)); - talloc_free(ccc); - return ret; - } + if (ret == 0) { + krb5_free_principal(ccc->smb_krb5_context->krb5_context, princ); + ret = cli_credentials_set_from_ccache(cred, ccc, obtained, error_string); - krb5_free_principal(ccc->smb_krb5_context->krb5_context, princ); + if (ret) { + (*error_string) = error_message(ret); + return ret; + } - ret = cli_credentials_set_from_ccache(cred, ccc, obtained, error_string); + cred->ccache = ccc; + cred->ccache_obtained = obtained; + talloc_steal(cred, ccc); - if (ret) { - (*error_string) = error_message(ret); - return ret; + cli_credentials_invalidate_client_gss_creds(cred, cred->ccache_obtained); + return 0; } - - cred->ccache = ccc; - cred->ccache_obtained = obtained; - talloc_steal(cred, ccc); - - cli_credentials_invalidate_client_gss_creds(cred, cred->ccache_obtained); return 0; } |