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

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

RE: [Help-gnu-radius] RE: Radius 1.1 3COM/USR support


From: Sergey Poznyakoff
Subject: RE: [Help-gnu-radius] RE: Radius 1.1 3COM/USR support
Date: Tue, 30 Sep 2003 11:56:07 +0300

Hello Konrad,

Attached is the patch that should fix the problem. Please, inform me
if it works for you.

Regards,
Sergey

Index: lib/radpdu.c
===================================================================
RCS file: /cvsroot/radius/radius/lib/radpdu.c,v
retrieving revision 1.14
diff -p -u -r1.14 radpdu.c
--- lib/radpdu.c        12 Sep 2003 13:41:09 -0000      1.14
+++ lib/radpdu.c        30 Sep 2003 08:45:41 -0000
@@ -228,16 +228,23 @@ rad_create_pdu(void **rptr, int code, in
                 rad_attr_init(&attr);
                 if ((vendorcode = VENDOR(pair->attribute)) > 0
                     && (vendorpec  = vendor_id_to_pec(vendorcode)) > 0) {
-                        u_char c;
-                        
                         attr.attrno = DA_VENDOR_SPECIFIC;
                         lval = htonl(vendorpec);
                         rad_attr_write(&attr, &lval, 4);
-                        c = pair->attribute & 0xff;
-                        rad_attr_write(&attr, &c, 1); 
-                        rad_attr_write(&attr, &lval, 1); /* Reserve a byte */
-                        attrlen = rad_encode_pair(&attr, pair);
-                        attr.data[5] = 2+attrlen; /* Fill in the length */
+                       if (vendorpec == 429) {
+                               /* Hack for non-compliant USR VSA */
+                               UINT4 atval = htonl(pair->attribute & 0xffff);
+                               rad_attr_write(&attr, &atval, 4);
+                               attrlen = rad_encode_pair(&attr, pair);
+                       } else {
+                               u_char c = pair->attribute & 0xff;
+                               rad_attr_write(&attr, &c, 1);
+                               /* Reserve a length byte */
+                               rad_attr_write(&attr, &lval, 1); 
+                               attrlen = rad_encode_pair(&attr, pair);
+                               /* Fill in the length */
+                               attr.data[5] = 2+attrlen; 
+                       }
                 } else if (pair->attribute > 0xff)
                         continue;
                else {
@@ -453,9 +460,11 @@ rad_decode_pdu(UINT4 host, u_short udp_p
                                        ptr += 4;
                                        attrlen -= 4;
                                        len = attrlen;
+                                       attrlen = 0;
                                } else {
                                        attrno = *ptr++ | (vendorcode << 16);
                                        len = *ptr++ - 2;
+                                       attrlen -= len + 2;
                                }
                                
                                 pair = rad_decode_pair(attrno, ptr, len);
@@ -467,7 +476,6 @@ rad_decode_pdu(UINT4 host, u_short udp_p
                                        prev = pair;
                                } 
                                 ptr += len;
-                                attrlen -= len + 2;
                         }
                 } else {
                         pair = rad_decode_pair(attrno, ptr, attrlen);
Index: lib/symtab.c
===================================================================
RCS file: /cvsroot/radius/radius/lib/symtab.c,v
retrieving revision 1.6
diff -p -u -r1.6 symtab.c
--- lib/symtab.c        19 Jul 2003 22:12:20 -0000      1.6
+++ lib/symtab.c        30 Sep 2003 08:45:41 -0000
@@ -286,7 +286,7 @@ symtab_iterate(Symtab *symtab, int (*fn)
                 while (sym) {
                         next = sym->next;
                         if ((*fn)(closure, sym))
-                                break;
+                                return;
                         sym = next;
                 }
         }

reply via email to

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