Commit Graph

374 Commits

Author SHA1 Message Date
Ronnie Sahlberg 6ac7d7f7ac Updates for NT QUOTA in packet-smb.c
svn path=/trunk/; revision=4961
2002-03-17 10:59:35 +00:00
Guy Harris fcf8cd8807 The service is just called "IPC"; the pipe is what's called "IPC$".
svn path=/trunk/; revision=4957
2002-03-16 22:39:45 +00:00
Guy Harris 949b2d4131 Whether the data returned from a read or sent in a write is DCERPC
traffic or not, that data doesn't include the padding; handle padding
if you're dissecting it as DCERPC traffic.

Don't treat the traffic as DCERPC traffic unless it's to the IPC$ share.

svn path=/trunk/; revision=4956
2002-03-16 22:35:51 +00:00
Guy Harris 0b60f086ef There is no guarantee that, when processing an SMB response, "si->sip"
is non-null, as there's no guarantee that the corresponding SMB request
is in the capture.  Check whether it's null before using it.

svn path=/trunk/; revision=4954
2002-03-16 22:01:27 +00:00
Ronnie Sahlberg 17392c995b A new type of DCERPC over SMB transport.
I have captures with w2k speaking DCERPC without using the normal
Transaction named pipes SMBs.
Instead DCERPC is just implemented ontop of ordinary read/write calls.

The smb dissector now examines TreeConnectAndX and stores the conversation/tid/type-of-share in a table for later access.
All SMB requests examine that hash table to find out if TID in the header refers
to a normal share or an IPC$ share.

Initial support in read/write SMB calls to detect if the operations are for an
 IPC share and thus it assumes it must be DCERPC commands in the payload.
Desegmentation/Reassembly of these types of calls are not implemented yet.

svn path=/trunk/; revision=4952
2002-03-16 04:39:29 +00:00
Richard Sharpe 9693b93085 Pretty up the SID dissector ...
svn path=/trunk/; revision=4948
2002-03-15 19:47:03 +00:00
Ronnie Sahlberg ad861e7827 Moved the value_string for MS country codes from packet-dcerpc-nt.c to
packet-smb.c so that packet-smb-pipe.c can reference this struct as well.

svn path=/trunk/; revision=4947
2002-03-15 08:59:53 +00:00
Tim Potter d3c236be5e Added error messages for invalid name and invalid form size.
svn path=/trunk/; revision=4946
2002-03-15 04:46:43 +00:00
Guy Harris ecda579229 Clean up the display of the top-level item for the NT ACE Flags, so that
there's a space after the colon, and so that there's no extra comma at the
end and only one space between the items.

Fix a typo.

svn path=/trunk/; revision=4940
2002-03-14 05:45:16 +00:00
Ronnie Sahlberg 024f90f4fe Absolute and Relative times were swapped. Also add comment that there seems
to be an unknown special time constant : 0x40000000 00000000 that we dont know
yet what it means.

svn path=/trunk/; revision=4915
2002-03-10 23:13:04 +00:00
Guy Harris eb62c04d71 No need to put ", N byte{s} at offset O" into the Info column twice;
once is enough.

svn path=/trunk/; revision=4901
2002-03-09 02:12:47 +00:00
Tim Potter 6bb9d7eaf8 Display a different message in the COL_INFO field for anonymous session
setup packets.

svn path=/trunk/; revision=4818
2002-02-27 02:42:19 +00:00
Tim Potter c2e21d860b Fixed up value_string for SMBE_unknownlevel error.
svn path=/trunk/; revision=4785
2002-02-22 21:29:02 +00:00
Guy Harris 2f70b4df02 Initial quota support, from Ronnie Sahlberg.
svn path=/trunk/; revision=4771
2002-02-22 00:05:02 +00:00
Guy Harris e80b68372c Use the right format (one with a numerical format item rather than a
string format item) as the third argument to "val_to_str()".

svn path=/trunk/; revision=4770
2002-02-21 23:54:03 +00:00
Tim Potter 15c2a5a651 Export dissect_nt_sec_desc() so it can be used by other dissectors.
A NT security descriptor can be either revision 1 or 2 and seem to be the
same format on the wire.

svn path=/trunk/; revision=4768
2002-02-21 18:39:49 +00:00
Guy Harris ac4cd62ed8 From Ronnie Sahlberg: add the actual SMB command to the structure that
remembers SMBs for request/response matching, and make sure the request
and the response have the same type (or that the response has a
different type but is a valid response to the request).

svn path=/trunk/; revision=4763
2002-02-20 21:46:42 +00:00
Guy Harris 6a21dc7e44 Don't give tvbuffs names; instead, give data sources names, where a
"data source" has a name and a top-level tvbuff, and frames can have a
list of data sources associated with them.

Use the tvbuff pointer to determine which data source is the data source
for a given field; this means we don't have to worry about multiple data
sources with the same name - the only thing the name does is label the
notebook tab for the display of the data source, and label the hex dump
of the data source in print/Tethereal output.

Clean up a bunch of things discovered in the process of doing the above.

svn path=/trunk/; revision=4749
2002-02-18 01:08:44 +00:00
Guy Harris 879e1160e4 From Tim Potter:
- For selected read and write SMBs, display the byte count and offset
    in the info column.  This makes browsing file read/writes easier to
    understand.

  - In dissect_nt_sids() sometimes the version number is 3 but the rest
    of the sid format remains the same.  This is purely by observation -
    I have no documentation to confirm this.

  - Use a GString instead of a fixed buffer in dissect_nt_sids().

svn path=/trunk/; revision=4733
2002-02-14 05:53:59 +00:00
Guy Harris e7737953d0 From Ronnie Sahlberg: display FILETIME values of 0x8000000000000000 as
"Infinity (absolute time)", and values of 0x7fffffffffffffff as
"Infinity (relative time)".

svn path=/trunk/; revision=4727
2002-02-13 04:11:37 +00:00
Guy Harris f094e1c292 From Tim Potter: for all the SMBs that have a FID in the request, put
the FID in the Info column.

svn path=/trunk/; revision=4663
2002-02-01 07:22:51 +00:00
Gilbert Ramirez 4c4edd93fb Remove extra white-space from text added to proto_tree.
Thanks to Tim Potter <tpot@samba.org>

svn path=/trunk/; revision=4657
2002-02-01 04:42:24 +00:00
Guy Harris 3c1fb071eb Redo the previous change in a slightly cleaner fashion (don't convert
the result of "g_hash_table_lookup()" to an integer until you've
determined that it's not a null pointer, i.e. that the lookup
succeeded).

svn path=/trunk/; revision=4623
2002-01-29 21:49:43 +00:00
Guy Harris e08be416ff "NULL" is a pointer.
Objects of type "guint32" are integers.

Don't compare the former with the latter.

svn path=/trunk/; revision=4622
2002-01-29 21:37:58 +00:00
Guy Harris b3bc97d7f5 Add support for dissecting NT FILETIME time stamp values.
Get rid of a level of hierarchy in some SMB field names.

svn path=/trunk/; revision=4613
2002-01-28 00:58:46 +00:00
Guy Harris 42a38685cd In the "Announce change to UAS or SAM" NETLOGON message, dissect the
"Large Serial Number" as a 64-bit little-endian integer, and dissect the
"NT Date/Time" as a FILETIME by calling "dissect_smb_64bit_time()".

Export "dissect_smb_64bit_time()" so that we can do so.

svn path=/trunk/; revision=4609
2002-01-25 09:42:21 +00:00
Guy Harris 7f0ef5ec87 From Tim Potter: NT SID dissection.
Don't label the SID in an ACE as an "NT SID SID", label it as an "NT ACE
SID".

svn path=/trunk/; revision=4607
2002-01-25 08:02:01 +00:00
Guy Harris ee5ca25d31 Include files from the "epan" directory and subdirectories thereof with
"epan/..." pathnames, so as to avoid collisions with header files in any
of the directories in which we look (e.g., "proto.h", as some other
package has its own "proto.h" file which it installs in the top-level
include directory).

Don't add "-I" flags to search "epan", as that's no longer necessary
(and we want includes of "epan" headers to fail if the "epan/" is left
out, so that we don't re-introduce includes lacking "epan/").

svn path=/trunk/; revision=4586
2002-01-21 07:37:49 +00:00
Guy Harris 92915713d3 Allow a length of -1 to be specified when adding FT_NONE and FT_PROTOCOL
items to the protocol tree; it's interpreted as "the rest of the data in
the tvbuff".  This can be used if

	1) the item covers the entire packet or the remaining payload in
	   the packet

or

	2) the item's length won't be known until it's dissected, and
	   will be then set with "proto_item_set_len()" - if an
	   exception is thrown in the dissection, it means the item ran
	   *past* the end of the tvbuff, so saying it runs to the end of
	   the tvbuff is reasonable.

Convert a number of "proto_tree_add_XXX()" calls using
"tvb_length_remaining()", values derived from the result of
"tvb_length()", or 0 (in the case of items whose length is unknown) to
use -1 instead (using 0 means that if an exception is thrown, selecting
the item highlights nothing; using -1 means it highlights all the data
for that item that's available).

In some places where "tvb_length()" or "tvb_length_remaining()" was used
to determine how large a packet is, use "tvb_reported_length()" or
"tvb_reported_length_remaining()", instead - the first two calls
indicate how much captured data was in the packet, the latter two calls
indicate how large the packet actually was (and the fact that using the
latter could cause BoundsError exceptions to be thrown is a feature - if
such an exception is thrown, the frame really *was* short, and it should
be tagged as such).

Replace some "proto_tree_add_XXX()" calls with equivalent
"proto_tree_add_item()" calls.

Fix some indentation.

svn path=/trunk/; revision=4578
2002-01-20 22:12:39 +00:00
Guy Harris fb1e26fe6a Use the "fragmented" field of the "packet_info" structure in
"dissect_frame()" to indicate whether a ReportedBoundsError was due to
the packet being malformed (i.e., the packet was shorter than it's
supposed to be, so the dissector went past the end trying to extract
fields that were supposed to be there) or due to it not being
reassembled (i.e., the packet was fragmented, and we didn't reassemble
it, but just treated the first fragment as the entire packet, so the
dissector went past the end trying to extract fields that were partially
or completely in fragments after that).  Mark the latter as being
unreasembled rather than malformed.

Properly initialize, save, and restore that field, and properly set it,
so that works.

svn path=/trunk/; revision=4555
2002-01-17 06:29:20 +00:00
Guy Harris 86d348aed1 Fix some preferences to eliminate the extra copy of the protocol name at
the beginning, and to use underscores rather than periods where the
preference's name really isn't part of a hierarchical namespace.

Use "%u" rather than "%d" to print unsigned quantities.

svn path=/trunk/; revision=4543
2002-01-15 10:01:21 +00:00
Guy Harris c8f8db531f When checking whether to do DCERPC-over-SMB reassembly on a Read and X
response, don't assume that we saw the request and therefore that
"si->sip" is non-null - we might well not have seen the request and thus
might not have set "si->sip".

svn path=/trunk/; revision=4542
2002-01-15 09:42:26 +00:00
Guy Harris c78cb46c0e Use "proto_tree_add_item()", not "proto_tree_add_bytes()", to add an
item for extra data at the end of the Transaction2 request parameters.

svn path=/trunk/; revision=4499
2002-01-08 20:11:57 +00:00
Guy Harris 4e08507d23 Match requests and responses using both the MID and the PID; the SNIA
CIFS draft spec speaks of both being used:

	The multiplex ID (Mid) is used along with the Pid to allow
	multiplexing the single client and server connection among the
	client's multiple processes, threads, and requests per thread.
	Clients may have many outstanding requests (up to the negotiated
	number, MaxMpxCount) at one time.  Servers MAY respond to
	requests in any order, but a response message MUST always
	contain the same Mid and Pid values as the corresponding request
	message.  The client MUST NOT have multiple outstanding requests
	to a server with the same Mid and Pid.

and I have seen a capture where more than one PID is used on a given
connection and where the same MID is used with two different PIDs.

Get rid of the "mid" field in the "smb_info_t" structure - the MID is
not used outside "dissect_smb()".

svn path=/trunk/; revision=4495
2002-01-08 05:52:05 +00:00
Guy Harris 98b2ecb304 SPOOLSS RPC dissector, from Tim Potter. This includes adding additional
DOS error codes to the table of them, and exporting that table to other
dissectors for protocols using DOS error codes.

svn path=/trunk/; revision=4470
2002-01-03 20:42:41 +00:00
Guy Harris 4e013a44de Reassembly of fragmented NT Transaction responses, from Ronnie Sahlberg.
svn path=/trunk/; revision=4421
2001-12-18 08:55:49 +00:00
Guy Harris f370747531 From Ronnie Sahlberg: dissect security descriptor flags.
Clean up the display of the access control list entry flags.

Treat the access control list entry mask bits as NT permission bits (as
that's what they are).

svn path=/trunk/; revision=4420
2001-12-18 08:27:06 +00:00
Guy Harris 0ff9471830 NT ACL structure dissection, from Ronnie Sahlberg.
svn path=/trunk/; revision=4405
2001-12-15 23:59:23 +00:00
Guy Harris 3ccae74e5e NT security descriptor dissection, from Ronnie Sahlberg.
svn path=/trunk/; revision=4396
2001-12-15 04:35:50 +00:00
Guy Harris 23319ff023 Move the pointer to the "column_info" structure in the "frame_data"
structure to the "packet_info" structure; only stuff that's permanently
stored with each frame should be in the "frame_data" structure, and the
"column_info" structure is not guaranteed to hold the column values for
that frame at all times - it was only in the "frame_data" structure so
that it could be passed to dissectors, and, as all dissectors are now
passed a pointer to a "packet_info" structure, it could just as well be
put in the "packet_info" structure.

That saves memory, by shrinking the "frame_data" structure (there's one
of those per frame), and also lets us clean up the code a bit.

svn path=/trunk/; revision=4370
2001-12-10 00:26:21 +00:00
Guy Harris 6b0b77c5f1 More NT error codes, from Todd Sabin.
svn path=/trunk/; revision=4352
2001-12-07 05:52:23 +00:00
Guy Harris 787a331ae6 From Todd Sabin:
add "dissect_ndr_ctx_hnd()" for dissecting context handles, and
	use it in various DCERPC dissectors;

	beef up the MS Security Account Manager dissector.

Also, export "NT_errors[]" for use by that dissector.

svn path=/trunk/; revision=4350
2001-12-06 23:30:36 +00:00
Guy Harris ef626a48ce From Ronnie Sahlberg: reassemble DCERPC-over-SMB requests as well as
responses.

svn path=/trunk/; revision=4348
2001-12-06 09:24:02 +00:00
Guy Harris 10b79123ef In the SMB dissector, keep a list of all the conversation structures
and, when we're re-initializing the dissector, free up all the hash
tables attached to those structures.

svn path=/trunk/; revision=4345
2001-12-06 07:04:02 +00:00
Guy Harris fc6a4d9b6f There can be more than one SMB request or response in a frame when
you're doing NetBIOS-over-TCP (yes, I've seen that, with one response
being a Transaction and the other being a Read and X), so the frame
number is insufficient as a key in the hash table of matched
request/response pairs; use the frame number and the MID.

svn path=/trunk/; revision=4344
2001-12-06 06:35:31 +00:00
Guy Harris 6b253331f0 Support for reassembly of DCERPC over SMB, from Ronnie Sahlberg.
svn path=/trunk/; revision=4335
2001-12-05 08:20:30 +00:00
Guy Harris a17c23a7a2 From Tim Potter: add the DOS error for "file already exists" on a
rename.

svn path=/trunk/; revision=4333
2001-12-05 00:49:32 +00:00
Guy Harris a9c0c1ebbb Don't fetch "t2i->info_level" if "t2i" is null.
svn path=/trunk/; revision=4332
2001-12-05 00:25:44 +00:00
Guy Harris 3396fb2777 Update from Ronnie Sahlberg:
1.  Changes how can_desegment works so that can_desegment is
	    only != 0 for whichever dissector is running immediately on
	    top of whoever offers the can_desegment service.

	    Thus DCERPC needs no special handling to see if it can trust
	    can_desegment (which is currently only available ontop of TCP
	    and not ontop of tcp->nbss->smb).

	2.  Changes fragment reassembly of transaction smb to only show
	    the defragmented packet for the transaction smb holding the
	    first fragment.

	    To see why, test it with a transaction SMB containing a ~60kb
	    PDU or larger.  The old behaviour had approximately quadratic
	    behaviour regarding runtime for dissecting such PDUs.

	    (example: NetShareEnum is a command which can grow really really
	    large if the number of shares and comments are large)

svn path=/trunk/; revision=4296
2001-11-29 09:05:25 +00:00
Guy Harris ec19562f1a When processing a response, check whether "si->sip" is null before using
it; it'll be null if the matching request hasn't been seen.

svn path=/trunk/; revision=4295
2001-11-29 08:36:56 +00:00
Guy Harris 3be79df937 From Ronnie Sahlberg: track FID values between requesta and responses
for ReadAndX and WriteAndX.

svn path=/trunk/; revision=4293
2001-11-28 11:47:27 +00:00
Guy Harris 390d5bbb55 If a request has already been processed, and we fail to find its
"smb_saved_info_t" in the table of requests whose replies have been
found, don't look it up in the table of requests whose replies have not
been found - if the request in question has no reply in the capture,
that may find some later frame in the same conversation with the same
MID, and we don't need that information anyway - the only reason we
*need* that structure is to save information in it for use when
processing its reply, and we already did that the first time we
processed the request.  (The information for the later frame may be bad,
e.g. having a null "extra_info" pointer, or having one that points to
information for another request.)

Arrange that we don't use the pointer to the "smb_saved_info_t" when
processing a request except to save information if the request hasn't
already been processed, as that pointer may not be valid if the request
has already been processed, as per the above.

svn path=/trunk/; revision=4292
2001-11-28 11:33:55 +00:00
Guy Harris ce66d97e35 Updates to transaction reassembly, from Ronnie Sahlberg.
Add some checks for null tvbuff arguments.

When dissecting transaction setup, parameters, and data when we couldn't
dissect it as a pipe or mailslot transaction, use the reported length of
the supplied tvbuff, not the actual length, as the amount of data
present.

svn path=/trunk/; revision=4291
2001-11-28 09:44:27 +00:00
Guy Harris fd456eaf0b Remove an extra blank from a data source name.
Added comments, from Ronnie Sahlberg.

svn path=/trunk/; revision=4280
2001-11-27 05:16:29 +00:00
Guy Harris ddfdbad4bd In "smb_trans_defragment()", quit if "si->sip" is null, as it means we
don't have the frame number of the request, which we use as the ID of
the transaction being reassembled.  (If we're reassembling a reply,
should we not use the frame number of the reply instead?  We used to
have a hash table to keep track of that, so we might just be able to
bring it back....)

svn path=/trunk/; revision=4274
2001-11-26 10:24:59 +00:00
Guy Harris d2197e36df Add some comments.
svn path=/trunk/; revision=4273
2001-11-26 10:05:27 +00:00
Guy Harris a8e949c74d From Ronnie Sahlberg: reassemble transaction data if transaction
continuations are seen.

svn path=/trunk/; revision=4272
2001-11-26 09:58:38 +00:00
Guy Harris ac16b7463b Assorted changes from Ronnie Sahlberg:
Add a few small functions to reassemble.c to cope with protocols
	where the total length of defragmented PDUs are specified in the
	first fragment (all previous uses of reassembly has been for
	PDUs where the last fragment is signalled by a flag in the
	header for the last fragment).

	Add a few small functions to reassemble.c to abort-and-delete
	defragmentation of PDUs and also detect IF a PDU is currently
	being defragmented.  (Useful for PDUs where the "unique"
	identifier is rather ununique, or may be reused often enough so
	it can be a problem for Ethereal.)

	Change where NT Cancel presents its Cancelation-to output, and
	makes the three trans secondary requests also output similar
	information.

svn path=/trunk/; revision=4255
2001-11-24 09:36:40 +00:00
Guy Harris 99e2d7e626 Discard stuff in "smb.h" not used by the dissectors, and replace the
#defines for SMB commands with ones that use the names from the SNIA
CIFS spec.

Use those #define values rather than hardcoded values in various places
that check for specific commands.

svn path=/trunk/; revision=4244
2001-11-21 06:25:58 +00:00
Guy Harris daef7e962d Support for Transaction Secondary and Transaction2 Secondary, from
Ronnie Sahlberg.

svn path=/trunk/; revision=4243
2001-11-21 06:04:39 +00:00
Guy Harris 60fe401dc7 Get rid of some unused variables.
svn path=/trunk/; revision=4241
2001-11-21 02:01:06 +00:00
Guy Harris 3c11e4ff6d From Ronnie Sahlberg: handle transaction continuations the way we handle
NT Cancel, as transaction continuations don't get a response, either.

svn path=/trunk/; revision=4230
2001-11-20 08:18:01 +00:00
Guy Harris f7496cc674 Dissect the rest of the named pipe protocol. Export from "packet-smb.c"
routines used for that.

Rename some named pipe functions as per the SNIA CIFS spec.

Label the "number of files moved" field of the reply to a Move SMB as
such, rather than as an unspecified "Count".

svn path=/trunk/; revision=4229
2001-11-20 07:47:42 +00:00
Guy Harris 7cd2bc5659 Save the function code and FID for pipe requests, and use it for the
matching responses.

svn path=/trunk/; revision=4228
2001-11-20 06:24:20 +00:00
Guy Harris b31b47e066 Dissect the setup words in pipe transactions that have them; that
obviates the need to have a protocol tree item for "MSRPC-over-SMB", as
the setup words for it are just standard TransactNmPipe setup words
(0x26 is the TransactNmPipe function code, and the next setup word is
the FID for the pipe in question.)

Pass to the pipe dissector tvbuffs for setup-words-plus-pipe (which is
the data for the pipe protocol) and parameters-plus-data (which is the
data for the protocol running atop the pipe protocol); use the former
for the top-level protocol tree item for the pipe protocol, and the
latter for the top-level protocol tree item for the LANMAN protocol.

svn path=/trunk/; revision=4223
2001-11-19 11:41:51 +00:00
Guy Harris 5b36683d39 Make the register routines for the mailslot, pipe, browser, and
mailslot-based logon protocols just be regular register routines,
detected by the script that generates the "register.c" file, rather than
special stuff known to the SMB dissector.

svn path=/trunk/; revision=4222
2001-11-19 10:23:39 +00:00
Guy Harris 853aa01c6e Pass, as the first tvbuff argument to "dissect_mailslot_smb()" and
"dissect_pipe_smb()", a tvbuff containing the setup words and the
pipe/mailslot pathname, as those are arguably the part of the packet
that contains the "mailslot protocol" and the "pipe protocol", as
opposed to the protocol running atop mailslots or pipes.

Pass a setup tvbuff to "dissect_pipe_smb()" for it to pass on to the
MSRPC-over-named-pipe dissector, and have the setup tvbuff passed to it
and "dissect_mailslot_smb()" contain *only* the setup words; don't
extract anything other than the setup words from it.

Declare "register_proto_smb_mailslot()" in "packet-smb-mailslot.h"
rather than "packet-smb.c", and declare "register_proto_smb_pipe()" in
"packet-smb-pipe.h" rather than "packet-smb.c".

Add a protocol for MSRPC-over-named-pipes.

Move the stuff to handle the FID in the setup words of
MSRPC-over-named-pipe transactions out of the SMB Transaction dissector
into the MSRPC dissector.  Add a routine to "packet-smb.c", callable
from outside "packet-smb.c", to put an "smb.fid" field into the protocol
tree, and to add ", FID: XXXX" to the Info column, for use by the
MSRPC-over-named-pipe dissector; use it in the SMB dissector as well, in
all the places where we put a FID into the protocol tree.

Move the stuff to check whether the LANMAN protocol is enabled, and to
set "pinfo->current_proto" to "LANMAN" if it is, into the LANMAN
API-over-named-pipe dissector out of the named pipe protocol dissector.

If we didn't dissect a Transaction request or reply as a named pipe or
mailslot message, put any setup words, parameters, and data it has into
the protocol tree as separate items.

Don't put a "Response in" item into the protocol tree for an NT Cancel
request, as there are no responses to NT Cancel requests.

svn path=/trunk/; revision=4221
2001-11-19 10:06:42 +00:00
Guy Harris dbec2dc1e8 From Tim Potter:
display the returned FID in the Info column for NT Create And X
	replies;

	display the setup words, and treat the second word as a FID in
	Transaction requests presumed to contain DCE RPC-over-SMB.

Add the FID to the Info column for other open/create replies while we're
at it.

svn path=/trunk/; revision=4219
2001-11-18 22:12:46 +00:00
Guy Harris bdd9eb3cf4 Pass in the "smb_info" structure a pointer to the "smb_saved_info_t"
structure, so that it can be updated by subdissectors; this way the
updates affect the structure immediately, and don't get lost if the
subdissector later throws an exception.

Use "tvb_reported_length()" to check for an interim mailslot reply;
"tvb_length()" could give the wrong answer if a short snapshot length
was given in the capture.

svn path=/trunk/; revision=4218
2001-11-18 02:51:20 +00:00
Guy Harris c211cb9da9 Have only the request and response frame numbers, and a "void *", in an
"smb_saved_info_t".  Put all the information needed to dissect NT
Transaction replies, Transaction2 replies, or Transaction replies into
separate data structures, allocated separately, and put a pointer to
that data structure in the "void *" in question.

Use the return value of "dissect_pipe_smb()" and
"dissect_mailslot_smb()" to control whether to display as data the stuff
those routines were asked to dissect.

If we've seen a request before, but its "smb_saved_info_t" isn't in the
"matched" hash table, look in the "unmatched" hash table - perhaps we
haven't seen the reply yet.

svn path=/trunk/; revision=4216
2001-11-18 01:46:51 +00:00
Guy Harris a2993889aa Add some bits in the Write AndX write mode as per "Microsoft Networks
SMB FILE SHARING PROTOCOL EXTENSIONS, SMB File Sharing Protocol
Extensions Version 2.0, Document Version 3.3".

Fix the test for the "connectionless mode" to test the correct bit.

svn path=/trunk/; revision=4215
2001-11-16 10:19:35 +00:00
Guy Harris c3ffa85819 Never put an entry into the hash table for an NT Cancel request, even if
we didn't find the request it's cancelling.

svn path=/trunk/; revision=4214
2001-11-16 09:52:29 +00:00
Guy Harris a7e7c07d02 Don't save a full "smb_info" structure in the hash tables for requests
and replies, just save a structure holding that information that can't
be derived from the contents of one of the SMBs.

Don't save anything at all for NT Cancel requests - they have the same
TID/PID/MID/UID as the SMB being cancelled, and you want the information
for that request used when dissecting the NT Cancel (so it gets the
number of the frame containing the request being cancelled) and when
dissecting the reply to the request being cancelled.

Get rid of an unused routine.

svn path=/trunk/; revision=4213
2001-11-16 09:27:03 +00:00
Guy Harris 6f2633ba61 Cleanup of request/response matching, from Ronnie Sahlberg.
Get rid of "Response to" stuff in the LANMAN dissector, as that's now
done in the SMB dissector.

Add a routine for dissecting unknown SMBs (gets the word and byte
counts, and just adds text entries for the word and byte parameters, if
any), and replace null pointers in the dissector table with pointers to
that routine.  Get rid of the check for a null dissector pointer.

svn path=/trunk/; revision=4212
2001-11-16 07:56:28 +00:00
Guy Harris 7b9cf0f511 Responses to queries for stream information can return more than one
piece of information in the reply, as a file can have more than one
stream; show all of them.

Don't use the "File Name" field for stream names.

svn path=/trunk/; revision=4211
2001-11-16 02:53:11 +00:00
Guy Harris 239c730bce Use "hf_smb_t2_stream_size", not "hf_smb_t2_stream_name_length", when
adding the stream size.

svn path=/trunk/; revision=4210
2001-11-16 01:52:27 +00:00
Guy Harris dc1ac349f9 Tvbuffification of Transaction requests, from Ronnie Sahlberg.
"Send buffer pointer" and "send buffer length" items appear not to be
sent over the wire.

Add support for Write And X.

svn path=/trunk/; revision=4204
2001-11-15 10:41:53 +00:00
Guy Harris 20bfe42945 Squelch an MSVC++ complaint.
svn path=/trunk/; revision=4198
2001-11-13 06:17:07 +00:00
Guy Harris 7141a2aa78 Include the sync I/O alert and nonalert bits.
Put in comments about some of the other bits.

svn path=/trunk/; revision=4196
2001-11-12 21:43:49 +00:00
Guy Harris 0b0116e207 Transaction2 tvbuffified, and support added for many Transaction2 SMBs,
from Ronnie Sahlberg.

Various other bug fixes, cleanups, and other improvements.

svn path=/trunk/; revision=4193
2001-11-12 08:46:14 +00:00
Guy Harris 45cc752b95 Dissect the NT create option bits. (Well, some of them, anyway.)
svn path=/trunk/; revision=4192
2001-11-11 02:27:06 +00:00
Guy Harris c62c2256e3 Change from Tim Potter to show the error status in the Info column for
SMBs that got errors.

Add some additional access mask bits, and the URL of another spec.

svn path=/trunk/; revision=4191
2001-11-10 22:23:11 +00:00
Guy Harris c08a612a4c Microsoft calls it "Dfs", not "DFS", perhaps to avoid confusion with the
OSF's DCE DFS (which is completely unrelated to Dfs).

svn path=/trunk/; revision=4190
2001-11-09 22:58:10 +00:00
Guy Harris dbe1718c7e NT Create and X support, from Ronnie Sahlberg.
"#if 0" out an unused routine, pending determination of whether there's
any place that would use it.

Fix some typos.

Display the NT create options in hex, as they appear to be a bitmask.

svn path=/trunk/; revision=4189
2001-11-09 22:45:22 +00:00
Guy Harris e6b12dd801 Tvbuffification of SMB print commands, from Ronnie Sahlberg.
Fix up some SMBs I missed when adding the byte-count checks.

svn path=/trunk/; revision=4183
2001-11-09 06:43:38 +00:00
Guy Harris 0ec155cfaf Print the create flags with 8 hex digits.
Add some checks of the return value of
"get_unicode_or_ascii_string_tvb()" - if a null terminator is missing,
it might well run past the end of the byte parameters - and add some
code to keep the byte count updated so that the right byte count is
passed to "get_unicode_or_ascii_string_tvb()".

svn path=/trunk/; revision=4180
2001-11-08 10:57:09 +00:00
Guy Harris f4a46388f2 Put the stuff to handle file data in read and write requests into a
common subroutine.

Label the "total data length" field in Write Raw and Write Multiplexed
requests as such.

Dissect the IPC State/Device State field of Open and X requests and NT
Create and X requests ass per the stuff on page 67 of

	ftp://ftp.microsoft.com/developr/drg/CIFS/dosextp.txt

Make a variable that doesn't need to be static not static.

svn path=/trunk/; revision=4179
2001-11-08 10:34:11 +00:00
Guy Harris 3412303bf6 NT Transact dissection, from Ronnie Sahlberg.
svn path=/trunk/; revision=4178
2001-11-08 08:21:13 +00:00
Guy Harris d607582d65 "dissect_open_print_file_smb()" was defined but not used; put it into
the appropriate entry in the "dissect[]" table.

svn path=/trunk/; revision=4176
2001-11-07 20:30:43 +00:00
Guy Harris 588cd16184 Further tvbuffication from Ronnie Sahlberg.
Get rid of a bunch of stuff for which said tvbuffication removes the
need.

When dissecting byte parameters, make sure you don't consume more bytes
than the byte count, and handle captures where the last string in the
byte parameters area isn't properly null-terminated (I think I've seen
that in packets from various versions of Windows NT).

Make various bitfields given as decimal in SMB specs decimal.

svn path=/trunk/; revision=4172
2001-11-07 08:05:04 +00:00
Guy Harris d5727068bb Fix the previous change to handle SMBs with tvbuffified dissectors.
svn path=/trunk/; revision=4161
2001-11-05 07:58:33 +00:00
Guy Harris eff04e8bae Put andX commands at the same level as the first command.
svn path=/trunk/; revision=4160
2001-11-05 07:46:01 +00:00
Guy Harris 39b35fd837 Put in some references.
svn path=/trunk/; revision=4159
2001-11-05 05:39:31 +00:00
Guy Harris ff8cc11795 Further tvbuffication, from Ronnie Sahlberg.
Convert a bunch of "proto_tree_add_XXX" calls to "proto_tree_add_item"
calls.

svn path=/trunk/; revision=4158
2001-11-05 05:24:17 +00:00
Guy Harris 9449d55a91 Futher tvbuffification from Ronnie Sahlberg.
Do more sanity checking on DOS dates and times.

Convert a bunch of "proto_tree_add_XXX" calls to "proto_tree_add_item"
calls.

Put the word and byte data for untvbuffified SMBs under a subtree just
as is done for tvbuffified SMBs.

Get rid of some no-longer-used routines.

Fix some displays in untvbuffified SMBs to resemble the way those fields
are displayed for tvbuffified SMBs.

Display timesouts as seconds and milliseconds when they're in units of
milliseconds.

svn path=/trunk/; revision=4157
2001-11-05 01:44:17 +00:00
Guy Harris 35078ebac9 Further tvbuffication, from Ronnie Sahlberg.
Make it possible for a non-tvbuffied dissector for an andX SMB to call a
tvbuffified dissector for the andX command, and fix the non-tvbuffified
dissectors in question to do so.

svn path=/trunk/; revision=4154
2001-11-04 12:44:02 +00:00
Guy Harris 303bb72023 More tvbuffication, from Ronnie Sahlberg.
When converting DOS-date years to "struct tm" years, add 1980 and
subtract 1900, to make it clearer what the conversion involves (DOS-date
years are (year - 1980); "struct tm" years are (year - 1900)).

svn path=/trunk/; revision=4146
2001-11-04 00:53:46 +00:00
Guy Harris d6a16d417a Check for a zero word count in LogoffandX requests and replies.
svn path=/trunk/; revision=4145
2001-11-03 23:53:48 +00:00
Guy Harris 8a7bb75f0d Clean up the display of the Flags and Flags2 fields, and add a missing
bit to Flags2.

svn path=/trunk/; revision=4140
2001-11-03 12:10:34 +00:00
Guy Harris f2676ba1c9 Tvbuffification of Negotiate Protocol, from Ronnie Sahlberg.
Fix up Info column to put "Request" or "Response" *after* the name of
the request.

Give the Negotiate Protocol request its full name.

svn path=/trunk/; revision=4139
2001-11-03 11:42:50 +00:00
Guy Harris 80d72f8cf3 First tvbuffication change, from Ronnie Sahlberg. Also changes SMB
command names to match later SMB specs.

svn path=/trunk/; revision=4138
2001-11-03 06:56:56 +00:00
Guy Harris 0c13da5c70 Rename the "private" member of the "packet_info" structure to
"private_data", to keep C++ compilers from getting heartburn.

svn path=/trunk/; revision=4130
2001-11-03 00:58:52 +00:00
Guy Harris 106740a5f5 Properly handle the andX command in a LockingAndX message.
Fix up some closing braces.

svn path=/trunk/; revision=4049
2001-10-20 19:29:21 +00:00
Guy Harris 3869ff8bfb Make several of the fields in the SMB header filterable.
Get rid of the "unknown-0xXX" entries in the "value_string" table for
SMB command codes - they make it much more painful to select one of them
in the filter-editing dialog box.

svn path=/trunk/; revision=3985
2001-09-30 23:36:46 +00:00
Guy Harris a6c48da6a3 Use tvbuff routines to extract data from the SMB header.
svn path=/trunk/; revision=3974
2001-09-29 01:44:09 +00:00
Guy Harris 0102e0c783 Start the process of tvbuffifying the SMB dissector - give it a
tvbuffified heuristic-dissector interface, but have it immediately turn
its arguments into an old-style buffer pointer and offset.

Register the SMB dissector as a heuristic NetBIOS dissector, and have
"dissect_netbios_payload()" just try the heuristics, as it no longer has
to call the SMB dissector explicitly.

svn path=/trunk/; revision=3973
2001-09-29 01:19:01 +00:00
Guy Harris 44e672ab42 From Todd Sabin: dissect the auth info in connection oriented dcerpc
packets.

Make a "dissect_netbios_payload()" routine, called from the
NetBIOS-over-802.2 (NBF), NetBIOS-over-IPX, and NetBIOS-over-TCP
dissectors.  Take Todd Sabin's changes to add a heuristic dissector list
to the NBSS dissector, and apply them to "dissect_netbios_payload()"
instead.  Make the SMB dissector heuristic, returning FALSE if it
doesn't see 0xFF S M B at the beginning of the packet, and have
"dissect_netbios_payload()" first try the heuristic dissector list, then
try the SMB dissector if no other heuristic dissector claims the packet,
then just dissect the payload as data.

From Todd Sabin: have the DCE/RPC dissector register as a heuristic
dissector for NetBIOS.

svn path=/trunk/; revision=3969
2001-09-28 22:43:57 +00:00
Guy Harris 5a16a295ad WordCount is unsigned, so test for "WordCount != 0" rather than
"WordCount > 0".

Always put the byte count field into the protocol tree, regardless of
whether WordCount is 0 - it's not one of the word parameters counted by
WordCount, so it's present even if WordCount is 0.

Fix a "val_to_str()" call.

svn path=/trunk/; revision=3966
2001-09-28 08:39:59 +00:00
Guy Harris 31328f1ac4 Base decisions on whether to dump the word parameters on the word count
value being non-zero, not on whether the error code is zero.  Don't
bother passing the error code to dissectors for particular SMBs, as they
don't need to use it.

In "get_unicode_or_ascii_string()", when aligning to an even boundary,
align to an even boundary in the SMB message, not in the packet as a
whole - there's no guarantee that there are an even number of bytes in
the frame before the SMB message.

In the Info column, mark the packet as a request or response based on
the request/response bit in the Flags field, not on the matched port -
for NBIPX, the source and destination ports (IPX sockets) may be the
same, so you may not be able to determine whether it's a request or a
response based on that.

svn path=/trunk/; revision=3965
2001-09-28 08:01:22 +00:00
Guy Harris ad0e1385e3 Add support for NT error codes.
svn path=/trunk/; revision=3962
2001-09-27 22:48:46 +00:00
Guy Harris f0a15c306b Handle interim Transact2 responses correctly.
Mark interim responses as such in the Info column.

svn path=/trunk/; revision=3961
2001-09-27 22:33:44 +00:00
Guy Harris 65ac4971d2 The byte count field in an SMB Write request counts not only the data
being written, but the 2 bytes of data length and one byte of buffer
type preceding that data; use the data length (which doesn't count
itself or the buffer type byte), rather than the byte count, to
determine how much data is being written.

svn path=/trunk/; revision=3917
2001-09-11 05:31:45 +00:00
Guy Harris 3388bde488 Instead of having a single datum attached to a conversation, have a list
of protocol-id-plus-datum pairs, so that multiple protocols can attach
information to the same conversation.

Dissectors that attach information to a conversation should not assume
that if they find a conversation it has one of its data attached to it;
the conversation might've been created by another dissector.

svn path=/trunk/; revision=3901
2001-09-03 10:33:12 +00:00
Guy Harris 9cef3b28ad Put in a comment noting that the "Service" string in a Tree Connect and
X reply is always in ASCII.

svn path=/trunk/; revision=3877
2001-08-27 23:17:30 +00:00
Guy Harris a7f16a41d9 Handle the "Native File System" string in a TconX response as ASCII or
Unicode based on whether strings in the SMB are ASCII or Unicode.

svn path=/trunk/; revision=3876
2001-08-27 20:15:30 +00:00
Guy Harris e18fdae9b6 Use the descriptor strings when dissecting remote APIs; this lets us
handle null pointer entries, and lets us make the dissection of those
APIs more table-driven.

svn path=/trunk/; revision=3873
2001-08-27 09:09:36 +00:00
Guy Harris 37f355caf5 Show the Capabilities field in a Session Setup and X request as a 32-bit
value.

Put in a comment noting what may be *another* bug in some versions of
Windows when constructing Session Setup and X requests.

svn path=/trunk/; revision=3871
2001-08-27 07:56:49 +00:00
Guy Harris 1e55187184 Show buffer formats symbolically as well as numerically.
svn path=/trunk/; revision=3870
2001-08-27 06:18:24 +00:00
Guy Harris 5c87d84946 Fix a number of SMB dissectors to correctly handle ASCII and Unicode
strings, based on whether the "strings are Unicode" bit is set in the
SMB header or not.

svn path=/trunk/; revision=3869
2001-08-27 05:52:06 +00:00
Guy Harris 44fb959e81 Make a routine to handle fetching strings that are Unicode or ASCII
depending on the setting of the "Strings are Unicode" bit in the SMB.

Correctly handle Unicode strings in Session Setup and X and Tree Connect
and X messages.

Always display the Word Count and Byte Count fields of a Session Setup
and X message, regardless of whether we recognize the word count value
as one we can handle or not.

Correctly handle Session Setup and X messages if extended security
exchanges are being used.

Decode the (known) bits of the Action field in an Session Setup and X
message, and the (known) bits of the optional flags field of a Tree
Connect and X message.  Show the optional flags field as a 16-bit hex
quantity.

svn path=/trunk/; revision=3868
2001-08-27 04:45:39 +00:00
Guy Harris 9afbcb1f2c Fix a typo in a comment.
svn path=/trunk/; revision=3842
2001-08-11 19:15:35 +00:00
Guy Harris 46e333674c In the Info column for transaction responses for which we don't have the
matching request, or for responses where we don't have the
pathname/transaction code of the matching request, indicate the SMB
opcode of the transaction, rather than just saying it's a response to a
generic message.

svn path=/trunk/; revision=3841
2001-08-11 18:33:22 +00:00
Guy Harris 97fd776acf If the matching request for a transaction reply wasn't found, so that we
don't know the path name, don't give up, just show the parameters and
data, as is done with transactions that aren't mailslot browser
transactions or LANMAN RAP pipe transactions.

svn path=/trunk/; revision=3840
2001-08-11 18:26:03 +00:00
Guy Harris 3f88a3a881 Display padding and data fields in transaction requests/replies as hex,
not as text; it's rarely, if ever, pure text.

svn path=/trunk/; revision=3839
2001-08-11 17:46:06 +00:00
Guy Harris 9ed0eb9882 Squelch a compiler warning.
svn path=/trunk/; revision=3838
2001-08-11 17:31:13 +00:00
Richard Sharpe 0046494f94 Change the SMB header to being a separate break-out tree ...
Next, on to tvbuffify etc the others...

svn path=/trunk/; revision=3836
2001-08-11 13:50:11 +00:00
Guy Harris a739061860 Keep track of transaction replies that have continuations, and associate
continuations with the message to which they're a continuation.

svn path=/trunk/; revision=3834
2001-08-11 07:26:25 +00:00
Guy Harris 30296fc745 Tvbuffified SMB mailslot protocol dissector, from Ronnie Sahlberg.
svn path=/trunk/; revision=3832
2001-08-07 08:39:57 +00:00
Guy Harris 95056acbba The MID in an SMB message is not a transaction ID in, say, the ONC RPC
sense; instead, it's a "multiplex ID" used when there's more than one
request *currently* in flight, to distinguish replies.

This means that the MID and PID don't uniquely identify a request in
a conversation.

Therefore, we have to use some other value to distinguish between
requests with the same MID and PID.

Add a mechanism to do so.

svn path=/trunk/; revision=3829
2001-08-06 00:59:14 +00:00
Guy Harris d2b01e812b Remote API protocol (that seems to be what it's called in a number of
places) dissector tvbuffified, from Ronnie Sahlberg and me.

Additional "are we past the end of the buffer" checks added, so that we
don't hand random junk to the transaction and transact2 dissectors.

svn path=/trunk/; revision=3824
2001-08-05 01:15:27 +00:00
Guy Harris d271509c7e Use the #define SMB_FLAGS_DIRN, rather than its numerical value, when
testing the request/response flag.

svn path=/trunk/; revision=3823
2001-08-05 00:30:41 +00:00
Guy Harris 749f27dd0e Add a request/response flag to the "struct smb_info" structure, and use
that rather than passing another copy of that flag to dissectors of
particular messages.

Pass that structure to the pipe subdissector by making "pi.private"
point to it, rather than by passing it as an explicit argument.

Change more of the

	if (dirn == 1) {
		...
	}
	if (dirn == 0) {
		...
	}

stuff to

	if (dirn == 1) {
		...
	} else {
		...
	}

and then, as per the first paragraph, check the "request" flag in the
"smb_info" structure rather than checking a "dirn" flag.

Set "last_transact2_command" to -1 in the "smb_request_val" structures
for TRANSACTION requests, as it doesn't apply to those requests.

As "dissect_transact_params()" doesn't do any work if the "TransactName"
argument is null, don't bother calling it for a reply if we don't have an
"smb_request_val" for the corresponding request, as that means we can't
find out the value to pass as the "TransactName" argument.

svn path=/trunk/; revision=3822
2001-08-05 00:16:36 +00:00
Guy Harris 358e1944db Use "val_to_str()" to convert TRANSACT2 transaction codes to strings.
(This fixes an incorrect string for TRANS2_GET_DFS_REFERRAL, which has
the code 0x10 according to the current SNIA CIFS draft spec; I've seen
those in packet captures.)

Create entries in the transaction hash tables only for requests, not for
replies; this means a reply might not have an entry in the table, if the
request didn't appear in the capture, so handle that case.

Make the "last_transact2_command" field of a "smb_request_val" structure
an "int", so it can be given the value -1, which is different from all
the valid 16-bit unsigned values, to indicate that we couldn't get the
transaction code from the request (e.g., because it's too short).

Show the first Setup word in a TRANSACT2 request as the transaction
code, as that's what it is.

"dirn" is a Boolean, so

	if (dirn == 1) {
		...
	}
	if (dirn == 0) {
		...
	}

is equivalent to

	if (dirn == 1) {
		...
	} else {
		...
	}

and the latter is a bit clearer, so use it.

Distinguish between a TRANSACTION or TRANSACT2 reply where we didn't see
the request and one where we saw the request but didn't see the request
path for TRANSACTION or the request code for TRANSACT2.

Use "g_strdup()" rather than "g_malloc()" followed by "strcpy()".

svn path=/trunk/; revision=3819
2001-08-04 10:17:24 +00:00
Guy Harris 166c1fd900 Always initialize the "last_transact_command", "last_param_descrip", and
"last_data_descrip" fields of an "smb_request_val" structure to null
when you allocate it, so that, when the hash table is cleaned out, we
don't try handing random junk to "g_free()".

svn path=/trunk/; revision=3811
2001-08-02 09:37:27 +00:00
Guy Harris 840f9b11b6 The "mid" field of the "smb_request_val" structure isn't used; eliminate
it.

svn path=/trunk/; revision=3810
2001-08-02 09:30:09 +00:00
Guy Harris 8b1df43d92 When looking for the request that matches a reply, match the PID as well
as the MID and the conversation index; the current CIFS spec from the SNIA
Web site says

	The multiplex ID (Mid) is used along with the Pid to allow
	multiplexing the single client and server connection among the
	client's multiple processes, threads, and requests per thread.
	Clients may have many outstanding requests (up to the negotiated
	number, MaxMpxCount) at one time.  Servers MAY respond to
	requests in any order, but a response message MUST always
	contain the same Mid and Pid values as the corresponding request
	message.  The client MUST NOT have multiple outstanding requests
	to a server with the same Mid and Pid.

(although, in practice, at least as I remember from working on the
NetApp CIFS server N years ago, Windows clients tend to use the same PID
in all requests, so only the MID acts as a transaction ID).

When initializing the dissector, free up all the data attached to
"smb_request_val" structures in the request hash table before destroying
the hash table and the structures in question.

svn path=/trunk/; revision=3809
2001-08-02 08:48:46 +00:00
Guy Harris f56c5b5333 Make some variables and routines not used outside "packet-smb.c" static.
Show the parameters, data, and padding in transact/transact2 SMBs as
hex, not text; it's usually binary.

"dissect_transact_params()" returns immediately if TransactName is null,
so we don't need to check whether it's null when copying it; just use
"g_strdup()" to copy it.

svn path=/trunk/; revision=3808
2001-08-02 08:08:12 +00:00
Guy Harris bbb52d060b Put in some checks to make sure we're not running past the end of the
packet; this is far from a complete set of checks - the right way to
make this dissector safe is to tvbuffify it - but it's sufficient to
eliminate most cases where my regression tests bogusly reported that the
packet was dissected differently due to different stuff being past the
end of the packet.

svn path=/trunk/; revision=3807
2001-08-02 07:16:05 +00:00
Guy Harris 2997acf2cc Parameters to Transact and Transact2 calls are usually binary, not pure
text; display them with "bytes_to_str()", not "format_text()".

svn path=/trunk/; revision=3798
2001-07-30 07:36:28 +00:00
Guy Harris eb5031e9df Handle Negotiate Protocol replies with the "extended security"
capability flag set.

svn path=/trunk/; revision=3579
2001-06-20 01:58:48 +00:00
Guy Harris 8412393197 From Joerg Mayer: explicitly fill in all members of a
"header_field_info" structure, including the ones that are later set by
the routines to register fields.

svn path=/trunk/; revision=3561
2001-06-18 02:18:27 +00:00
Guy Harris 4d99343d8b Fix a typo.
svn path=/trunk/; revision=3518
2001-06-05 23:40:34 +00:00
Guy Harris eee7f58e2d Fix up a cast so that it properly sign-extends the server time zone;
from Joerg Mayer.

svn path=/trunk/; revision=3427
2001-05-20 22:26:14 +00:00
Guy Harris 2c109432a2 Put in a note about the use of some currently-undissected fields in the
SMB header, as per a Microsoft document.

svn path=/trunk/; revision=3149
2001-03-20 04:46:37 +00:00
Guy Harris b8289288e8 Correctly handle Interim responses to TRANSACTION requests.
Move the declaration of routines exported from "packet-smb-mailslot.c"
into a "packet-smb-mailslot.h" header file, and have modules that import
those routines include "packet-smb-mailslot.h" rather than declaring the
routines themselves; do the same for routines exported from
"packet-smb-pipe.c".  Make routines not exported static, and make
routines that return a true/false return value "gboolean" rather than
"guint32".

svn path=/trunk/; revision=3146
2001-03-18 03:23:30 +00:00
Richard Sharpe 82d18e3d1a Added a new error code I just found ... no such share.
svn path=/trunk/; revision=2956
2001-01-29 08:14:42 +00:00
Gilbert Ramirez 5b7f184296 Ensure that all value_string arrays end in {0, NULL}. Dissectors got away
with not terminating their arrays because they knew the limits of the
value used to look up strings in the value_string array, but the
dfilter_expr_dlg does not know these limits and must rely on the terminating
{0, NULL} record.

Also, in SNA fixed a bug in which a field should have been defined as FT_UINT8
but was defined as FT_BOOLEAN.

In WTP, fixed a value string which had duplicate keys.

svn path=/trunk/; revision=2817
2001-01-03 16:41:08 +00:00
Guy Harris 0e7c1de08a Have "proto_register_protocol()" build a list of data structures for
protocols, in addition to adding structures to the list of filterable
fields.  Give it an extra argument that specifies a "short name" for the
protocol, for use in such places as

	pinfo->current_proto;

	the dialog box for constructing filters;

	the preferences tab for the protocol;

and so on (although we're not yet using it in all those places).

Make the preference name that appears in the preferences file and the
command line for the DIAMETER protocol "diameter", not "Diameter"; the
convention is that the name in question be all-lower-case.

Make some routines and variables that aren't exported static.

Update a comment in the ICP dissector to make it clear that the
dissector won't see fragments other than the first fragment of a
fragmented datagram.

svn path=/trunk/; revision=2810
2001-01-03 06:56:03 +00:00
Richard Sharpe 8c47761ae4 Patches to prevent problems under Windows when time formats are negative.
Make sure that if _gtime is null, a bad format message returned.

Also noticed that I am going to have to do something about Unicode strings soon and the SMBopenX dissect is slightly wrong ... Oh well, it is the Xmas break soon :-) No rest for the Wicca'd (please don't interpret that as a statement of my religious affiliation, it is just a cute saying :-)

svn path=/trunk/; revision=2764
2000-12-17 03:48:44 +00:00
Richard Sharpe 07f065e61a Apply Jeroen Ruigrok van der Werven's patches ...
svn path=/trunk/; revision=2699
2000-11-22 21:19:38 +00:00
Guy Harris 252d55d80f For each column, have both a buffer into which strings for that column
can be put, and a pointer to the string for the column, which might or
might not point to that buffer.

Add a routine "col_set_str()", which sets the string for the column to
the string passed to it as an argument; it should only be handed a
static string (a string constant would be ideal).  It doesn't do any
copying, so it's faster than "col_add_str()".

Make the routines that append to columns check whether the pointer to
the string for the column points to the buffer for the column and, if
not, copy the string for the column to the buffer for the column so that
you can append to it (so you can use "col_set_str()" and then use
"col_append_str()" or "col_append_fstr()").

Convert a bunch of "col_add_str()" calls that take a string constant as
an argument to "col_set_str()" calls.

Convert some "col_add_fstr()" calls that take a string constant as the
only argument - i.e., the format string doesn't have any "%" slots into
which to put strings for subsequent arguments to "col_set_str()" calls
(those calls are just like "col_add_str()" calls).

Replace an END_OF_FRAME reference in a tvbuffified dissector with a
"tvb_length(tvb)" call.

svn path=/trunk/; revision=2670
2000-11-19 08:54:37 +00:00
Guy Harris 563f86ee5e Support for conversations with "wildcard" destination addresses, from
Jeff Foster.

svn path=/trunk/; revision=2523
2000-10-21 05:52:28 +00:00
Gilbert Ramirez 9941aabd64 Move format_text(), get_token_len(), and fine_line_end(), into strutil.c
This keeps tvbuff.c generic; it doesn't have to pull in packet.h and all
of it's included files.

svn path=/trunk/; revision=2409
2000-09-11 16:16:13 +00:00
Laurent Deniel cc36f0b931 Add the "Edit:Protocols..." feature which currently only implements
the following:

It is now possible to enable/disable a particular protocol decoding
(i.e. the protocol dissector is void or not). When a protocol
is disabled, it is displayed as Data and of course, all linked
sub-protocols are disabled as well.

Disabling a protocol could be interesting:

- in case of buggy dissectors
- in case of wrong heuristics
- for performance reasons
- to decode the data as another protocol (TODO)

Currently (if I am not wrong), all dissectors but NFS can be disabled
(and dissectors that do not register protocols :-)

I do not like the way the RPC sub-dissectors are disabled (in the
sub-dissectors) since this could be done in the RPC dissector itself,
knowing the sub-protocol hfinfo entry (this is why, I've not modified
the NFS one yet).

Two functions are added in proto.c :

gboolean proto_is_protocol_enabled(int n);
void proto_set_decoding(int n, gboolean enabled);

and two MACROs which can be used in dissectors:

OLD_CHECK_DISPLAY_AS_DATA(index, pd, offset, fd, tree)
CHECK_DISPLAY_AS_DATA(index, tvb, pinfo, tree)

See also the XXX in proto_dlg.c and proto.c around the new functions.

svn path=/trunk/; revision=2267
2000-08-13 14:09:15 +00:00
Richard Sharpe 73e093e7e7 A small set of patches to fix one small problem and start working on the
filtering in packet-smb.c ...

svn path=/trunk/; revision=2220
2000-08-07 14:49:03 +00:00
Richard Sharpe 3d80db01df A small change to SMB dissector so it lists near the other SMB-related
dissectors when you do 'ethereal -G' ...

svn path=/trunk/; revision=2180
2000-07-30 14:35:39 +00:00
Guy Harris 283ce59938 Add routines for adding items to a protocol tree that take arguments of
a particular type, rather than taking a varargs list, along the lines of
the "proto_tree_add_XXX_format()" routines.

Replace most calls to "proto_tree_add_item()" and
"proto_tree_add_item_hidden()" with calls to those routines.

Rename "proto_tree_add_item()" and "proto_tree_add_item_hidden()" to
"proto_tree_add_item_old()" and "proto_tree_add_item_hidden_old()", and
add new "proto_tree_add_item()" and "proto_tree_add_item_hidden()"
routines that don't take the item to be added as an argument - instead,
they fetch the argument from the packet whose tvbuff was handed to them,
from the offset handed to them.

svn path=/trunk/; revision=2031
2000-05-31 05:09:07 +00:00
Guy Harris f90bbf2a5a Assorted enhancements from Mark Burton.
svn path=/trunk/; revision=2000
2000-05-25 08:38:54 +00:00
Guy Harris f937a5d86f Assorted padding fixes from Mark Burton.
svn path=/trunk/; revision=1999
2000-05-25 08:32:13 +00:00
Gilbert Ramirez 292e38e2c6 Add tvbuff class.
Add exceptions routines.
Convert proto_tree_add_*() routines to require tvbuff_t* argument.
Convert all dissectors to pass NULL argument ("NullTVB" macro == NULL) as
the tvbuff_t* argument to proto_tree_add_*() routines.

dissect_packet() creates a tvbuff_t, wraps the next dissect call in
a TRY block, will print "Short Frame" on the proto_tree if a BoundsError
exception is caught.

The FDDI dissector is converted to use tvbuff's.

svn path=/trunk/; revision=1939
2000-05-11 08:18:09 +00:00
Guy Harris 9bd27d3471 Andreas Sikkema's patch to make the SMB dissector not blithely pass a
null "request_val->last_transact_command" to "col_add_fstr()".

svn path=/trunk/; revision=1738
2000-03-21 10:15:50 +00:00
Gilbert Ramirez e29f2705bf Change dfilter_init() to check for empty-string abbreviations and for
duplicate abbreviations. All mods to packet-*.c files are fixes to remove
those cases.

svn path=/trunk/; revision=1733
2000-03-20 22:52:48 +00:00
Guy Harris 8c200212c7 Fix some "proto_tree_add_text()" calls.
svn path=/trunk/; revision=1695
2000-03-06 20:04:53 +00:00
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