char *realmname;
int replicating;
+ /*
+ * Not authentication or accounting. Stop it.
+ */
+ if ((request->packet->code != PW_AUTHENTICATION_REQUEST) &&
+ (request->packet->code != PW_ACCOUNTING_REQUEST)) {
+ return -1;
+ }
+
/*
* The timestamp is used below to figure the
* next_try. The request needs to "hang around" until
*/
realm = realm_find(realmname);
if (realm == NULL) {
- return 0;
+ return -1;
}
/*
if (request->packet->code == PW_AUTHENTICATION_REQUEST) {
request->proxy->dst_port = realm->auth_port;
request->proxy->dst_ipaddr = realm->ipaddr;
- } else {
+ } else if (request->packet->code == PW_ACCOUNTING_REQUEST) {
request->proxy->dst_port = realm->acct_port;
request->proxy->dst_ipaddr = realm->acct_ipaddr;
}
*/
if (proxy_requests) {
if (request->proxy == NULL) {
+ /*
+ * Try to proxy this request. Returns:
+ * -1: error, drop the request
+ * 0: OK, but don't proxy it.
+ * 1: OK, it's been proxied, don't do any more here.
+ * 2: OK, it's been proxied to one or more servers.
+ */
proxy_sent = proxy_send(request);
+
+ /*
+ * There was an error trying to proxy the request.
+ * Drop it on the floor.
+ */
+ if (proxy_sent < 0) {
+ DEBUG2("Error trying to proxy request %d: Rejecting it", request->number);
+ rad_reject(request);
+ goto finished_request;
+ }
/*
* sent==1 means it's been proxied. The child
* is NOT finished!
*/
if (proxy_sent == 1) {
- finished = request->finished;
goto postpone_request;
}
}
* by a thread.
*/
if (proxy_sent) {
- finished = request->finished;
goto postpone_request;
}
* the request as finished, and go to the next one.
*/
if (request->proxy_try_count == 0) {
- request->finished = TRUE;
rad_reject(request);
realm_disable(request->proxy->dst_ipaddr);
+ request->finished = TRUE;
goto setup_timeout;
}