allow returning the default cc-type.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22844 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2008-04-07 11:48:45 +00:00
parent 74a7510937
commit 294407ee53

View File

@@ -204,16 +204,14 @@ krb5_error_code KRB5_LIB_FUNCTION
krb5_cc_new_unique(krb5_context context, const char *type, krb5_cc_new_unique(krb5_context context, const char *type,
const char *hint, krb5_ccache *id) const char *hint, krb5_ccache *id)
{ {
const krb5_cc_ops *ops = KRB5_DEFAULT_CCTYPE; const krb5_cc_ops *ops;
krb5_error_code ret; krb5_error_code ret;
if (type) { ops = krb5_cc_get_prefix_ops(context, type);
ops = krb5_cc_get_prefix_ops(context, type); if (ops == NULL) {
if (ops == NULL) { krb5_set_error_string(context,
krb5_set_error_string(context, "Credential cache type %s is unknown", type);
"Credential cache type %s is unknown", type); return KRB5_CC_UNKNOWN_TYPE;
return KRB5_CC_UNKNOWN_TYPE;
}
} }
ret = _krb5_cc_allocate(context, ops, id); ret = _krb5_cc_allocate(context, ops, id);
@@ -864,10 +862,12 @@ krb5_cc_clear_mcred(krb5_creds *mcred)
/** /**
* Get the cc ops that is registered in `context' to handle the * Get the cc ops that is registered in `context' to handle the
* `prefix'. `prefix' can be a complete credential cache name or a * prefix. prefix can be a complete credential cache name or a
* prefix, the function will only use part up to the first colon (:) * prefix, the function will only use part up to the first colon (:)
* if there is one. * if there is one. If prefix the argument is NULL, the default ccache
* Returns NULL if ops not found. * implemtation is returned.
* @return Returns NULL if ops not found.
* *
* @ingroup krb5_ccache * @ingroup krb5_ccache
*/ */
@@ -879,6 +879,8 @@ krb5_cc_get_prefix_ops(krb5_context context, const char *prefix)
char *p, *p1; char *p, *p1;
int i; int i;
if (prefix == NULL)
return KRB5_DEFAULT_CCTYPE;
if (prefix[0] == '/') if (prefix[0] == '/')
return &krb5_fcc_ops; return &krb5_fcc_ops;