/[radius]/radius/radiusd/proxy.c
ViewVC logotype

Diff of /radius/radiusd/proxy.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.47 by gray, Fri May 30 10:38:43 2003 UTC revision 1.48 by gray, Tue Jun 3 14:19:30 2003 UTC
# Line 67  passwd_recode(VALUE_PAIR *pass_pair, cha Line 67  passwd_recode(VALUE_PAIR *pass_pair, cha
67  {  {
68          char    password[AUTH_STRING_LEN+1];          char    password[AUTH_STRING_LEN+1];
69          req_decrypt_password(password, req, pass_pair);          req_decrypt_password(password, req, pass_pair);
70          string_free(pass_pair->avp_strvalue);          efree(pass_pair->avp_strvalue);
71          encrypt_password(pass_pair, password, new_vector, new_secret);          encrypt_password(pass_pair, password, new_vector, new_secret);
72          /* Don't let the cleantext hang around */          /* Don't let the cleantext hang around */
73          memset(password, 0, AUTH_STRING_LEN);          memset(password, 0, AUTH_STRING_LEN);
# Line 75  passwd_recode(VALUE_PAIR *pass_pair, cha Line 75  passwd_recode(VALUE_PAIR *pass_pair, cha
75    
76  /* ************************************************************************* */  /* ************************************************************************* */
77  /* Functions for finding the matching request in the list of outstanding ones.  /* Functions for finding the matching request in the list of outstanding ones.
  * There appear to be two cases: i) when the remote server retains the  
  * Proxy-State A/V pair, which seems to correspond to RFC 2865,  
  * and ii) when the remote server drops the Proxy-State pair.  
78   */   */
79    
80  int  int
# Line 114  proxy_cmp(RADIUS_REQ *qr, RADIUS_REQ *r) Line 111  proxy_cmp(RADIUS_REQ *qr, RADIUS_REQ *r)
111                         state->proxy_id,                         state->proxy_id,
112                         state->rem_ipaddr));                         state->rem_ipaddr));
113                                    
114                  if (state->proxy_id   == r->id                  if (state->proxy_id == r->id
115                      && state->rem_ipaddr == r->ipaddr) {                      && state->rem_ipaddr == r->ipaddr) {
116                          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",
117                                     qr->id, state->id,                                     qr->id, state->id,
# Line 130  proxy_cmp(RADIUS_REQ *qr, RADIUS_REQ *r) Line 127  proxy_cmp(RADIUS_REQ *qr, RADIUS_REQ *r)
127                                  return 0;                                  return 0;
128                          }                          }
129                  }                  }
         } else if (qr->server_id) {  
                 debug(10, ("(old=data) id %d %d, ipaddr %#8x %#8x",  
                            qr->server_id,  
                            r->id,  
                            server->addr,  
                            r->ipaddr));  
                           
                 if (r->ipaddr == server->addr  
                     && r->id == qr->server_id)  
                         return 0;  
130          }          }
131            
132          return 1;          return 1;
133  }  }
134    
# Line 194  proxy_send_request(int fd, RADIUS_REQ *r Line 182  proxy_send_request(int fd, RADIUS_REQ *r
182          p->attribute = DA_PROXY_STATE;          p->attribute = DA_PROXY_STATE;
183          p->type = TYPE_STRING;          p->type = TYPE_STRING;
184          p->avp_strlength = sizeof(PROXY_STATE);          p->avp_strlength = sizeof(PROXY_STATE);
185          p->avp_strvalue = string_alloc(p->avp_strlength);          p->avp_strvalue = emalloc(p->avp_strlength);
186                    
187          proxy_state = (PROXY_STATE *)p->avp_strvalue;          proxy_state = (PROXY_STATE *)p->avp_strvalue;
188                                
# Line 295  proxy_send(REQUEST *req) Line 283  proxy_send(REQUEST *req)
283                          *realmname = 0;                          *realmname = 0;
284          }          }
285                    
286            if (username[0]==0)
287                    abort();
288          string_replace(&namepair->avp_strvalue, username);          string_replace(&namepair->avp_strvalue, username);
289            if (namepair->avp_strvalue[0]==0)
290                    abort();
291          namepair->avp_strlength = strlen(namepair->avp_strvalue);          namepair->avp_strlength = strlen(namepair->avp_strvalue);
292    
293          radreq->server_no = 0;          radreq->server_no = 0;
294          radreq->attempt_no = 0;          radreq->attempt_no = 0;
295          radreq->remote_user = string_create(username);          radreq->remote_user = estrdup(username);
296    
         req->update_size = sizeof(*upd) + strlen(realm->realm);  
         upd = emalloc(req->update_size);  
         upd->proxy_id = radreq->server_id;  
         upd->server_no = radreq->server_no;  
         strcpy(upd->realmname, realm->realm);  
         req->update = upd;  
           
297          /* If there is no DA_CHAP_CHALLENGE attribute but there          /* If there is no DA_CHAP_CHALLENGE attribute but there
298             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
299             use the request authenticator anymore - we changed it. */             use the request authenticator anymore - we changed it. */
# Line 322  proxy_send(REQUEST *req) Line 307  proxy_send(REQUEST *req)
307                  vp->attribute = DA_CHAP_CHALLENGE;                  vp->attribute = DA_CHAP_CHALLENGE;
308                  vp->type = TYPE_STRING;                  vp->type = TYPE_STRING;
309                  vp->avp_strlength = AUTH_VECTOR_LEN;                  vp->avp_strlength = AUTH_VECTOR_LEN;
310                  vp->avp_strvalue = string_alloc(AUTH_VECTOR_LEN);                  vp->avp_strvalue = emalloc(AUTH_VECTOR_LEN);
311                  memcpy(vp->avp_strvalue, radreq->vector, AUTH_VECTOR_LEN);                  memcpy(vp->avp_strvalue, radreq->vector, AUTH_VECTOR_LEN);
312                  avl_add_pair(&radreq->request, vp);                  avl_add_pair(&radreq->request, vp);
313          }          }
# Line 330  proxy_send(REQUEST *req) Line 315  proxy_send(REQUEST *req)
315          efree(saved_username);          efree(saved_username);
316                    
317          proxy_send_request(req->fd, radreq);          proxy_send_request(req->fd, radreq);
318    
319            /* Prepare update data. This should follow the proxy_send_request(),
320               since it creates server_id and server_no */
321            req->update_size = sizeof(*upd) + strlen(realm->realm);
322            upd = emalloc(req->update_size);
323            upd->proxy_id = radreq->server_id;
324            upd->server_no = radreq->server_no;
325            strcpy(upd->realmname, realm->realm);
326            req->update = upd;
327            debug(100, ("Update id=%d, proxy_id=%d, realm=%s, server_no=%d",
328                        radreq->id,upd->proxy_id,upd->realmname,upd->server_no));
329                    
330          return 1;          return 1;
331  }  }

Legend:
Removed from v.1.47  
changed lines
  Added in v.1.48

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26