From 3c0a3e22536d009f3d4cc1faa37007058f51431b Mon Sep 17 00:00:00 2001 From: venaas Date: Tue, 3 Feb 2009 15:46:22 +0000 Subject: allowing multiple host statements in client and server blocks git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@466 e88ac4ed-0b26-0410-9574-a7f39faa03bf --- hostport.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'hostport.c') diff --git a/hostport.c b/hostport.c index 9360299..238af0e 100644 --- a/hostport.c +++ b/hostport.c @@ -173,18 +173,27 @@ int resolvehostport(struct hostportres *hp, int socktype, uint8_t passive) { return 0; } -int addhostport(struct list **hostports, char *hostport, char *portdefault, uint8_t prefixok) { +int addhostport(struct list **hostports, char **hostport, char *portdefault, uint8_t prefixok) { struct hostportres *hp; + int i; - hp = newhostport(hostport, portdefault, prefixok); - if (!hp) - return 0; - if (!*hostports) + if (!*hostports) { *hostports = list_create(); - if (!*hostports || !list_push(*hostports, hp)) { - freehostport(hp); - debug(DBG_ERR, "addhostport: malloc failed"); - return 0; + if (!*hostports) { + debug(DBG_ERR, "addhostport: malloc failed"); + return 0; + } + } + + for (i = 0; hostport[i]; i++) { + hp = newhostport(hostport[i], portdefault, prefixok); + if (!hp) + return 0; + if (!list_push(*hostports, hp)) { + freehostport(hp); + debug(DBG_ERR, "addhostport: malloc failed"); + return 0; + } } return 1; } -- cgit v1.1