summaryrefslogtreecommitdiff
path: root/radsecproxy.c
diff options
context:
space:
mode:
authorvenaas <venaas>2008-07-18 13:28:43 +0000
committervenaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf>2008-07-18 13:28:43 +0000
commitae3bd3d5edf72f819b43265d3ce8a1d66c6de387 (patch)
treec19f0e34c141f42614f334e79ad75b37f986a183 /radsecproxy.c
parent162d7c3d0d18329f20a1bc326bd4e797fc6d411b (diff)
now accounting appears to work
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/branches/release-1.1@309 e88ac4ed-0b26-0410-9574-a7f39faa03bf
Diffstat (limited to 'radsecproxy.c')
-rw-r--r--radsecproxy.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/radsecproxy.c b/radsecproxy.c
index 4c52570..6efdb51 100644
--- a/radsecproxy.c
+++ b/radsecproxy.c
@@ -1149,10 +1149,9 @@ void sendrq(struct server *to, struct request *rq) {
if (!to->requests[i].buf)
break;
if (i == to->nextid) {
- debug(DBG_WARN, "No room in queue, dropping request");
+ debug(DBG_WARN, "sendrq: no room in queue, dropping request");
freerqdata(rq);
- pthread_mutex_unlock(&to->newrq_mutex);
- return;
+ goto exit;
}
}
@@ -1161,8 +1160,15 @@ void sendrq(struct server *to, struct request *rq) {
attr = attrget(rq->buf + 20, RADLEN(rq->buf) - 20, RAD_Attr_Message_Authenticator);
if (attr && !createmessageauth(rq->buf, ATTRVAL(attr), to->conf->secret)) {
freerqdata(rq);
- pthread_mutex_unlock(&to->newrq_mutex);
- return;
+ goto exit;
+ }
+
+ if (*(uint8_t *)rq->buf == RAD_Accounting_Request) {
+ if (!radsign(rq->buf, (unsigned char *)to->conf->secret)) {
+ debug(DBG_WARN, "sendrq: failed to sign Accounting-Request message");
+ freerqdata(rq);
+ goto exit;
+ }
}
debug(DBG_DBG, "sendrq: inserting packet with id %d in queue for %s", i, to->conf->host);
@@ -1171,9 +1177,10 @@ void sendrq(struct server *to, struct request *rq) {
if (!to->newrq) {
to->newrq = 1;
- debug(DBG_DBG, "signalling client writer");
+ debug(DBG_DBG, "sendrq: signalling client writer");
pthread_cond_signal(&to->newrq_cond);
}
+ exit:
pthread_mutex_unlock(&to->newrq_mutex);
}
@@ -1957,13 +1964,7 @@ void radsrv(struct request *rq) {
rq->origid = id;
memcpy(rq->origauth, auth, 16);
- if (code == RAD_Accounting_Request) {
- if (!radsign(rq->buf, (unsigned char *)to->conf->secret)) {
- debug(DBG_WARN, "radsrv: failed to sign Accounting-Request message");
- goto exit;
- }
- } else
- memcpy(auth, newauth, 16);
+ memcpy(auth, newauth, 16);
sendrq(to, rq);
return;