(krb5_kt_get_full_name): new function
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16295 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -239,6 +239,40 @@ krb5_kt_get_name(krb5_context context,
|
||||
return (*keytab->get_name)(context, keytab, name, namesize);
|
||||
}
|
||||
|
||||
/*
|
||||
* Retrieve the full name of the keytab `keytab' and store the name in
|
||||
* `str'. `str' needs to be freed by the caller using free(3).
|
||||
* Returns 0 or an error. On error, *str is set to NULL.
|
||||
*/
|
||||
|
||||
krb5_error_code KRB5_LIB_FUNCTION
|
||||
krb5_kt_get_full_name(krb5_context context,
|
||||
krb5_keytab keytab,
|
||||
char **str)
|
||||
{
|
||||
char type[KRB5_KT_PREFIX_MAX_LEN];
|
||||
char name[MAXPATHLEN];
|
||||
krb5_error_code ret;
|
||||
|
||||
*str = NULL;
|
||||
|
||||
ret = krb5_kt_get_type(context, keytab, type, sizeof(type));
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = krb5_kt_get_name(context, keytab, name, sizeof(name));
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (asprintf(str, "%s:%s", type, name) == -1) {
|
||||
krb5_set_error_string(context, "malloc - out of memory");
|
||||
*str = NULL;
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Finish using the keytab in `id'. All resources will be released,
|
||||
* even on errors. Return 0 or an error.
|
||||
|
Reference in New Issue
Block a user