Commit Graph

61 Commits

Author SHA1 Message Date
Guy Harris 00f68c6f2a If "dissect_ndr_nt_STRING()" is being used to dissect a byte string
rather than a character string, don't decorate anything above that item
in the tree with the "string".

svn path=/trunk/; revision=7058
2003-01-31 06:47:55 +00:00
Tim Potter 3405e80d33 Don't append string to upper-level proto_items if item == NULL.
svn path=/trunk/; revision=7050
2003-01-30 22:42:57 +00:00
Guy Harris 5dc66497b7 Generalize "cb_str_postprocess()" to allow the string to be appended to
items N levels up from the item being processed, and use that to
decorate the tree as it was decorated before.

svn path=/trunk/; revision=7043
2003-01-30 08:19:39 +00:00
Guy Harris fc025eb3b8 NDR strings begin with a uint32, so they start on a 4-byte boundary.
svn path=/trunk/; revision=7041
2003-01-30 06:08:10 +00:00
Tim Potter 081f25299f Removed some out of date comments.
svn path=/trunk/; revision=7029
2003-01-28 23:26:11 +00:00
Tim Potter 6114714a5c Defined a useful callback function for dissect_ndr_pointer() which can
be used to help out in most DCERPC strings.  The cb_str_postprocess()
function reads the callback_args and either appends the value of the
string to the COL_INFO field, appends it to the NDR pointer item, or
saves the string to dcv->private_data.  Calling cb_str_postprocess()
with CB_STR_ITEM is the same as calling dissect_ndr_pointer() with
levels = 0.

Renamed some of the pointer dissection functions with a suffix of _cb
and created helpers of the original which call the _cb function with
NULL args.  This should help minimise the amount of code changes in
the bulk of the DCERPC dissectors.

svn path=/trunk/; revision=7016
2003-01-28 06:27:01 +00:00
Tim Potter 2213ef6aaa Perform the initialisation for the NT specific DCERPC dissectors as part
of the DCERPC dissector instead of creating a dummy protocol to hang
the ett and hf values off.

Make the open and close frame values in NT policy handles FT_FRAMENUM's
so the "Go to Corresponding Frame" menu item can be used on them.

svn path=/trunk/; revision=6995
2003-01-24 05:32:54 +00:00
Tim Potter 2146871345 Clean up some unused variables in dissect_ndr_nt_UNICODE_STRING_str()
Undo change to dissect_doserror() and dissect_ntstatus() made in
revision 1.42 as it breaks the display of rpc errors in COL_INFO.

svn path=/trunk/; revision=6934
2003-01-16 22:40:48 +00:00
Guy Harris 6e57154948 Put Unicode strings into the protocol tree with the appropriate protocol
tree item, not with hf_nt_str.  Get rid of hf_nt_str, as it's no longer
used.

Put ASCII strings into the protocol tree only once.

svn path=/trunk/; revision=6910
2003-01-11 08:22:39 +00:00
Guy Harris 84d0997526 "hf_nt_str" is of type FT_STRING, so it should be set to an ASCII
string; set it to the result of the "fake_unicode()" call, not to the
raw Unicode string.  (Yes, we should have support for strings that don't
have 8-bit characters - and somehow handle strings in packets in
multiple character sets, e.g. ISO 8859/x and other EUC codes, the
Macintosh extended character set, various DOS/Windows code pages, and
Unicode - but we don't have it now.)

svn path=/trunk/; revision=6909
2003-01-11 07:52:34 +00:00
Tim Potter 9f4148decf Delete all prs_* functions. Huzzah!
svn path=/trunk/; revision=6900
2003-01-11 04:42:16 +00:00
Guy Harris a55fa6743a Get rid of some no-longer-used routines; there are other routines that
have taken their places.

svn path=/trunk/; revision=6723
2002-12-02 21:20:26 +00:00
Guy Harris f6998aaa23 Get rid of a no-longer-used variable.
svn path=/trunk/; revision=6717
2002-12-02 20:01:55 +00:00
Guy Harris 0e050b1107 Get rid of the "pdata" argument to "dissect_dcerpc_uint16s()" and
"dissect_ndr_uint16s()"; "dissect_ndr_uint16s()" is always passed a null
pointer, "dissect_dcerpc_uint16s()" is only called by
"dissect_ndr_uint16s()", and the pointer returned through "pdata" is
*NOT* guaranteed to be aligned on a 16-bit boundary so we don't want to
tempt people to blithely dereference that pointer.

svn path=/trunk/; revision=6699
2002-11-28 21:03:36 +00:00
Guy Harris a56c79201d Arguments to hash routines are gconstpointer's; assign them to const
pointers.

The first argument to "sscanf()" is a "const char *"; don't cast const
pointers to "char *" when passing them to "sscanf()".

Assign the result of "tvb_get_ptr()" to const pointers, not non-const
pointers.

Make the "pdata" argument to various DCE routines a const pointer.

svn path=/trunk/; revision=6688
2002-11-28 03:57:50 +00:00
Jörg Mayer 7c4176d868 Removed trailing whitespaces from .h and .c files using the
winapi_cleanup tool written by Patrik Stridvall for the wine
project.

svn path=/trunk/; revision=6117
2002-08-28 21:04:11 +00:00
Guy Harris cc6c8214eb Put the top-level item for an NT access mask into the protocol tree with
"proto_tree_add_uint()" and the hfindex passed to us, rather than as a
text item.  That means it has the name our caller gave to it, and that
it's a filterable field.

svn path=/trunk/; revision=6062
2002-08-22 18:24:06 +00:00
Tim Potter 50b37822a0 Some cleanups and fixes from Guy:
- combine proto_tree_add_text() and proto_tree_append_text() calls in the
   access mask dissector

 - make the specific access bits dissector functions return void instead of
   an offset

I think Samba has the create user reply wrong.  There is perhaps a uint32
marked as unknown that shouldn't be there.  Removing this parses all the
captures I have.

svn path=/trunk/; revision=6057
2002-08-22 01:13:13 +00:00
Tim Potter de6ea27535 Added a NT access mask dissector. The breaks the permission bits up into
generic, standard and specific mode bits.  A protocol dissector can pass in
it's own function for dissecting the specific mode bits, if known.

svn path=/trunk/; revision=6053
2002-08-21 21:29:22 +00:00
Tim Potter 142ef6e2ab In dissect_doserror and dissect_ntstatus, don't add anything to the
COL_INFO field if the proto_tree parameter is NULL.  This prevents
duplicate error messages when we just want to peek at the value of the
error.

svn path=/trunk/; revision=5963
2002-08-07 00:54:32 +00:00
Tim Potter 973c1a447d Removed unused variable.
svn path=/trunk/; revision=5775
2002-06-28 07:17:34 +00:00
Tim Potter d24a5fd6c9 Cleaned up NT policy handle hashing a bit. Split the store function
into two - one that stores request/reply frame numbers and another
that associates a text name with a policy handle.

Removed all calls to prs_policy_hnd() and converted to calls to
dissect_nt_policy_hnd().

svn path=/trunk/; revision=5772
2002-06-28 01:23:26 +00:00
Tim Potter c5bc4a8a58 Same for a NT status code.
svn path=/trunk/; revision=5762
2002-06-25 02:58:11 +00:00
Tim Potter 39c2537cd7 Display the error code for a dos error that doesn't have a value string defined.
svn path=/trunk/; revision=5761
2002-06-25 02:57:39 +00:00
Tim Potter 134404b92a Added dissect_ndr_uint16s() utility function for dissecting a buffer
of uint16 values.

svn path=/trunk/; revision=5624
2002-06-05 04:17:47 +00:00
Ronnie Sahlberg c33e33fb7e Additions to the MAPI dissector. Function 02 for MAPI.
The function request/call are dissected but the main body of the function
in/out parameters consists of a unidimensional conformant and varying array of bytes which content is encrypted/obfuscated.
Whoever can tell me how to decrypt/unobfuscate these bytes will get
a case of VB next time in Sydney.

svn path=/trunk/; revision=5532
2002-05-23 12:23:29 +00:00
Tim Potter d72677d9b6 Set the length field correctly for proto_tree_add_text() when marking the
undissected part of a long frame.

svn path=/trunk/; revision=5470
2002-05-15 03:28:43 +00:00
Guy Harris 3479848f3f Mark unused arguments as such.
svn path=/trunk/; revision=5450
2002-05-11 22:53:58 +00:00
Guy Harris 6a79ad7e91 In "dissect_nt_policy_hnd()":
add arguments to specify whether the policy handle is being
	opened or closed, and don't set the "open frame" for the handle
	unless it's being opened and don't set the "close frame" for the
	handle unless it's being closed;

	store the policy handle before fetching it, so that an open or
	close is marked appropriately in the protocol tree on the first
	pass;

	if the policy handle has a name associated with it, put that
	name into the top-level item for the policy handle.

In "packet-dcerpc-spoolss.c":

	get rid of aun unused variable;

	make "setjob_commands[]" static, as it's not used outside
	"packet-dcerpc-spoolss.c";

	put a "VALS()" call around the reference to "setjob_commands",
	to squelch compiler warnings;

	give the SPOOLSS return code field the appropriate
	"value_string" array.

svn path=/trunk/; revision=5448
2002-05-11 22:29:43 +00:00
Tim Potter e932bc78a9 Added a routine to dissect a DOS error code. These are used in the spoolss
(also registry and srvsvc?) pipe dissectors.

Also added some helper routines for decoding a range of uint8s.  These map
nicely to the dissect_{dcerpc,ndr}_foo() format with the addition of a
length parameter, but aren't really part of the NDR specification and are
probably only going to be used in the NT dcerpc dissectors.

svn path=/trunk/; revision=5421
2002-05-09 02:44:22 +00:00
Tim Potter ea89f9f772 Fix up item lengths for policy handle subtree and subitems under it.
svn path=/trunk/; revision=5410
2002-05-07 00:35:14 +00:00
Guy Harris 16d52f4f29 From Joerg Mayer: mark unused arguments as such.
svn path=/trunk/; revision=5380
2002-05-04 09:05:44 +00:00
Guy Harris da74615c79 Get rid of some unused arguments, and mark some others as unused.
Remove the declaration of "dissect_nt_sid()" from
"packet-dcerpc-samr.c"; get it by including "packet-smb-common.h",
instead.

svn path=/trunk/; revision=5313
2002-04-30 11:03:08 +00:00
Guy Harris ab96c5694e Frame numbers are unsigned, and 0 is not a valid frame number; make the
frame number arguments, and elements in data structures, unsigned,
display them with "%u" rather than "%d", and use 0, rather than -1, as
"not known".

svn path=/trunk/; revision=5223
2002-04-22 09:43:03 +00:00
Guy Harris 92e27e03c1 Add a "proto_register_dcerpc_smb()" which registers ett_ values for
"packet-dcerpc-nt.c", and registers "dcerpc_smb_init()" as an
initialization routine.  Take the ett_ registration out of the latter
routine, and also take out the "do this only once" stuff.

Get rid of the initialization routines for netlogon, samr, and spoolss;
they just call "dcerpc_smb_init()", which is now an initialization
routine of its own.

The policy hash initialization should be done before every capture, so
it should be done in an initialization routine, and should not do any
"do this only once" stuff.  It should also be called only once before
every capture, rather than 3 times.

The ett_ initialization should, however, be done at the same time all
other ett_ initialization is done - at protocol registration time - so
it should be done in a "proto_register_" routine.

This fixes a bug I saw wherein

	1) the tree for Unicode strings was open by default

and

	2) if you closed one and then exited, Ethereal would crash.

The problem is that "proto_register_subtree_array()" doesn't expand the
array, it just bumps the number of registered ett_ values; the array is
allocated in "proto_init()".  As such, if you register ett_ values with
"proto_register_subtree_array()" *after* "proto_init()" is called - and,
even for the first capture, initialization routines are called after
"proto_init()" is called - you will get ett_ numbers that go past the
number of elements in the array.

Move the declaration of "ett_nt_unicode_string" to "packet-dcerpc-nt.h",
as it's exported from "packet-dcerpc-nt.c".

Get rid of the declaration of "dcerpc_smb_init()" in
"packet-dcerpc-nt.h", and make it static, as it's no longer called from
outside "packet-dcerpc-nt.c".

svn path=/trunk/; revision=5196
2002-04-18 00:29:17 +00:00
Tim Potter 8241e67243 Use policy handle hash code in DCERPC/SMB SAMR dissector.
Start to move some common stuff into packet-dcerpc-nt.[ch]

svn path=/trunk/; revision=5176
2002-04-17 07:52:26 +00:00
Tim Potter 0f7ea5950d Display non-zero return codes in COL_INFO.
svn path=/trunk/; revision=5170
2002-04-16 02:02:04 +00:00
Ronnie Sahlberg 9ededb6b99 len and max_len were swapped in the UNICODE_STRING dissector
svn path=/trunk/; revision=5043
2002-03-29 04:35:48 +00:00
Tim Potter b958e865ca Use dcerpc_call_value structure to fetch request/response frame numbers
and storage of private data.

Fix memory leaks in form dissectors.

svn path=/trunk/; revision=5020
2002-03-26 05:20:51 +00:00
Tim Potter c9360c715f Some refactoring of the spoolss dissector:
- rewrote request/response hashing code and moved it into
   packet-dcerpc-nt.c for use by other dcerpc/smb dissectors

 - rewrote policy handle hashing code as above, with nifty improvements

 - moved check for unparsed data and end of frame into a function

 - fixed matching of printername to handle in addprinterex

svn path=/trunk/; revision=5014
2002-03-25 05:42:02 +00:00
Guy Harris 02115cdb39 Fix "dissect_ndr_nt_UNICODE_STRING_str()" so that the "di->levels" value
is decremented after every level is appended to, so that it correctly
specifies the number of levels up the tree to which to append stuff.

Fix some arguments to various printing routines to specify the correct
level.  This includes making "dissect_ndr_nt_UNICODE_STRING()" add 1 to
the level argument it's passed before passing it on to
"dissect_ndr_pointer()".

Add a "netlogon_dissect_UNICODE_STRING()" routine to put the fields of a
bunch of NDR_POINTER_REF UNICODE_STRING values into subtrees.

Fix the labels passed as arguments in a bunch of "dissect_ndr_pointer()"
calls.

svn path=/trunk/; revision=5011
2002-03-24 12:25:40 +00:00
Guy Harris 3c012e8e6e In "fake_unicode()", check to make sure we have all the data in the
string available in the tvbuff before we allocate the buffer; this means
that

	1) we don't have to register a cleanup function to free the
	   buffer if we throw an exception trying to fetch some of the
	   data, because we won't even try to allocate the buffer if we
	   don't have all the data

and

	2) we won't try to allocate a buffer with a bogus too-large
	   length, as if the length is too large, we'll throw an
	   exception in the check.

svn path=/trunk/; revision=4990
2002-03-20 07:39:18 +00:00
Guy Harris ad8b000445 There is no guarantee that a buffer obtained using "tvb_get_ptr()" is
neatly aligned on a 2-byte or a 4-byte boundary, and there is no
guarantee that a misaligned pointer can be dereferenced without getting
a fault.

Furthermore, there is no guarantee that, even if you *can* dereference a
pointer to a 2-byte or 4-byte quantity in a packet, the resulting number
you get back is in the right byte order; the data in the packet might
have a different byte order from the machine on which you're running.

Therefore, we change "prs_uint8s()", "prs_uint16s()", and
"prs_uint32s()" to return the starting offset, in the tvbuff, of the
collection of 8-bit, 16-bit, or 32-bit integral values, rather than a
pointer to the raw packet data, and change their callers to fetch the
data using "tvb_get_guint8()", "tvb_get_letohs()", and
"tvb_get_letohl()" (the stuff in all the NT protocols is presumed to be
little-endian here).  We also change "fake_unicode()" to take a tvbuff
and an offset, rather than a data pointer, as arguments, and to use
"tvb_get_letohs()" to fetch the Unicode characters (again, we assume
little-endian Unicode).

This requires "fake_unicode()" to establish a cleanup handler, so we
don't leak memory if it throws an exception.

We also make "fake_unicode()" use "g_malloc()" to allocate its buffer
(we weren't checking for allocation failures in any case; with
"g_malloc()", we'll abort on an allocation failure - if we can come up
with a cleverer way of handling them, fine), and the matching frees to
use "g_free()".  (We also insert some missing frees....)

Fix some formats to print unsigned quantities with "%u", not "%d".

Don't append text to items in the tree for non-string values in
"dissect_ndr_nt_STRING_string()".

svn path=/trunk/; revision=4986
2002-03-19 22:09:23 +00:00
Richard Sharpe dc6bb2dc67 Pretty up Policy Handles.
svn path=/trunk/; revision=4949
2002-03-15 20:46:04 +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
Ronnie Sahlberg 7791aabe52 Added a value_string for the countreis which have their MS contry code listed
at www.unicode.org and made samr and netlogon use it.

svn path=/trunk/; revision=4943
2002-03-14 10:04:02 +00:00
Ronnie Sahlberg 5a801aacfa Update dissect_ndr_nt_STRING so it can also accept FT_BYTES and for that type
display the data as a hexadecimal string.

Update netlogon so that nt and lm challenge response bytes are displayed
in hexadecimal form and not pseudo-ascii

svn path=/trunk/; revision=4934
2002-03-13 07:38:34 +00:00
Ronnie Sahlberg 385c80e202 Small fix for dissect_ndr_nt_UNICODE_STRING_str() in packet-dcerpc-nt.c
so that NETLOGON will not dump core (since netlogon has these structs as top
level reference pointers)

Addition of full netlogon dissection. Full in the sense as it assumes the idl
is correct and complete.
Many calls and fields are unknown so they get dissected with "unknown long,
 contact ethereal-dev@... if you know what it is".

svn path=/trunk/; revision=4929
2002-03-12 08:16:41 +00:00
Ronnie Sahlberg 7900235dad Move the STRING dissector to packet-dcerpc-nt.c and add one more parameter
to make it more similar to the UNICODE_STRING dissector.

svn path=/trunk/; revision=4920
2002-03-11 00:15:20 +00:00
Ronnie Sahlberg 853654f2f3 Moved dissect_ndr_nt_NTTIME() from packet-dcerpc-samr.c to packet-dcerpc-nt.c
since this function will be used by other NT services as well such as NETLOGON.

svn path=/trunk/; revision=4918
2002-03-10 23:24:48 +00:00