Preliminary support for displaying Tunnel attributes as defined in
authorcparker <cparker>
Fri, 26 Oct 2001 00:24:12 +0000 (00:24 +0000)
committercparker <cparker>
Fri, 26 Oct 2001 00:24:12 +0000 (00:24 +0000)
RFC 2868.  Tag is properly printed for both string and integer
attributes when server or radclient displays A/V debugging pairs.

raddb/dictionary.tunnel is not changed yet.  Type will need to updated
for the tunnel attributes to t_string or t_integer for these changes
to be displayed.

src/include/radius.h
src/lib/dict.c
src/lib/print.c
src/lib/radius.c

index 626acc8..0d399ea 100644 (file)
@@ -12,6 +12,8 @@
 #define PW_TYPE_DATE                   3
 #define PW_TYPE_ABINARY                        4
 #define PW_TYPE_OCTETS                 5
+#define PW_TYPE_T_STRING                6
+#define PW_TYPE_T_INTEGER               7
 
 #define        PW_AUTHENTICATION_REQUEST       1
 #define        PW_AUTHENTICATION_ACK           2
index 7ab8ff4..71ea5c9 100644 (file)
@@ -32,6 +32,8 @@ static const char *dtypes[] = {
        "date",
        "abinary",
        "octets",
+       "t_string",
+       "t_integer",
        NULL,
 };
 
index ec0d5a8..5c12bcd 100644 (file)
@@ -88,6 +88,7 @@ int vp_prints_value(char * out, int outlen, VALUE_PAIR *vp, int delimitst)
        char        buf[1024];
        char        *a;
        time_t      t;
+       int         offset;
 
        out[0] = 0;
        if (!vp) return 0;
@@ -154,6 +155,43 @@ int vp_prints_value(char * out, int outlen, VALUE_PAIR *vp, int delimitst)
                  a = buf;
                  break;
 
+               case PW_TYPE_T_STRING:
+                       if (delimitst) {
+                                offset = snprintf(buf, sizeof(buf), 
+                                                  "\"%u:", vp->strvalue[0]);
+                                librad_safeprint((char *)(vp->strvalue + 1),
+                                                 vp->length - 1, 
+                                                 buf + offset, 
+                                                 sizeof(buf) - offset);
+                                strcat(buf, "\"");
+                       } else {
+                                offset = snprintf(buf, sizeof(buf), 
+                                                  "%u:", vp->strvalue[0]);
+                                librad_safeprint((char *)(vp->strvalue + 1),
+                                                 vp->length - 1, 
+                                                 buf + offset, 
+                                                 sizeof(buf) - offset);
+                       }
+
+                       a = buf;
+
+                       break;
+
+               case PW_TYPE_T_INTEGER:
+                       offset = snprintf(buf,  sizeof(buf), "%u:", (vp->lvalue >> 24));
+                       if ((v = dict_valbyattr(vp->attribute, (vp->lvalue)))
+                               != NULL)
+                               snprintf(buf + offset, sizeof(buf) - offset, 
+                                        "%s", v->name);
+                       else {
+                               snprintf(buf + offset, sizeof(buf) - offset, 
+                                        "%u", vp->lvalue);
+                              
+                       }
+
+                       a = buf;
+
+                       break;
                default:
                        a = 0;
                        break;
index 2bca33b..36cc103 100644 (file)
@@ -987,6 +987,7 @@ int rad_decode(RADIUS_PACKET *packet, RADIUS_PACKET *original, const char *secre
                case PW_TYPE_OCTETS:
                case PW_TYPE_ABINARY:
                case PW_TYPE_STRING:
+               case PW_TYPE_T_STRING:
                        /*
                         *      Hmm... this is based on names right
                         *      now.  We really shouldn't do this.
@@ -1009,6 +1010,7 @@ int rad_decode(RADIUS_PACKET *packet, RADIUS_PACKET *original, const char *secre
                case PW_TYPE_INTEGER:
                case PW_TYPE_DATE:
                case PW_TYPE_IPADDR:
+               case PW_TYPE_T_INTEGER:
                        /*
                         *      Check for RFC compliance.  If the
                         *      attribute isn't compliant, turn it