Improve and export krb5_principal_set_comp_string

This commit is contained in:
Nicolas Williams
2015-03-31 12:50:55 -05:00
parent c5e91cf462
commit febe23a399
3 changed files with 9 additions and 2 deletions

View File

@@ -497,6 +497,7 @@ EXPORTS
krb5_principal_get_type krb5_principal_get_type
krb5_principal_is_krbtgt krb5_principal_is_krbtgt
krb5_principal_match krb5_principal_match
krb5_principal_set_comp_string
krb5_principal_set_realm krb5_principal_set_realm
krb5_principal_set_type krb5_principal_set_type
krb5_print_address krb5_print_address

View File

@@ -63,6 +63,9 @@ host/admin@H5L.ORG
#define princ_ncomp(P, N) ((P)->name.name_string.val[(N)]) #define princ_ncomp(P, N) ((P)->name.name_string.val[(N)])
#define princ_realm(P) ((P)->realm) #define princ_realm(P) ((P)->realm)
static krb5_error_code append_component(krb5_context, krb5_principal,
const char *, size_t);
/** /**
* Frees a Kerberos principal allocated by the library with * Frees a Kerberos principal allocated by the library with
* krb5_parse_name(), krb5_make_principal() or any other related * krb5_parse_name(), krb5_make_principal() or any other related
@@ -668,8 +671,10 @@ krb5_principal_set_comp_string(krb5_context context,
const char *component) const char *component)
{ {
char *s; char *s;
if (k >= princ_num_comp(principal)) size_t i;
return ERANGE;
for (i = princ_num_comp(principal); i <= k; i++)
append_component(context, principal, "", 0);
s = strdup(component); s = strdup(component);
if (s == NULL) if (s == NULL)
return krb5_enomem(context); return krb5_enomem(context);

View File

@@ -489,6 +489,7 @@ HEIMDAL_KRB5_2.0 {
krb5_principal_get_realm; krb5_principal_get_realm;
krb5_principal_get_type; krb5_principal_get_type;
krb5_principal_match; krb5_principal_match;
krb5_principal_set_comp_string;
krb5_principal_set_realm; krb5_principal_set_realm;
krb5_principal_set_type; krb5_principal_set_type;
krb5_principal_is_krbtgt; krb5_principal_is_krbtgt;