148 |
size_t size; |
size_t size; |
149 |
RADIUS_SERVER *server; |
RADIUS_SERVER *server; |
150 |
int rc; |
int rc; |
151 |
|
PROXY_STATE *proxy_state; |
152 |
|
|
153 |
if (radreq->attempt_no > radreq->realm->queue->retries) { |
if (radreq->attempt_no > radreq->realm->queue->retries) { |
154 |
radreq->server_no++; |
radreq->server_no++; |
178 |
passwd_recode(p, server->secret, vector, radreq); |
passwd_recode(p, server->secret, vector, radreq); |
179 |
} |
} |
180 |
|
|
181 |
if (!envar_lookup_int(radreq->realm->args, "retransmit", 0)) { |
/* Add a proxy-pair to the end of the request. */ |
182 |
PROXY_STATE *proxy_state; |
p = avp_alloc(); |
183 |
|
p->name = "Proxy-State"; |
184 |
/* Add a proxy-pair to the end of the request. */ |
p->attribute = DA_PROXY_STATE; |
185 |
p = avp_alloc(); |
p->type = TYPE_STRING; |
186 |
p->name = "Proxy-State"; |
p->avp_strlength = sizeof(PROXY_STATE); |
187 |
p->attribute = DA_PROXY_STATE; |
p->avp_strvalue = emalloc(p->avp_strlength); |
188 |
p->type = TYPE_STRING; |
|
189 |
p->avp_strlength = sizeof(PROXY_STATE); |
proxy_state = (PROXY_STATE *)p->avp_strvalue; |
190 |
p->avp_strvalue = emalloc(p->avp_strlength); |
|
191 |
|
proxy_state->ref_ip = ref_ip; |
192 |
proxy_state = (PROXY_STATE *)p->avp_strvalue; |
proxy_state->client_ip = radreq->ipaddr; |
193 |
|
proxy_state->id = radreq->id; |
194 |
proxy_state->ref_ip = ref_ip; |
proxy_state->proxy_id = radreq->server_id; |
195 |
proxy_state->client_ip = radreq->ipaddr; |
proxy_state->remote_ip = server->addr; |
196 |
proxy_state->id = radreq->id; |
|
197 |
proxy_state->proxy_id = radreq->server_id; |
avl_add_pair(&plist, p); |
|
proxy_state->remote_ip = server->addr; |
|
|
|
|
|
avl_add_pair(&plist, p); |
|
|
} |
|
198 |
|
|
199 |
/* Create the pdu */ |
/* Create the pdu */ |
200 |
size = rad_create_pdu(&pdu, radreq->code, |
size = rad_create_pdu(&pdu, radreq->code, |
317 |
should remain the same */ |
should remain the same */ |
318 |
radreq->remote_user = estrdup(username); |
radreq->remote_user = estrdup(username); |
319 |
|
|
320 |
/* If there is no DA_CHAP_CHALLENGE attribute but there |
/* If there is a DA_CHAP_PASSWORD attribute, there is |
321 |
is a DA_CHAP_PASSWORD we need to add it since we can't |
also a DA_CHAP_CHALLENGE. If you change the code of |
322 |
use the request authenticator anymore - we changed it. */ |
radius_auth_req_decode(), you will have |
323 |
if (avl_find(radreq->request, DA_CHAP_PASSWORD) && |
to manually take care of this. */ |
|
avl_find(radreq->request, DA_CHAP_CHALLENGE) == NULL) { |
|
|
vp = avp_alloc(); |
|
|
|
|
|
memset(vp, 0, sizeof(VALUE_PAIR)); |
|
|
|
|
|
vp->name = "CHAP-Challenge"; |
|
|
vp->attribute = DA_CHAP_CHALLENGE; |
|
|
vp->type = TYPE_STRING; |
|
|
vp->avp_strlength = AUTH_VECTOR_LEN; |
|
|
vp->avp_strvalue = emalloc(AUTH_VECTOR_LEN); |
|
|
memcpy(vp->avp_strvalue, radreq->vector, AUTH_VECTOR_LEN); |
|
|
avl_add_pair(&radreq->request, vp); |
|
|
} |
|
324 |
|
|
325 |
proxy_send_request(req->fd, radreq); |
proxy_send_request(req->fd, radreq); |
326 |
|
|
|
if (envar_lookup_int(realm->args, "retransmit", 0)) |
|
|
return 0; |
|
|
|
|
327 |
return 1; |
return 1; |
328 |
} |
} |
329 |
|
|