summaryrefslogtreecommitdiffstats
path: root/contrib/tcpdump/print-smb.c
diff options
context:
space:
mode:
authorbms <bms@FreeBSD.org>2004-03-31 09:17:26 +0000
committerbms <bms@FreeBSD.org>2004-03-31 09:17:26 +0000
commit281e9d71408deb6e8c5046c746c2e97002b0e7fe (patch)
treeeb08e08f0f875c3b16f8e1aec86091f100906f1c /contrib/tcpdump/print-smb.c
parentbe6faec6d07fc3a2a54836e76d0309c36192dfad (diff)
downloadFreeBSD-src-281e9d71408deb6e8c5046c746c2e97002b0e7fe.zip
FreeBSD-src-281e9d71408deb6e8c5046c746c2e97002b0e7fe.tar.gz
Import tcpdump 3.8.3, from http://www.tcpdump.org/releases/tcpdump-3.8.3.tar.gz
Diffstat (limited to 'contrib/tcpdump/print-smb.c')
-rw-r--r--contrib/tcpdump/print-smb.c53
1 files changed, 26 insertions, 27 deletions
diff --git a/contrib/tcpdump/print-smb.c b/contrib/tcpdump/print-smb.c
index c61d866..5f683ef 100644
--- a/contrib/tcpdump/print-smb.c
+++ b/contrib/tcpdump/print-smb.c
@@ -11,15 +11,14 @@
#endif
#ifndef lint
-static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-smb.c,v 1.20.2.4 2002/07/11 07:47:01 guy Exp $";
+static const char rcsid[] _U_ =
+ "@(#) $Header: /tcpdump/master/tcpdump/print-smb.c,v 1.27.2.2 2003/11/16 08:51:45 guy Exp $";
#endif
+#include <tcpdump-stdinc.h>
+
#include <stdio.h>
#include <string.h>
-#include <sys/types.h>
-
-#include <netinet/in.h>
#include "interface.h"
#include "extract.h"
@@ -170,7 +169,7 @@ struct smbfnsint trans2_fns[] = {
static void
-print_trans2(const u_char *words, const u_char *dat, const u_char *buf, const u_char *maxbuf)
+print_trans2(const u_char *words, const u_char *dat _U_, const u_char *buf, const u_char *maxbuf)
{
static struct smbfnsint *fn = &trans2_fns[0];
const u_char *data, *param;
@@ -383,27 +382,28 @@ trunc:
static void
-print_negprot(const u_char *words, const u_char *data, const u_char *buf, const u_char *maxbuf)
+print_negprot(const u_char *words, const u_char *data, const u_char *buf _U_, const u_char *maxbuf)
{
+ u_int wcnt;
const char *f1 = NULL, *f2 = NULL;
TCHECK(words[0]);
+ wcnt = words[0];
if (request)
f2 = "*|Dialect=[Z]\n";
else {
- if (words[0] == 1)
+ if (wcnt == 1)
f1 = "Core Protocol\nDialectIndex=[d]";
- else if (words[0] == 17)
+ else if (wcnt == 17)
f1 = "NT1 Protocol\nDialectIndex=[d]\nSecMode=[B]\nMaxMux=[d]\nNumVcs=[d]\nMaxBuffer=[D]\nRawSize=[D]\nSessionKey=[W]\nCapabilities=[W]\nServerTime=[T3]TimeZone=[d]\nCryptKey=";
- else if (words[0] == 13)
+ else if (wcnt == 13)
f1 = "Coreplus/Lanman1/Lanman2 Protocol\nDialectIndex=[d]\nSecMode=[w]\nMaxXMit=[d]\nMaxMux=[d]\nMaxVcs=[d]\nBlkMode=[w]\nSessionKey=[W]\nServerTime=[T1]TimeZone=[d]\nRes=[W]\nCryptKey=";
}
if (f1)
- smb_fdata(words + 1, f1, SMBMIN(words + 1 + words[0] * 2, maxbuf));
+ smb_fdata(words + 1, f1, SMBMIN(words + 1 + wcnt * 2, maxbuf));
else
- print_data(words + 1, SMBMIN(words[0] * 2,
- PTR_DIFF(maxbuf, words + 1)));
+ print_data(words + 1, SMBMIN(wcnt * 2, PTR_DIFF(maxbuf, words + 1)));
TCHECK2(*data, 2);
if (f2)
@@ -417,9 +417,9 @@ trunc:
}
static void
-print_sesssetup(const u_char *words, const u_char *data, const u_char *buf, const u_char *maxbuf)
+print_sesssetup(const u_char *words, const u_char *data, const u_char *buf _U_, const u_char *maxbuf)
{
- int wcnt;
+ u_int wcnt;
const char *f1 = NULL, *f2 = NULL;
TCHECK(words[0]);
@@ -430,19 +430,18 @@ print_sesssetup(const u_char *words, const u_char *data, const u_char *buf, cons
else
f1 = "Com2=[B]\nRes1=[B]\nOff2=[d]\nMaxBuffer=[d]\nMaxMpx=[d]\nVcNumber=[d]\nSessionKey=[W]\nCaseInsensitivePasswordLength=[d]\nCaseSensitivePasswordLength=[d]\nRes=[W]\nCapabilities=[W]\nPass1&Pass2&Account&Domain&OS&LanMan=\n";
} else {
- if (words[0] == 3) {
+ if (wcnt == 3) {
f1 = "Com2=[w]\nOff2=[d]\nAction=[w]\n";
- } else if (words[0] == 13) {
+ } else if (wcnt == 13) {
f1 = "Com2=[B]\nRes=[B]\nOff2=[d]\nAction=[w]\n";
f2 = "NativeOS=[S]\nNativeLanMan=[S]\nPrimaryDomain=[S]\n";
}
}
if (f1)
- smb_fdata(words + 1, f1, SMBMIN(words + 1 + words[0] * 2, maxbuf));
+ smb_fdata(words + 1, f1, SMBMIN(words + 1 + wcnt * 2, maxbuf));
else
- print_data(words + 1, SMBMIN(words[0] * 2,
- PTR_DIFF(maxbuf, words + 1)));
+ print_data(words + 1, SMBMIN(wcnt * 2, PTR_DIFF(maxbuf, words + 1)));
TCHECK2(*data, 2);
if (f2)
@@ -540,7 +539,7 @@ static struct smbfns smb_fns[] = {
{ pSETDIR, "SMBsetdir", 0, { NULL, "Path=[Z]\n", NULL, NULL, NULL } },
{ SMBlseek, "SMBlseek", 0,
- { "Handle=[d]\nMode=[w]\nOffset=[D]\n", "Offset=[D]\n", NULL, NULL } },
+ { "Handle=[d]\nMode=[w]\nOffset=[D]\n", "Offset=[D]\n", NULL, NULL, NULL } },
{ SMBflush, "SMBflush", 0, { "Handle=[d]\n", NULL, NULL, NULL, NULL } },
@@ -718,7 +717,7 @@ static struct smbfns smb_fns[] = {
{ "Com2=[w]\nOff2=[d]\nRes=[b]\nNameLen=[d]\nFlags=[W]\nRootDirectoryFid=[D]\nAccessMask=[W]\nAllocationSize=[L]\nExtFileAttributes=[W]\nShareAccess=[W]\nCreateDisposition=[W]\nCreateOptions=[W]\nImpersonationLevel=[W]\nSecurityFlags=[b]\n",
"Path=[S]\n",
"Com2=[w]\nOff2=[d]\nOplockLevel=[b]\nFid=[d]\nCreateAction=[W]\nCreateTime=[T3]LastAccessTime=[T3]LastWriteTime=[T3]ChangeTime=[T3]ExtFileAttributes=[W]\nAllocationSize=[L]\nEndOfFile=[L]\nFileType=[w]\nDeviceState=[w]\nDirectory=[b]\n",
- NULL } },
+ NULL, NULL } },
{ SMBntcancel, "SMBntcancel", 0, DEFDESCRIPT },
@@ -735,7 +734,7 @@ print_smb(const u_char *buf, const u_char *maxbuf)
int command;
const u_char *words, *data;
struct smbfns *fn;
- char *fmt_smbheader =
+ const char *fmt_smbheader =
"[P4]SMB Command = [B]\nError class = [BP1]\nError code = [d]\nFlags1 = [B]\nFlags2 = [B][P13]\nTree ID = [d]\nProc ID = [d]\nUID = [d]\nMID = [d]\nWord Count = [b]\n";
@@ -766,7 +765,7 @@ print_smb(const u_char *buf, const u_char *maxbuf)
for (;;) {
const char *f1, *f2;
int wct;
- int bcc;
+ u_int bcc;
TCHECK(words[0]);
wct = words[0];
@@ -807,7 +806,7 @@ print_smb(const u_char *buf, const u_char *maxbuf)
smb_fdata(data + 2, f2, data + 2 + bcc);
}
} else {
- printf("smb_bcc=%d\n", bcc);
+ printf("smb_bcc=%u\n", bcc);
if (bcc > 0) {
printf("smb_buf[]=\n");
print_data(data + 2, SMBMIN(bcc, PTR_DIFF(maxbuf, data + 2)));
@@ -848,7 +847,7 @@ nbt_tcp_print(const u_char *data, int length)
{
const u_char *maxbuf = data + length;
int flags;
- int nbt_len;
+ u_int nbt_len;
TCHECK2(data[2], 2);
flags = data[0];
@@ -950,7 +949,7 @@ nbt_udp137_print(const u_char *data, int length)
const u_char *maxbuf = data + length;
int name_trn_id, response, opcode, nm_flags, rcode;
int qdcount, ancount, nscount, arcount;
- char *opcodestr;
+ const char *opcodestr;
const u_char *p;
int total, i;
OpenPOWER on IntegriCloud