summaryrefslogtreecommitdiff
path: root/hostport.c
diff options
context:
space:
mode:
authorvenaas <venaas>2009-02-03 15:46:22 +0000
committervenaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf>2009-02-03 15:46:22 +0000
commit3c0a3e22536d009f3d4cc1faa37007058f51431b (patch)
treefcd67f6d60c1c69d366224b908d4332a37438a06 /hostport.c
parent39bedc61c523e84a3b7c2d01ebb4fd2e075d02db (diff)
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
Diffstat (limited to 'hostport.c')
-rw-r--r--hostport.c27
1 files changed, 18 insertions, 9 deletions
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;
}