}
}
-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;
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;
return rq;
}
+static void
+purgedupcache(struct client *client) {
+ struct request *r;
+ struct timeval now;
+ int i;
+
+ gettimeofday(&now, NULL);
+ for (i = 0; i < MAX_REQUESTS; i++) {
+ r = client->rqs[i];
+ if (r && now.tv_sec - r->created.tv_sec > r->from->conf->dupinterval) {
+ freerq(r);
+ client->rqs[i] = NULL;
+ }
+ }
+}
+
int addclientrq(struct request *rq) {
struct request *r;
struct timeval now;
goto exit;
}
+ purgedupcache(from);
if (!addclientrq(rq))
goto exit;
if (msg->code == RAD_Status_Server) {
- respond(rq, RAD_Access_Accept, NULL);
+ respond(rq, RAD_Access_Accept, NULL, 0);
goto exit;
}
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;
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;
}
#if defined ENABLE_EXPERIMENTAL_DYNDISC
pthread_mutex_unlock(&server->lock);
#endif
- debug(DBG_WARN, "%s: dynamicconfig(%s) failed, sleeping %ds",
- __func__, server->conf->name, ZZZ);
+ debug(DBG_WARN, "%s: dynamicconfig(%s: %s) failed, sleeping %ds",
+ __func__, server->conf->name, server->dynamiclookuparg, ZZZ);
sleep(ZZZ);
goto errexit;
}
free(conf->rewriteusername);
}
free(conf->dynamiclookupcommand);
- free(conf->rewritein);
- free(conf->rewriteout);
+ conf->rewritein=NULL;
+ conf->rewriteout=NULL;
if (conf->hostports)
freehostports(conf->hostports);
if (conf->lock) {