diff options
author | venaas <venaas> | 2008-07-18 13:28:43 +0000 |
---|---|---|
committer | venaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf> | 2008-07-18 13:28:43 +0000 |
commit | f6f0b080b3f40ed9a5c53814bd8ec32c56d45081 (patch) | |
tree | 7cd4151593c247e2419cd5b9ec1aec56fc9af910 | |
parent | 4dbbe4615f6864867bb897879aa49076d40aef43 (diff) |
now accounting appears to work
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@309 e88ac4ed-0b26-0410-9574-a7f39faa03bf
-rw-r--r-- | radsecproxy.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/radsecproxy.c b/radsecproxy.c index 7f1ab32..f381c79 100644 --- a/radsecproxy.c +++ b/radsecproxy.c @@ -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; |