fixed signed problem with reporting of unknown vsa
authorbodea <bodea>
Wed, 2 Aug 2006 12:51:25 +0000 (12:51 +0000)
committerbodea <bodea>
Wed, 2 Aug 2006 12:51:25 +0000 (12:51 +0000)
radius.c

index dd8a3e6..3976bb7 100644 (file)
--- a/radius.c
+++ b/radius.c
@@ -1,6 +1,6 @@
 // L2TPNS Radius Stuff
 
-char const *cvs_id_radius = "$Id: radius.c,v 1.50 2006/04/27 09:53:50 bodea Exp $";
+char const *cvs_id_radius = "$Id: radius.c,v 1.49.2.1 2006/08/02 12:51:25 bodea Exp $";
 
 #include <time.h>
 #include <stdio.h>
@@ -537,7 +537,7 @@ void processrad(uint8_t *buf, int len, char socket_index)
                        if (radius[r].chap)
                        {
                                // CHAP
-                               uint8_t *p = makeppp(b, sizeof(b), 0, 0, s, t, PPPCHAP, 0, 0, 0);
+                               uint8_t *p = makeppp(b, sizeof(b), 0, 0, s, t, PPPCHAP);
                                if (!p) return; // Abort!
 
                                *p = (r_code == AccessAccept) ? 3 : 4;     // ack/nak
@@ -551,7 +551,7 @@ void processrad(uint8_t *buf, int len, char socket_index)
                        else
                        {
                                // PAP
-                               uint8_t *p = makeppp(b, sizeof(b), 0, 0, s, t, PPPPAP, 0, 0, 0);
+                               uint8_t *p = makeppp(b, sizeof(b), 0, 0, s, t, PPPPAP);
                                if (!p) return;         // Abort!
 
                                // ack/nak
@@ -593,19 +593,6 @@ void processrad(uint8_t *buf, int len, char socket_index)
                                                LOG(3, s, session[s].tunnel, "   Radius reply contains primary DNS address %s\n",
                                                        fmtaddr(htonl(session[s].dns1), 0));
                                        }
-                                       else if (*p == 27)
-                                       {
-                                               // Session timeout
-                                               if (p[1] < 6) {
-                                                       LOG(2, s, session[s].tunnel, "Error: Received Session timeout with length %d < 6\n", p[1]);
-                                                       continue;
-                                               }
-
-                                               session[s].timeout = ntohl(*(uint32_t *) (p + 2));
-                                               LOG(3, s, session[s].tunnel, "   Radius reply contains Session timeout %d\n", session[s].timeout);
-                                               if (!session[s].timeout)
-                                                       sessionshutdown(s, "Session timeout is zero", CDN_ADMIN_DISC, TERM_SESSION_TIMEOUT);
-                                       }
                                        else if (*p == 136)
                                        {
                                                // DNS address
@@ -702,11 +689,11 @@ void processrad(uint8_t *buf, int len, char socket_index)
                                        else if (*p == 26 && p[1] >= 7)
                                        {
                                                // Vendor-Specific Attribute
-                                               int vendor = ntohl(*(int *)(p + 2));
-                                               char attrib = *(p + 6);
+                                               uint32_t vendor = ntohl(*(int *)(p + 2));
+                                               uint8_t attrib = *(p + 6);
                                                int attrib_length = *(p + 7) - 2;
 
-                                               LOG(3, s, session[s].tunnel, "   Radius reply contains Vendor-Specific.  Vendor=%d Attrib=%d Length=%d\n", vendor, attrib, attrib_length);
+                                               LOG(3, s, session[s].tunnel, "   Radius reply contains Vendor-Specific.  Vendor=%u Attrib=%u Length=%d\n", vendor, attrib, attrib_length);
                                                if (vendor != 9 || attrib != 1)
                                                {
                                                        LOG(3, s, session[s].tunnel, "      Unknown vendor-specific\n");