summaryrefslogtreecommitdiff
path: root/radsecproxy.c
diff options
context:
space:
mode:
authorvenaas <venaas>2008-06-05 10:47:13 +0000
committervenaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf>2008-06-05 10:47:13 +0000
commit4f7738e4fb6b55819fdbe531aeafa73fb7d9b38b (patch)
tree85de4eff170c0b98bd2adb67ca341aa77ecc6604 /radsecproxy.c
parent17df196bbcdb70414383343cf3dc73442e00f256 (diff)
trying to remove dynamic server state when tlsconnection goes down
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@286 e88ac4ed-0b26-0410-9574-a7f39faa03bf
Diffstat (limited to 'radsecproxy.c')
-rw-r--r--radsecproxy.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/radsecproxy.c b/radsecproxy.c
index f5b420b..b3ccfd0 100644
--- a/radsecproxy.c
+++ b/radsecproxy.c
@@ -903,6 +903,7 @@ int tlsconnect(struct server *server, struct timeval *when, int timeout, char *t
if (server->sock >= 0)
close(server->sock);
SSL_free(server->ssl);
+ server->ssl = NULL;
pthread_mutex_unlock(&server->lock);
return 0;
}
@@ -1046,6 +1047,8 @@ int clientradputtls(struct server *server, unsigned char *rad) {
while ((cnt = SSL_write(server->ssl, rad, len)) <= 0) {
while ((error = ERR_get_error()))
debug(DBG_ERR, "clientradputtls: TLS: %s", ERR_error_string(error, NULL));
+ if (server->dynamiclookuparg)
+ return 0;
tlsconnect(server, &lastconnecttry, 0, "clientradputtls");
lastconnecttry = server->lastconnecttry;
}
@@ -2271,6 +2274,10 @@ void *tlsclientrd(void *arg) {
lastconnecttry = server->lastconnecttry;
buf = radtlsget(server->ssl);
if (!buf) {
+ if (server->dynamiclookuparg) {
+ server->clientrdgone = 1;
+ return NULL;
+ }
tlsconnect(server, &lastconnecttry, 0, "clientrd");
continue;
}
@@ -2333,7 +2340,7 @@ void *clientwr(void *arg) {
pthread_mutex_lock(&server->newrq_mutex);
if (!server->newrq) {
gettimeofday(&now, NULL);
- if (conf->statusserver) {
+ if (conf->statusserver || server->dynamiclookuparg) {
/* random 0-7 seconds */
RAND_bytes(&rnd, 1);
rnd /= 32;
@@ -2357,6 +2364,10 @@ void *clientwr(void *arg) {
pthread_mutex_unlock(&server->newrq_mutex);
for (i = 0; i < MAX_REQUESTS; i++) {
+ if (server->clientrdgone) {
+ pthread_join(tlsclientrdth, NULL);
+ goto errexit;
+ }
pthread_mutex_lock(&server->newrq_mutex);
while (i < MAX_REQUESTS && !server->requests[i].buf)
i++;