Commit Graph

77 Commits

Author SHA1 Message Date
Francois-Xavier Le Bail
00b189d27c Use more the ND_TCHECK_1() macro 2017-12-04 17:50:29 +01:00
Francois-Xavier Le Bail
4166458a2a Use more the EXTRACT_U_1() macro (46/n)
In: if (... p[n] ...) ...
2017-12-03 21:51:36 +01:00
Francois-Xavier Le Bail
10a52254ae Use more the EXTRACT_U_1() macro (44/n)
In: switch (... p[n] ...) ...
2017-12-03 14:00:15 +01:00
Francois-Xavier Le Bail
61c422a88c Use more the EXTRACT_U_1() macro (43/n)
In: if (... p[n] ...) ...
2017-12-03 13:35:26 +01:00
Francois-Xavier Le Bail
a5bb53dd74 Simplify some expressions 2017-12-03 11:13:27 +01:00
Francois-Xavier Le Bail
e83dfd9b16 Simplify some expressions
This will also help some future scripted code updates.
2017-12-02 20:52:22 +01:00
Francois-Xavier Le Bail
1a90fd99d2 Use more the EXTRACT_U_1() macro (28/n)
In ND_PRINT() macro call(s) (step 7).

p[n] ...
2017-11-26 15:44:43 +01:00
Francois-Xavier Le Bail
39c8c55aa9 Use more ND_TCHECK_n()/ND_TTEST_n() macros 2017-11-24 22:48:55 +01:00
Francois-Xavier Le Bail
f68c3e3ec0 Use pointer expressions like in most similar cases 2017-11-23 12:23:32 +01:00
Francois-Xavier Le Bail
da20bc56d6 Rename EXTRACT_ macros
Now all the macros have a name meaning a count in bytes.

With _S_: signed, _U_: unsigned

e.g.:
EXTRACT_BE_32BITS -> EXTRACT_BE_U_4
EXTRACT_LE_32BITS -> EXTRACT_LE_U_4
...
EXTRACT_BE_INT32 -> EXTRACT_BE_S_4

and have:
EXTRACT_8BITS -> EXTRACT_U_1
EXTRACT_INT8  -> EXTRACT_S_1
2017-11-22 23:54:09 +01:00
Francois-Xavier Le Bail
3c8f3e13b0 Rename ND_TCHECK_/ND_TTEST_ macros
Now all the macros have a name meaning a count in bytes.

e.g.:
ND_TCHECK_32BITS -> ND_TCHECK_4
ND_TTEST_32BITS -> ND_TTEST_4
2017-11-22 21:58:44 +01:00
Francois-Xavier Le Bail
93bee24026 Use pointer expressions like in most similar cases 2017-11-20 22:58:59 +01:00
Francois-Xavier Le Bail
577621026d Rename EXTRACT_nBITS() macros to EXTRACT_BE_nBITS()
It indicates clearly that these macros are used to extract big-endian
integral values.
2017-11-18 13:56:40 +01:00
Guy Harris
ecf6e822e1 Do bounds checks on NBNS resource types and resource data lengths. 2017-01-18 09:16:40 +01:00
Guy Harris
97d372ef70 Before fetching the flags2 field, make sure we have it.
Also, don't fetch it until we need it, so we can do a little more
dissection before reporting a truncated packet.
2017-01-18 09:16:40 +01:00
Francois-Xavier Le Bail
ca54d72376 Declare some variables as static 2016-09-11 21:45:26 +02:00
Francois-Xavier Le Bail
11d3a01319 Move the printer summaries from INSTALL.txt to each printer
with the tag '\summary:' for greping.
Remark: Currently some printers have no summary line.

Moreover:
Summarize all printers with a single line in INSTALL.txt
2016-08-14 17:03:43 +02:00
Francois-Xavier Le Bail
817bdfede2 Rename print_data() to smb_print_data() 2015-09-18 13:04:24 +02:00
Francois-Xavier Le Bail
99c91c3aec Rename 'tcpdump-stdinc.h' to 'netdissect-stdinc.h'
Get the full log via: git log --follow netdissect-stdinc.h
2015-09-10 08:50:40 +02:00
Francois-Xavier Le Bail
c1c3c77463 Printers must include 'netdissect.h', not 'interface.h' 2015-09-05 23:35:58 +02:00
Denis Ovsienko
38700c7f24 dismiss NETDISSECT_REWORKED macro
The purpose of this macro was to enable the file-by-file switch to NDO,
after which only tcpdump.c had a use of it and the definitions guarded
by it. Update tcpdump.c not to require them any more and dismiss the
unused definitions.
2015-03-22 10:06:15 +00:00
Guy Harris
bf93670b6c Separate SMB-over-TCP output from TCP output with a space. 2014-10-19 13:58:20 -07:00
Guy Harris
ed85e20e4d u_intN_t is dead, long live uintN_t.
And, as we require at least autoconf 2.61, and as autoconf 2.61 and
later have AC_TYPE_UINTn_T and AC_TYPE_INTn_T macros, we use them to
define the uintN_t and intN_t macros if the system doesn't define them
for us.

This lets us get rid of bitypes.h as well.
2014-04-23 00:20:40 -07:00
Denis Ovsienko
430631e5df SMB: make use of tok2str() and ternary conditional 2014-04-14 11:40:51 +04:00
Denis Ovsienko
bcf0fb3b48 NDOize SMB decoder 2014-04-02 08:14:19 +04:00
Denis Ovsienko
dbfdf97bde justify min()/max() macros declarations and usage
This change moves the macros to tcpdump-stdinc.h to make sure these are
available without interface.h. It also dismisses two redundant macros
MIN() and SMBMIN(). It is intended to fix the following Solaris compile
error:

Undefined                       first referenced
 symbol                             in file
MIN                                 print-zeromq.o
2014-03-14 09:55:30 +04:00
Denis Ovsienko
fe3253b9b8 remove tcpdump's own CVS keywords
Remove lots of $Header's and a few $Id's that all belong to the former
CVS repository of tcpdump itself. These keywords have been frozen since
the migration to git in late 2008.
2014-01-03 00:59:08 +04:00
Michael Richardson
a97fb2f3ae whitespace changes 2014-01-01 21:31:18 -05:00
Denis Ovsienko
d8acd8f5d0 make consistent use of the "tstr" idiom
For each decoder that has more than one instance of truncation signaling
and prints the same string in each instance make sure that the string is
declared as "static const char tstr[]" right after the initial includes
block. Where necessary, replace fputs(s, stdout) with equivalent
printf("%s", s).
2013-12-26 18:19:50 +04:00
Denis Ovsienko
d8b3af528a make more array declarations static/const 2013-12-19 14:25:01 +04:00
guy
a11ed8914e SMB-over-TCP (port 445) support. 2007-12-09 00:30:47 +00:00
mcr
05b7f224d8 Patches from NetBSD tree. 2007-08-29 02:31:44 +00:00
guy
44e351db08 Fix message printed for bad andX offset to correctly describe the
badness.
2007-07-14 22:28:36 +00:00
guy
c639979cc9 Properly check for a bogus andX offset - it has to move forward, not
just not move backward.
2007-07-14 21:08:57 +00:00
guy
c44d8840e1 Fix up the bounds checking for NetBIOS-over-TCP. Among other things,
this means that we don't go past the end of the captured data when
dumping raw packet data and that we distinguish between "this packet was
cut off by the snapshot length" and "this packet is continued in a
subsequent TCP segment".
2005-05-08 19:59:57 +00:00
guy
414804c252 Always check for "smb_fdata()" returning null - for example, check it on
every iteration of a loop.
2005-05-05 22:30:03 +00:00
guy
0f77f5da7b Check the "status value is an NT status" flag and, if it is, treat the
status value as such.

Constify some tables.
2004-12-30 03:36:50 +00:00
guy
e46e896eab Add format options to save the value fetched and to later use that value
for counted strings, and use them where appropriate.
2004-12-29 03:10:24 +00:00
guy
f5671747ac Correctly dissect GetBackupList and BackupListResponse. 2004-12-29 02:43:24 +00:00
guy
4e688ac925 The transaction name doesn't seem to be in any Transaction2 requests
I've seen; get rid of it.

Do, however, show the byte count.
2004-12-29 00:06:28 +00:00
guy
9ce2222dfe Correctly handle Unicode strings - skip padding to put them on a 2-byte
boundary, and base the Unicode-vs-non-Unicode decision on the "strings
are Unicode" bit in Flags2, except for those few strings that are always
ASCII, rather than doing a heuristic check.

Fix the padding in FindFirst2 requests.
2004-12-28 22:29:44 +00:00
guy
922c8688c1 Correctly dissect LockingAndX requests - there's a flag bit that
indicates whether the offsets and lengths are 32 bit or 64 bit.
2004-12-28 20:38:27 +00:00
guy
4f64b59ab4 Don't print byte data if the byte count is 0.
In "print_smb()", Don't go past the passed-in length when printing the
word data.

The andX command is 1 byte, not 2 bytes.

Check that the andX offset is after the offset of the previous SMB
information, so we don't get caught in a loop if there's a bogus andX
offset.
2004-12-28 11:18:29 +00:00
guy
cb354dfa7d Fetch the byte count from the right location. 2004-12-28 09:35:18 +00:00
guy
25e8fd6e14 Rename "wcnt" in some routines to "wct", just as it's called in
"print_smb()".

Don't print "smb_vwv[] =" - just print the "smb_vwv[i] =" for each of
the words in the word data if we're dumping it as raw data.

Only print "smb_buf[] =" if we're dumping the byte data as raw data.

Always print the byte count (except for Trans2, but we should probably
print it there as well).
2004-12-28 09:16:09 +00:00
guy
f8686bf224 Fetch lengths in NBT Session Service packets in big-endian byte order;
don't bother specifying big-endian for one-byte fields.

Show the length in all NBSS packets.
2004-05-31 02:08:27 +00:00
guy
50f4698927 Show the message type for NBT Session Service messages even with "-vv".
The first byte of an NBT Session Service message is the message type -
the *second* byte is the flags.
2004-05-31 01:55:07 +00:00
guy
a918a240ea Do NBF commands with a table giving the name of the command, an
"smb_fdata()" string for non-verbose mode (all on one line), and an
"smb_fdata()" string for verbose mode.  Add entries for a number of
additional commands.

Don't look for an SMB packet except in Datagram, Broadcast Datagram,
Data First/Middle, or Data Only/Last NBF packets.
2004-05-31 01:19:10 +00:00
guy
bbc1cfa669 Have the configure script arrange that the Makefile define _U_
appropriately, and that GNUmakefile and the MSVC++ project file define
it apppriately, as we do with libpcap, rather than defining it in
"interface.h".

Undo the rcsid-shuffling and addition of extra #includes, as we no
longer need to arrange that "interface.h" be included before using _U_
in an RCS ID or copyright.
2003-11-16 09:36:07 +00:00
guy
3824a6c041 From Neil Spring:
use "_U_" in the definitions of "rcsid[]", to eliminate
	complaints about those variables being unused;

	move the definitions after the include of "interface.h", or add
	an include of "interface.h", so that "_U_" is defined.

Include "config.h" before including "tcpdump-stdinc.h" in
"missing/datalinks.c".
2003-11-15 00:39:12 +00:00