Skip to content

Commit

Permalink
Improve and export krb5_principal_set_comp_string
Browse files Browse the repository at this point in the history
  • Loading branch information
nicowilliams committed Apr 13, 2015
1 parent c5e91cf commit febe23a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/krb5/libkrb5-exports.def.in
Expand Up @@ -497,6 +497,7 @@ EXPORTS
krb5_principal_get_type
krb5_principal_is_krbtgt
krb5_principal_match
krb5_principal_set_comp_string
krb5_principal_set_realm
krb5_principal_set_type
krb5_print_address
Expand Down
9 changes: 7 additions & 2 deletions lib/krb5/principal.c
Expand Up @@ -63,6 +63,9 @@ host/admin@H5L.ORG
#define princ_ncomp(P, N) ((P)->name.name_string.val[(N)])
#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
* krb5_parse_name(), krb5_make_principal() or any other related
Expand Down Expand Up @@ -668,8 +671,10 @@ krb5_principal_set_comp_string(krb5_context context,
const char *component)
{
char *s;
if (k >= princ_num_comp(principal))
return ERANGE;
size_t i;

for (i = princ_num_comp(principal); i <= k; i++)
append_component(context, principal, "", 0);
s = strdup(component);
if (s == NULL)
return krb5_enomem(context);
Expand Down
1 change: 1 addition & 0 deletions lib/krb5/version-script.map
Expand Up @@ -489,6 +489,7 @@ HEIMDAL_KRB5_2.0 {
krb5_principal_get_realm;
krb5_principal_get_type;
krb5_principal_match;
krb5_principal_set_comp_string;
krb5_principal_set_realm;
krb5_principal_set_type;
krb5_principal_is_krbtgt;
Expand Down

0 comments on commit febe23a

Please sign in to comment.