Commit Graph

138 Commits

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