]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-radius.c
Makefile.in: don't remove configure and config.h.in in make distclean.
[tcpdump] / print-radius.c
index 8c33438f2ed00fbb4935b93913fe30bbd63b2d06..658bb532611b0ea6fed569460fb9ea77e5090757 100644 (file)
 #define PRINT_HEX(bytes_len, ptr_data)                               \
            while(bytes_len)                                          \
            {                                                         \
-              ND_PRINT("%02X", *ptr_data );                   \
+              ND_PRINT("%02X", GET_U_1(ptr_data));                   \
               ptr_data++;                                            \
               bytes_len--;                                           \
            }
@@ -214,7 +214,7 @@ static void print_attr_location_information(netdissect_options *, const u_char *
 static void print_attr_location_data(netdissect_options *, const u_char *, u_int, u_short);
 static void print_basic_location_policy_rules(netdissect_options *, const u_char *, u_int, u_short);
 static void print_attr_time(netdissect_options *, const u_char *, u_int, u_short);
-static void print_attr_vector64(netdissect_options *, register const u_char *, u_int, u_short);
+static void print_attr_vector64(netdissect_options *, const u_char *, u_int, u_short);
 static void print_attr_strange(netdissect_options *, const u_char *, u_int, u_short);
 
 
@@ -845,7 +845,6 @@ print_vendor_attr(netdissect_options *ndo,
 
     if (length < 4)
         goto trunc;
-    ND_TCHECK_4(data);
     vendor_id = GET_BE_U_4(data);
     data+=4;
     length-=4;
@@ -855,8 +854,6 @@ print_vendor_attr(netdissect_options *ndo,
            vendor_id);
 
     while (length >= 2) {
-       ND_TCHECK_2(data);
-
         vendor_type = GET_U_1(data);
         vendor_length = GET_U_1(data + 1);
 
@@ -911,7 +908,6 @@ print_attr_num(netdissect_options *ndo,
        return;
    }
 
-   ND_TCHECK_4(data);
                           /* This attribute has standard values */
    if (attr_type[attr_code].siz_subtypes)
    {
@@ -1008,11 +1004,6 @@ print_attr_num(netdissect_options *ndo,
       } /* switch */
 
    } /* if-else */
-
-   return;
-
-   trunc:
-     nd_print_trunc(ndo);
 }
 
 /*****************************/
@@ -1032,8 +1023,6 @@ print_attr_address(netdissect_options *ndo,
        return;
    }
 
-   ND_TCHECK_4(data);
-
    switch(attr_code)
    {
       case FRM_IPADDR:
@@ -1051,11 +1040,6 @@ print_attr_address(netdissect_options *ndo,
           ND_PRINT("%s", GET_IPADDR_STRING(data));
       break;
    }
-
-   return;
-
-   trunc:
-     nd_print_trunc(ndo);
 }
 
 /*****************************/
@@ -1075,14 +1059,7 @@ print_attr_address6(netdissect_options *ndo,
        return;
    }
 
-   ND_TCHECK_16(data);
-
    ND_PRINT("%s", GET_IP6ADDR_STRING(data));
-
-   return;
-
-   trunc:
-     nd_print_trunc(ndo);
 }
 
 static void
@@ -1107,7 +1084,7 @@ print_attr_netmask6(netdissect_options *ndo,
    if (length > 2)
       memcpy(data2, data+2, length-2);
 
-   ND_PRINT("%s/%u", ip6addr_string(ndo, data2), GET_U_1(data + 1));
+   ND_PRINT("%s/%u", ip6addr_string(ndo, data2), GET_U_1(data + 1)); /* local buffer, not packet data; don't use GET_IP6ADDR_STRING() */
 
    if (GET_U_1(data + 1) > 8 * (length - 2))
       ND_PRINT(" (inconsistent prefix length)");
@@ -1158,7 +1135,7 @@ print_attr_operator_name(netdissect_options *ndo,
    data++;
    ND_PRINT("[%s] ", tok2str(operator_name_vector, "unknown namespace %u", namespace_value));
 
-   nd_printn(ndo, data, length - 1, NULL);
+   nd_printjn(ndo, data, length - 1);
 
    return;
 
@@ -1206,7 +1183,7 @@ print_attr_location_information(netdissect_options *ndo,
    data += 8;
 
    ND_PRINT("method \"");
-   nd_printn(ndo, data, length - 20, NULL);
+   nd_printjn(ndo, data, length - 20);
    ND_PRINT("\"");
 
    return;
@@ -1270,7 +1247,7 @@ print_basic_location_policy_rules(netdissect_options *ndo,
 
    if (length > 10) {
       ND_PRINT(", note well \"");
-      nd_printn(ndo, data, length - 10, NULL);
+      nd_printjn(ndo, data, length - 10);
       ND_PRINT("\"");
    }
 
@@ -1302,22 +1279,16 @@ print_attr_time(netdissect_options *ndo,
        return;
    }
 
-   ND_TCHECK_4(data);
-
    attr_time = GET_BE_U_4(data);
    strlcpy(string, ctime(&attr_time), sizeof(string));
    /* Get rid of the newline */
    string[24] = '\0';
    ND_PRINT("%.24s", string);
-   return;
-
-   trunc:
-     nd_print_trunc(ndo);
 }
 
 static void
 print_attr_vector64(netdissect_options *ndo,
-                 register const u_char *data, u_int length, u_short attr_code _U_)
+                   const u_char *data, u_int length, u_short attr_code _U_)
 {
    uint64_t data_value, i;
    const char *sep = "";
@@ -1343,8 +1314,6 @@ print_attr_vector64(netdissect_options *ndo,
    }
 
    ND_PRINT("]");
-
-   return;
 }
 
 /***********************************/
@@ -1370,11 +1339,9 @@ print_attr_strange(netdissect_options *ndo,
                return;
            }
            ND_PRINT("User_challenge (");
-           ND_TCHECK_8(data);
            len_data = 8;
            PRINT_HEX(len_data, data);
            ND_PRINT(") User_resp(");
-           ND_TCHECK_8(data);
            len_data = 8;
            PRINT_HEX(len_data, data);
            ND_PRINT(")");
@@ -1386,25 +1353,20 @@ print_attr_strange(netdissect_options *ndo,
                ND_PRINT("ERROR: length %u != 14", length);
                return;
            }
-           ND_TCHECK_1(data);
            if (GET_U_1(data))
               ND_PRINT("User can change password");
            else
               ND_PRINT("User cannot change password");
            data++;
-           ND_TCHECK_1(data);
            ND_PRINT(", Min password length: %u", GET_U_1(data));
            data++;
            ND_PRINT(", created at: ");
-           ND_TCHECK_4(data);
            len_data = 4;
            PRINT_HEX(len_data, data);
            ND_PRINT(", expires in: ");
-           ND_TCHECK_4(data);
            len_data = 4;
            PRINT_HEX(len_data, data);
            ND_PRINT(", Current Time: ");
-           ND_TCHECK_4(data);
            len_data = 4;
            PRINT_HEX(len_data, data);
         break;
@@ -1415,7 +1377,6 @@ print_attr_strange(netdissect_options *ndo,
                ND_PRINT("ERROR: length %u != 8", length);
                return;
            }
-           ND_TCHECK_8(data);
            len_data = 8;
            PRINT_HEX(len_data, data);
         break;
@@ -1426,16 +1387,12 @@ print_attr_strange(netdissect_options *ndo,
                ND_PRINT("Error: length %u != 4", length);
                return;
            }
-           ND_TCHECK_4(data);
 
            error_cause_value = GET_BE_U_4(data);
            ND_PRINT("Error cause %u: %s", error_cause_value, tok2str(errorcausetype, "Error-Cause %u not known", error_cause_value));
         break;
    }
    return;
-
-   trunc:
-     nd_print_trunc(ndo);
 }
 
 static void