* Routines for DCERPC over SMB packet disassembly
* Copyright 2001-2003, Tim Potter <tpot@samba.org>
*
- * $Id: packet-dcerpc-nt.c,v 1.57 2003/01/28 23:26:11 tpot Exp $
+ * $Id: packet-dcerpc-nt.c,v 1.78 2004/01/19 20:10:35 jmayer Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* dissectors for ethereal.
*/
-/* Convert a string from little-endian unicode to ascii. At the moment we
- fake it by taking every odd byte. )-: The caller must free the
- result returned. */
-
-char *fake_unicode(tvbuff_t *tvb, int offset, int len)
-{
- char *buffer;
- int i;
- guint16 character;
-
- /* Make sure we have enough data before allocating the buffer,
- so we don't blow up if the length is huge.
- We do so by attempting to fetch the last character; it'll
- throw an exception if it's past the end. */
- tvb_get_letohs(tvb, offset + 2*(len - 1));
-
- /* We know we won't throw an exception, so we don't have to worry
- about leaking this buffer. */
- buffer = g_malloc(len + 1);
-
- for (i = 0; i < len; i++) {
- character = tvb_get_letohs(tvb, offset);
- buffer[i] = character & 0xff;
- offset += 2;
- }
-
- buffer[len] = 0;
+/*
+ * Used by several dissectors.
+ */
+const value_string platform_id_vals[] = {
+ { 300, "DOS" },
+ { 400, "OS/2" },
+ { 500, "Windows NT" },
+ { 600, "OSF" },
+ { 700, "VMS" },
+ { 0, NULL }
+};
- return buffer;
-}
+/* Parse some common RPC structures */
-/* following are a few functions for dissecting common structures used by NT
- services. These might need to be cleaned up at a later time but at least we get
- them out of the real service dissectors.
-*/
-
-
-/* UNICODE_STRING BEGIN */
-/* functions to dissect a UNICODE_STRING structure, common to many
- NT services
- struct {
- short len;
- short size;
- [size_is(size/2), length_is(len/2), ptr] unsigned short *string;
- } UNICODE_STRING;
-
- these variables can be found in packet-dcerpc-samr.c
-*/
-extern int hf_nt_str_len;
-extern int hf_nt_str_off;
-extern int hf_nt_str_max_len;
-extern int hf_nt_string_length;
-extern int hf_nt_string_size;
-
-gint ett_nt_unicode_string = -1;
-static gint ett_nt_policy_hnd = -1;
+gint ett_nt_unicode_string = -1; /* FIXME: make static */
-/* this function will dissect the
- [size_is(size/2), length_is(len/2), ptr] unsigned short *string;
- part of the unicode string
+/* Dissect a counted string as a callback to dissect_ndr_pointer_cb() */
- struct {
- short len;
- short size;
- [size_is(size/2), length_is(len/2), ptr] unsigned short *string;
- } UNICODE_STRING;
- structure used by NT to transmit unicode string values.
+static int hf_nt_cs_len = -1;
+static int hf_nt_cs_size = -1;
-*/
int
-dissect_ndr_nt_UNICODE_STRING_str(tvbuff_t *tvb, int offset,
- packet_info *pinfo, proto_tree *tree,
- char *drep)
+dissect_ndr_counted_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)
{
- guint32 len;
- dcerpc_info *di;
- char *text;
+ dcerpc_info *di = pinfo->private_data;
+ guint16 len, size;
- di=pinfo->private_data;
- if(di->conformant_run){
- /*just a run to handle conformant arrays, nothing to dissect */
+ /* Structure starts with short, but is aligned for longs */
+
+ ALIGN_TO_4_BYTES;
+
+ if (di->conformant_run)
return offset;
- }
+
+ /*
+ struct {
+ short len;
+ short size;
+ [size_is(size/2), length_is(len/2), ptr] unsigned short *string;
+ } UNICODE_STRING;
- offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
- hf_nt_str_max_len, NULL);
- offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
- hf_nt_str_off, NULL);
- offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
- hf_nt_str_len, &len);
+ */
- if (offset % 2)
- offset++;
+ offset = dissect_ndr_uint16(tvb, offset, pinfo, tree, drep,
+ hf_nt_cs_len, &len);
- if (tree) {
- text = fake_unicode(tvb, offset, len);
- proto_tree_add_string (tree, di->hf_index, tvb, offset, len * 2, text);
- g_free(text);
- }
+ offset = dissect_ndr_uint16(tvb, offset, pinfo, tree, drep,
+ hf_nt_cs_size, &size);
- offset += len * 2;
+ offset = dissect_ndr_pointer_cb(tvb, offset, pinfo, tree, drep,
+ dissect_ndr_wchar_cvstring, NDR_POINTER_UNIQUE,
+ "Character Array", hf_index, callback, callback_args);
- return offset;
+ return offset;
}
-/* this function will dissect the
- struct {
- short len;
- short size;
- [size_is(size/2), length_is(len/2), ptr] unsigned short *string;
- } UNICODE_STRING;
- structure used by NT to transmit unicode string values.
-*/
-int
-dissect_ndr_nt_UNICODE_STRING_cb(tvbuff_t *tvb, int offset,
- packet_info *pinfo, proto_tree *parent_tree,
- char *drep, int hf_index,
- dcerpc_callback_fnct_t *callback,
- void *callback_args)
+static gint ett_nt_counted_string = -1;
+
+static int
+dissect_ndr_counted_string_helper(tvbuff_t *tvb, int offset,
+ packet_info *pinfo, proto_tree *tree,
+ guint8 *drep, int hf_index, int levels,
+ gboolean add_subtree)
{
- proto_item *item=NULL;
- proto_tree *tree=NULL;
- int old_offset=offset;
- dcerpc_info *di;
- char *name;
+ proto_item *item;
+ proto_tree *subtree = tree;
- ALIGN_TO_4_BYTES; /* strcture starts with short, but is aligned for longs */
+ if (add_subtree) {
- di=pinfo->private_data;
- if(di->conformant_run){
- /*just a run to handle conformant arrays, nothing to dissect */
- return offset;
- }
+ item = proto_tree_add_text(
+ tree, tvb, offset, 0,
+ proto_registrar_get_name(hf_index));
- name = proto_registrar_get_name(hf_index);
- if(parent_tree){
- item = proto_tree_add_text(parent_tree, tvb, offset, -1,
- "%s", name);
- tree = proto_item_add_subtree(item, ett_nt_unicode_string);
+ subtree = proto_item_add_subtree(item, ett_nt_counted_string);
}
- offset = dissect_ndr_uint16 (tvb, offset, pinfo, tree, drep,
- hf_nt_string_length, NULL);
- offset = dissect_ndr_uint16 (tvb, offset, pinfo, tree, drep,
- hf_nt_string_size, NULL);
- offset = dissect_ndr_pointer_cb(tvb, offset, pinfo, tree, drep,
- dissect_ndr_nt_UNICODE_STRING_str, NDR_POINTER_UNIQUE,
- name, hf_index, callback, callback_args);
-
- proto_item_set_len(item, offset-old_offset);
- return offset;
+ /*
+ * Add 2 levels, so that the string gets attached to the
+ * "Character Array" top-level item and to the top-level item
+ * added above.
+ */
+ return dissect_ndr_counted_string_cb(
+ tvb, offset, pinfo, subtree, drep, hf_index,
+ cb_wstr_postprocess, GINT_TO_POINTER(2 + levels));
}
-/* UNICODE_STRING END */
+
+/* Dissect a counted string in-line. */
int
-dissect_ndr_nt_UNICODE_STRING(tvbuff_t *tvb, int offset,
- packet_info *pinfo, proto_tree *parent_tree,
- char *drep, int hf_index)
+dissect_ndr_counted_string(tvbuff_t *tvb, int offset,
+ packet_info *pinfo, proto_tree *tree,
+ guint8 *drep, int hf_index, int levels)
{
- return dissect_ndr_nt_UNICODE_STRING_cb(
- tvb, offset, pinfo, parent_tree, drep, hf_index,
- cb_str_postprocess, GINT_TO_POINTER(CB_STR_ITEM));
+ return dissect_ndr_counted_string_helper(
+ tvb, offset, pinfo, tree, drep, hf_index, levels, TRUE);
}
-/* functions to dissect a STRING structure, common to many
- NT services
- struct {
- short len;
- short size;
- [size_is(size), length_is(len), ptr] char *string;
- } STRING;
-*/
+/* Dissect a counted string as a callback to dissect_ndr_pointer().
+ This doesn't add a adds a proto item and subtreee for the string as
+ the pointer dissection already creates one. */
+
int
-dissect_ndr_nt_STRING_string(tvbuff_t *tvb, int offset,
- packet_info *pinfo, proto_tree *tree,
- char *drep)
+dissect_ndr_counted_string_ptr(tvbuff_t *tvb, int offset,
+ packet_info *pinfo, proto_tree *tree,
+ guint8 *drep)
{
- guint32 len, off, max_len;
- const guint8 *text;
- header_field_info *hfi;
- dcerpc_info *di;
+ dcerpc_info *di = pinfo->private_data;
- di=pinfo->private_data;
- if(di->conformant_run){
- /*just a run to handle conformant arrays, nothing to dissect */
- return offset;
- }
+ return dissect_ndr_counted_string_helper(
+ tvb, offset, pinfo, tree, drep, di->hf_index, 0, FALSE);
+}
- offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
- hf_nt_str_max_len, &max_len);
- offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
- hf_nt_str_off, &off);
- offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
- hf_nt_str_len, &len);
-
- hfi = proto_registrar_get_nth(di->hf_index);
-
- switch(hfi->type){
- case FT_STRING:
- text = tvb_get_ptr(tvb, offset, len);
- break;
- case FT_BYTES:
- text = NULL;
- break;
- default:
- text = NULL;
- g_assert_not_reached();
- }
- proto_tree_add_item(tree, di->hf_index, tvb, offset, len, FALSE);
- offset += len;
+/* Dissect a counted byte_array as a callback to dissect_ndr_pointer_cb() */
- return offset;
-}
+static gint ett_nt_counted_byte_array = -1;
+
+/* Dissect a counted byte array in-line. */
int
-dissect_ndr_nt_STRING_cb(tvbuff_t *tvb, int offset,
- packet_info *pinfo, proto_tree *parent_tree,
- char *drep, int hf_index,
- dcerpc_callback_fnct_t *callback,
- void *callback_args)
+dissect_ndr_counted_byte_array_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)
{
- proto_item *item=NULL;
- proto_tree *tree=NULL;
- int old_offset=offset;
- dcerpc_info *di;
- char *name;
+ dcerpc_info *di = pinfo->private_data;
+ proto_item *item;
+ proto_tree *subtree;
+ guint16 len, size;
- ALIGN_TO_4_BYTES; /* strcture starts with short, but is aligned for longs */
+ /* Structure starts with short, but is aligned for longs */
- di=pinfo->private_data;
- if(di->conformant_run){
- /*just a run to handle conformant arrays, nothing to dissect */
+ ALIGN_TO_4_BYTES;
+
+ if (di->conformant_run)
return offset;
- }
- name = proto_registrar_get_name(hf_index);
- if(parent_tree){
- item = proto_tree_add_text(parent_tree, tvb, offset, -1,
- "%s", name);
- tree = proto_item_add_subtree(item, ett_nt_unicode_string);
- }
+ item = proto_tree_add_text(tree, tvb, offset, 0,
+ proto_registrar_get_name(hf_index));
+
+ subtree = proto_item_add_subtree(item, ett_nt_counted_byte_array);
+
+ /*
+ struct {
+ short len;
+ short size;
+ [size_is(size), length_is(len), ptr] unsigned char *string;
+ } WHATEVER_THIS_IS_CALLED;
+
+ */
- offset = dissect_ndr_uint16 (tvb, offset, pinfo, tree, drep,
- hf_nt_string_length, NULL);
- offset = dissect_ndr_uint16 (tvb, offset, pinfo, tree, drep,
- hf_nt_string_size, NULL);
- offset = dissect_ndr_pointer_cb(tvb, offset, pinfo, tree, drep,
- dissect_ndr_nt_STRING_string, NDR_POINTER_UNIQUE,
- name, hf_index, callback, callback_args);
+ offset = dissect_ndr_uint16(tvb, offset, pinfo, subtree, drep,
+ hf_nt_cs_len, &len);
+
+ offset = dissect_ndr_uint16(tvb, offset, pinfo, subtree, drep,
+ hf_nt_cs_size, &size);
+
+ offset = dissect_ndr_pointer_cb(tvb, offset, pinfo, subtree, drep,
+ dissect_ndr_char_cvstring, NDR_POINTER_UNIQUE,
+ "Byte Array", hf_index, callback, callback_args);
- proto_item_set_len(item, offset-old_offset);
return offset;
}
int
-dissect_ndr_nt_STRING(tvbuff_t *tvb, int offset,
- packet_info *pinfo, proto_tree *parent_tree,
- char *drep, int hf_index)
+dissect_ndr_counted_byte_array(tvbuff_t *tvb, int offset,
+ packet_info *pinfo, proto_tree *tree,
+ guint8 *drep, int hf_index)
{
- return dissect_ndr_nt_STRING_cb(
- tvb, offset, pinfo, parent_tree, drep, hf_index,
- cb_str_postprocess, GINT_TO_POINTER(CB_STR_ITEM));
+ return dissect_ndr_counted_byte_array_cb(
+ tvb, offset, pinfo, tree, drep, hf_index, NULL, NULL);
}
/* This function is used to dissect a DCERPC encoded 64 bit time value.
int
dissect_ndr_nt_NTTIME (tvbuff_t *tvb, int offset,
packet_info *pinfo, proto_tree *tree,
- char *drep _U_, int hf_index)
+ guint8 *drep _U_, int hf_index)
{
dcerpc_info *di;
#undef DEBUG_HASH_COLL
/*
- * Policy handle hashing
+ * Policy handle hashing.
+ *
+ * We hash based on the policy handle value; the items in the hash table
+ * are lists of policy handle information about one or more policy
+ * handles with that value. We have multiple values in case a given
+ * policy handle is opened in frame N, closed in frame M, and re-opened
+ * in frame O, where N < M < O.
+ *
+ * XXX - we really should also use a DCE RPC conversation/session handle
+ * of some sort, in case two separate sessions have the same handle
+ * value. A transport-layer conversation might not be sufficient, as you
+ * might, for example, have multiple pipes in a single SMB connection,
+ * and you might have the same handle opened and closed separately on
+ * those two pipes.
+ *
+ * The policy handle information has "first frame" and "last frame"
+ * information; the entry should be used when dissecting a given frame
+ * only if that frame is within the interval [first frame,last frame].
+ * The list is sorted by "first frame".
+ *
+ * This doesn't handle the case of a handle being opened in frame N and
+ * re-opened in frame M, where N < M, with no intervening close, but I'm
+ * not sure anything can handle that if it's within the same DCE RPC
+ * session (if it's not, the conversation/session handle would fix that).
*/
typedef struct {
guint8 policy_hnd[20];
} pol_hash_key;
-typedef struct {
+typedef struct pol_value {
+ struct pol_value *next; /* Next entry in hash bucket */
guint32 open_frame, close_frame; /* Frame numbers for open/close */
+ guint32 first_frame; /* First frame in which this instance was seen */
+ guint32 last_frame; /* Last frame in which this instance was seen */
char *name; /* Name of policy handle */
+} pol_value;
+
+typedef struct {
+ pol_value *list; /* List of policy handle entries */
} pol_hash_value;
#define POL_HASH_INIT_COUNT 100
static GHashTable *pol_hash;
static GMemChunk *pol_hash_key_chunk;
+static GMemChunk *pol_value_chunk;
static GMemChunk *pol_hash_value_chunk;
/* Hash function */
sizeof(key1->policy_hnd)) == 0;
}
-/* Store the open and close frame numbers of a policy handle */
+/*
+ * Look up the instance of a policy handle value in whose range of frames
+ * the specified frame falls.
+ */
+static pol_value *find_pol_handle(e_ctx_hnd *policy_hnd, guint32 frame,
+ pol_hash_value **valuep)
+{
+ pol_hash_key key;
+ pol_value *pol;
-void dcerpc_smb_store_pol_pkts(e_ctx_hnd *policy_hnd, guint32 open_frame,
- guint32 close_frame)
+ memcpy(&key.policy_hnd, policy_hnd, sizeof(key.policy_hnd));
+ if ((*valuep = g_hash_table_lookup(pol_hash, &key))) {
+ /*
+ * Look for the first value such that both:
+ *
+ * 1) the first frame in which it was seen is
+ * <= the specified frame;
+ *
+ * 2) the last frame in which it was seen is
+ * either unknown (meaning we haven't yet
+ * seen a close or another open of the
+ * same handle, which is assumed to imply
+ * an intervening close that wasn't captured)
+ * or is >= the specified frame.
+ *
+ * If there's more than one such frame, that's the
+ * case where a handle is opened in frame N and
+ * reopened in frame M, with no intervening close;
+ * there is no right answer for that, so the instance
+ * opened in frame N is as right as anything else.
+ */
+ for (pol = (*valuep)->list; pol != NULL; pol = pol->next) {
+ if (pol->first_frame <= frame &&
+ (pol->last_frame == 0 ||
+ pol->last_frame >= frame))
+ break; /* found one */
+ }
+ return pol;
+ } else {
+ /*
+ * The handle isn't in the hash table.
+ */
+ return NULL;
+ }
+}
+
+static void add_pol_handle(e_ctx_hnd *policy_hnd, guint32 frame,
+ pol_value *pol, pol_hash_value *value)
{
pol_hash_key *key;
+ pol_value *polprev, *polnext;
+
+ if (value == NULL) {
+ /*
+ * There's no hash value; create one, put the new
+ * value at the beginning of its policy handle list,
+ * and put the hash value in the policy handle hash
+ * table.
+ */
+ value = g_mem_chunk_alloc(pol_hash_value_chunk);
+ value->list = pol;
+ pol->next = NULL;
+ key = g_mem_chunk_alloc(pol_hash_key_chunk);
+ memcpy(&key->policy_hnd, policy_hnd, sizeof(key->policy_hnd));
+ g_hash_table_insert(pol_hash, key, value);
+ } else {
+ /*
+ * Put the new value in the hash value's policy handle
+ * list so that it's sorted by the first frame in
+ * which it appeared.
+ *
+ * Search for the first entry whose first frame number
+ * is greater than the current frame number, if any.
+ */
+ for (polnext = value->list, polprev = NULL;
+ polnext != NULL && polnext->first_frame <= frame;
+ polprev = polnext, polnext = polnext->next)
+ ;
+
+ /*
+ * "polprev" points to the entry in the list after
+ * which we should put the new entry; if it's null,
+ * that means we should put it at the beginning of
+ * the list.
+ */
+ if (polprev == NULL)
+ value->list = pol;
+ else
+ polprev->next = pol;
+
+ /*
+ * "polnext" points to the entry in the list before
+ * which we should put the new entry; if it's null,
+ * that means we should put it at the end of the list.
+ */
+ pol->next = polnext;
+ }
+}
+
+/* Store the open and close frame numbers of a policy handle */
+
+void dcerpc_smb_store_pol_pkts(e_ctx_hnd *policy_hnd, packet_info *pinfo,
+ gboolean is_open, gboolean is_close)
+{
pol_hash_value *value;
+ pol_value *pol;
+
+ /*
+ * By the time the first pass is done, the policy handle database
+ * has been completely constructed. If we've already seen this
+ * frame, there's nothing to do.
+ */
+ if (pinfo->fd->flags.visited)
+ return;
- if (is_null_pol(policy_hnd) || (open_frame == 0 && close_frame == 0))
+ if (is_null_pol(policy_hnd))
return;
/* Look up existing value */
-
- key = g_mem_chunk_alloc(pol_hash_key_chunk);
-
- memcpy(&key->policy_hnd, policy_hnd, sizeof(key->policy_hnd));
-
- if ((value = g_hash_table_lookup(pol_hash, key))) {
-
- /* Update existing value */
-
- if (open_frame) {
-#ifdef DEBUG_HASH_COLL
- if (value->open_frame != open_frame)
- g_warning("dcerpc_smb: pol_hash open frame collision %d/%d\n", value->open_frame, open_frame);
-#endif
- value->open_frame = open_frame;
+ pol = find_pol_handle(policy_hnd, pinfo->fd->num, &value);
+
+ if (pol != NULL) {
+ /*
+ * Update the existing value as appropriate.
+ */
+ if (is_open) {
+ /*
+ * This is an open; we assume that we missed
+ * a close of this handle, so we set its
+ * "last frame" value and act as if we didn't
+ * see it.
+ *
+ * XXX - note that we might be called twice for
+ * the same operation (see "dissect_pipe_dcerpc()",
+ * which calls the DCE RPC dissector twice), so we
+ * must first check to see if this is a handle we
+ * just filled in.
+ *
+ * We check whether this handle's "first frame"
+ * frame number is this frame and its "last frame
+ * is 0; if so, this is presumably a duplicate call,
+ * and we don't do an implicit close.
+ */
+ if (pol->first_frame == pinfo->fd->num &&
+ pol->last_frame == 0)
+ return;
+ pol->last_frame = pinfo->fd->num;
+ pol = NULL;
+ } else {
+ if (is_close) {
+ pol->close_frame = pinfo->fd->num;
+ pol->last_frame = pinfo->fd->num;
+ }
+ return;
}
-
- if (close_frame) {
-#ifdef DEBUG_HASH_COLL
- if (value->close_frame != close_frame)
- g_warning("dcerpc_smb: pol_hash close frame collision %d/%d\n", value->close_frame, close_frame);
-#endif
- value->close_frame = close_frame;
- }
-
- return;
}
/* Create a new value */
- value = g_mem_chunk_alloc(pol_hash_value_chunk);
+ pol = g_mem_chunk_alloc(pol_value_chunk);
- value->open_frame = open_frame;
- value->close_frame = close_frame;
+ pol->open_frame = is_open ? pinfo->fd->num : 0;
+ pol->close_frame = is_close ? pinfo->fd->num : 0;
+ pol->first_frame = pinfo->fd->num;
+ pol->last_frame = pol->close_frame; /* if 0, unknown; if non-0, known */
- value->name = NULL;
+ pol->name = NULL;
- g_hash_table_insert(pol_hash, key, value);
+ add_pol_handle(policy_hnd, pinfo->fd->num, pol, value);
}
/* Store a text string with a policy handle */
-void dcerpc_smb_store_pol_name(e_ctx_hnd *policy_hnd, char *name)
+void dcerpc_smb_store_pol_name(e_ctx_hnd *policy_hnd, packet_info *pinfo,
+ char *name)
{
- pol_hash_key *key;
pol_hash_value *value;
+ pol_value *pol;
+
+ /*
+ * By the time the first pass is done, the policy handle database
+ * has been completely constructed. If we've already seen this
+ * frame, there's nothing to do.
+ */
+ if (pinfo->fd->flags.visited)
+ return;
if (is_null_pol(policy_hnd))
return;
/* Look up existing value */
-
- key = g_mem_chunk_alloc(pol_hash_key_chunk);
-
- memcpy(&key->policy_hnd, policy_hnd, sizeof(key->policy_hnd));
-
- if ((value = g_hash_table_lookup(pol_hash, key))) {
-
- /* Update existing value */
-
- if (value->name && name) {
+ pol = find_pol_handle(policy_hnd, pinfo->fd->num, &value);
+
+ if (pol != NULL) {
+ /*
+ * This is the first pass; update the existing
+ * value as appropriate.
+ */
+ if (pol->name && name) {
#ifdef DEBUG_HASH_COLL
- if (strcmp(value->name, name) != 0)
+ if (strcmp(pol->name, name) != 0)
g_warning("dcerpc_smb: pol_hash name collision %s/%s\n", value->name, name);
#endif
- free(value->name);
+ free(pol->name);
}
- value->name = strdup(name);
+ pol->name = strdup(name);
return;
}
/* Create a new value */
- value = g_mem_chunk_alloc(pol_hash_value_chunk);
+ pol = g_mem_chunk_alloc(pol_value_chunk);
- value->open_frame = 0;
- value->close_frame = 0;
+ pol->open_frame = 0;
+ pol->close_frame = 0;
+ pol->first_frame = pinfo->fd->num;
+ pol->last_frame = 0;
if (name)
- value->name = strdup(name);
+ pol->name = strdup(name);
else
- value->name = strdup("<UNKNOWN>");
+ pol->name = strdup("<UNKNOWN>");
- g_hash_table_insert(pol_hash, key, value);
+ add_pol_handle(policy_hnd, pinfo->fd->num, pol, value);
}
-/* Retrieve a policy handle */
+/*
+ * Retrieve a policy handle.
+ *
+ * XXX - should this get an "is_close" argument, and match even closed
+ * policy handles if the call is a close, so we can handle retransmitted
+ * close operations?
+ */
gboolean dcerpc_smb_fetch_pol(e_ctx_hnd *policy_hnd, char **name,
- guint32 *open_frame, guint32 *close_frame)
+ guint32 *open_frame, guint32 *close_frame,
+ guint32 cur_frame)
{
- pol_hash_key key;
pol_hash_value *value;
+ pol_value *pol;
/* Prevent uninitialised return vars */
*close_frame = 0;
/* Look up existing value */
+ pol = find_pol_handle(policy_hnd, cur_frame, &value);
- memcpy(&key.policy_hnd, policy_hnd, sizeof(key.policy_hnd));
-
- value = g_hash_table_lookup(pol_hash, &key);
-
- /* Return name and frame numbers */
-
- if (value) {
+ if (pol) {
if (name)
- *name = value->name;
+ *name = pol->name;
if (open_frame)
- *open_frame = value->open_frame;
+ *open_frame = pol->open_frame;
if (close_frame)
- *close_frame = value->close_frame;
+ *close_frame = pol->close_frame;
}
- return value != NULL;
+ return pol != NULL;
}
-/* Iterator to free a policy handle key/value pair */
+/* Iterator to free a policy handle key/value pair, and all
+ the policy handle values to which the hash table value
+ points */
-static void free_pol_keyvalue(gpointer key _U_, gpointer value,
+static void free_pol_keyvalue(gpointer key _U_, gpointer value_arg,
gpointer user_data _U_)
{
- pol_hash_value *pol_value = (pol_hash_value *)value;
+ pol_hash_value *value = (pol_hash_value *)value_arg;
+ pol_value *pol;
/* Free user data */
- if (pol_value->name) {
- free(pol_value->name);
- pol_value->name = NULL;
+ for (pol = value->list; pol != NULL; pol = pol->next) {
+ free(pol->name);
+ pol->name = NULL;
}
}
"Policy handle hash keys", sizeof(pol_hash_key),
POL_HASH_INIT_COUNT * sizeof(pol_hash_key), G_ALLOC_ONLY);
+ if (pol_value_chunk)
+ g_mem_chunk_destroy(pol_value_chunk);
+
+ pol_value_chunk = g_mem_chunk_new(
+ "Policy handle values", sizeof(pol_value),
+ POL_HASH_INIT_COUNT * sizeof(pol_value), G_ALLOC_ONLY);
+
if (pol_hash_value_chunk)
g_mem_chunk_destroy(pol_hash_value_chunk);
pol_hash = g_hash_table_new(pol_hash_fn, pol_hash_compare);
}
-/* Dissect an access mask. All this stuff is kind of explained at MSDN:
-
-http://msdn.microsoft.com/library/default.asp?url=/library/en-us/security/security/windows_2000_windows_nt_access_mask_format.asp
-
-*/
-
-static gint ett_nt_access_mask = -1;
-static gint ett_nt_access_mask_generic = -1;
-static gint ett_nt_access_mask_standard = -1;
-static gint ett_nt_access_mask_specific = -1;
-
-static int hf_access_sacl = -1;
-static int hf_access_maximum_allowed = -1;
-static int hf_access_generic_read = -1;
-static int hf_access_generic_write = -1;
-static int hf_access_generic_execute = -1;
-static int hf_access_generic_all = -1;
-static int hf_access_standard_delete = -1;
-static int hf_access_standard_read_control = -1;
-static int hf_access_standard_synchronise = -1;
-static int hf_access_standard_write_dac = -1;
-static int hf_access_standard_write_owner = -1;
-static int hf_access_specific_15 = -1;
-static int hf_access_specific_14 = -1;
-static int hf_access_specific_13 = -1;
-static int hf_access_specific_12 = -1;
-static int hf_access_specific_11 = -1;
-static int hf_access_specific_10 = -1;
-static int hf_access_specific_9 = -1;
-static int hf_access_specific_8 = -1;
-static int hf_access_specific_7 = -1;
-static int hf_access_specific_6 = -1;
-static int hf_access_specific_5 = -1;
-static int hf_access_specific_4 = -1;
-static int hf_access_specific_3 = -1;
-static int hf_access_specific_2 = -1;
-static int hf_access_specific_1 = -1;
-static int hf_access_specific_0 = -1;
-
-int
-dissect_nt_access_mask(tvbuff_t *tvb, gint offset, packet_info *pinfo,
- proto_tree *tree, char *drep, int hfindex,
- nt_access_mask_fn_t *specific_rights_fn)
-{
- proto_item *item;
- proto_tree *subtree, *generic, *standard, *specific;
- guint32 access;
-
- offset = dissect_ndr_uint32(tvb, offset, pinfo, NULL, drep,
- hfindex, &access);
-
- item = proto_tree_add_uint(tree, hfindex, tvb, offset - 4, 4, access);
-
- subtree = proto_item_add_subtree(item, ett_nt_access_mask);
-
- /* Generic access rights */
-
- item = proto_tree_add_text(subtree, tvb, offset - 4, 4,
- "Generic rights: 0x%08x",
- access & GENERIC_RIGHTS_MASK);
-
- generic = proto_item_add_subtree(item, ett_nt_access_mask_generic);
-
- proto_tree_add_boolean(
- generic, hf_access_generic_read, tvb, offset - 4, 4,
- access);
-
- proto_tree_add_boolean(
- generic, hf_access_generic_write, tvb, offset - 4, 4,
- access);
-
- proto_tree_add_boolean(
- generic, hf_access_generic_execute, tvb, offset - 4, 4,
- access);
-
- proto_tree_add_boolean(
- generic, hf_access_generic_all, tvb, offset - 4, 4,
- access);
-
- /* Reserved (??) */
-
- proto_tree_add_boolean(
- subtree, hf_access_maximum_allowed, tvb, offset - 4, 4,
- access);
-
- /* Access system security */
-
- proto_tree_add_boolean(
- subtree, hf_access_sacl, tvb, offset - 4, 4,
- access);
-
- /* Standard access rights */
-
- item = proto_tree_add_text(subtree, tvb, offset - 4, 4,
- "Standard rights: 0x%08x",
- access & STANDARD_RIGHTS_MASK);
-
- standard = proto_item_add_subtree(item, ett_nt_access_mask_standard);
-
- proto_tree_add_boolean(
- standard, hf_access_standard_synchronise, tvb, offset - 4, 4,
- access);
-
- proto_tree_add_boolean(
- standard, hf_access_standard_write_owner, tvb, offset - 4, 4,
- access);
-
- proto_tree_add_boolean(
- standard, hf_access_standard_write_dac, tvb, offset - 4, 4,
- access);
-
- proto_tree_add_boolean(
- standard, hf_access_standard_read_control, tvb, offset - 4, 4,
- access);
-
- proto_tree_add_boolean(
- standard, hf_access_standard_delete, tvb, offset - 4, 4,
- access);
-
- /* Specific access rights. Call the specific_rights_fn
- pointer if we have one, otherwise just display bits 0-15 in
- boring fashion. */
-
- item = proto_tree_add_text(subtree, tvb, offset - 4, 4,
- "Specific rights: 0x%08x",
- access & SPECIFIC_RIGHTS_MASK);
-
- specific = proto_item_add_subtree(item, ett_nt_access_mask_specific);
-
- if (specific_rights_fn) {
- specific_rights_fn(tvb, offset - 4, specific, access);
- return offset;
- }
-
- proto_tree_add_boolean(
- specific, hf_access_specific_15, tvb, offset - 4, 4,
- access);
-
- proto_tree_add_boolean(
- specific, hf_access_specific_14, tvb, offset - 4, 4,
- access);
-
- proto_tree_add_boolean(
- specific, hf_access_specific_13, tvb, offset - 4, 4,
- access);
-
- proto_tree_add_boolean(
- specific, hf_access_specific_12, tvb, offset - 4, 4,
- access);
-
- proto_tree_add_boolean(
- specific, hf_access_specific_11, tvb, offset - 4, 4,
- access);
-
- proto_tree_add_boolean(
- specific, hf_access_specific_10, tvb, offset - 4, 4,
- access);
-
- proto_tree_add_boolean(
- specific, hf_access_specific_9, tvb, offset - 4, 4,
- access);
-
- proto_tree_add_boolean(
- specific, hf_access_specific_8, tvb, offset - 4, 4,
- access);
-
- proto_tree_add_boolean(
- specific, hf_access_specific_7, tvb, offset - 4, 4,
- access);
-
- proto_tree_add_boolean(
- specific, hf_access_specific_6, tvb, offset - 4, 4,
- access);
-
- proto_tree_add_boolean(
- specific, hf_access_specific_5, tvb, offset - 4, 4,
- access);
-
- proto_tree_add_boolean(
- specific, hf_access_specific_4, tvb, offset - 4, 4,
- access);
-
- proto_tree_add_boolean(
- specific, hf_access_specific_3, tvb, offset - 4, 4,
- access);
-
- proto_tree_add_boolean(
- specific, hf_access_specific_2, tvb, offset - 4, 4,
- access);
-
- proto_tree_add_boolean(
- specific, hf_access_specific_1, tvb, offset - 4, 4,
- access);
-
- proto_tree_add_boolean(
- specific, hf_access_specific_0, tvb, offset - 4, 4,
- access);
-
- return offset;
-}
-
-/* Check if there is unparsed data remaining in a frame and display an
- error. I guess this could be made into an exception like the malformed
- frame exception. For the DCERPC over SMB dissectors a long frame
- indicates a bug in a dissector. */
-
-void dcerpc_smb_check_long_frame(tvbuff_t *tvb, int offset,
- packet_info *pinfo, proto_tree *tree)
-{
- if (tvb_length_remaining(tvb, offset) != 0) {
-
- proto_tree_add_text(
- tree, tvb, offset, tvb_length_remaining(tvb, offset),
- "[Long frame (%d bytes): SPOOLSS]",
- tvb_length_remaining(tvb, offset));
-
- if (check_col(pinfo->cinfo, COL_INFO))
- col_append_fstr(pinfo->cinfo, COL_INFO,
- "[Long frame (%d bytes): SPOOLSS]",
- tvb_length_remaining(tvb, offset));
- }
-}
-
/* Dissect a NT status code */
int
dissect_ntstatus(tvbuff_t *tvb, gint offset, packet_info *pinfo,
- proto_tree *tree, char *drep,
+ proto_tree *tree, guint8 *drep,
int hfindex, guint32 *pdata)
{
guint32 status;
int
dissect_doserror(tvbuff_t *tvb, gint offset, packet_info *pinfo,
- proto_tree *tree, char *drep,
+ proto_tree *tree, guint8 *drep,
int hfindex, guint32 *pdata)
{
guint32 status;
static int hf_nt_policy_open_frame = -1;
static int hf_nt_policy_close_frame = -1;
+static gint ett_nt_policy_hnd = -1;
+
int
dissect_nt_policy_hnd(tvbuff_t *tvb, gint offset, packet_info *pinfo,
- proto_tree *tree, char *drep, int hfindex,
- e_ctx_hnd *pdata, gboolean is_open, gboolean is_close)
+ proto_tree *tree, guint8 *drep, int hfindex,
+ e_ctx_hnd *pdata, proto_item **pitem,
+ gboolean is_open, gboolean is_close)
{
proto_item *item;
proto_tree *subtree;
guint32 open_frame = 0, close_frame = 0;
char *name;
int old_offset = offset;
+ dcerpc_info *di;
+
+ di=pinfo->private_data;
+ if(di->conformant_run){
+ /*
+ * just a run to handle conformant arrays, no scalars to
+ * dissect - and "dissect_ndr_ctx_hnd()" won't return
+ * a handle, so we can't do the hashing stuff in any
+ * case
+ */
+ return offset;
+ }
/* Add to proto tree */
offset = dissect_ndr_ctx_hnd(tvb, offset, pinfo, subtree, drep,
hfindex, &hnd);
- /* Store request/reply information */
+ /*
+ * Create a new entry for this handle if it's not a null handle
+ * and no entry already exists, and, in any case, set the
+ * open, close, first, and last frame information as appropriate.
+ */
+ dcerpc_smb_store_pol_pkts(&hnd, pinfo, is_open, is_close);
- dcerpc_smb_store_pol_pkts(&hnd, 0, is_close ? pinfo->fd->num : 0);
- dcerpc_smb_store_pol_pkts(&hnd, is_open ? pinfo->fd->num: 0, 0);
+ /* Insert open/close/name information if known */
- /* Insert request/reply information if known */
-
- if (dcerpc_smb_fetch_pol(&hnd, &name, &open_frame, &close_frame)) {
+ if (dcerpc_smb_fetch_pol(&hnd, &name, &open_frame, &close_frame,
+ pinfo->fd->num)) {
if (open_frame)
proto_tree_add_uint(
subtree, hf_nt_policy_close_frame, tvb,
old_offset, sizeof(e_ctx_hnd), close_frame);
- if (name != NULL)
+ /*
+ * Don't append the handle name if pitem is null; that's
+ * an indication that our caller will do so, as we're
+ * supplying a pointer to the item so that they can do
+ * so.
+ */
+ if (name != NULL && pitem == NULL)
proto_item_append_text(item, ": %s", name);
}
if (pdata)
*pdata = hnd;
+ if (pitem)
+ *pitem = item;
+
return offset;
}
int
dissect_dcerpc_uint8s(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_,
- proto_tree *tree, char *drep, int hfindex,
+ proto_tree *tree, guint8 *drep, int hfindex,
int length, const guint8 **pdata)
{
const guint8 *data;
int
dissect_ndr_uint8s(tvbuff_t *tvb, gint offset, packet_info *pinfo,
- proto_tree *tree, char *drep,
+ proto_tree *tree, guint8 *drep,
int hfindex, int length, const guint8 **pdata)
{
dcerpc_info *di;
int
dissect_dcerpc_uint16s(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_,
- proto_tree *tree, char *drep, int hfindex,
+ proto_tree *tree, guint8 *drep, int hfindex,
int length)
{
if (tree) {
int
dissect_ndr_uint16s(tvbuff_t *tvb, gint offset, packet_info *pinfo,
- proto_tree *tree, char *drep,
+ proto_tree *tree, guint8 *drep,
int hfindex, int length)
{
dcerpc_info *di;
* Helper routines for dissecting NDR strings
*/
+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)
+{
+ gint options = GPOINTER_TO_INT(callback_args);
+ gint levels = CB_STR_ITEM_LEVELS(options);
+ char *s;
+
+ /* Align start_offset on 4-byte boundary. */
+
+ if (start_offset % 4)
+ start_offset += 4 - (start_offset % 4);
+
+ /* Get string value */
+
+ if ((end_offset - start_offset) <= 12)
+ return; /* XXX: Use unistr2 dissector instead? */
+
+ /*
+ * XXX - need to handle non-printable characters here.
+ *
+ * XXX - this is typically called after the string has already
+ * been fetched and processed by some other routine; is there
+ * some way we can get that string, rather than duplicating the
+ * efforts of that routine?
+ */
+ s = tvb_fake_unicode(
+ tvb, start_offset + 12, (end_offset - start_offset - 12) / 2,
+ TRUE);
+
+ /* Append string to COL_INFO */
+
+ if (options & CB_STR_COL_INFO) {
+ if (check_col(pinfo->cinfo, COL_INFO))
+ col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", s);
+ }
+
+ /* Append string to upper-level proto_items */
+
+ if (levels > 0 && item && s && s[0]) {
+ proto_item_append_text(item, ": %s", s);
+ item = item->parent;
+ levels--;
+ if (levels > 0) {
+ proto_item_append_text(item, ": %s", s);
+ item = item->parent;
+ levels--;
+ while (levels > 0) {
+ proto_item_append_text(item, " %s", s);
+ item = item->parent;
+ levels--;
+ }
+ }
+ }
+
+ /* Save string to dcv->private_data */
+
+ if (options & CB_STR_SAVE) {
+ dcerpc_info *di = (dcerpc_info *)pinfo->private_data;
+ dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
+
+ dcv->private_data = g_strdup(s);
+ }
+
+ g_free(s);
+}
+
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)
{
gint options = GPOINTER_TO_INT(callback_args);
+ gint levels = CB_STR_ITEM_LEVELS(options);
char *s;
+ /* Align start_offset on 4-byte boundary. */
+
+ if (start_offset % 4)
+ start_offset += 4 - (start_offset % 4);
+
/* Get string value */
if ((end_offset - start_offset) <= 12)
return; /* XXX: Use unistr2 dissector instead? */
- s = fake_unicode(
- tvb, start_offset + 12, (end_offset - start_offset - 12) / 2);
+ /*
+ * XXX - need to handle non-printable characters here.
+ *
+ * XXX - this is typically called after the string has already
+ * been fetched and processed by some other routine; is there
+ * some way we can get that string, rather than duplicating the
+ * efforts of that routine?
+ */
+ s = tvb_get_string(
+ tvb, start_offset + 12, (end_offset - start_offset - 12) );
/* Append string to COL_INFO */
col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", s);
}
- /* Append string to top level pointer proto_item */
+ /* Append string to upper-level proto_items */
- if (options & CB_STR_ITEM)
+ if (levels > 0 && item && s && s[0]) {
proto_item_append_text(item, ": %s", s);
+ item = item->parent;
+ levels--;
+ if (levels > 0) {
+ proto_item_append_text(item, ": %s", s);
+ item = item->parent;
+ levels--;
+ while (levels > 0) {
+ proto_item_append_text(item, " %s", s);
+ item = item->parent;
+ levels--;
+ }
+ }
+ }
/* Save string to dcv->private_data */
int dissect_ndr_str_pointer_item(tvbuff_t *tvb, gint offset,
packet_info *pinfo, proto_tree *tree,
- char *drep, int type, char *text,
- int hf_index)
+ guint8 *drep, int type, char *text,
+ int hf_index, int levels)
{
return dissect_ndr_pointer_cb(
tvb, offset, pinfo, tree, drep,
- dissect_ndr_nt_UNICODE_STRING_str, type, text, hf_index,
- cb_str_postprocess, GINT_TO_POINTER(CB_STR_ITEM));
+ dissect_ndr_wchar_cvstring, type, text, hf_index,
+ cb_wstr_postprocess, GINT_TO_POINTER(levels + 1));
}
/*
{
static hf_register_info hf[] = {
- /* Access mask */
-
- { &hf_access_generic_read,
- { "Generic read", "nt.access_mask.generic_read",
- FT_BOOLEAN, 32, TFS(&flags_set_truth),
- GENERIC_READ_ACCESS, "Generic read", HFILL }},
-
- { &hf_access_generic_write,
- { "Generic write", "nt.access_mask.generic_write",
- FT_BOOLEAN, 32, TFS(&flags_set_truth),
- GENERIC_WRITE_ACCESS, "Generic write", HFILL }},
-
- { &hf_access_generic_execute,
- { "Generic execute", "nt.access_mask.generic_execute",
- FT_BOOLEAN, 32, TFS(&flags_set_truth),
- GENERIC_EXECUTE_ACCESS, "Generic execute", HFILL }},
-
- { &hf_access_generic_all,
- { "Generic all", "nt.access_mask.generic_all",
- FT_BOOLEAN, 32, TFS(&flags_set_truth),
- GENERIC_ALL_ACCESS, "Generic all", HFILL }},
-
- { &hf_access_maximum_allowed,
- { "Maximum allowed", "nt.access_mask.maximum_allowed",
- FT_BOOLEAN, 32, TFS(&flags_set_truth),
- MAXIMUM_ALLOWED_ACCESS, "Maximum allowed", HFILL }},
-
- { &hf_access_sacl,
- { "Access SACL", "nt.access_mask.access_sacl",
- FT_BOOLEAN, 32, TFS(&flags_set_truth),
- ACCESS_SACL_ACCESS, "Access SACL", HFILL }},
-
- { &hf_access_standard_read_control,
- { "Read control", "nt.access_mask.read_control",
- FT_BOOLEAN, 32, TFS(&flags_set_truth),
- READ_CONTROL_ACCESS, "Read control", HFILL }},
-
- { &hf_access_standard_delete,
- { "Delete", "nt.access_mask.delete",
- FT_BOOLEAN, 32, TFS(&flags_set_truth),
- DELETE_ACCESS, "Delete", HFILL }},
-
- { &hf_access_standard_synchronise,
- { "Synchronise", "nt.access_mask.synchronise",
- FT_BOOLEAN, 32, TFS(&flags_set_truth),
- SYNCHRONIZE_ACCESS, "Synchronise", HFILL }},
-
- { &hf_access_standard_write_dac,
- { "Write DAC", "nt.access_mask.write_dac",
- FT_BOOLEAN, 32, TFS(&flags_set_truth),
- WRITE_DAC_ACCESS, "Write DAC", HFILL }},
-
- { &hf_access_standard_write_owner,
- { "Write owner", "nt.access_mask.write_owner",
- FT_BOOLEAN, 32, TFS(&flags_set_truth),
- WRITE_OWNER_ACCESS, "Write owner", HFILL }},
-
- { &hf_access_specific_15,
- { "Specific access, bit 15", "nt.access_mask.specific_15",
- FT_BOOLEAN, 32, TFS(&flags_set_truth),
- 0x8000, "Specific access, bit 15", HFILL }},
-
- { &hf_access_specific_14,
- { "Specific access, bit 14", "nt.access_mask.specific_14",
- FT_BOOLEAN, 32, TFS(&flags_set_truth),
- 0x4000, "Specific access, bit 14", HFILL }},
-
- { &hf_access_specific_13,
- { "Specific access, bit 13", "nt.access_mask.specific_13",
- FT_BOOLEAN, 32, TFS(&flags_set_truth),
- 0x2000, "Specific access, bit 13", HFILL }},
-
- { &hf_access_specific_12,
- { "Specific access, bit 12", "nt.access_mask.specific_12",
- FT_BOOLEAN, 32, TFS(&flags_set_truth),
- 0x1000, "Specific access, bit 12", HFILL }},
-
- { &hf_access_specific_11,
- { "Specific access, bit 11", "nt.access_mask.specific_11",
- FT_BOOLEAN, 32, TFS(&flags_set_truth),
- 0x0800, "Specific access, bit 11", HFILL }},
-
- { &hf_access_specific_10,
- { "Specific access, bit 10", "nt.access_mask.specific_10",
- FT_BOOLEAN, 32, TFS(&flags_set_truth),
- 0x0400, "Specific access, bit 10", HFILL }},
-
- { &hf_access_specific_9,
- { "Specific access, bit 9", "nt.access_mask.specific_9",
- FT_BOOLEAN, 32, TFS(&flags_set_truth),
- 0x0200, "Specific access, bit 9", HFILL }},
-
- { &hf_access_specific_8,
- { "Specific access, bit 8", "nt.access_mask.specific_8",
- FT_BOOLEAN, 32, TFS(&flags_set_truth),
- 0x0100, "Specific access, bit 8", HFILL }},
-
- { &hf_access_specific_7,
- { "Specific access, bit 7", "nt.access_mask.specific_7",
- FT_BOOLEAN, 32, TFS(&flags_set_truth),
- 0x0080, "Specific access, bit 7", HFILL }},
-
- { &hf_access_specific_6,
- { "Specific access, bit 6", "nt.access_mask.specific_6",
- FT_BOOLEAN, 32, TFS(&flags_set_truth),
- 0x0040, "Specific access, bit 6", HFILL }},
-
- { &hf_access_specific_5,
- { "Specific access, bit 5", "nt.access_mask.specific_5",
- FT_BOOLEAN, 32, TFS(&flags_set_truth),
- 0x0020, "Specific access, bit 5", HFILL }},
-
- { &hf_access_specific_4,
- { "Specific access, bit 4", "nt.access_mask.specific_4",
- FT_BOOLEAN, 32, TFS(&flags_set_truth),
- 0x0010, "Specific access, bit 4", HFILL }},
-
- { &hf_access_specific_3,
- { "Specific access, bit 3", "nt.access_mask.specific_3",
- FT_BOOLEAN, 32, TFS(&flags_set_truth),
- 0x0008, "Specific access, bit 3", HFILL }},
-
- { &hf_access_specific_2,
- { "Specific access, bit 2", "nt.access_mask.specific_2",
- FT_BOOLEAN, 32, TFS(&flags_set_truth),
- 0x0004, "Specific access, bit 2", HFILL }},
-
- { &hf_access_specific_1,
- { "Specific access, bit 1", "nt.access_mask.specific_1",
- FT_BOOLEAN, 32, TFS(&flags_set_truth),
- 0x0002, "Specific access, bit 1", HFILL }},
-
- { &hf_access_specific_0,
- { "Specific access, bit 0", "nt.access_mask.specific_0",
- FT_BOOLEAN, 32, TFS(&flags_set_truth),
- 0x0001, "Specific access, bit 0", HFILL }},
+ /* String handling */
+ { &hf_nt_cs_size,
+ { "Size", "nt.str.size", FT_UINT16, BASE_DEC,
+ NULL, 0x0, "Size of string in short integers",
+ HFILL }},
+
+ { &hf_nt_cs_len,
+ { "Length", "nt.str.len", FT_UINT16, BASE_DEC,
+ NULL, 0x0, "Length of string in short integers",
+ HFILL }},
+
/* Policy handles */
{ &hf_nt_policy_open_frame,
"Frame handle opened", HFILL }},
{ &hf_nt_policy_close_frame,
- { "Frame handle close", "dcerpc.nt.close_frame",
+ { "Frame handle closed", "dcerpc.nt.close_frame",
FT_FRAMENUM, BASE_NONE, NULL, 0x0,
"Frame handle closed", HFILL }},
};
static gint *ett[] = {
&ett_nt_unicode_string,
+ &ett_nt_counted_string,
+ &ett_nt_counted_byte_array,
&ett_nt_policy_hnd,
- &ett_nt_access_mask,
- &ett_nt_access_mask_generic,
- &ett_nt_access_mask_standard,
- &ett_nt_access_mask_specific,
};
/* Register ett's and hf's */