#include "config.h"
#endif
-#ifndef lint
-static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.37 2005-04-21 04:09:44 guy Exp $";
-#endif
-
#include <tcpdump-stdinc.h>
#include <stdio.h>
return;
printf("[%03X] ", i);
for (i = 0; i < len; /*nothing*/) {
+ TCHECK(buf[i]);
printf("%02X ", buf[i] & 0xff);
i++;
if (i%8 == 0)
while (n--)
printf(" ");
- n = SMBMIN(8, i % 16);
+ n = min(8, i % 16);
print_asc(&buf[i - (i % 16)], n);
printf(" ");
n = (i % 16) - n;
print_asc(&buf[i - n], n);
printf("\n");
}
+ return;
+
+trunc:
+ printf("\n");
+ printf("WARNING: Short packet. Try increasing the snap length\n");
}
}
}
-/* convert a UCS2 string into iso-8859-1 string */
+/* convert a UCS-2 string into an ASCII string */
#define MAX_UNISTR_SIZE 1000
static const char *
unistr(const u_char *s, u_int32_t *len, int use_unicode)
TCHECK(s[0]);
if (l >= MAX_UNISTR_SIZE)
break;
- if (isprint(s[0]))
+ if (ND_ISPRINT(s[0]))
buf[l] = s[0];
else {
if (s[0] == 0)
TCHECK2(s[0], 2);
if (l >= MAX_UNISTR_SIZE)
break;
- if (s[1] == 0 && isprint(s[0])) {
+ if (s[1] == 0 && ND_ISPRINT(s[0])) {
/* It's a printable ASCII character */
buf[l] = s[0];
} else {
t = interpret_long_date(buf);
buf += 8;
break;
+ default:
+ t = 0;
+ break;
}
if (t != 0) {
lt = localtime(&t);
};
/* Server Error Messages */
-err_code_struct server_msgs[] = {
+static const err_code_struct server_msgs[] = {
{ "ERRerror", 1, "Non-specific error code." },
{ "ERRbadpw", 2, "Bad password - name/password pair in a Tree Connect or Session Setup are invalid." },
{ "ERRbadtype", 3, "reserved." },
};
/* Hard Error Messages */
-err_code_struct hard_msgs[] = {
+static const err_code_struct hard_msgs[] = {
{ "ERRnowrite", 19, "Attempt to write on write-protected diskette." },
{ "ERRbadunit", 20, "Unknown unit." },
{ "ERRnotready", 21, "Drive not ready." },