Now that we have Cleartext-Password and Password-With-Header, use
[freeradius.git] / src / main / radclient.c
index e3a067a..e80ffd5 100644 (file)
@@ -217,7 +217,7 @@ static radclient_t *radclient_init(const char *filename)
                /*
                 *      Keep a copy of the the User-Password attribute.
                 */
-               if ((vp = pairfind(radclient->request->vps, PW_PASSWORD)) != NULL) {
+               if ((vp = pairfind(radclient->request->vps, PW_USER_PASSWORD)) != NULL) {
                        strNcpy(radclient->password, vp->vp_strvalue,
                                sizeof(radclient->password));
                        /*
@@ -546,7 +546,7 @@ static int send_one_packet(radclient_t *radclient)
                if (radclient->password[0] != '\0') {
                        VALUE_PAIR *vp;
 
-                       if ((vp = pairfind(radclient->request->vps, PW_PASSWORD)) != NULL) {
+                       if ((vp = pairfind(radclient->request->vps, PW_USER_PASSWORD)) != NULL) {
                                strNcpy(vp->vp_strvalue, radclient->password,
                                        sizeof(vp->vp_strvalue));
                                vp->length = strlen(vp->vp_strvalue);
@@ -703,9 +703,6 @@ static int recv_one_packet(int wait_time)
                return -1;      /* got reply to packet we didn't send */
        }
        radclient = lrad_packet2myptr(radclient_t, request, request_p);
-       lrad_packet_list_yank(pl, radclient->request);
-       deallocate_id(radclient);
-       radclient->reply = reply;
 
        /*
         *      Fails the signature validation: not a real reply.
@@ -717,6 +714,10 @@ static int recv_one_packet(int wait_time)
                goto packet_done; /* shared secret is incorrect */
        }
 
+       lrad_packet_list_yank(pl, radclient->request);
+       deallocate_id(radclient);
+       radclient->reply = reply;
+
        /*
         *      If this fails, we're out of memory.
         */