diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-12-30 15:21:14 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-12-30 15:21:14 -0800 |
commit | 82a2a77889313964302ce7b6be3b8e8cb1ba7e1f (patch) | |
tree | 30a26c1a9f356e9c982410d04c4661d652a2cc6b /print-krb.c | |
parent | 5e1ef0dd0961ceefd61c250a64a0a0dad0766889 (diff) | |
download | tcpdump-82a2a77889313964302ce7b6be3b8e8cb1ba7e1f.tar.gz |
Use nd_ types, add EXTRACT_ calls, clean up signed vs. unsigned.
Diffstat (limited to 'print-krb.c')
-rw-r--r-- | print-krb.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/print-krb.c b/print-krb.c index b6c78298..4a5b1afa 100644 --- a/print-krb.c +++ b/print-krb.c @@ -78,8 +78,8 @@ static void krb4_print(netdissect_options *, const u_char *); #define KERB_ERR_NULL_KEY 10 struct krb { - uint8_t pvno; /* Protocol Version */ - uint8_t type; /* Type+B */ + nd_uint8_t pvno; /* Protocol Version */ + nd_uint8_t type; /* Type+B */ }; static const struct tok type2str[] = { @@ -172,17 +172,17 @@ krb4_print(netdissect_options *ndo, #define PRINT if ((cp = c_print(ndo, cp, ndo->ndo_snapend)) == NULL) goto trunc /* True if struct krb is little endian */ -#define IS_LENDIAN(kp) (((kp)->type & 0x01) != 0) +#define IS_LENDIAN(kp) ((EXTRACT_U_1((kp)->type) & 0x01) != 0) #define KTOHSP(kp, cp) (IS_LENDIAN(kp) ? EXTRACT_LE_U_2(cp) : EXTRACT_BE_U_2(cp)) kp = (const struct krb *)cp; - if ((&kp->type) >= ndo->ndo_snapend) { + if (!ND_TTEST_1(kp->type)) { ND_PRINT((ndo, "%s", tstr)); return; } - type = kp->type & (0xFF << 1); + type = EXTRACT_U_1(kp->type) & (0xFF << 1); ND_PRINT((ndo, " %s %s: ", IS_LENDIAN(kp) ? "le" : "be", tok2str(type2str, NULL, type))); @@ -194,7 +194,7 @@ krb4_print(netdissect_options *ndo, return; cp += 4; /* ctime */ ND_TCHECK_1(cp); - ND_PRINT((ndo, " %dmin ", EXTRACT_U_1(cp) * 5)); + ND_PRINT((ndo, " %umin ", EXTRACT_U_1(cp) * 5)); cp++; PRINT; ND_PRINT((ndo, ".")); @@ -204,14 +204,14 @@ krb4_print(netdissect_options *ndo, case AUTH_MSG_APPL_REQUEST: cp += 2; ND_TCHECK_1(cp); - ND_PRINT((ndo, "v%d ", EXTRACT_U_1(cp))); + ND_PRINT((ndo, "v%u ", EXTRACT_U_1(cp))); cp++; PRINT; ND_TCHECK_1(cp); - ND_PRINT((ndo, " (%d)", EXTRACT_U_1(cp))); + ND_PRINT((ndo, " (%u)", EXTRACT_U_1(cp))); cp++; ND_TCHECK_1(cp); - ND_PRINT((ndo, " (%d)", EXTRACT_U_1(cp))); + ND_PRINT((ndo, " (%u)", EXTRACT_U_1(cp))); break; case AUTH_MSG_KDC_REPLY: @@ -220,7 +220,7 @@ krb4_print(netdissect_options *ndo, cp += 10; /* timestamp + n + exp + kvno */ ND_TCHECK_LEN(cp, sizeof(short)); len = KTOHSP(kp, cp); - ND_PRINT((ndo, " (%d)", len)); + ND_PRINT((ndo, " (%u)", len)); break; case AUTH_MSG_ERR_REPLY: @@ -256,16 +256,16 @@ krb_print(netdissect_options *ndo, return; } - switch (kp->pvno) { + switch (EXTRACT_U_1(kp->pvno)) { case 1: case 2: case 3: - ND_PRINT((ndo, " v%d", kp->pvno)); + ND_PRINT((ndo, " v%u", EXTRACT_U_1(kp->pvno))); break; case 4: - ND_PRINT((ndo, " v%d", kp->pvno)); + ND_PRINT((ndo, " v%u", EXTRACT_U_1(kp->pvno))); krb4_print(ndo, (const u_char *)kp); break; |