diff options
author | Linus Nordberg <linus@nordberg.se> | 2013-08-28 13:48:49 +0200 |
---|---|---|
committer | Linus Nordberg <linus@nordberg.se> | 2013-09-05 15:15:32 +0200 |
commit | 33a3b21fa6926e8cbe61725dd80d258951766e2f (patch) | |
tree | e96b714d24571395a9a93adcc958af933b878431 /radsecproxy.c | |
parent | e0b805508ae91a82c1992bdf35db5efcd89cfd6d (diff) |
Keep Proxy-State attributes in all replies to clients.
Closes RADSECPROXY-52.
Diffstat (limited to 'radsecproxy.c')
-rw-r--r-- | radsecproxy.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/radsecproxy.c b/radsecproxy.c index 5dfe241..563c4a8 100644 --- a/radsecproxy.c +++ b/radsecproxy.c @@ -1274,7 +1274,9 @@ void acclog(struct radmsg *msg, struct client *from) { } } -void respond(struct request *rq, uint8_t code, char *message) { +void respond(struct request *rq, uint8_t code, char *message, + int copy_proxystate_flag) +{ struct radmsg *msg; struct tlv *attr; @@ -1292,6 +1294,12 @@ void respond(struct request *rq, uint8_t code, char *message) { return; } } + if (copy_proxystate_flag) { + if (radmsg_copy_attrs(msg, rq->msg, RAD_Proxy_State) < 0) { + debug(DBG_ERR, "%s: unable to copy all Proxy-State attributes", + __func__); + } + } radmsg_free(rq->msg); rq->msg = msg; @@ -1461,7 +1469,7 @@ int radsrv(struct request *rq) { goto exit; if (msg->code == RAD_Status_Server) { - respond(rq, RAD_Access_Accept, NULL); + respond(rq, RAD_Access_Accept, NULL, 0); goto exit; } @@ -1480,7 +1488,7 @@ int radsrv(struct request *rq) { if (!attr) { if (msg->code == RAD_Accounting_Request) { acclog(msg, from); - respond(rq, RAD_Accounting_Response, NULL); + respond(rq, RAD_Accounting_Response, NULL, 1); } else debug(DBG_INFO, "radsrv: ignoring access request, no username attribute"); goto exit; @@ -1506,10 +1514,10 @@ int radsrv(struct request *rq) { if (!to) { if (realm->message && msg->code == RAD_Access_Request) { debug(DBG_INFO, "radsrv: sending reject to %s (%s) for %s", from->conf->name, addr2string(from->addr), userascii); - respond(rq, RAD_Access_Reject, realm->message); + respond(rq, RAD_Access_Reject, realm->message, 1); } else if (realm->accresp && msg->code == RAD_Accounting_Request) { acclog(msg, from); - respond(rq, RAD_Accounting_Response, NULL); + respond(rq, RAD_Accounting_Response, NULL, 1); } goto exit; } |