Use start_realm cc config in export cred

This commit is contained in:
Viktor Dukhovni
2015-04-10 00:24:33 +00:00
committed by Nicolas Williams
parent 629eeb811a
commit f93947672d

View File

@@ -62,6 +62,9 @@ _gsskrb5_export_cred(OM_uint32 *minor_status,
type = krb5_cc_get_type(context, handle->ccache);
if (strcmp(type, "MEMORY") == 0) {
krb5_creds *creds;
krb5_data config_start_realm;
char *start_realm;
ret = krb5_store_uint32(sp, 0);
if (ret) {
krb5_storage_free(sp);
@@ -69,9 +72,25 @@ _gsskrb5_export_cred(OM_uint32 *minor_status,
return GSS_S_FAILURE;
}
ret = _krb5_get_krbtgt(context, handle->ccache,
handle->principal->realm,
&creds);
ret = krb5_cc_get_config(context, handle->ccache, NULL, "start_realm",
&config_start_realm);
if (ret == 0) {
start_realm = strndup(config_start_realm.data,
config_start_realm.length);
krb5_data_free(&config_start_realm);
} else {
start_realm = strdup(krb5_principal_get_realm(context,
handle->principal));
}
if (start_realm == NULL) {
*minor_status = krb5_enomem(context);
krb5_storage_free(sp);
return GSS_S_FAILURE;
}
ret = _krb5_get_krbtgt(context, handle->ccache, start_realm, &creds);
free(start_realm);
start_realm = NULL;
if (ret) {
krb5_storage_free(sp);
*minor_status = ret;