#
# copy_initiator_creds fails, if ccache file is not present.
# This patch in that case initializes the ccache to create the missing file
# and retries credentials copy.
# This was required for SunSSH credential delegation code.
# We will try to push the patch upstream.
# Patch source: in-house
#
@@ -143,6 +143,16 @@ copy_initiator_creds(OM_uint32 *minor_status,
}
code = krb5_cc_copy_creds(context, kcred->ccache, ccache);
+ if (code == KRB5_FCC_NOFILE) {
+ /* default ccache file does not exists => initialize ccache */
+ code = krb5_cc_initialize(context, ccache, kcred->name->princ);
+ if (code != 0) {
+ *minor_status = code;
+ major_status = GSS_S_CRED_UNAVAIL;
+ goto cleanup;
+ }
+ code = krb5_cc_copy_creds(context, kcred->ccache, ccache);
+ }
if (code != 0) {
*minor_status = code;
major_status = GSS_S_FAILURE;