Commit Graph

218 Commits

Author SHA1 Message Date
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