mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
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
This commit is contained in:
parent
81407b1bff
commit
bb2f7e3aee
@ -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);
|
||||
|
||||
if (ret) {
|
||||
(*error_string) = error_message(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
cred->ccache = ccc;
|
||||
cred->ccache_obtained = obtained;
|
||||
talloc_steal(cred, ccc);
|
||||
|
||||
cli_credentials_invalidate_client_gss_creds(cred, cred->ccache_obtained);
|
||||
return 0;
|
||||
}
|
||||
|
||||
krb5_free_principal(ccc->smb_krb5_context->krb5_context, princ);
|
||||
|
||||
ret = cli_credentials_set_from_ccache(cred, ccc, obtained, error_string);
|
||||
|
||||
if (ret) {
|
||||
(*error_string) = error_message(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
cred->ccache = ccc;
|
||||
cred->ccache_obtained = obtained;
|
||||
talloc_steal(cred, ccc);
|
||||
|
||||
cli_credentials_invalidate_client_gss_creds(cred, cred->ccache_obtained);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user