summaryrefslogtreecommitdiff
path: root/source4/build/pidl
diff options
context:
space:
mode:
Diffstat (limited to 'source4/build/pidl')
-rw-r--r--source4/build/pidl/eparser.pm87
-rw-r--r--source4/build/pidl/packet-dcerpc-eparser.c314
-rw-r--r--source4/build/pidl/packet-dcerpc-eparser.h41
3 files changed, 383 insertions, 59 deletions
diff --git a/source4/build/pidl/eparser.pm b/source4/build/pidl/eparser.pm
index 562797c9ea..05ab9a270e 100644
--- a/source4/build/pidl/eparser.pm
+++ b/source4/build/pidl/eparser.pm
@@ -81,7 +81,7 @@ sub find_size_var($$$)
}
if ($size =~ /ndr->|\(/) {
- return $size;
+ return $size;
}
my $prefix = "";
@@ -92,19 +92,19 @@ sub find_size_var($$$)
}
if ($fn->{TYPE} ne "FUNCTION") {
- return $prefix . "r->$size";
+ return $prefix . "elt_$size";
}
my $e2 = find_sibling($e, $size);
if (util::has_property($e2, "in") && util::has_property($e2, "out")) {
- return $prefix . "$var_prefix$size";
+ return $prefix . "elt_$size";
}
if (util::has_property($e2, "in")) {
- return $prefix . "r->in.$size";
+ return $prefix . "elt_$size";
}
if (util::has_property($e2, "out")) {
- return $prefix . "r->out.$size";
+ return $prefix . "elt_$size";
}
die "invalid variable in $size for element $e->{NAME} in $fn->{NAME}\n";
@@ -232,18 +232,14 @@ sub ParseArrayPull($$$)
my $size = find_size_var($e, util::array_size($e), $var_prefix);
my $alloc_size = $size;
- pidl "// ParseArrayPull under construction\n";
- return;
-
- pidl "\t{ guint32 _array_size;\n";
# if this is a conformant array then we use that size to allocate, and make sure
# we allocate enough to pull the elements
if (defined $e->{CONFORMANT_SIZE}) {
$alloc_size = $e->{CONFORMANT_SIZE};
- pidl "\tif ($size > $alloc_size) {\n";
- pidl "\t\treturn ndr_pull_error(ndr, \"Bad conformant size %u should be %u\", $alloc_size, $size);\n";
- pidl "\t}\n";
+ pidl "//\tif ($size > $alloc_size) {\n";
+ pidl "//\t\treturn ndr_pull_error(ndr, \"Bad conformant size %u should be %u\", $alloc_size, $size);\n";
+ pidl "//\t}\n";
} elsif (!util::is_inline_array($e)) {
if ($var_prefix =~ /^r->out/ && $size =~ /^\*r->in/) {
my $size2 = substr($size, 1);
@@ -252,6 +248,7 @@ sub ParseArrayPull($$$)
# non fixed arrays encode the size just before the array
pidl "\t{\n";
+ pidl "\t\tguint32 _array_size;\n\n";
pidl "\t\tdissect_ndr_uint32(ndr->tvb, ndr->offset, ndr->pinfo, ndr->tree, ndr->drep, hf_array_size, &_array_size);\n";
if ($size =~ /r->in/) {
pidl "\t\t// if (!(ndr->flags & LIBNDR_FLAG_REF_ALLOC) && _array_size != $size) {\n";
@@ -286,21 +283,20 @@ sub ParseArrayPull($$$)
if (my $length = util::has_property($e, "length_is")) {
$length = find_size_var($e, $length, $var_prefix);
pidl "\t\tguint32 _offset, _length;\n";
- pidl "\t\tndr_pull_uint32(ndr, &_offset);\n";
- pidl "\t\tndr_pull_uint32(ndr, &_length);\n";
- pidl "\t\tif (_offset != 0) return ndr_pull_error(ndr, \"Bad array offset 0x%08x\", _offset);\n";
+ pidl "\t\tndr_pull_uint32(ndr, hf_array_offset, &_offset);\n";
+ pidl "\t\tndr_pull_uint32(ndr, hf_array_length, &_length);\n";
+ pidl "//\t\tif (_offset != 0) return ndr_pull_error(ndr, \"Bad array offset 0x%08x\", _offset);\n";
pidl "\t\t//if (_length > $size || _length != $length) return ndr_pull_error(ndr, \"Bad array length 0x%08x > size 0x%08x\", _offset, $size);\n\n";
$size = "_length";
}
if (util::is_scalar_type($e->{TYPE})) {
- pidl "\t\tndr_pull_array_$e->{TYPE}(ndr, $ndr_flags, _array_size);\n";
+ pidl "\t\tndr_pull_array_$e->{TYPE}(ndr, hf_$e->{NAME}_$e->{TYPE}, $ndr_flags, $size);\n";
} else {
- pidl "\t\tndr_pull_array(ndr, $ndr_flags, /* sizeof($var_prefix$e->{NAME}\[0]), */ _array_size, ndr_pull_$e->{TYPE});\n";
+ pidl "\t\tndr_pull_array(ndr, $ndr_flags, $size, ndr_pull_$e->{TYPE});\n";
}
pidl "\t}\n";
- pidl "\t}\n";
}
@@ -320,19 +316,19 @@ sub ParseElementPullSwitch($$$$)
if (!defined $utype ||
!util::has_property($utype->{DATA}, "nodiscriminant")) {
my $e2 = find_sibling($e, $switch);
- pidl "\tint _level;\n";
+ pidl "\tguint16 _level;\n";
pidl "\tif (($ndr_flags) & NDR_SCALARS) {\n";
pidl "\t\tndr_pull_level(ndr, hf_level, &_level);\n";
if ($switch_var =~ /r->in/) {
- pidl "\t\t // if (!(ndr->flags & LIBNDR_FLAG_REF_ALLOC) && _level != $switch_var) {\n";
+ pidl "\t\tif (!(ndr->flags & LIBNDR_FLAG_REF_ALLOC) && _level != $switch_var) {\n";
} else {
- pidl "\t\t // if (_level != $switch_var) {\n";
+ pidl "\t\t//if (_level != $switch_var) {\n";
}
- pidl "\t\t\t // return ndr_pull_error(ndr, \"Bad switch value %u in $e->{NAME}\");\t\t}\n";
+ pidl "\t\t\t//return ndr_pull_error(ndr, \"Bad switch value %u in $e->{NAME}\");\t\t}\n";
if ($switch_var =~ /r->/) {
- pidl "// else { $switch_var = _level;\n }\n";
+ pidl "//else { $switch_var = _level;\n }\n";
}
- pidl "\t// }\n";
+ pidl "\t}\n";
}
my $sub_size = util::has_property($e, "subcontext");
@@ -378,8 +374,8 @@ sub ParseElementPullScalar($$$)
} else {
pidl "\tndr_pull_subcontext_flags_fn(ndr, $sub_size, $cprefix$var_prefix$e->{NAME}, (ndr_pull_flags_fn_t) ndr_pull_$e->{TYPE});\n";
}
- } elsif (util::is_builtin_type($e->{TYPE}) || $e->{TYPE} eq "policy_handle") {
- pidl "\tndr_pull_$e->{TYPE}(ndr, hf_$e->{NAME}_$e->{TYPE});\n";
+ } elsif (util::is_builtin_type($e->{TYPE})) {
+ pidl "\tndr_pull_$e->{TYPE}(ndr, hf_$e->{NAME}_$e->{TYPE}, &elt_$e->{NAME});\n";
} else {
pidl "\tndr_pull_$e->{TYPE}(ndr, $ndr_flags);\n";
}
@@ -429,8 +425,8 @@ sub ParseElementPullBuffer($$$)
pidl "\tndr_pull_subcontext_flags_fn(ndr, $sub_size, ndr_pull_$e->{TYPE});\n";
}
}
- } elsif (util::is_builtin_type($e->{TYPE}) || $e->{TYPE} eq "policy_handle") {
- pidl "\t\tndr_pull_$e->{TYPE}(ndr, hf_$e->{NAME}_$e->{TYPE});\n";
+ } elsif (util::is_builtin_type($e->{TYPE})) {
+ pidl "\t\tndr_pull_$e->{TYPE}(ndr, hf_$e->{NAME}_$e->{TYPE}, &elt_$e->{NAME});\n";
} elsif ($e->{POINTERS}) {
pidl "\t\tndr_pull_$e->{TYPE}(ndr, NDR_SCALARS|NDR_BUFFERS);\n";
} else {
@@ -451,6 +447,11 @@ sub ParseStructPull($)
my($struct) = shift;
my $conform_e;
+ for my $x (@{$struct->{ELEMENTS}}) {
+ pidl "\tg$x->{TYPE} elt_$x->{NAME};\n",
+ if util::is_builtin_type($x->{TYPE});
+ }
+
if (! defined $struct->{ELEMENTS}) {
return;
}
@@ -482,7 +483,7 @@ sub ParseStructPull($)
pidl "\tndr_pull_struct_start(ndr);\n";
if (defined $conform_e) {
- pidl "\tndr_pull_uint32(ndr, &$conform_e->{CONFORMANT_SIZE});\n";
+ pidl "\tndr_pull_uint32(ndr, hf_conformant_size, &$conform_e->{CONFORMANT_SIZE});\n";
}
my $align = struct_alignment($struct);
@@ -696,6 +697,8 @@ sub ParseFunctionPull($)
# declare any internal pointers we need
foreach my $e (@{$fn->{DATA}}) {
+ pidl "\tg$e->{TYPE} elt_$e->{NAME};\n",
+ if util::is_builtin_type($e->{TYPE});
if (util::need_wire_pointer($e) &&
util::has_property($e, "in")) {
pidl "\tguint32 _ptr_$e->{NAME};\n";
@@ -721,6 +724,8 @@ sub ParseFunctionPull($)
# declare any internal pointers we need
foreach my $e (@{$fn->{DATA}}) {
+ pidl "\tg$e->{TYPE} elt_$e->{NAME};\n",
+ if util::is_builtin_type($e->{TYPE});
if (util::need_wire_pointer($e) &&
util::has_property($e, "out")) {
pidl "\tguint32 _ptr_$e->{NAME};\n";
@@ -806,6 +811,7 @@ sub type2ft($)
return "FT_UINT32", if ($t eq "uint32");
return "FT_UINT16", if ($t eq "uint16");
+ return "FT_UINT8", if ($t eq "uint8");
return "FT_BYTES";
}
@@ -813,7 +819,8 @@ sub type2base($)
{
my($t) = shift;
- return "BASE_DEC", if ($t eq "uint32") or ($t eq "uint16");
+ return "BASE_DEC", if ($t eq "uint32") or ($t eq "uint16") or
+ ($t eq "uint8");
return "BASE_NONE";
}
@@ -962,6 +969,9 @@ sub Parse($$)
pidl "static int hf_rc = -1;\n";
pidl "static int hf_ptr = -1;\n";
pidl "static int hf_array_size = -1;\n";
+ pidl "static int hf_array_offset = -1;\n";
+ pidl "static int hf_array_length = -1;\n";
+ pidl "static int hf_conformant_size = -1;\n";
pidl "static int hf_level = -1;\n";
# Declarations for hf variables
@@ -993,16 +1003,19 @@ sub Parse($$)
pidl "};\n\n";
pidl "static guint16 ver_dcerpc_$module = " . $if_version . ";\n\n";
- pidl "void proto_register_dcerpc_$module(void)\n";
- pidl "{\n";
-
}
+ pidl "void proto_register_dcerpc_$module(void)\n";
+ pidl "{\n";
+
pidl "\tstatic hf_register_info hf[] = {\n";
pidl "\t{ &hf_opnum, { \"Operation\", \"$module.opnum\", FT_UINT16, BASE_DEC, NULL, 0x0, \"Operation\", HFILL }},\n";
pidl "\t{ &hf_rc, { \"Return code\", \"$module.rc\", FT_UINT32, BASE_HEX, VALS(NT_errors), 0x0, \"Return status code\", HFILL }},\n";
pidl "\t{ &hf_array_size, { \"Array size\", \"$module.array_size\", FT_UINT32, BASE_DEC, NULL, 0x0, \"Array size\", HFILL }},\n";
+ pidl "\t{ &hf_array_offset, { \"Array offset\", \"$module.array_offset\", FT_UINT32, BASE_DEC, NULL, 0x0, \"Array offset\", HFILL }},\n";
+ pidl "\t{ &hf_array_length, { \"Array length\", \"$module.array_length\", FT_UINT32, BASE_DEC, NULL, 0x0, \"Array length\", HFILL }},\n";
+ pidl "\t{ &hf_conformant_size, { \"Conformant size\", \"$module.conformant_size\", FT_UINT32, BASE_DEC, NULL, 0x0, \"Conformant size\", HFILL }},\n";
pidl "\t{ &hf_level, { \"Level\", \"$module.level\", FT_UINT32, BASE_DEC, NULL, 0x0, \"Level\", HFILL }},\n";
pidl "\t{ &hf_ptr, { \"Pointer\", \"$module.ptr\", FT_UINT32, BASE_HEX, NULL, 0x0, \"Pointer\", HFILL }},\n";
@@ -1036,6 +1049,14 @@ sub Parse($$)
pidl "\t\tdcerpc_dissectors, hf_opnum);\n";
pidl "}\n";
+ } else {
+
+ pidl "\tint proto_dcerpc;\n\n";
+ pidl "\tproto_dcerpc = proto_get_id_by_filter_name(\"dcerpc\");\n";
+ pidl "\tproto_register_field_array(proto_dcerpc, hf, array_length(hf));\n";
+
+ pidl "}\n";
+
}
close(OUT);
diff --git a/source4/build/pidl/packet-dcerpc-eparser.c b/source4/build/pidl/packet-dcerpc-eparser.c
index 5ae0a4a93e..11cc280831 100644
--- a/source4/build/pidl/packet-dcerpc-eparser.c
+++ b/source4/build/pidl/packet-dcerpc-eparser.c
@@ -6,6 +6,11 @@
#include "packet-dcerpc-nt.h"
#include "packet-dcerpc-eparser.h"
+static int hf_string4_len = -1;
+static int hf_string4_offset = -1;
+static int hf_string4_len2 = -1;
+static int hf_string_data = -1;
+
/* Create a ndr_pull structure from data stored in a tvb at a given offset. */
struct e_ndr_pull *ndr_pull_init(tvbuff_t *tvb, int offset, packet_info *pinfo,
@@ -20,6 +25,7 @@ struct e_ndr_pull *ndr_pull_init(tvbuff_t *tvb, int offset, packet_info *pinfo,
ndr->pinfo = pinfo;
ndr->tree = tree;
ndr->drep = drep;
+ ndr->flags = NDR_SCALARS|NDR_BUFFERS;
return ndr;
}
@@ -38,11 +44,11 @@ void ndr_pull_ptr(struct e_ndr_pull *e_ndr, int hf, guint32 *ptr)
e_ndr->tree, e_ndr->drep, hf, ptr);
}
-void ndr_pull_level(struct e_ndr_pull *e_ndr, int hf, int *ptr)
+void ndr_pull_level(struct e_ndr_pull *e_ndr, int hf, gint16 *data)
{
e_ndr->offset = dissect_ndr_uint16(
e_ndr->tvb, e_ndr->offset, e_ndr->pinfo,
- e_ndr->tree, e_ndr->drep, hf, ptr);
+ e_ndr->tree, e_ndr->drep, hf, data);
}
void ndr_pull_NTSTATUS(struct e_ndr_pull *e_ndr, int hf)
@@ -52,49 +58,250 @@ void ndr_pull_NTSTATUS(struct e_ndr_pull *e_ndr, int hf)
e_ndr->tree, e_ndr->drep, hf, NULL);
}
-void ndr_pull_uint8(struct e_ndr_pull *e_ndr, int hf)
+void ndr_pull_uint8(struct e_ndr_pull *e_ndr, int hf, guint8 *data)
{
e_ndr->offset = dissect_ndr_uint8(
e_ndr->tvb, e_ndr->offset, e_ndr->pinfo,
- e_ndr->tree, e_ndr->drep, hf, NULL);
+ e_ndr->tree, e_ndr->drep, hf, data);
}
-void ndr_pull_uint16(struct e_ndr_pull *e_ndr, int hf)
+void ndr_pull_uint16(struct e_ndr_pull *e_ndr, int hf, guint16 *data)
{
e_ndr->offset = dissect_ndr_uint16(
e_ndr->tvb, e_ndr->offset, e_ndr->pinfo,
- e_ndr->tree, e_ndr->drep, hf, NULL);
+ e_ndr->tree, e_ndr->drep, hf, data);
}
-void ndr_pull_uint32(struct e_ndr_pull *e_ndr, int hf)
+void ndr_pull_uint32(struct e_ndr_pull *e_ndr, int hf, guint32 *data)
{
e_ndr->offset = dissect_ndr_uint32(
e_ndr->tvb, e_ndr->offset, e_ndr->pinfo,
- e_ndr->tree, e_ndr->drep, hf, NULL);
+ e_ndr->tree, e_ndr->drep, hf, data);
}
-void ndr_pull_int64(struct e_ndr_pull *e_ndr, int hf)
+void ndr_pull_int64(struct e_ndr_pull *e_ndr, int hf, gint64 *data)
{
}
-void ndr_pull_uint64(struct e_ndr_pull *e_ndr, int hf)
+void ndr_pull_uint64(struct e_ndr_pull *e_ndr, int hf, guint64 *data)
{
}
-void ndr_pull_string(struct e_ndr_pull *e_ndr, int hf)
+void ndr_pull_string(struct e_ndr_pull *ndr, int ndr_flags)
{
+ guint32 len1, ofs, len2;
+ char *data;
+
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return;
+ }
+
+ switch (ndr->flags & LIBNDR_STRING_FLAGS) {
+ case LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_SIZE4:
+ case LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_NOTERM:
+
+ ndr_pull_uint32(ndr, hf_string4_len, &len1);
+ ndr_pull_uint32(ndr, hf_string4_offset, &ofs);
+ ndr_pull_uint32(ndr, hf_string4_len2, &len2);
+
+ if (len2 > 65535)
+ return;
+
+ data = g_malloc(len2*2);
+
+ proto_tree_add_bytes(ndr->tree, hf_string_data, ndr->tvb,
+ ndr->offset, len2 * 2, data);
+
+ g_free(data);
+
+ ndr->offset += len2 * 2;
+
+#if 0
+
+ ndr_pull_uint32(ndr, &len1));
+ ndr_pull_uint32(ndr, &ofs);
+ ndr_pull_uint32(ndr, &len2);
+ if (len2 > len1) {
+ return ndr_pull_error(ndr, NDR_ERR_STRING,
+ "Bad string lengths len1=%u ofs=%u len2=%u\n",
+ len1, ofs, len2);
+ }
+ if (len2 == 0) {
+ *s = talloc_strdup(ndr->mem_ctx, "");
+ break;
+ }
+ NDR_PULL_NEED_BYTES(ndr, len2*2);
+ ret = convert_string_talloc(ndr->mem_ctx, chset, CH_UNIX,
+ ndr->data+ndr->offset,
+ len2*2,
+ (const void **)&as);
+ if (ret == -1) {
+ return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
+ "Bad character conversion");
+ }
+ ndr_pull_advance(ndr, len2*2);
+
+ /* this is a way of detecting if a string is sent with the wrong
+ termination */
+ if (ndr->flags & LIBNDR_FLAG_STR_NOTERM) {
+ if (strlen(as) < len2) {
+ DEBUG(6,("short string '%s'\n", as));
+ }
+ } else {
+ if (strlen(as) == len2) {
+ DEBUG(6,("long string '%s'\n", as));
+ }
+ }
+ *s = as;
+
+#endif
+
+ break;
+
+ case LIBNDR_FLAG_STR_SIZE4:
+
+#if 0
+
+ ndr_pull_uint32(ndr, &len1);
+ NDR_PULL_NEED_BYTES(ndr, len1*2);
+ if (len1 == 0) {
+ *s = talloc_strdup(ndr->mem_ctx, "");
+ break;
+ }
+ ret = convert_string_talloc(ndr->mem_ctx, chset, CH_UNIX,
+ ndr->data+ndr->offset,
+ len1*2,
+ (const void **)&as);
+ if (ret == -1) {
+ return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
+ "Bad character conversion");
+ }
+ ndr_pull_advance(ndr, len1*2);
+ *s = as;
+
+#endif
+
+ break;
+
+ case LIBNDR_FLAG_STR_NULLTERM:
+
+#if 0
+
+ len1 = strnlen_w(ndr->data+ndr->offset,
+ (ndr->data_size - ndr->offset)/2);
+ if (len1*2+2 <= ndr->data_size - ndr->offset) {
+ len1++;
+ }
+ ret = convert_string_talloc(ndr->mem_ctx, chset, CH_UNIX,
+ ndr->data+ndr->offset,
+ len1*2,
+ (const void **)s);
+ if (ret == -1) {
+ return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
+ "Bad character conversion");
+ }
+ ndr_pull_advance(ndr, len1*2);
+
+#endif
+
+ break;
+
+ case LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_SIZE4:
+ case LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_NOTERM:
+
+#if 0
+
+ ndr_pull_uint32(ndr, &len1);
+ ndr_pull_uint32(ndr, &ofs);
+ ndr_pull_uint32(ndr, &len2);
+ if (len2 > len1) {
+ return ndr_pull_error(ndr, NDR_ERR_STRING,
+ "Bad ascii string lengths len1=%u ofs=%u len2=%u\n",
+ len1, ofs, len2);
+ }
+ NDR_ALLOC_N(ndr, as, (len2+1));
+ ndr_pull_bytes(ndr, as, len2);
+ as[len2] = 0;
+ (*s) = as;
+
+#endif
+
+ break;
+
+ case LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_LEN4:
+
+#if 0
+ ndr_pull_uint32(ndr, &ofs);
+ ndr_pull_uint32(ndr, &len2);
+ NDR_ALLOC_N(ndr, as, (len2+1));
+ ndr_pull_bytes(ndr, as, len2);
+ as[len2] = 0;
+ (*s) = as;
+
+#endif
+
+ break;
+
+ case LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_SIZE2:
+
+#if 0
+
+ ndr_pull_uint16(ndr, &len3);
+ NDR_ALLOC_N(ndr, as, (len3+1));
+ ndr_pull_bytes(ndr, as, len3);
+ as[len3] = 0;
+ (*s) = as;
+
+#endif
+
+ break;
+
+ case LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM:
+
+#if 0
+
+ len1 = strnlen(ndr->data+ndr->offset, (ndr->data_size - ndr->offset));
+ if (len1+1 <= ndr->data_size - ndr->offset) {
+ len1++;
+ }
+ NDR_ALLOC_N(ndr, as, (len1+1));
+ ndr_pull_bytes(ndr, as, len1);
+ as[len1] = 0;
+ (*s) = as;
+
+#endif
+
+ break;
+
+ default:
+
+#if 0
+
+ return ndr_pull_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%x\n",
+ ndr->flags & LIBNDR_STRING_FLAGS);
+
+#endif
+
+ }
}
-void ndr_pull_NTTIME(struct e_ndr_pull *e_ndr, int hf)
+void ndr_pull_NTTIME(struct e_ndr_pull *e_ndr, int hf, gNTTIME *data)
{
}
-void ndr_pull_HYPER_T(struct e_ndr_pull *e_ndr, int hf)
+void ndr_pull_HYPER_T(struct e_ndr_pull *e_ndr, int hf, gHYPER_T *data)
{
}
-void ndr_pull_dom_sid2(struct e_ndr_pull *e_ndr, int hf)
+void ndr_pull_dom_sid2(struct e_ndr_pull *e_ndr, int flags)
{
+ guint32 num_auths;
+ if (!(flags & NDR_SCALARS)) {
+ return;
+ }
+ ndr_pull_uint32(e_ndr, hf_string4_len, &num_auths);
+
+ ndr_pull_dom_sid(e_ndr, flags);
}
#if 0
@@ -156,18 +363,91 @@ void ndr_pull_struct_start(struct e_ndr_pull *ndr)
*/
void ndr_pull_struct_end(struct e_ndr_pull *ndr)
{
- struct ndr_ofs_list *ofs = ndr->ofs_list->next;
- g_free(ndr->ofs_list);
- ndr->ofs_list = ofs;
+ ndr->ofs_list = ndr->ofs_list->next;
}
void ndr_pull_subcontext_header(struct e_ndr_pull *ndr,
size_t sub_size,
struct e_ndr_pull *ndr2)
{
+ ndr2->tvb = ndr->tvb;
+ ndr2->offset = ndr->offset;
+ ndr2->pinfo = ndr->pinfo;
+ ndr2->tree = ndr->tree;
+ ndr2->drep = ndr->drep;
+ ndr2->ofs_list = ndr->ofs_list;
+ ndr2->flags = ndr->flags;
}
void ndr_pull_relative(struct e_ndr_pull *ndr,
void (*fn)(struct e_ndr_pull *, int ndr_flags))
{
}
+
+int lsa_dissect_LSA_SECURITY_DESCRIPTOR(tvbuff_t tvb, int offset,
+ packet_info *pinfo, proto_tree *tree,
+ guint8 *drep)
+{
+ return offset;
+}
+
+int lsa_dissect_LSA_SECURITY_DESCRIPTOR_data(tvbuff_t tvb, int offset,
+ packet_info *pinfo, proto_tree *tree,
+ guint8 *drep)
+{
+ return offset;
+}
+
+int lsa_dissect_POLICY_DNS_DOMAIN_INFO(tvbuff_t tvb, int offset,
+ packet_info *pinfo, proto_tree *tree,
+ guint8 *drep)
+{
+ return offset;
+}
+
+void ndr_pull_bytes(struct e_ndr_pull *ndr, guint32 n)
+{
+ ndr->offset += n;
+}
+
+void ndr_pull_array_uint8(struct e_ndr_pull *ndr, int hf, int ndr_flags, guint32 n)
+{
+ guint32 i;
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return;
+ }
+ for (i=0;i<n;i++) {
+ ndr_pull_uint8(ndr, hf, NULL);
+ }
+}
+
+void ndr_pull_array_uint32(struct e_ndr_pull *ndr, int hf, int ndr_flags, guint32 n)
+{
+ guint32 i;
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return;
+ }
+ for (i=0;i<n;i++) {
+ ndr_pull_uint32(ndr, hf, NULL);
+ }
+}
+
+void ndr_pull_array(struct e_ndr_pull *ndr, int ndr_flags, guint32 n,
+ void (*fn)(struct e_ndr_pull *, int ndr_flags))
+{
+}
+
+void proto_register_eparser(void)
+{
+ static hf_register_info hf[] = {
+ { &hf_string4_len, { "String4 length", "eparser.string4_length", FT_UINT32, BASE_DEC, NULL, 0x0, "String4 length", HFILL }},
+ { &hf_string4_offset, { "String4 offset", "eparser.string4_offset", FT_UINT32, BASE_DEC, NULL, 0x0, "String4 offset", HFILL }},
+ { &hf_string4_len2, { "String4 length2", "eparser.string4_length2", FT_UINT32, BASE_DEC, NULL, 0x0, "String4 length2", HFILL }},
+ { &hf_string_data, { "String data", "eparser.string_data", FT_BYTES, BASE_NONE, NULL, 0x0, "String data", HFILL }},
+ };
+
+ int proto_dcerpc;
+
+ proto_dcerpc = proto_get_id_by_filter_name("dcerpc");
+ proto_register_field_array(proto_dcerpc, hf, array_length(hf));
+}
diff --git a/source4/build/pidl/packet-dcerpc-eparser.h b/source4/build/pidl/packet-dcerpc-eparser.h
index 9e5dfdd3c8..2e3d557bf7 100644
--- a/source4/build/pidl/packet-dcerpc-eparser.h
+++ b/source4/build/pidl/packet-dcerpc-eparser.h
@@ -48,6 +48,11 @@ struct ndr_ofs_list {
struct ndr_ofs_list *next;
};
+typedef long long gNTTIME;
+typedef long long gHYPER_T;
+//typedef unsigned long long guint64;
+//typedef long long gint64;
+
#include "packet-dcerpc-proto.h"
/* Create a ndr_pull structure from data stored in a tvb at a given offset. */
@@ -56,11 +61,11 @@ struct e_ndr_pull *ndr_pull_init(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree, guint8 *drep);
void ndr_pull_free(struct e_ndr_pull *ndr);
void ndr_pull_ptr(struct e_ndr_pull *ndr, int hf, guint32 *ptr);
-void ndr_pull_level(struct e_ndr_pull *ndr, int hf, int *ptr);
+void ndr_pull_level(struct e_ndr_pull *ndr, int hf, gint16 *data);
void ndr_pull_NTSTATUS(struct e_ndr_pull *ndr, int hf);
-void ndr_pull_uint8(struct e_ndr_pull *ndr, int hf);
-void ndr_pull_uint16(struct e_ndr_pull *ndr, int hf);
-void ndr_pull_uint32(struct e_ndr_pull *ndr, int hf);
+void ndr_pull_uint8(struct e_ndr_pull *ndr, int hf, guint8 *data);
+void ndr_pull_uint16(struct e_ndr_pull *ndr, int hf, guint16 *data);
+void ndr_pull_uint32(struct e_ndr_pull *ndr, int hf, guint32 *data);
void ndr_pull_policy_handle(struct e_ndr_pull *ndr, int hf);
void ndr_pull_advance(struct e_ndr_pull *ndr, int offset);
void ndr_pull_subcontext_flags_fn(struct e_ndr_pull *ndr, size_t sub_size,
@@ -72,16 +77,34 @@ void ndr_pull_subcontext_header(struct e_ndr_pull *ndr,
void ndr_pull_struct_start(struct e_ndr_pull *ndr);
void ndr_pull_struct_end(struct e_ndr_pull *ndr);
void ndr_pull_align(struct e_ndr_pull *ndr, int size);
-void ndr_pull_NTTIME(struct e_ndr_pull *e_ndr, int hf);
-void ndr_pull_HYPER_T(struct e_ndr_pull *e_ndr, int hf);
-void ndr_pull_int64(struct e_ndr_pull *e_ndr, int hf);
-void ndr_pull_uint64(struct e_ndr_pull *e_ndr, int hf);
+void ndr_pull_NTTIME(struct e_ndr_pull *e_ndr, int hf, gNTTIME *data);
+void ndr_pull_HYPER_T(struct e_ndr_pull *e_ndr, int hf, gHYPER_T *data);
+void ndr_pull_int64(struct e_ndr_pull *e_ndr, int hf, gint64 *data);
+void ndr_pull_uint64(struct e_ndr_pull *e_ndr, int hf, guint64 *data);
void ndr_pull_string(struct e_ndr_pull *e_ndr, int hf);
-void ndr_pull_dom_sid2(struct e_ndr_pull *e_ndr, int hf);
+void ndr_pull_dom_sid2(struct e_ndr_pull *e_ndr, int flags);
void ndr_pull_security_descriptor(struct e_ndr_pull *e_ndr, int hf);
void ndr_pull_relative(struct e_ndr_pull *ndr,
void (*fn)(struct e_ndr_pull *, int ndr_flags));
+int lsa_dissect_LSA_SECURITY_DESCRIPTOR(tvbuff_t tvb, int offset,
+ packet_info *pinfo, proto_tree *tree,
+ guint8 *drep);
+
+int lsa_dissect_LSA_SECURITY_DESCRIPTOR_data(tvbuff_t tvb, int offset,
+ packet_info *pinfo, proto_tree *tree,
+ guint8 *drep);
+
+int lsa_dissect_POLICY_DNS_DOMAIN_INFO(tvbuff_t tvb, int offset,
+ packet_info *pinfo, proto_tree *tree,
+ guint8 *drep);
+
+void ndr_pull_array_uint8(struct e_ndr_pull *ndr, int hf, int ndr_flags, guint32 n);
+void ndr_pull_array_uint32(struct e_ndr_pull *ndr, int hf, int ndr_flags, guint32 n);
+
+void ndr_pull_array(struct e_ndr_pull *ndr, int ndr_flags, guint32 n,
+ void (*fn)(struct e_ndr_pull *, int ndr_flags));
+
#endif /* _packet_dcerpc_eparser_h */