2001-12-16 20:17:10 +00:00
|
|
|
/* packet-dcerpc-nt.h
|
|
|
|
* Routines for DCERPC over SMB packet disassembly
|
2003-01-28 06:27:01 +00:00
|
|
|
* Copyright 2001-2003 Tim Potter <tpot@samba.org>
|
2001-12-16 20:17:10 +00:00
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
2001-12-16 20:17:10 +00:00
|
|
|
*
|
|
|
|
* Ethereal - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@ethereal.com>
|
|
|
|
* Copyright 1998 Gerald Combs
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2001-12-16 20:17:10 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2001-12-16 20:17:10 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2001-12-16 20:17:10 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __PACKET_DCERPC_NT_H
|
2003-02-07 08:56:12 +00:00
|
|
|
#define __PACKET_DCERPC_NT_H
|
2001-12-16 20:17:10 +00:00
|
|
|
|
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
|
|
|
/*
|
|
|
|
* ett_ value for Unicode strings.
|
|
|
|
*/
|
|
|
|
extern gint ett_nt_unicode_string;
|
|
|
|
|
2003-05-15 05:24:19 +00:00
|
|
|
/*
|
|
|
|
* Platform ID values, used by several dissectors.
|
|
|
|
*/
|
|
|
|
extern const value_string platform_id_vals[];
|
|
|
|
|
2001-12-16 20:17:10 +00:00
|
|
|
/* Routines for handling deferral of referants in NDR */
|
|
|
|
|
2005-01-28 09:12:40 +00:00
|
|
|
#define ALIGN_TO_8_BYTES \
|
|
|
|
{ dcerpc_info *xzdi; \
|
|
|
|
xzdi=pinfo->private_data; \
|
|
|
|
if(!xzdi->conformant_run) { \
|
|
|
|
if(offset&0x07) { \
|
|
|
|
offset=(offset&0xfffffff8)+8; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
}
|
2002-06-16 13:47:39 +00:00
|
|
|
#define ALIGN_TO_4_BYTES \
|
|
|
|
{ dcerpc_info *xzdi; \
|
|
|
|
xzdi=pinfo->private_data; \
|
|
|
|
if(!xzdi->conformant_run) { \
|
|
|
|
if(offset&0x03) { \
|
|
|
|
offset=(offset&0xfffffffc)+4; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
}
|
2005-01-22 19:56:12 +00:00
|
|
|
#define ALIGN_TO_2_BYTES \
|
|
|
|
{ dcerpc_info *xzdi; \
|
|
|
|
xzdi=pinfo->private_data; \
|
|
|
|
if(!xzdi->conformant_run) { \
|
|
|
|
if(offset&0x01) { \
|
|
|
|
offset=(offset&0xfffffffe)+2; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
}
|
2002-03-06 08:58:01 +00:00
|
|
|
|
2005-01-30 11:56:37 +00:00
|
|
|
int
|
|
|
|
dissect_ndr_counted_ascii_string_cb(tvbuff_t *tvb, int offset,
|
|
|
|
packet_info *pinfo, proto_tree *tree,
|
|
|
|
guint8 *drep, int hf_index,
|
|
|
|
dcerpc_callback_fnct_t *callback,
|
|
|
|
void *callback_args);
|
|
|
|
int
|
|
|
|
dissect_ndr_counted_ascii_string(tvbuff_t *tvb, int offset,
|
|
|
|
packet_info *pinfo, proto_tree *tree,
|
|
|
|
guint8 *drep, int hf_index, int levels);
|
|
|
|
|
2002-03-06 08:58:01 +00:00
|
|
|
int
|
2003-02-03 02:00:54 +00:00
|
|
|
dissect_ndr_counted_string_cb(tvbuff_t *tvb, int offset,
|
|
|
|
packet_info *pinfo, proto_tree *tree,
|
2004-01-19 20:10:37 +00:00
|
|
|
guint8 *drep, int hf_index,
|
2003-02-03 02:00:54 +00:00
|
|
|
dcerpc_callback_fnct_t *callback,
|
|
|
|
void *callback_args);
|
2003-01-28 06:27:01 +00:00
|
|
|
|
|
|
|
int
|
2003-02-03 02:00:54 +00:00
|
|
|
dissect_ndr_counted_string_ptr(tvbuff_t *tvb, int offset,
|
|
|
|
packet_info *pinfo, proto_tree *parent_tree,
|
2004-01-19 20:10:37 +00:00
|
|
|
guint8 *drep);
|
2003-01-28 06:27:01 +00:00
|
|
|
|
2002-03-11 00:15:20 +00:00
|
|
|
int
|
2003-02-03 02:00:54 +00:00
|
|
|
dissect_ndr_counted_string(tvbuff_t *tvb, int offset,
|
|
|
|
packet_info *pinfo, proto_tree *parent_tree,
|
2004-01-19 20:10:37 +00:00
|
|
|
guint8 *drep, int hf_index, int levels);
|
2003-01-28 06:27:01 +00:00
|
|
|
|
2003-02-08 09:41:44 +00:00
|
|
|
int
|
|
|
|
dissect_ndr_counted_byte_array(tvbuff_t *tvb, int offset,
|
|
|
|
packet_info *pinfo, proto_tree *parent_tree,
|
2005-01-30 02:52:25 +00:00
|
|
|
guint8 *drep, int hf_index, int levels);
|
2003-02-08 09:41:44 +00:00
|
|
|
|
2003-05-09 01:43:59 +00:00
|
|
|
int
|
|
|
|
dissect_ndr_counted_byte_array_cb(tvbuff_t *tvb, int offset,
|
|
|
|
packet_info *pinfo, proto_tree *tree,
|
2004-01-19 20:10:37 +00:00
|
|
|
guint8 *drep, int hf_index,
|
2003-05-09 01:43:59 +00:00
|
|
|
dcerpc_callback_fnct_t *callback,
|
|
|
|
void *callback_args);
|
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
int
|
|
|
|
dissect_ndr_nt_acct_ctrl(tvbuff_t *tvb, int offset, packet_info *pinfo,
|
2004-01-19 20:10:37 +00:00
|
|
|
proto_tree *parent_tree, guint8 *drep);
|
2005-02-01 05:21:08 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
dissect_nt_GUID(tvbuff_t *tvb, int offset,
|
|
|
|
packet_info *pinfo, proto_tree *tree,
|
|
|
|
guint8 *drep);
|
|
|
|
|
2002-03-10 23:24:48 +00:00
|
|
|
int
|
2002-08-28 21:04:11 +00:00
|
|
|
dissect_ndr_nt_NTTIME (tvbuff_t *tvb, int offset,
|
|
|
|
packet_info *pinfo, proto_tree *tree,
|
2004-01-19 20:10:37 +00:00
|
|
|
guint8 *drep, int hf_index);
|
2002-03-11 00:00:15 +00:00
|
|
|
int
|
2002-08-28 21:04:11 +00:00
|
|
|
dissect_ndr_nt_LOGON_HOURS(tvbuff_t *tvb, int offset,
|
2002-03-11 00:00:15 +00:00
|
|
|
packet_info *pinfo, proto_tree *parent_tree,
|
2004-01-19 20:10:37 +00:00
|
|
|
guint8 *drep);
|
2002-03-11 00:28:21 +00:00
|
|
|
int
|
2002-08-28 21:04:11 +00:00
|
|
|
dissect_ndr_nt_SID(tvbuff_t *tvb, int offset,
|
2004-05-19 04:52:31 +00:00
|
|
|
packet_info *pinfo, proto_tree *tree,
|
|
|
|
guint8 *drep);
|
2002-03-11 00:28:21 +00:00
|
|
|
int
|
2005-02-16 11:31:56 +00:00
|
|
|
dissect_ndr_nt_SID_with_options(tvbuff_t *tvb, int offset,
|
|
|
|
packet_info *pinfo, proto_tree *tree,
|
|
|
|
guint8 *drep, guint32 options);
|
|
|
|
int
|
2002-08-28 21:04:11 +00:00
|
|
|
dissect_ndr_nt_PSID(tvbuff_t *tvb, int offset,
|
2004-05-19 04:52:31 +00:00
|
|
|
packet_info *pinfo, proto_tree *parent_tree,
|
|
|
|
guint8 *drep);
|
2002-03-11 00:28:21 +00:00
|
|
|
int
|
2002-08-28 21:04:11 +00:00
|
|
|
dissect_ndr_nt_PSID_ARRAY(tvbuff_t *tvb, int offset,
|
2002-03-11 00:28:21 +00:00
|
|
|
packet_info *pinfo, proto_tree *parent_tree,
|
2004-01-19 20:10:37 +00:00
|
|
|
guint8 *drep);
|
2002-03-11 00:28:21 +00:00
|
|
|
|
|
|
|
int
|
2002-08-28 21:04:11 +00:00
|
|
|
dissect_ndr_nt_SID_AND_ATTRIBUTES_ARRAY(tvbuff_t *tvb, int offset,
|
2002-03-11 00:28:21 +00:00
|
|
|
packet_info *pinfo, proto_tree *parent_tree,
|
2004-01-19 20:10:37 +00:00
|
|
|
guint8 *drep);
|
2002-03-11 00:28:21 +00:00
|
|
|
int
|
2002-08-28 21:04:11 +00:00
|
|
|
dissect_ndr_nt_SID_AND_ATTRIBUTES(tvbuff_t *tvb, int offset,
|
2002-03-11 00:28:21 +00:00
|
|
|
packet_info *pinfo, proto_tree *parent_tree,
|
2004-01-19 20:10:37 +00:00
|
|
|
guint8 *drep);
|
2002-03-11 00:28:21 +00:00
|
|
|
|
2002-03-25 05:42:02 +00:00
|
|
|
/*
|
|
|
|
* Policy handle hashing
|
|
|
|
*/
|
|
|
|
|
2002-06-28 01:23:26 +00:00
|
|
|
/* Store open and close packet numbers for a policy handle */
|
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
void
|
In the policy handle hashing, handle more than one policy handle having
the same value, as an open might return handle XXX, handle XXX might
then be closed, and a subsequent handle might return handle XXX, and we
want to keep the two handles distinct to avoid, for example, displaying
handles closed before they're opened.
In policy handle open replies, store the handle name only if the
operation succeeded. We can now do that without parsing the packet
twice.
Have "dissect_nt_policy_hnd()" optionally return, through a pointer, the
protocol tree item for the handle, so that its caller can decorate the
item with the name of the handle - that's done on opens, where we do
that only if the operation succeeds.
svn path=/trunk/; revision=7787
2003-06-05 04:22:04 +00:00
|
|
|
dcerpc_smb_store_pol_pkts(e_ctx_hnd *policy_hnd, packet_info *pinfo,
|
|
|
|
gboolean is_open, gboolean is_close);
|
2002-06-28 01:23:26 +00:00
|
|
|
|
|
|
|
/* Store a name with a policy handle */
|
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
void
|
In the policy handle hashing, handle more than one policy handle having
the same value, as an open might return handle XXX, handle XXX might
then be closed, and a subsequent handle might return handle XXX, and we
want to keep the two handles distinct to avoid, for example, displaying
handles closed before they're opened.
In policy handle open replies, store the handle name only if the
operation succeeded. We can now do that without parsing the packet
twice.
Have "dissect_nt_policy_hnd()" optionally return, through a pointer, the
protocol tree item for the handle, so that its caller can decorate the
item with the name of the handle - that's done on opens, where we do
that only if the operation succeeds.
svn path=/trunk/; revision=7787
2003-06-05 04:22:04 +00:00
|
|
|
dcerpc_smb_store_pol_name(e_ctx_hnd *policy_hnd, packet_info *pinfo,
|
2005-07-26 08:01:16 +00:00
|
|
|
const char *name);
|
2002-06-28 01:23:26 +00:00
|
|
|
|
|
|
|
/* Fetch details stored with a policy handle */
|
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
gboolean
|
|
|
|
dcerpc_smb_fetch_pol(e_ctx_hnd *policy_hnd, char **name,
|
In the policy handle hashing, handle more than one policy handle having
the same value, as an open might return handle XXX, handle XXX might
then be closed, and a subsequent handle might return handle XXX, and we
want to keep the two handles distinct to avoid, for example, displaying
handles closed before they're opened.
In policy handle open replies, store the handle name only if the
operation succeeded. We can now do that without parsing the packet
twice.
Have "dissect_nt_policy_hnd()" optionally return, through a pointer, the
protocol tree item for the handle, so that its caller can decorate the
item with the name of the handle - that's done on opens, where we do
that only if the operation succeeds.
svn path=/trunk/; revision=7787
2003-06-05 04:22:04 +00:00
|
|
|
guint32 *open_frame, guint32 *close_frame,
|
|
|
|
guint32 cur_frame);
|
2002-03-25 05:42:02 +00:00
|
|
|
|
2002-04-16 02:02:04 +00:00
|
|
|
/* Dissect NT specific things */
|
|
|
|
|
|
|
|
int
|
|
|
|
dissect_ntstatus(tvbuff_t *tvb, gint offset, packet_info *pinfo,
|
2004-01-19 20:10:37 +00:00
|
|
|
proto_tree *tree, guint8 *drep,
|
2002-04-16 02:02:04 +00:00
|
|
|
int hfindex, guint32 *pdata);
|
|
|
|
|
2002-05-09 02:44:22 +00:00
|
|
|
int
|
|
|
|
dissect_doserror(tvbuff_t *tvb, gint offset, packet_info *pinfo,
|
2004-01-19 20:10:37 +00:00
|
|
|
proto_tree *tree, guint8 *drep,
|
2002-05-09 02:44:22 +00:00
|
|
|
int hfindex, guint32 *pdata);
|
|
|
|
|
2002-04-17 07:52:26 +00:00
|
|
|
int
|
|
|
|
dissect_nt_policy_hnd(tvbuff_t *tvb, gint offset, packet_info *pinfo,
|
2004-01-19 20:10:37 +00:00
|
|
|
proto_tree *tree, guint8 *drep, int hfindex,
|
In the policy handle hashing, handle more than one policy handle having
the same value, as an open might return handle XXX, handle XXX might
then be closed, and a subsequent handle might return handle XXX, and we
want to keep the two handles distinct to avoid, for example, displaying
handles closed before they're opened.
In policy handle open replies, store the handle name only if the
operation succeeded. We can now do that without parsing the packet
twice.
Have "dissect_nt_policy_hnd()" optionally return, through a pointer, the
protocol tree item for the handle, so that its caller can decorate the
item with the name of the handle - that's done on opens, where we do
that only if the operation succeeds.
svn path=/trunk/; revision=7787
2003-06-05 04:22:04 +00:00
|
|
|
e_ctx_hnd *pdata, proto_item **pitem,
|
|
|
|
gboolean is_open, gboolean is_close);
|
2002-04-17 07:52:26 +00:00
|
|
|
|
2002-04-17 10:29:09 +00:00
|
|
|
int
|
|
|
|
dissect_nt_LUID(tvbuff_t *tvb, int offset,
|
2002-08-28 21:04:11 +00:00
|
|
|
packet_info *pinfo, proto_tree *tree,
|
2004-01-19 20:10:37 +00:00
|
|
|
guint8 *drep);
|
2002-04-17 10:29:09 +00:00
|
|
|
|
2002-05-09 02:44:22 +00:00
|
|
|
/* Stored here instead of packet-dcerpc{,-ndr}.c as they are probably not
|
|
|
|
official NDR representations. */
|
|
|
|
|
|
|
|
int dissect_dcerpc_uint8s(tvbuff_t *tvb, gint offset, packet_info *pinfo,
|
2004-01-19 20:10:37 +00:00
|
|
|
proto_tree *tree, guint8 *drep,
|
2002-11-28 03:57:50 +00:00
|
|
|
int hfindex, int length, const guint8 **pdata);
|
2002-05-09 02:44:22 +00:00
|
|
|
|
|
|
|
int dissect_ndr_uint8s(tvbuff_t *tvb, gint offset, packet_info *pinfo,
|
2004-01-19 20:10:37 +00:00
|
|
|
proto_tree *tree, guint8 *drep,
|
2002-11-28 03:57:50 +00:00
|
|
|
int hfindex, int length, const guint8 **pdata);
|
2002-05-09 02:44:22 +00:00
|
|
|
|
2002-06-05 04:17:47 +00:00
|
|
|
int dissect_dcerpc_uint16s(tvbuff_t *tvb, gint offset, packet_info *pinfo,
|
2004-01-19 20:10:37 +00:00
|
|
|
proto_tree *tree, guint8 *drep,
|
2002-11-28 21:03:36 +00:00
|
|
|
int hfindex, int length);
|
2002-06-05 04:17:47 +00:00
|
|
|
|
|
|
|
int dissect_ndr_uint16s(tvbuff_t *tvb, gint offset, packet_info *pinfo,
|
2004-01-19 20:10:37 +00:00
|
|
|
proto_tree *tree, guint8 *drep,
|
2002-11-28 21:03:36 +00:00
|
|
|
int hfindex, int length);
|
2002-06-05 04:17:47 +00:00
|
|
|
|
2003-01-28 06:27:01 +00:00
|
|
|
int dissect_ndr_str_pointer_item(tvbuff_t *tvb, gint offset,
|
|
|
|
packet_info *pinfo, proto_tree *tree,
|
2005-07-26 08:01:16 +00:00
|
|
|
guint8 *drep, int type, const char *text,
|
2003-01-30 08:19:39 +00:00
|
|
|
int hf_index, int levels);
|
2003-01-28 06:27:01 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Helper routines for dissecting NDR strings
|
|
|
|
*/
|
|
|
|
|
2003-01-30 08:19:39 +00:00
|
|
|
/* Number of levels to go up appending string to pointer item */
|
|
|
|
#define CB_STR_ITEM_LEVELS(x) ((x) & 0xFFFF)
|
|
|
|
#define CB_STR_COL_INFO 0x10000 /* Append string to COL_INFO */
|
|
|
|
#define CB_STR_SAVE 0x20000 /* Save string to dcv->private_data */
|
2003-01-28 06:27:01 +00:00
|
|
|
|
2003-04-27 00:49:14 +00:00
|
|
|
void cb_wstr_postprocess(packet_info *pinfo, proto_tree *tree _U_,
|
|
|
|
proto_item *item, tvbuff_t *tvb,
|
|
|
|
int start_offset, int end_offset,
|
|
|
|
void *callback_args);
|
2003-01-28 06:27:01 +00:00
|
|
|
void cb_str_postprocess(packet_info *pinfo, proto_tree *tree _U_,
|
|
|
|
proto_item *item, tvbuff_t *tvb,
|
|
|
|
int start_offset, int end_offset,
|
|
|
|
void *callback_args);
|
2003-01-24 05:32:54 +00:00
|
|
|
|
|
|
|
/* Initialise DCERPC over SMB */
|
|
|
|
|
|
|
|
void dcerpc_smb_init(int proto_dcerpc);
|
|
|
|
|
2001-12-16 20:17:10 +00:00
|
|
|
#endif /* packet-dcerpc-nt.h */
|