summaryrefslogtreecommitdiff
path: root/source4/auth
diff options
context:
space:
mode:
Diffstat (limited to 'source4/auth')
-rw-r--r--source4/auth/credentials/credentials_krb5.c30
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;
}