summaryrefslogtreecommitdiff
path: root/tls.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 /tls.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 'tls.c')
-rw-r--r--tls.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/tls.c b/tls.c
index fa43aea..afd64fc 100644
--- a/tls.c
+++ b/tls.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2008 Stig Venaas <venaas@uninett.no>
+ * Copyright (C) 2006-2009 Stig Venaas <venaas@uninett.no>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -27,6 +27,7 @@
#include <openssl/ssl.h>
#include <openssl/err.h>
#include "list.h"
+#include "hostport.h"
#include "radsecproxy.h"
#ifdef RADPROT_TLS
@@ -82,8 +83,7 @@ static char **getlistenerargs() {
void tlssetsrcres() {
if (!srcres)
- srcres = resolve_hostport_addrinfo(handle, protoopts ? protoopts->sourcearg : NULL);
-
+ srcres = resolvepassiveaddrinfo(protoopts ? protoopts->sourcearg : NULL, NULL, protodefs.socktype);
}
int tlsconnect(struct server *server, struct timeval *when, int timeout, char *text) {
@@ -127,13 +127,11 @@ int tlsconnect(struct server *server, struct timeval *when, int timeout, char *t
sleep(60);
} else
server->lastconnecttry.tv_sec = now.tv_sec; /* no sleep at startup */
- debug(DBG_WARN, "tlsconnect: trying to open TLS connection to %s port %s", server->conf->host, server->conf->port);
+
if (server->sock >= 0)
close(server->sock);
- if ((server->sock = connecttcp(server->conf->addrinfo, srcres)) < 0) {
- debug(DBG_ERR, "tlsconnect: connecttcp failed");
+ if ((server->sock = connecttcphostlist(server->conf->hostports, srcres)) < 0)
continue;
- }
SSL_free(server->ssl);
server->ssl = NULL;
@@ -159,7 +157,7 @@ int tlsconnect(struct server *server, struct timeval *when, int timeout, char *t
}
X509_free(cert);
}
- debug(DBG_WARN, "tlsconnect: TLS connection to %s port %s up", server->conf->host, server->conf->port);
+ debug(DBG_WARN, "tlsconnect: TLS connection to %s up", server->conf->name);
server->connectionok = 1;
gettimeofday(&server->lastconnecttry, NULL);
pthread_mutex_unlock(&server->lock);
@@ -260,7 +258,7 @@ int clientradputtls(struct server *server, unsigned char *rad) {
return 0;
}
- debug(DBG_DBG, "clientradputtls: Sent %d bytes, Radius packet of length %d to TLS peer %s", cnt, len, conf->host);
+ debug(DBG_DBG, "clientradputtls: Sent %d bytes, Radius packet of length %d to TLS peer %s", cnt, len, conf->name);
return 1;
}