diff options
author | guy <guy> | 2004-12-28 03:34:08 +0000 |
---|---|---|
committer | guy <guy> | 2004-12-28 03:34:08 +0000 |
commit | ae82ae627eb9671e354678e9be4de7a8a066983c (patch) | |
tree | 402c69c39c16551cce51250210515e74132d8857 /smbutil.c | |
parent | 13c072a2c75d8544c0aec1ac8cba02b309a57474 (diff) | |
download | tcpdump-ae82ae627eb9671e354678e9be4de7a8a066983c.tar.gz |
Use native 64-bit integer support when dissecting 64-bit integers in
SMB.
Shuffle around some of the cases in the smb_fdata1() switch to keep
together the cases to handle various sizes of integer in a particular
fashion.
Diffstat (limited to 'smbutil.c')
-rw-r--r-- | smbutil.c | 70 |
1 files changed, 32 insertions, 38 deletions
@@ -12,7 +12,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.29 2004-12-27 22:45:44 guy Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.30 2004-12-28 03:34:08 guy Exp $"; #endif #include <tcpdump-stdinc.h> @@ -421,31 +421,13 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf) reverse = !reverse; fmt++; break; - case 'D': + case 'b': { unsigned int x; - - TCHECK2(buf[0], 4); - x = reverse ? EXTRACT_32BITS(buf) : EXTRACT_LE_32BITS(buf); - printf("%d (0x%x)", x, x); - buf += 4; - fmt++; - break; - } - case 'L': - { - unsigned int x1, x2; - - TCHECK2(buf[4], 4); - x1 = reverse ? EXTRACT_32BITS(buf) : - EXTRACT_LE_32BITS(buf); - x2 = reverse ? EXTRACT_32BITS(buf + 4) : - EXTRACT_LE_32BITS(buf + 4); - if (x2) - printf("0x%08x:%08x", x2, x1); - else - printf("%d (0x%08x%08x)", x1, x2, x1); - buf += 8; + TCHECK(buf[0]); + x = buf[0]; + printf("%u (0x%x)", x, x); + buf += 1; fmt++; break; } @@ -460,25 +442,25 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf) fmt++; break; } - case 'W': + case 'D': { unsigned int x; TCHECK2(buf[0], 4); x = reverse ? EXTRACT_32BITS(buf) : EXTRACT_LE_32BITS(buf); - printf("0x%X", x); + printf("%d (0x%x)", x, x); buf += 4; fmt++; break; } - case 'w': + case 'L': { - unsigned int x; - TCHECK2(buf[0], 2); - x = reverse ? EXTRACT_16BITS(buf) : - EXTRACT_LE_16BITS(buf); - printf("0x%X", x); - buf += 2; + u_int64_t x; + TCHECK2(buf[0], 8); + x = reverse ? EXTRACT_64BITS(buf) : + EXTRACT_LE_64BITS(buf); + printf("%" PRIu64 " (0x%" PRIx64 ")", x, x); + buf += 8; fmt++; break; } @@ -492,13 +474,25 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf) fmt++; break; } - case 'b': + case 'w': { unsigned int x; - TCHECK(buf[0]); - x = buf[0]; - printf("%u (0x%x)", x, x); - buf += 1; + TCHECK2(buf[0], 2); + x = reverse ? EXTRACT_16BITS(buf) : + EXTRACT_LE_16BITS(buf); + printf("0x%X", x); + buf += 2; + fmt++; + break; + } + case 'W': + { + unsigned int x; + TCHECK2(buf[0], 4); + x = reverse ? EXTRACT_32BITS(buf) : + EXTRACT_LE_32BITS(buf); + printf("0x%X", x); + buf += 4; fmt++; break; } |