(krb5_cc_get_full_name): Add
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16273 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -222,6 +222,41 @@ krb5_cc_get_type(krb5_context context,
|
||||
return id->ops->prefix;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the complete resolvable name the ccache `id' in `str<74>.
|
||||
* `str` should be freed with free(3).
|
||||
* Returns 0 or an error (and then *str is set to NULL).
|
||||
*/
|
||||
|
||||
krb5_error_code KRB5_LIB_FUNCTION
|
||||
krb5_cc_get_full_name(krb5_context context,
|
||||
krb5_ccache id,
|
||||
char **str)
|
||||
{
|
||||
const char *type, *name;
|
||||
|
||||
*str = NULL;
|
||||
|
||||
type = krb5_cc_get_type(context, id);
|
||||
if (type == NULL) {
|
||||
krb5_set_error_string(context, "cache have no name of type");
|
||||
return KRB5_CC_UNKNOWN_TYPE;
|
||||
}
|
||||
|
||||
name = krb5_cc_get_name(context, id);
|
||||
if (name == NULL) {
|
||||
krb5_set_error_string(context, "cache of type %s have no name", type);
|
||||
return KRB5_CC_BADNAME;
|
||||
}
|
||||
|
||||
if (asprintf(str, "%s:%s", type, name) == -1) {
|
||||
krb5_set_error_string(context, "malloc - out of memory");
|
||||
*str = NULL;
|
||||
return ENOMEM;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return krb5_cc_ops of a the ccache `id'.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user