diff options
author | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2013-10-15 12:50:43 +0200 |
---|---|---|
committer | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2013-10-17 13:17:26 +0200 |
commit | 13734b9723e221cbb535306b89fc3e77fc2010de (patch) | |
tree | f6d5d9c27d25a6ba62b7c29f3e5be4272ee89177 | |
parent | 0740b9ab9acc2ecae9342d2db42c4645ae4104eb (diff) | |
download | sssd-13734b9723e221cbb535306b89fc3e77fc2010de.tar.gz sssd-13734b9723e221cbb535306b89fc3e77fc2010de.tar.bz2 sssd-13734b9723e221cbb535306b89fc3e77fc2010de.zip |
heimdal: Add wrapper for krb5_unparse_name_ext
Use krb5_unparse_name in heimdal and calculate length using strlen.
-rw-r--r-- | src/external/krb5.m4 | 1 | ||||
-rw-r--r-- | src/providers/krb5/krb5_child.c | 3 | ||||
-rw-r--r-- | src/util/sss_krb5.c | 19 | ||||
-rw-r--r-- | src/util/sss_krb5.h | 6 |
4 files changed, 28 insertions, 1 deletions
diff --git a/src/external/krb5.m4 b/src/external/krb5.m4 index ba92da2a..ff4924f3 100644 --- a/src/external/krb5.m4 +++ b/src/external/krb5.m4 @@ -46,6 +46,7 @@ AC_CHECK_TYPES([krb5_ticket_times, krb5_times, krb5_trace_info], [], [], #endif ]) AC_CHECK_FUNCS([krb5_get_init_creds_opt_alloc krb5_get_error_message \ + krb5_unparse_name_ext \ krb5_free_unparsed_name \ krb5_get_init_creds_opt_set_expire_callback \ krb5_get_init_creds_opt_set_fast_ccache_name \ diff --git a/src/providers/krb5/krb5_child.c b/src/providers/krb5/krb5_child.c index 5bc6ec00..6d8269d7 100644 --- a/src/providers/krb5/krb5_child.c +++ b/src/providers/krb5/krb5_child.c @@ -673,7 +673,8 @@ static errno_t add_ticket_times_and_upn_to_response(struct krb5_req *kr) goto done; } - kerr = krb5_unparse_name_ext(kr->ctx, kr->creds->client, &upn, &upn_len); + kerr = sss_krb5_unparse_name_ext(kr->ctx, kr->creds->client, + &upn, &upn_len); if (kerr != 0) { DEBUG(SSSDBG_OP_FAILURE, ("krb5_unparse_name failed.\n")); goto done; diff --git a/src/util/sss_krb5.c b/src/util/sss_krb5.c index 5f36f7e9..c9b16107 100644 --- a/src/util/sss_krb5.c +++ b/src/util/sss_krb5.c @@ -1079,3 +1079,22 @@ done: return NULL; #endif /* HAVE_KRB5_CC_COLLECTION */ } + +krb5_error_code KRB5_CALLCONV +sss_krb5_unparse_name_ext(krb5_context ctx, + krb5_const_principal principal, + char **name, + unsigned int *len) +{ + krb5_error_code kerr; + +#ifdef HAVE_KRB5_UNPARSE_NAME_EXT + kerr = krb5_unparse_name_ext(ctx, principal, name, len); +#else + kerr = krb5_unparse_name(ctx, principal, name); + if (kerr == 0 && *name) + *len = strlen(*name); +#endif /* HAVE_KRB5_UNPARSE_NAME_EXT */ + + return kerr; +} diff --git a/src/util/sss_krb5.h b/src/util/sss_krb5.h index 43243735..c8f2d4d7 100644 --- a/src/util/sss_krb5.h +++ b/src/util/sss_krb5.h @@ -186,4 +186,10 @@ char * sss_get_ccache_name_for_principal(TALLOC_CTX *mem_ctx, krb5_context ctx, krb5_principal principal, const char *location); + +krb5_error_code KRB5_CALLCONV +sss_krb5_unparse_name_ext(krb5_context ctx, + krb5_const_principal principal, + char **name, + unsigned int *len); #endif /* __SSS_KRB5_H__ */ |