118 |
*/ |
*/ |
119 |
/*ARGSUSED*/ |
/*ARGSUSED*/ |
120 |
int |
int |
121 |
rad_proxy(radreq, activefd) |
rad_proxy(REQUEST *req ARG_UNUSED) |
|
RADIUS_REQ *radreq; |
|
|
int activefd; |
|
122 |
{ |
{ |
|
void *ptr; |
|
|
|
|
|
/* |
|
|
* Copy the static data into malloc()ed memory. |
|
|
*/ |
|
|
ptr = emalloc(radreq->data_len); |
|
|
debug(1,("allocated ptr %p", ptr)); |
|
|
memcpy(ptr, radreq->data, radreq->data_len); |
|
|
radreq->data = ptr; |
|
|
radreq->data_alloced = 1; |
|
|
|
|
123 |
return 0; |
return 0; |
124 |
} |
} |
125 |
|
|
320 |
radreq->server_id = next_proxy_id(radreq->server->addr); |
radreq->server_id = next_proxy_id(radreq->server->addr); |
321 |
radreq->remote_user = string_create(username); |
radreq->remote_user = string_create(username); |
322 |
|
|
|
/* Is this a valid & signed request ? */ |
|
|
switch (radreq->code) { |
|
|
case RT_AUTHENTICATION_REQUEST: |
|
|
rc = 0; |
|
|
break; |
|
|
case RT_ACCOUNTING_REQUEST: |
|
|
what = _("digest mismatch"); |
|
|
rc = calc_acctdigest(radreq) < 0; |
|
|
break; |
|
|
default: |
|
|
what = _("unknown request code"); |
|
|
rc = 1; |
|
|
} |
|
|
|
|
|
if (rc) { |
|
|
radlog_req(L_NOTICE, radreq, |
|
|
_("Possible Security Breach: %s"), what); |
|
|
efree(saved_username); |
|
|
return -1; |
|
|
} |
|
|
|
|
323 |
/* If there is no DA_CHAP_CHALLENGE attribute but there |
/* If there is no DA_CHAP_CHALLENGE attribute but there |
324 |
is a DA_CHAP_PASSWORD we need to add it since we can't |
is a DA_CHAP_PASSWORD we need to add it since we can't |
325 |
use the request authenticator anymore - we changed it. */ |
use the request authenticator anymore - we changed it. */ |
352 |
} |
} |
353 |
|
|
354 |
void |
void |
355 |
proxy_retry(type, radreq, orig_req, fd, status_str) |
proxy_retry(int type, void *data, void *orig_data, |
356 |
int type; |
int fd, char *status_str) |
|
RADIUS_REQ *radreq; |
|
|
RADIUS_REQ *orig_req; |
|
|
int fd; |
|
|
char *status_str; |
|
357 |
{ |
{ |
358 |
|
RADIUS_REQ *radreq = data ? data : orig_data; |
359 |
|
RADIUS_REQ *orig_req = orig_data; |
360 |
VALUE_PAIR *namepair; |
VALUE_PAIR *namepair; |
361 |
char *saved_username; |
char *saved_username; |
362 |
|
|
363 |
if (!(orig_req && radreq)) { |
if (!(orig_req && radreq)) { |
364 |
rad_req_drop(type, radreq, orig_req, fd, status_str); |
radius_req_drop(type, radreq, orig_req, fd, status_str); |
365 |
return; |
return; |
366 |
} |
} |
367 |
|
|
399 |
/* proxy_compare_request(): Find matching request based on the information |
/* proxy_compare_request(): Find matching request based on the information |
400 |
preserved in the Proxy-State pair. */ |
preserved in the Proxy-State pair. */ |
401 |
int |
int |
402 |
proxy_compare_request(data, oldreq) |
proxy_compare_request(void *item, void *datap) |
|
struct proxy_data *data; |
|
|
RADIUS_REQ *oldreq; |
|
403 |
{ |
{ |
404 |
|
RADIUS_REQ *oldreq = item; |
405 |
|
struct proxy_data *data = datap; |
406 |
|
|
407 |
debug(10, ("(old=data) id %d %d, ipaddr %#8x %#8x, proxy_id %d %d, server_addr %#8x %#8x", |
debug(10, ("(old=data) id %d %d, ipaddr %#8x %#8x, proxy_id %d %d, server_addr %#8x %#8x", |
408 |
oldreq->id, data->state->id, |
oldreq->id, data->state->id, |
409 |
data->ipaddr, data->state->ipaddr, |
data->ipaddr, data->state->ipaddr, |
427 |
FIXME: hmmm, perhaps we don't even need Proxy-State |
FIXME: hmmm, perhaps we don't even need Proxy-State |
428 |
after all! */ |
after all! */ |
429 |
int |
int |
430 |
proxy_compare_request_no_state(data, oldreq) |
proxy_compare_request_no_state(void *item, void *datap) |
|
struct proxy_data *data; |
|
|
RADIUS_REQ *oldreq; |
|
431 |
{ |
{ |
432 |
|
RADIUS_REQ *oldreq = item; |
433 |
|
struct proxy_data *data = datap; |
434 |
|
|
435 |
debug(10, ("(old=data) id %d %d, ipaddr %#8x %#8x", |
debug(10, ("(old=data) id %d %d, ipaddr %#8x %#8x", |
436 |
oldreq->server_id, |
oldreq->server_id, |
437 |
data->radreq->id, |
data->radreq->id, |