Skip to content

Commit

Permalink
Use start_realm cc config in export cred
Browse files Browse the repository at this point in the history
  • Loading branch information
Viktor Dukhovni authored and nicowilliams committed Apr 14, 2015
1 parent 629eeb8 commit f939476
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions lib/gssapi/krb5/creds.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,35 @@ _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);
*minor_status = ret;
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;
Expand Down

0 comments on commit f939476

Please sign in to comment.