Use start_realm cc config in export cred
This commit is contained in:

committed by
Nicolas Williams

parent
629eeb811a
commit
f93947672d
@@ -62,6 +62,9 @@ _gsskrb5_export_cred(OM_uint32 *minor_status,
|
|||||||
type = krb5_cc_get_type(context, handle->ccache);
|
type = krb5_cc_get_type(context, handle->ccache);
|
||||||
if (strcmp(type, "MEMORY") == 0) {
|
if (strcmp(type, "MEMORY") == 0) {
|
||||||
krb5_creds *creds;
|
krb5_creds *creds;
|
||||||
|
krb5_data config_start_realm;
|
||||||
|
char *start_realm;
|
||||||
|
|
||||||
ret = krb5_store_uint32(sp, 0);
|
ret = krb5_store_uint32(sp, 0);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
krb5_storage_free(sp);
|
krb5_storage_free(sp);
|
||||||
@@ -69,9 +72,25 @@ _gsskrb5_export_cred(OM_uint32 *minor_status,
|
|||||||
return GSS_S_FAILURE;
|
return GSS_S_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = _krb5_get_krbtgt(context, handle->ccache,
|
ret = krb5_cc_get_config(context, handle->ccache, NULL, "start_realm",
|
||||||
handle->principal->realm,
|
&config_start_realm);
|
||||||
&creds);
|
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) {
|
if (ret) {
|
||||||
krb5_storage_free(sp);
|
krb5_storage_free(sp);
|
||||||
*minor_status = ret;
|
*minor_status = ret;
|
||||||
|
Reference in New Issue
Block a user