summaryrefslogtreecommitdiff
path: root/hostport.c
diff options
context:
space:
mode:
authorvenaas <venaas>2009-01-27 14:02:35 +0000
committervenaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf>2009-01-27 14:02:35 +0000
commit2e4e8b5fd240d7f3647ba662b43d4e28f62260d7 (patch)
treec5b2dc26bccc088397eed05563305ac5ae69dcc9 /hostport.c
parent67902f98c988aba120a3abb4250fb483f7d3139a (diff)
rewriting code for hosts,ports,resolving,builds but needs testing
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@462 e88ac4ed-0b26-0410-9574-a7f39faa03bf
Diffstat (limited to 'hostport.c')
-rw-r--r--hostport.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/hostport.c b/hostport.c
index 5f248f2..00c31c8 100644
--- a/hostport.c
+++ b/hostport.c
@@ -264,3 +264,20 @@ int addressmatches(struct list *hostports, struct sockaddr *addr) {
}
return 0;
}
+
+int connecttcphostlist(struct list *hostports, struct addrinfo *src) {
+ int s;
+ struct list_node *entry;
+ struct hostportres *hp = NULL;
+
+ for (entry = list_first(hostports); entry; entry = list_next(entry)) {
+ hp = (struct hostportres *)entry->data;
+ debug(DBG_WARN, "connecttcphostlist: trying to open TCP connection to %s port %s", hp->host, hp->port);
+ if ((s = connecttcp(hp->addrinfo, src)) >= 0) {
+ debug(DBG_WARN, "connecttcphostlist: TCP connection to %s port %s up", hp->host, hp->port);
+ return s;
+ }
+ }
+ debug(DBG_ERR, "connecttcphostlist: failed");
+ return -1;
+}