From f8a1e4124cb067a35279638bab445db18606809f Mon Sep 17 00:00:00 2001 From: Jennifer Richards Date: Thu, 24 May 2018 14:01:14 -0400 Subject: [PATCH] Fix a leftover use of the old TR_AAA_SERVER structure --- common/tr_idp_encoders.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/common/tr_idp_encoders.c b/common/tr_idp_encoders.c index 72acd15..4b3d845 100644 --- a/common/tr_idp_encoders.c +++ b/common/tr_idp_encoders.c @@ -44,7 +44,18 @@ static char *tr_aaa_server_to_str(TALLOC_CTX *mem_ctx, TR_AAA_SERVER *aaa) { - return talloc_strndup(mem_ctx, aaa->hostname->buf, aaa->hostname->len); + char *aaa_hostname = tr_name_strdup( tr_aaa_server_get_hostname(aaa) ); + char *result = NULL; + + if (aaa_hostname == NULL) + return NULL; + + result = talloc_asprintf(mem_ctx, + "%s:%d", + aaa_hostname, + tr_aaa_server_get_port(aaa)); + free(aaa_hostname); + return result; } @@ -151,14 +162,9 @@ cleanup: static json_t *tr_aaa_server_to_json(TR_AAA_SERVER *aaa) { - char *hostname = tr_name_strdup(aaa->hostname); - char *s = NULL; + char *s = tr_aaa_server_to_str(NULL, aaa); json_t *jstr = NULL; - if (hostname == NULL) - return NULL; - - s = talloc_asprintf(NULL, "%s:%d", hostname, TID_PORT); if (s) { jstr = json_string(s); talloc_free(s); -- 2.1.4