Beispiel #1
0
static void
radius_attrs_print(netdissect_options *ndo,
                   register const u_char *attr, u_int length)
{
   register const struct radius_attr *rad_attr = (struct radius_attr *)attr;
   const char *attr_string;

   while (length > 0)
   {
     if (length < 2)
        goto trunc;
     ND_TCHECK(*rad_attr);

     if (rad_attr->type > 0 && rad_attr->type < TAM_SIZE(attr_type))
	attr_string = attr_type[rad_attr->type].name;
     else
	attr_string = "Unknown";
     if (rad_attr->len < 2)
     {
	ND_PRINT((ndo, "\n\t  %s Attribute (%u), length: %u (bogus, must be >= 2)",
               attr_string,
               rad_attr->type,
               rad_attr->len));
	return;
     }
     if (rad_attr->len > length)
     {
	ND_PRINT((ndo, "\n\t  %s Attribute (%u), length: %u (bogus, goes past end of packet)",
               attr_string,
               rad_attr->type,
               rad_attr->len));
        return;
     }
     ND_PRINT((ndo, "\n\t  %s Attribute (%u), length: %u, Value: ",
            attr_string,
            rad_attr->type,
            rad_attr->len));

     if (rad_attr->type < TAM_SIZE(attr_type))
     {
         if (rad_attr->len > 2)
         {
             if ( attr_type[rad_attr->type].print_func )
                 (*attr_type[rad_attr->type].print_func)(
                     ndo, ((u_char *)(rad_attr+1)),
                     rad_attr->len - 2, rad_attr->type);
         }
     }
     /* do we also want to see a hex dump ? */
     if (ndo->ndo_vflag> 1)
         print_unknown_data(ndo, (u_char *)rad_attr+2, "\n\t    ", (rad_attr->len)-2);

     length-=(rad_attr->len);
     rad_attr = (struct radius_attr *)( ((char *)(rad_attr))+rad_attr->len);
   }
   return;

trunc:
   ND_PRINT((ndo, "%s", tstr));
}
Beispiel #2
0
static void
radius_attrs_print(register const u_char *attr, u_int length)
{
   register const struct radius_attr *rad_attr = (struct radius_attr *)attr;
   const char *attr_string;

   while (length > 0)
   {
     if (length < 2)
        goto trunc;
     TCHECK(*rad_attr);
     
     if (rad_attr->type > 0 && rad_attr->type < TAM_SIZE(attr_type))
	attr_string = attr_type[rad_attr->type].name;
     else
	attr_string = "Unknown";
     if (rad_attr->len < 2)
     {
	sprintf(&ArgusBuf[strlen(ArgusBuf)],"\n\t  %s Attribute (%u), length: %u (bogus, must be >= 2)",
               attr_string,
               rad_attr->type,
               rad_attr->len);
	return;
     }
     if (rad_attr->len > length)
     {
	sprintf(&ArgusBuf[strlen(ArgusBuf)],"\n\t  %s Attribute (%u), length: %u (bogus, goes past end of packet)",
               attr_string,
               rad_attr->type,
               rad_attr->len);
        return;
     }
     sprintf(&ArgusBuf[strlen(ArgusBuf)],"\n\t  %s Attribute (%u), length: %u, Value: ",
            attr_string,
            rad_attr->type,
            rad_attr->len);

     if (rad_attr->type < TAM_SIZE(attr_type))
     {
         if (rad_attr->len > 2)
         {
             if ( attr_type[rad_attr->type].print_func )
                 (*attr_type[rad_attr->type].print_func)(
                     ((u_char *)(rad_attr+1)),
                     rad_attr->len - 2, rad_attr->type);
         }
     }
     /* do we also want to see a hex dump ? */
     if (ArgusParser->vflag> 1)
         print_unknown_data((u_char *)rad_attr+2,"\n\t    ",(rad_attr->len)-2);

     length-=(rad_attr->len);
     rad_attr = (struct radius_attr *)( ((char *)(rad_attr))+rad_attr->len);
   }
   return;

trunc:
   sprintf(&ArgusBuf[strlen(ArgusBuf)]," [|radius]");
}
Beispiel #3
0
static void
radius_attrs_print(packetbody_t attr, u_int length)
{
   __capability const struct radius_attr *rad_attr = (__capability struct radius_attr *)attr;
   const char *attr_string;

   while (length > 0)
   {
     if (length < 2)
        goto trunc;
     PACKET_HAS_ONE_OR_TRUNC(rad_attr);
     
     if (rad_attr->type > 0 && rad_attr->type < TAM_SIZE(attr_type))
	attr_string = attr_type[rad_attr->type].name;
     else
	attr_string = "Unknown";
     if (rad_attr->len < 2)
     {
	printf("\n\t  %s Attribute (%u), length: %u (bogus, must be >= 2)",
               attr_string,
               rad_attr->type,
               rad_attr->len);
	return;
     }
     if (rad_attr->len > length)
     {
	printf("\n\t  %s Attribute (%u), length: %u (bogus, goes past end of packet)",
               attr_string,
               rad_attr->type,
               rad_attr->len);
        return;
     }
     printf("\n\t  %s Attribute (%u), length: %u, Value: ",
            attr_string,
            rad_attr->type,
            rad_attr->len);

     if (rad_attr->type < TAM_SIZE(attr_type))
     {
         if (rad_attr->len > 2)
         {
             if ( attr_type[rad_attr->type].print_func )
                 (*attr_type[rad_attr->type].print_func)(
                     ((packetbody_t)(rad_attr+1)),
                     rad_attr->len - 2, rad_attr->type);
         }
     }
     /* do we also want to see a hex dump ? */
     if (vflag> 1)
         print_unknown_data((packetbody_t)rad_attr+2,"\n\t    ",(rad_attr->len)-2);

     length-=(rad_attr->len);
     rad_attr = (__capability struct radius_attr *)( ((packetbody_t)(rad_attr))+rad_attr->len);
   }
   return;

trunc:
   printf(" [|radius]");
}
Beispiel #4
0

struct attrtype { const char *name;      /* Attribute name                 */
                  const char **subtypes; /* Standard Values (if any)       */
                  u_char siz_subtypes;   /* Size of total standard values  */
                  u_char first_subtype;  /* First standard value is 0 or 1 */
                  void (*print_func)(register u_char *, u_int, u_short );
                } attr_type[]=
  {
     { NULL,                              NULL, 0, 0, NULL               },
     { "Username",                        NULL, 0, 0, print_attr_string  },
     { "Password",                        NULL, 0, 0, NULL               },
     { "CHAP Password",                   NULL, 0, 0, NULL               },
     { "NAS IP Address",                  NULL, 0, 0, print_attr_address },
     { "NAS Port",                        NULL, 0, 0, print_attr_num     },
     { "Service Type",                    serv_type, TAM_SIZE(serv_type)-1, 1, print_attr_num },
     { "Framed Protocol",                 frm_proto, TAM_SIZE(frm_proto)-1, 1, print_attr_num },
     { "Framed IP Address",               NULL, 0, 0, print_attr_address },
     { "Framed IP Network",               NULL, 0, 0, print_attr_address },
     { "Framed Routing",                  frm_routing, TAM_SIZE(frm_routing), 0, print_attr_num },
     { "Filter ID",                       NULL, 0, 0, print_attr_string  },
     { "Framed MTU",                      NULL, 0, 0, print_attr_num     },
     { "Framed Compression",              frm_comp, TAM_SIZE(frm_comp),   0, print_attr_num },
     { "Login IP Host",                   NULL, 0, 0, print_attr_address },
     { "Login Service",                   login_serv, TAM_SIZE(login_serv), 0, print_attr_num },
     { "Login TCP Port",                  NULL, 0, 0, print_attr_num     },
     { "Unassigned",                      NULL, 0, 0, NULL }, /*17*/
     { "Reply",                           NULL, 0, 0, print_attr_string },
     { "Callback-number",                 NULL, 0, 0, print_attr_string },
     { "Callback-ID",                     NULL, 0, 0, print_attr_string },
     { "Unassigned",                      NULL, 0, 0, NULL }, /*21*/
Beispiel #5
0

struct attrtype { const char *name;      /* Attribute name                 */
                  const char **subtypes; /* Standard Values (if any)       */
                  u_char siz_subtypes;   /* Size of total standard values  */
                  u_char first_subtype;  /* First standard value is 0 or 1 */
                  void (*print_func)(netdissect_options *, register u_char *, u_int, u_short);
                } attr_type[]=
  {
     { NULL,                              NULL, 0, 0, NULL               },
     { "User-Name",                       NULL, 0, 0, print_attr_string  },
     { "User-Password",                   NULL, 0, 0, NULL               },
     { "CHAP-Password",                   NULL, 0, 0, NULL               },
     { "NAS-IP-Address",                  NULL, 0, 0, print_attr_address },
     { "NAS-Port",                        NULL, 0, 0, print_attr_num     },
     { "Service-Type",                    serv_type, TAM_SIZE(serv_type)-1, 1, print_attr_num },
     { "Framed-Protocol",                 frm_proto, TAM_SIZE(frm_proto)-1, 1, print_attr_num },
     { "Framed-IP-Address",               NULL, 0, 0, print_attr_address },
     { "Framed-IP-Netmask",               NULL, 0, 0, print_attr_address },
     { "Framed-Routing",                  frm_routing, TAM_SIZE(frm_routing), 0, print_attr_num },
     { "Filter-Id",                       NULL, 0, 0, print_attr_string  },
     { "Framed-MTU",                      NULL, 0, 0, print_attr_num     },
     { "Framed-Compression",              frm_comp, TAM_SIZE(frm_comp),   0, print_attr_num },
     { "Login-IP-Host",                   NULL, 0, 0, print_attr_address },
     { "Login-Service",                   login_serv, TAM_SIZE(login_serv), 0, print_attr_num },
     { "Login-TCP-Port",                  NULL, 0, 0, print_attr_num     },
     { "Unassigned",                      NULL, 0, 0, NULL }, /*17*/
     { "Reply-Message",                   NULL, 0, 0, print_attr_string },
     { "Callback-Number",                 NULL, 0, 0, print_attr_string },
     { "Callback-Id",                     NULL, 0, 0, print_attr_string },
     { "Unassigned",                      NULL, 0, 0, NULL }, /*21*/
Beispiel #6
0
static void
radius_attrs_print(netdissect_options *ndo,
                   const u_char *attr, u_int length)
{
   const struct radius_attr *rad_attr = (const struct radius_attr *)attr;
   const char *attr_string;
   uint8_t type, len;

   while (length > 0)
   {
     if (length < 2)
        goto trunc;
     ND_TCHECK_SIZE(rad_attr);

     type = EXTRACT_U_1(rad_attr->type);
     len = EXTRACT_U_1(rad_attr->len);
     if (type != 0 && type < TAM_SIZE(attr_type))
	attr_string = attr_type[type].name;
     else
	attr_string = "Unknown";
     if (len < 2)
     {
	ND_PRINT("\n\t  %s Attribute (%u), length: %u (bogus, must be >= 2)",
               attr_string,
               type,
               len);
	return;
     }
     if (len > length)
     {
	ND_PRINT("\n\t  %s Attribute (%u), length: %u (bogus, goes past end of packet)",
               attr_string,
               type,
               len);
        return;
     }
     ND_PRINT("\n\t  %s Attribute (%u), length: %u, Value: ",
            attr_string,
            type,
            len);

     if (type < TAM_SIZE(attr_type))
     {
         if (len > 2)
         {
             if ( attr_type[type].print_func )
                 (*attr_type[type].print_func)(
                     ndo, ((const u_char *)(rad_attr+1)),
                     len - 2, type);
         }
     }
     /* do we also want to see a hex dump ? */
     if (ndo->ndo_vflag> 1)
         print_unknown_data(ndo, (const u_char *)rad_attr+2, "\n\t    ", (len)-2);

     length-=(len);
     rad_attr = (const struct radius_attr *)( ((const char *)(rad_attr))+len);
   }
   return;

trunc:
   nd_print_trunc(ndo);
}