summaryrefslogtreecommitdiff
path: root/radsecproxy.c
diff options
context:
space:
mode:
authorvenaas <venaas>2008-08-22 14:32:51 +0000
committervenaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf>2008-08-22 14:32:51 +0000
commit5ffb1376dd0a2f1f55cfc0511bd3ef38be6e4d1d (patch)
treebab6ad90524920aa261874308abee56ffda4a178 /radsecproxy.c
parenta2a0f702e632d9219628fc467e1d2e5bde2eab7d (diff)
fixed bug with multiple status server sent, some dtls fixes
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@358 e88ac4ed-0b26-0410-9574-a7f39faa03bf
Diffstat (limited to 'radsecproxy.c')
-rw-r--r--radsecproxy.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/radsecproxy.c b/radsecproxy.c
index 50bdd20..a26fdfa 100644
--- a/radsecproxy.c
+++ b/radsecproxy.c
@@ -619,6 +619,8 @@ void freeserver(struct server *server, uint8_t destroymutex) {
if (server->rbios)
freebios(server->rbios);
free(server->dynamiclookuparg);
+ if (server->ssl)
+ SSL_free(server->ssl);
if (destroymutex) {
pthread_mutex_destroy(&server->lock);
pthread_cond_destroy(&server->newrq_cond);
@@ -2094,9 +2096,9 @@ void *clientwr(void *arg) {
struct server *server = (struct server *)arg;
struct request *rq;
pthread_t clientrdth;
- int i, dynconffail = 0;
+ int i, secs, dynconffail = 0;
uint8_t rnd;
- struct timeval now;
+ struct timeval now, laststatsrv;
struct timespec timeout;
struct request statsrvrq;
unsigned char statsrvbuf[38];
@@ -2124,6 +2126,7 @@ void *clientwr(void *arg) {
statsrvbuf[20] = RAD_Attr_Message_Authenticator;
statsrvbuf[21] = 18;
gettimeofday(&server->lastrcv, NULL);
+ gettimeofday(&laststatsrv, NULL);
}
if (conf->pdef->connecter) {
@@ -2145,13 +2148,14 @@ void *clientwr(void *arg) {
RAND_bytes(&rnd, 1);
rnd /= 32;
if (conf->statusserver) {
- if (!timeout.tv_sec || timeout.tv_sec > server->lastrcv.tv_sec + STATUS_SERVER_PERIOD + rnd)
- timeout.tv_sec = server->lastrcv.tv_sec + STATUS_SERVER_PERIOD + rnd;
+ secs = server->lastrcv.tv_sec > laststatsrv.tv_sec ? server->lastrcv.tv_sec : laststatsrv.tv_sec;
+ if (!timeout.tv_sec || timeout.tv_sec > secs + STATUS_SERVER_PERIOD + rnd)
+ timeout.tv_sec = secs + STATUS_SERVER_PERIOD + rnd;
} else {
if (!timeout.tv_sec || timeout.tv_sec > now.tv_sec + STATUS_SERVER_PERIOD + rnd)
timeout.tv_sec = now.tv_sec + STATUS_SERVER_PERIOD + rnd;
}
-#if 0
+#if 0
if (timeout.tv_sec > now.tv_sec)
debug(DBG_DBG, "clientwr: waiting up to %ld secs for new request", timeout.tv_sec - now.tv_sec);
#endif
@@ -2230,8 +2234,10 @@ void *clientwr(void *arg) {
conf->pdef->clientradput(server, server->requests[i].buf);
}
if (conf->statusserver) {
+ secs = server->lastrcv.tv_sec > laststatsrv.tv_sec ? server->lastrcv.tv_sec : laststatsrv.tv_sec;
gettimeofday(&now, NULL);
- if (now.tv_sec - server->lastrcv.tv_sec >= STATUS_SERVER_PERIOD) {
+ if (now.tv_sec - secs > STATUS_SERVER_PERIOD) {
+ laststatsrv = now;
if (!RAND_bytes(statsrvbuf + 4, 16)) {
debug(DBG_WARN, "clientwr: failed to generate random auth");
continue;