From d2ba6b76ef112c3ff285a55ac04c5308e840fdd9 Mon Sep 17 00:00:00 2001 From: Jennifer Richards Date: Thu, 24 May 2018 14:05:39 -0400 Subject: [PATCH] Fix typo, reorder methods in tr_aaa_server.c --- common/tr_aaa_server.c | 106 +++++++++++++++++++++++----------------------- common/tr_config_realms.c | 2 +- 2 files changed, 53 insertions(+), 55 deletions(-) diff --git a/common/tr_aaa_server.c b/common/tr_aaa_server.c index b008e5d..7345783 100644 --- a/common/tr_aaa_server.c +++ b/common/tr_aaa_server.c @@ -64,6 +64,58 @@ void tr_aaa_server_free(TR_AAA_SERVER *aaa) talloc_free(aaa); } +TR_NAME *tr_aaa_server_get_hostname(TR_AAA_SERVER *aaa) +{ + return aaa->hostname; +} + +/** + * Set the hostname for a AAA server + * + * Takes ownership of the TR_NAME. Does nothing if aaa is null. + * + * @param aaa + * @param hostname + */ +void tr_aaa_server_set_hostname(TR_AAA_SERVER *aaa, TR_NAME *hostname) +{ + if (aaa == NULL) + return; + + if (aaa->hostname != NULL) { + tr_free_name(aaa->hostname); + } + + aaa->hostname = hostname; +} + +int tr_aaa_server_get_port(TR_AAA_SERVER *aaa) +{ + return aaa->port; +} + +/** + * Set the port for a AAA server + * + * If port is 0, uses the standard TID port (12309). Other invalid values are stored + * as-is. + * + * Does nothing if aaa is null. + * + * @param aaa + * @param port + */ +void tr_aaa_server_set_port(TR_AAA_SERVER *aaa, int port) +{ + if (aaa == NULL) + return; + + if (port == 0) + port = TID_PORT; + + aaa->port = port; +} + /** * Parse the port from a hostname:port string * @@ -217,57 +269,3 @@ TR_AAA_SERVER *tr_aaa_server_iter_next(TR_AAA_SERVER_ITER *iter) } return iter->this; } - -TR_NAME *tr_aaa_server_get_hostname(TR_AAA_SERVER *aaa) -{ - return aaa->hostname; -} - -/** - * Set the hostname for a AAA server - * - * Takes ownership of the TR_NAME. Does nothing if aaa is null. - * - * @param aaa - * @param hostname - */ -void tr_aaa_server_set_hostname(TR_AAA_SERVER *aaa, TR_NAME *hostname) -{ - if (aaa == NULL) - return; - - if (aaa->hostname != NULL) { - tr_free_name(aaa->hostname); - } - - aaa->hostname = hostname; -} - -int tr_aaa_server_get_port(TR_AAA_SERVER *aaa) -{ - return aaa->port; -} - -/** - * Set the port for a AAA server - * - * If port is 0, uses the standard TID port (12309). Other invalid values are stored - * as-is. - * - * Does nothing if aaa is null. - * - * @param aaa - * @param port - */ -void tr_aaa_server_set_port(TR_AAA_SERVER *aaa, int port) -{ - if (aaa == NULL) - return; - - if (port == 0) - port = TID_PORT; - - aaa->port = port; -} - - diff --git a/common/tr_config_realms.c b/common/tr_config_realms.c index 881a881..cd8f660 100644 --- a/common/tr_config_realms.c +++ b/common/tr_config_realms.c @@ -68,7 +68,7 @@ TR_AAA_SERVER *tr_cfg_parse_one_aaa_server(TALLOC_CTX *mem_ctx, json_t *jaddr, T if (aaa == NULL) { tr_debug("tr_cfg_parse_one_aaa_server: Out of memory allocating AAA server."); *rc = TR_CFG_NOMEM; - goto cleanup + goto cleanup; } if (tr_aaa_server_get_hostname(aaa)->len == 0) { -- 2.1.4