diff options
Diffstat (limited to 'crypto/heimdal/lib/gssapi/add_cred.c')
-rw-r--r-- | crypto/heimdal/lib/gssapi/add_cred.c | 56 |
1 files changed, 37 insertions, 19 deletions
diff --git a/crypto/heimdal/lib/gssapi/add_cred.c b/crypto/heimdal/lib/gssapi/add_cred.c index 1e23a5b..53d4f33 100644 --- a/crypto/heimdal/lib/gssapi/add_cred.c +++ b/crypto/heimdal/lib/gssapi/add_cred.c @@ -33,7 +33,7 @@ #include "gssapi_locl.h" -RCSID("$Id: add_cred.c,v 1.2 2003/04/06 00:29:17 lha Exp $"); +RCSID("$Id: add_cred.c,v 1.2.2.1 2003/10/21 21:00:47 lha Exp $"); OM_uint32 gss_add_cred ( OM_uint32 *minor_status, @@ -152,25 +152,43 @@ OM_uint32 gss_add_cred ( goto failure; } - name = krb5_cc_get_name(gssapi_krb5_context, cred->ccache); - if (name == NULL) { - *minor_status = ENOMEM; - goto failure; - } - - asprintf(&type_name, "%s:%s", type, name); - if (type_name == NULL) { - *minor_status = ENOMEM; - goto failure; + if (strcmp(type, "MEMORY") == 0) { + ret = krb5_cc_gen_new(gssapi_krb5_context, &krb5_mcc_ops, + &handle->ccache); + if (ret) { + *minor_status = ret; + goto failure; + } + + ret = krb5_cc_copy_cache(gssapi_krb5_context, cred->ccache, + handle->ccache); + if (ret) { + *minor_status = ret; + goto failure; + } + + } else { + + name = krb5_cc_get_name(gssapi_krb5_context, cred->ccache); + if (name == NULL) { + *minor_status = ENOMEM; + goto failure; + } + + asprintf(&type_name, "%s:%s", type, name); + if (type_name == NULL) { + *minor_status = ENOMEM; + goto failure; + } + + kret = krb5_cc_resolve(gssapi_krb5_context, type_name, + &handle->ccache); + free(type_name); + if (kret) { + *minor_status = kret; + goto failure; + } } - - kret = krb5_cc_resolve(gssapi_krb5_context, type_name, - &handle->ccache); - free(type_name); - if (kret) { - *minor_status = kret; - goto failure; - } } ret = gss_create_empty_oid_set(minor_status, &handle->mechanisms); |