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
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2001-12-16 20:17:10 +00:00
|
|
|
* 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
|
|
|
|
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
|
|
|
|
2009-10-03 02:44:31 +00:00
|
|
|
#define ALIGN_TO_5_BYTES ALIGN_TO_4_OR_8_BYTES
|
|
|
|
|
2009-10-03 00:10:35 +00:00
|
|
|
#define ALIGN_TO_4_OR_8_BYTES \
|
|
|
|
{ dcerpc_info *xzdi2; \
|
|
|
|
xzdi2=pinfo->private_data; \
|
|
|
|
if (xzdi2->call_data->flags & DCERPC_IS_NDR64) { \
|
|
|
|
ALIGN_TO_8_BYTES; \
|
|
|
|
} else { \
|
|
|
|
ALIGN_TO_4_BYTES; \
|
|
|
|
} \
|
|
|
|
}
|
2009-10-03 02:44:31 +00:00
|
|
|
|
2010-02-08 00:48:45 +00:00
|
|
|
#define ALIGN_TO_3_BYTES ALIGN_TO_2_OR_4_BYTES
|
|
|
|
|
|
|
|
#define ALIGN_TO_2_OR_4_BYTES \
|
|
|
|
{ dcerpc_info *xzdi2; \
|
|
|
|
xzdi2=pinfo->private_data; \
|
|
|
|
if (xzdi2->call_data->flags & DCERPC_IS_NDR64) { \
|
|
|
|
ALIGN_TO_4_BYTES; \
|
|
|
|
} else { \
|
|
|
|
ALIGN_TO_2_BYTES; \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
2009-10-03 02:44:31 +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);
|
|
|
|
|
2009-10-06 08:07:17 +00:00
|
|
|
int
|
|
|
|
dissect_ndr_lsa_String(tvbuff_t *tvb, int offset, packet_info *pinfo,
|
|
|
|
proto_tree *parent_tree, guint8 *drep,
|
|
|
|
guint32 param, int hfindex);
|
|
|
|
|
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
|
2007-08-28 11:45:08 +00:00
|
|
|
dcerpc_store_polhnd_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
|
2007-08-28 11:45:08 +00:00
|
|
|
dcerpc_fetch_polhnd_data(e_ctx_hnd *policy_hnd, char **name, guint32 *type,
|
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
|
|
|
|
2007-02-20 09:01:50 +00:00
|
|
|
int
|
|
|
|
PIDL_dissect_policy_hnd(tvbuff_t *tvb, gint offset, packet_info *pinfo,
|
|
|
|
proto_tree *tree, guint8 *drep, int hfindex,
|
|
|
|
guint32 param);
|
|
|
|
|
2005-11-11 22:12:10 +00:00
|
|
|
int
|
|
|
|
dissect_nt_guid_hnd(tvbuff_t *tvb, gint offset, packet_info *pinfo,
|
|
|
|
proto_tree *tree, guint8 *drep, int hfindex,
|
|
|
|
e_ctx_hnd *pdata, proto_item **pitem,
|
|
|
|
gboolean is_open, gboolean is_close);
|
|
|
|
|
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)
|
2007-08-28 11:45:08 +00:00
|
|
|
#define CB_STR_SAVE 0x20000000 /* Save string to dcv->private_data */
|
|
|
|
#define CB_STR_COL_INFO 0x10000000 /* Append string to COL_INFO */
|
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);
|
|
|
|
|
2009-10-20 08:44:26 +00:00
|
|
|
/* Used into packet-dcerpc-netlogon.c*/
|
2009-10-20 10:03:55 +00:00
|
|
|
extern int hf_nt_cs_len;
|
|
|
|
extern int hf_nt_cs_size;
|
2007-08-28 11:45:08 +00:00
|
|
|
|
2001-12-16 20:17:10 +00:00
|
|
|
#endif /* packet-dcerpc-nt.h */
|