Hi,
Using radclient for CHAP auth, cannot authenticate any user.
running radclient with gdb, I noted that the CHAP-Password used by 
rad_chap_encode was always a null string, i.e. the first char is '\0'.
This is because before calling rad_chap_encode we copy the password into 
a VP by
strNcpy((char *)vp->strvalue, password, vp->length + 1), and the 
vp->lengh is always 0!!!
I replaced the vp->length with strlen(password) and now it works.
in attach the patch.

max "coccolesto" liccardo



--- radclient.c.orig    Sun Sep  1 13:07:46 2002
+++ radclient.c Sun Sep  1 13:08:41 2002
@@ -453,7 +453,7 @@
                                                     &(vp->length),
                                                     secret, (char *)req->vector);
                                } else if ((vp = pairfind(req->vps, PW_CHAP_PASSWORD)) 
!= NULL) {
-                                       strNcpy((char *)vp->strvalue, password, 
vp->length + 1);
+                                       strNcpy((char *)vp->strvalue, password, 
+strlen(password) + 1);
                                        vp->length = strlen(password);
                                        
                                        rad_chap_encode(req, (char *) vp->strvalue, 
req->id, vp);


Reply via email to