]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-krb.c
Add changes in 4.2.1.
[tcpdump] / print-krb.c
index 0417ac8388fb957a3bb654e9c5449749d978722e..213db642db63fc59e68f687ba2786396964d8b53 100644 (file)
@@ -22,8 +22,8 @@
  */
 
 #ifndef lint
-static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-krb.c,v 1.17 2002-08-06 04:42:05 guy Exp $";
+static const char rcsid[] _U_ =
+    "@(#) $Header: /tcpdump/master/tcpdump/print-krb.c,v 1.23 2003-11-16 09:36:26 guy Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -36,12 +36,11 @@ static const char rcsid[] =
 
 #include "interface.h"
 #include "addrtoname.h"
+#include "extract.h"
 
-const u_char *c_print(register const u_char *, register const u_char *);
-const u_char *krb4_print_hdr(const u_char *);
-void krb4_print(const u_char *);
-void krb_print(const u_char *, u_int);
-
+static const u_char *c_print(register const u_char *, register const u_char *);
+static const u_char *krb4_print_hdr(const u_char *);
+static void krb4_print(const u_char *);
 
 #define AUTH_MSG_KDC_REQUEST                   1<<1
 #define AUTH_MSG_KDC_REPLY                     2<<1
@@ -66,8 +65,8 @@ void krb_print(const u_char *, u_int);
 #define KERB_ERR_NULL_KEY                      10
 
 struct krb {
-       u_char pvno;            /* Protocol Version */
-       u_char type;            /* Type+B */
+       u_int8_t pvno;          /* Protocol Version */
+       u_int8_t type;          /* Type+B */
 };
 
 static char tstr[] = " [|kerberos]";
@@ -100,26 +99,7 @@ static struct tok kerr2str[] = {
        { 0,                            NULL}
 };
 
-
-/* little endian (unaligned) to host byte order */
-/* XXX need to look at this... */
-#define vtohlp(x)          ((( ((char *)(x))[0] )      )  | \
-                            (( ((char *)(x))[1] ) <<  8)  | \
-                            (( ((char *)(x))[2] ) << 16)  | \
-                            (( ((char *)(x))[3] ) << 24))
-#define vtohsp(x)          ((( ((char *)(x))[0] )      )  | \
-                            (( ((char *)(x))[1] ) <<  8))
-/* network (big endian) (unaligned) to host byte order */
-#define ntohlp(x)          ((( ((char *)(x))[3] )      )  | \
-                            (( ((char *)(x))[2] ) <<  8)  | \
-                            (( ((char *)(x))[1] ) << 16)  | \
-                            (( ((char *)(x))[0] ) << 24))
-#define ntohsp(x)          ((( ((char *)(x))[1] )      )  | \
-                            (( ((char *)(x))[0] ) <<  8))
-
-
-
-const u_char *
+static const u_char *
 c_print(register const u_char *s, register const u_char *ep)
 {
        register u_char c;
@@ -148,7 +128,7 @@ c_print(register const u_char *s, register const u_char *ep)
        return (s);
 }
 
-const u_char *
+static const u_char *
 krb4_print_hdr(const u_char *cp)
 {
        cp += 2;
@@ -169,7 +149,7 @@ trunc:
 #undef PRINT
 }
 
-void
+static void
 krb4_print(const u_char *cp)
 {
        register const struct krb *kp;
@@ -179,7 +159,7 @@ krb4_print(const u_char *cp)
 #define PRINT          if ((cp = c_print(cp, snapend)) == NULL) goto trunc
 /*  True if struct krb is little endian */
 #define IS_LENDIAN(kp) (((kp)->type & 0x01) != 0)
-#define KTOHSP(kp, cp) (IS_LENDIAN(kp) ? vtohsp(cp) : ntohsp(cp))
+#define KTOHSP(kp, cp) (IS_LENDIAN(kp) ? EXTRACT_LE_16BITS(cp) : EXTRACT_16BITS(cp))
 
        kp = (struct krb *)cp;
 
@@ -247,7 +227,7 @@ trunc:
 }
 
 void
-krb_print(const u_char *dat, u_int length)
+krb_print(const u_char *dat)
 {
        register const struct krb *kp;