Commit f6f0b080 authored by venaas's avatar venaas Committed by venaas
Browse files

now accounting appears to work

git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@309 e88ac4ed-0b26-0410-9574-a7f39faa03bf
parent 4dbbe461
......@@ -1247,10 +1247,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;
}
}
......@@ -1259,8 +1258,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);
......@@ -1269,9 +1275,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);
}
......@@ -2123,13 +2130,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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment