summaryrefslogtreecommitdiff
path: root/radsecproxy.c
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2013-08-28 13:48:49 +0200
committerLinus Nordberg <linus@nordberg.se>2013-09-05 15:26:11 +0200
commit506b4eea8641e69ccf1ad35c185346299019afda (patch)
tree67e16baca9188012049e829fe6ba8e74d721ad9b /radsecproxy.c
parentb1a17ab16492b1ebb13e2d696b2f121a85fa71ba (diff)
Keep Proxy-State attributes in all replies to clients.
Closes RADSECPROXY-52.
Diffstat (limited to 'radsecproxy.c')
-rw-r--r--radsecproxy.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/radsecproxy.c b/radsecproxy.c
index a3a4999..b7b2063 100644
--- a/radsecproxy.c
+++ b/radsecproxy.c
@@ -1287,7 +1287,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;
@@ -1305,6 +1307,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;
@@ -1474,7 +1482,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;
}
@@ -1493,7 +1501,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;
@@ -1519,10 +1527,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;
}