help-gnu-radius
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AW: [Help-gnu-radius] upgrade to 1.0 and Acct-Status-Type


From: Sergey Poznyakoff
Subject: AW: [Help-gnu-radius] upgrade to 1.0 and Acct-Status-Type
Date: Mon, 07 Jul 2003 17:03:39 +0300

Hello,

Attached is the patch that corrects this bug. To apply it, change
to the radius-1.0 directory and run `patch -p0 < patchfile.'
Please inform me if it works for you.

Regards,
Sergey

cvs server: Diffing lib
Index: lib/radpdu.c
===================================================================
RCS file: /cvsroot/radius/radius/lib/radpdu.c,v
retrieving revision 1.11
diff -p -u -r1.11 radpdu.c
--- lib/radpdu.c        10 Jun 2003 13:11:31 -0000      1.11
+++ lib/radpdu.c        7 Jul 2003 13:53:51 -0000
@@ -379,6 +379,7 @@ rad_decode_pdu(UINT4 host, u_short udp_p
        
         auth = (AUTH_HDR *)buffer;
         reported_len = ntohs(auth->length);
+       debug(100,("AUTH_HDR={%u,%u,%u}",auth->code,auth->id,reported_len));
         if (length > reported_len) { /* FIXME: != ? */
                 radlog(L_WARN,
                        _("Actual request length does not match reported length 
(%d, %d)"),
@@ -412,6 +413,7 @@ rad_decode_pdu(UINT4 host, u_short udp_p
                 attrno = *ptr++;
                 attrlen = *ptr++;
                 if (attrlen < 2) {
+                       debug(1,("loop stopped"));
                         stop = 1;
                         continue;
                 }
@@ -420,14 +422,14 @@ rad_decode_pdu(UINT4 host, u_short udp_p
                 
                 if (attrno == DA_VENDOR_SPECIFIC) {
                         if (attrlen <= 6) { /*FIXME*/
+                               radlog(L_NOTICE,_("Received a vendor-specific 
attribute with length <= 6"));
                                 stop = 1;
                                 continue;
                         }
                         memcpy(&lval, ptr, 4);
                         vendorpec = ntohl(lval);
                         if ((vendorcode = vendor_pec_to_id(vendorpec)) == 0) {
-                                stop = 1;
-                                continue;
+                               goto lab1;
                         }
                         
                         ptr += 4;
@@ -450,30 +452,27 @@ rad_decode_pdu(UINT4 host, u_short udp_p
                                }
                                
                                 pair = rad_decode_pair(attrno, ptr, len);
-                                if (!pair) {
-                                        stop = 1;
-                                        break;
-                                }
-                                if (first_pair == NULL) 
-                                        first_pair = pair;
-                                else 
-                                        prev->next = pair;
-                                prev = pair;
+                                if (pair) {
+                                       if (first_pair == NULL) 
+                                               first_pair = pair;
+                                       else 
+                                               prev->next = pair;
+                                       prev = pair;
+                               } 
                                 ptr += len;
                                 attrlen -= len + 2;
                         }
                 } else {
+lab1:
                         pair = rad_decode_pair(attrno, ptr, attrlen);
                         ptr += attrlen;
-                        if (!pair) {
-                                stop = 1;
-                                break;
-                        }
-                        if (first_pair == NULL) 
-                                first_pair = pair;
-                        else 
-                                prev->next = pair;
-                        prev = pair;
+                        if (pair) {
+                               if (first_pair == NULL) 
+                                       first_pair = pair;
+                               else 
+                                       prev->next = pair;
+                               prev = pair;
+                       }
                 }
         }
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]