Commit Graph

61 Commits

Author SHA1 Message Date
Guy Harris 12df8af4e3 Jeff Foster's SMB Mailslot and Netlogin dissectors; he split
"packet-smb.c" up into several files.

svn path=/trunk/; revision=1629
2000-02-14 04:02:21 +00:00
Guy Harris 5b5f2271cd "tm_mon" in a "struct tm" is 0-based, not 1-based; when printing the
month number, add 1 to "tm_mon".

svn path=/trunk/; revision=1519
2000-01-22 02:00:27 +00:00
Guy Harris 7a943b7810 Fix Gerald's e-mail address.
svn path=/trunk/; revision=1437
2000-01-07 22:05:43 +00:00
Gilbert Ramirez 90293644a3 Don't take strlen of TransactName if NULL. In fact, don't do *anything*
and return if TransactName == NULL.

svn path=/trunk/; revision=1431
2000-01-07 04:27:06 +00:00
Guy Harris c8716decab Patch from Greg Kilfoyle of Redback Networks:
Don't use a global variable named "gmtime" - some versions of
	NetBSD define it in <time.h> - use "_gmtime" instead, so we can
	build on those NetBSD systems.

svn path=/trunk/; revision=1375
1999-12-23 20:47:16 +00:00
Richard Sharpe bcc9362c47 Latest patches for SMB decodes ... This fixes the bug in large NetServerEnum2
responses and adds some more stuff.


I will have to decode NTcreateAndX requests and responses soon as well
as the MSRPC stuff ...

svn path=/trunk/; revision=1356
1999-12-18 13:39:03 +00:00
Richard Sharpe f65a512676 More patches for packet-smb.c ...
Now should be decoding the names of lots more LanMan API request. These
were culled from Samba.  Would be good to go through and give names to the
fields as well.

Will soon decode the response structures returned and then will look at
ways to specify that built-in routines should be called to decode an element.

I also need some captures with UNICODE in them. Anyone got any? Someone
sent in a patch for UNICODE handling, but I did not realize what it was and
now the code has diverged so far it is hard to apply the patch ...

Send captures to rsharpe@ns.aus.com./

svn path=/trunk/; revision=1334
1999-12-14 23:16:59 +00:00
Richard Sharpe 3216e87029 Fixed up the problems with compilation warnings, as per some patched
from Guy, plus a few more of my own.

Also added in basic response decoding where we don't know what it is ...

Got more to do, as well as decoding returned data ... Thinking about that
now, and will have a data-drived approach.

I need some way to specify that an internal routine be called for some types
of data where we know what type it is, in the case of Server Types for
example ...

svn path=/trunk/; revision=1294
1999-12-12 02:19:00 +00:00
Olivier Abad a55ed83646 Fixed a typo (tee instead of tree) in dissect_transact_next
svn path=/trunk/; revision=1284
1999-12-10 12:51:01 +00:00
Richard Sharpe df0decde2f Beginning to handle LANMAN in a data-driven way, with tables etc.
Next will handle responses, and data returned ...

svn path=/trunk/; revision=1283
1999-12-10 11:53:18 +00:00
Richard Sharpe bbc7e6afbc Here I am commit'ing again in a Qantas Club lounge :-)
Fixed up some bugs to do with NetShareEnum.  There is still a persistent bug
left that looks like an alignment problem. Damn documentation does not talk
about the need to align the response structures for a NetServerEnum2 on SHORT
boundaries, but it sure looks like they should be so.

svn path=/trunk/; revision=1235
1999-12-07 06:36:12 +00:00
Richard Sharpe 7a41e5568f Some small fixes to the smb decoding of sessionsetup&X.
Will have to do some more soon.

svn path=/trunk/; revision=1216
1999-12-05 08:22:22 +00:00
Gilbert Ramirez de6c24bdb6 Check sanity of EntCount in lanman decode before going off and
marking 26 * EntCount bytes as Server entries.

svn path=/trunk/; revision=1160
1999-11-30 03:46:46 +00:00
Richard Sharpe b09955d91d Fixed the problem of crashing when a NetServerEnum2 with Level 0 is
seen.

svn path=/trunk/; revision=1122
1999-11-27 02:17:49 +00:00
Richard Sharpe 7d7b0fbdbd Fixed the problem causing a SIGSEGV, and fixed problems with
UNICODE strings in transact SMBs.

Added decode of NetShareEnum transact request.  Will have to clean that all
up and use the decode engine when I get it done.

Still more fix ups to be done, but the book is calling, and I have to write
some stuff after an interview with LinuxCare.

svn path=/trunk/; revision=1113
1999-11-26 06:27:22 +00:00
Richard Sharpe a90cb04447 Some more fixups. Decode NetServerEnum2 responses, removed those
ugly wannings, and added start of general params decode.  May all change
drastically though.

svn path=/trunk/; revision=1093
1999-11-22 10:30:22 +00:00
Laurent Deniel eb65d4fdb9 Remove debugging printf.
svn path=/trunk/; revision=1082
1999-11-21 11:17:13 +00:00
Richard Sharpe 139cfdccda Added support or NetServerEnum2 LANMAN messages.
I still have compile warnings, but I am too tired to chase them down.

Have also fixed a number of problems.

Next thing to add is a general engine that can decode Transact messages
as they can be decode from the descriptors in the Parameters area, and I
can feed in a list of names where we know what a structure looks like,
otherwise we use made up names.

svn path=/trunk/; revision=1079
1999-11-20 13:48:26 +00:00
Richard Sharpe 71fb29b83d Added decode of the Election Criteria and a few other bits of
info.

Still need someone to look at the times I have in there ... Guy?

svn path=/trunk/; revision=1055
1999-11-18 07:32:46 +00:00
Guy Harris 781acb5043 Craig Rodrigues' fixes to let it compile on AIX using IBM's compiler
(remove commas following the last member of an enum, make all bit fields
"guint32" - GCC lets you get away with that, but at least some other
compilers don't).

svn path=/trunk/; revision=1052
1999-11-18 01:45:05 +00:00
Guy Harris 4fddc1f328 Provide a general mechanism by which dissectors can register "init"
routines, which are called before a dissection pass is made over all the
packets in a capture - the "init" routine would clear out any state
information that needs to be initialized before such a dissection pass.

Make the NCP, SMB, AFS, and ONC RPC dissectors register their "init"
routines with that mechanism, have the code that reads in a capture file
call the routine that calls all registered "init" routines rather than
calling a wired-in set of "init" routines, and also have the code that
runs a filtering or colorizing pass over all the packets call that
routine, as a filtering or colorizing pass is a dissection pass.

Have the ONC RPC "init" routine zero out the table of RPC calls, so that
it completely erases any state from the previous dissection pass (so
that, for example, if you run a filtering pass, it doesn't mark any
non-duplicate packets as duplicates because it remembers them from the
previous pass).

svn path=/trunk/; revision=1050
1999-11-17 21:58:33 +00:00
Gilbert Ramirez 36eabe2100 We should be checking the value of loc_of_slash instead of index. It
might be NULL from strchr().

svn path=/trunk/; revision=1044
1999-11-16 17:03:36 +00:00
Guy Harris a7aba0a288 Replace the ETT_ "enum" members, declared in "packet.h", with
dynamically-assigned "ett_" integer values, assigned by
"proto_register_subtree_array()"; this:

	obviates the need to update "packet.h" whenever you add a new
	subtree type - you only have to add a call to
	"proto_register_subtree_array()" to a "register" routine and an
	array of pointers to "ett_", if they're not already there, and
	add a pointer to the new "ett_" variable to the array, if they
	are there;

	would allow run-time-loaded dissectors to allocate subtree types
	when they're loaded.

svn path=/trunk/; revision=1043
1999-11-16 11:44:20 +00:00
Richard Sharpe e351b687e4 I hope no one just committed something on this.
There was a core dump because of a coding oversight.  Should be fixed
now Gilbert.

Should now handle names of form \<somepipe>

Will screw up if there is no leading slash, but in a non-fatal way, I
think.

svn path=/trunk/; revision=1041
1999-11-16 07:58:12 +00:00
Richard Sharpe cfdb8fdc2c OK,
much more complete decoding of browse messages.

They are now shown in the parent tree as well.

I still have problems with:

  1. Times
  2. Election criteral

I also haven't been able to see a BecomeBackup request, nor a
GetBackupListResp with more than one browser ... Should run a Windows NT
server or another Samba on my network.

I am also not sure of there are any more message types.  Damn! Old, and
wrong MS documents!

svn path=/trunk/; revision=1025
1999-11-14 06:54:42 +00:00
Richard Sharpe baadd1b3d7 Fixed some more small problems and added support for decoding
MS Windows Browser messages.  Can decode host announcements now.

Still need to decode more.  Also need to break the new code out.


I also have the Browse tree at the wrong location.  Can I get at the
parent of the tree somewhere, or do I have to pass it in as a variable?

svn path=/trunk/; revision=1024
1999-11-14 02:42:03 +00:00
Richard Sharpe 76710fcc54 Some general fixups and some fixes for protocol decode problems
exposed by Win2000 interacting with a Samba server ...

svn path=/trunk/; revision=1010
1999-11-11 13:56:58 +00:00
Gilbert Ramirez aad98c9a66 Added #include <time.h> for AIX.
svn path=/trunk/; revision=937
1999-10-27 19:30:23 +00:00
Richard Sharpe 454a982d3b Some small fixes to get rid of compiler warnings
svn path=/trunk/; revision=929
1999-10-26 21:30:11 +00:00
Guy Harris 1d72c68bc6 Export the data structure used to represent a conversation.
Replace "add_to_conversation()" with:

	"conversation_new()", which creates a new conversation, given
	source and destination addresses and ports, and returns a
	pointer to the structure for the conversation;

	"find_conversation()", which tries to find a conversation for
	given source and destination addresses and ports, and returns a
	pointer to the structure for the conversation if found, and a
	null pointer if not found.

Add a private data pointer field to the conversation structure, and have
"conversation_new()" take an argument that specifies what to set that
pointer to; that lets clients of the conversation code hang arbitrary
data off the conversation (e.g., a hash table of protocol requests and
replies, in case the protocol is a request/reply protocol wherein the
reply doesn't say what type of request it's a reply to, and you need
that information to dissect the reply).

svn path=/trunk/; revision=920
1999-10-24 07:27:20 +00:00
Guy Harris 047b8751f3 Generalize the "ip_src" and "ip_dst" members of the "packet_info"
structure to "dl_src"/"dl_dst", "net_src"/"net_dst", and "src"/"dst"
addresses, where an address is an address type, an address length in
bytes, and a pointer to that many bytes.

"dl_{src,dst}" are the link-layer source/destination; "net_{src,dst}"
are the network-layer source/destination; "{src,dst}" are the
source/destination from the highest of those two layers that we have in
the packet.

Add a port type to "packet_info" as well, specifying whether it's a TCP
or UDP port.

Don't set the address and port columns in the dissector functions; just
set the address and port members of the "packet_info" structure.  Set
the columns in "fill_in_columns()"; this means that if we're showing
COL_{DEF,RES,UNRES}_SRC" or "COL_{DEF,RES,UNRES}_DST", we only generate
the string from "src" or "dst", we don't generate a string for the
link-layer address and then overwrite it with a string for the
network-layer address (generating those strings costs CPU).

Add support for "conversations", where a "conversation" is (at present)
a source and destination address and a source and destination port.  (In
the future, we may support "conversations" above the transport layer,
e.g. a TFTP conversation, where the first packet goes from the client to
the TFTP server port, but the reply comes back from a different port,
and all subsequent packets go between the client address/port and the
server address/new port, or an NFS conversation, which might include
lock manager, status monitor, and mount packets, as well as NFS
packets.)

Currently, all we support is a call that takes the source and
destination address/port pairs, looks them up in a hash table, and:

	if nothing is found, creates a new entry in the hash table, and
	assigns it a unique 32-bit conversation ID, and returns that
	conversation ID;

	if an entry is found, returns its conversation ID.

Use that in the SMB and AFS code to keep track of individual SMB or AFS
conversations.  We need to match up requests and replies, as, for
certain replies, the operation code for the request to which it's a
reply doesn't show up in the reply - you have to find the request with a
matching transaction ID.  Transaction IDs are per-conversation, so the
hash table for requests should include a conversation ID and transaction
ID as the key.

This allows SMB and AFS decoders to handle IPv4 or IPv6 addresses
transparently (and should allow the SMB decoder to handle NetBIOS atop
other protocols as well, if the source and destination address and port
values in the "packet_info" structure are set appropriately).

In the "Follow TCP Connection" code, check to make sure that the
addresses are IPv4 addressses; ultimately, that code should be changed
to use the conversation code instead, which will let it handle IPv6
transparently.

svn path=/trunk/; revision=909
1999-10-22 07:18:23 +00:00
Laurent Deniel 039bb4fbd8 Remove #define DEBUG_SMB_HASH
Is this file generated code ?

If not, please :

- get rid of compilation warnings
- put the # of preprocessor macros at the first column

svn path=/trunk/; revision=863
1999-10-16 20:26:37 +00:00
Richard Sharpe f646f88a5e Completed first pass of state keeping code in packet-smb.c.
Added decoder for transact SMBs.

Changed things a lot for state keeping.

Next thing is to decode transacts and transact2s more.

svn path=/trunk/; revision=860
1999-10-16 16:02:46 +00:00
Richard Sharpe 42b64a7584 Big bunch of fixes to packet-smb.c for things I need.
Also added first pass of state keeping. I am using glib's hash
functions.

Modelled after packet-ncp.c.

We will need to standardize the <proto>_init_protocol functions called in
file.c at some stage ...

I will have a couple of more goes at the state keeping before I am finished.
At the moment, the infrastructure is there but I do nothing with it.

svn path=/trunk/; revision=798
1999-10-10 11:50:45 +00:00
Guy Harris 06494664b0 "gmtime()" takes a pointer to a "time_t", not a pointer to a "guint32",
as an argument.  ("time_t" could be 64 bits - I think it is 64 bits on
some platforms, e.g.  Alpha Linux - and it's typically signed rather
than unsigned.)

svn path=/trunk/; revision=760
1999-10-03 05:01:56 +00:00
Richard Sharpe 776a369f1a A bunch of fixes for SMB decode.
1. Fix some silly errors.
  2. Dont decode beyond Word Count if errcode > 0
  3. Decode a bunch mode SMBs

Next is to keep state so we can do a better job ...

svn path=/trunk/; revision=758
1999-10-03 01:14:33 +00:00
Guy Harris 96e79ab6f8 Add a "BYTES_ARE_IN_FRAME()" macro, to test whether there are a
specified number of bytes of captured data in the frame at the specified
offset, and a "IS_DATA_IN_FRAME()" macro, to test whether there are any
bytes of captured data in the frame at the specified offset, and convert
some bounds checks to use them.

Add a dissector for the Internet Printing Protocol.

svn path=/trunk/; revision=685
1999-09-17 05:56:58 +00:00
Guy Harris f93c76fd10 Convert a bunch of uses of "fd->cap_len" to use "pi.captured_len" (or to
use END_OF_FRAME), so that they don't look at stuff in an IP datagram
past the end of the IP datagram (i.e., frame padding).

svn path=/trunk/; revision=584
1999-08-26 07:34:43 +00:00
Gilbert Ramirez cb1e32da97 Removed unnecessary #include "etypes.h" lines.
svn path=/trunk/; revision=565
1999-08-24 17:26:16 +00:00
Guy Harris ac4f87218d Declare the "packet_info" structure "pi" in "packet.h", rather than in a
bunch of source files.

Replace the "payload" field of a "packet_info" structure with "len" and
"captured_len" fields, which contain the total packet length and total
captured packet length (including all headers) at the current protocol
layer (i.e., if a given layer has a length field, and that length field
says its shorter than the length we got from the capture, reduce the
"pi.len" and "pi.captured_len" values appropriately).  Those fields can
be used in the future if we add checks to make sure a field we're
extracting from a packet doesn't go past the end of the packet, or past
the captured part of the packet.

Get rid of the additional payload argument to some dissection functions;
use "pi.captured_len - offset" instead.

Have the END_OF_FRAME macro use "pi.captured_len" rather than
"fd->cap_len", so that "dissect the rest of the frame" becomes "dissect
the rest of the packet", and doesn't dissect end-of-frame padding such
as padding added to make an Ethernet frame 60 or more octets long.  (We
might want to rename it END_OF_PACKET; if we ever want to label the
end-of-frame padding for the benefit of people curious what that extra
gunk is, we could have a separate END_OF_FRAME macro that uses
"fd->cap_len".)

svn path=/trunk/; revision=506
1999-08-18 00:57:54 +00:00
Gilbert Ramirez 7bd6c15378 Made the protocol (but not the fields) use the new proto_tree routine,
allowing users to filter on the existence of these protocols. I also
added packet-clip.c to the Nmake makefile.

svn path=/trunk/; revision=402
1999-07-29 05:47:07 +00:00
Gilbert Ramirez 02fe5e7d57 Got rid of ipv6 compiler warnings when compiling on RedHat 6.0.
Initialized AndXCommand to 0 in packet-smb.c just to get rid of compiler
warning about 'possibly used uninitialized'.

svn path=/trunk/; revision=382
1999-07-23 15:08:25 +00:00
Gilbert Ramirez 601c52f0fb Added support for compiling on win32 with Visual C and 'nmake'. It compiles,
but does not link. Perhaps someone who understands the MS tools can help
out. I made it link a few months ago, but with different version of glib/gtk+.
I can't remember how I made it link.

Most of the compatibility issues were resolved with adding
#ifdef HAVE_UNISTD_H the the source code. Please be sure to add this to all
future code.

svn path=/trunk/; revision=359
1999-07-13 02:53:26 +00:00
Richard Sharpe 87be6de734 Some more updates. Now have open_andx decoded mostly ... Still some funnies
and some difficult things.

I should not have blown away any of Gilbert's stuff this time around ...

Hope not anyway ...

svn path=/trunk/; revision=357
1999-07-12 14:26:16 +00:00
Guy Harris d35862ac07 The previous checkins were based on versions of the file prior to
Gilbert's new protocol-tree code (and to a bunch of other changes); put
all the missing changes back in.

svn path=/trunk/; revision=354
1999-07-11 07:24:57 +00:00
Richard Sharpe 9b8cd07087 More decoding of fields. Now handle enumerated fields, but still have
problems with single bit fields when declared as an enumerated field.

It shows an unknown ... Damn ... Can't see what the problem is.

svn path=/trunk/; revision=353
1999-07-10 14:01:53 +00:00
Gilbert Ramirez 07f42b5b31 Created a new protocol tree implementation and a new display filter
mechanism that is built into ethereal. Wiretap is now used to read all
file formats. Libpcap is used only for capturing.

svn path=/trunk/; revision=342
1999-07-07 22:52:57 +00:00
Richard Sharpe 4cef485bd4 Fixed a small problem that would have prevented Ethereal from compiling.
svn path=/trunk/; revision=335
1999-07-01 04:04:38 +00:00
Richard Sharpe e10ddc676c Added some more, auto-generated decoding to packet-smb.c.
Hope it is all OK.

This is getting interesting.

svn path=/trunk/; revision=334
1999-06-28 10:57:57 +00:00
Guy Harris 9bee1b3f20 Unfortunately, as the "cap_len" field in a "frame_data" is unsigned,
"fd->cap_len - offset", i.e. END_OF_FRAME, is unsigned, so

	while (END_OF_FRAME > 0) {

doesn't keep you out of the loop if "offset" is already beyond
"fd->cap_len", so you can try processing stuff past the end of the
captured data in the packet.

svn path=/trunk/; revision=298
1999-06-01 20:39:20 +00:00