diff options
author | Tim Potter <tpot@samba.org> | 2004-06-06 11:18:38 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:56:34 -0500 |
commit | 7b1e0454ef1a6af65c9e9305b7502ca5294a1793 (patch) | |
tree | cda91ac4ac6e9700f2e4810806bdf1287976c5ca /source4/build/pidl | |
parent | ae444c03ea95887897b57799aa436bfed7c577da (diff) | |
download | samba-7b1e0454ef1a6af65c9e9305b7502ca5294a1793.tar.gz samba-7b1e0454ef1a6af65c9e9305b7502ca5294a1793.tar.bz2 samba-7b1e0454ef1a6af65c9e9305b7502ca5294a1793.zip |
r1047: Now samr eparser compiles, links and doesn't crash ethereal.
(This used to be commit f18dc9eb887034171dcf28a1f309a69e9088604e)
Diffstat (limited to 'source4/build/pidl')
-rw-r--r-- | source4/build/pidl/eparser.pm | 17 | ||||
-rw-r--r-- | source4/build/pidl/packet-dcerpc-eparser.c | 75 | ||||
-rw-r--r-- | source4/build/pidl/packet-dcerpc-eparser.h | 16 |
3 files changed, 97 insertions, 11 deletions
diff --git a/source4/build/pidl/eparser.pm b/source4/build/pidl/eparser.pm index 9c96d63852..fb8d0e39ca 100644 --- a/source4/build/pidl/eparser.pm +++ b/source4/build/pidl/eparser.pm @@ -232,6 +232,9 @@ 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 @@ -317,9 +320,9 @@ sub ParseElementPullSwitch($$$$) if (!defined $utype || !util::has_property($utype->{DATA}, "nodiscriminant")) { my $e2 = find_sibling($e, $switch); - pidl "\t g$e2->{TYPE} _level;\n"; + pidl "\tint _level;\n"; pidl "\tif (($ndr_flags) & NDR_SCALARS) {\n"; - pidl "\t\tndr_pull_$e2->{TYPE}(ndr, &_level);\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"; } else { @@ -375,7 +378,7 @@ 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})) { + } elsif (util::is_builtin_type($e->{TYPE}) || $e->{TYPE} eq "policy_handle") { pidl "\tndr_pull_$e->{TYPE}(ndr, hf_$e->{NAME}_$e->{TYPE});\n"; } else { pidl "\tndr_pull_$e->{TYPE}(ndr, $ndr_flags);\n"; @@ -426,7 +429,7 @@ sub ParseElementPullBuffer($$$) pidl "\tndr_pull_subcontext_flags_fn(ndr, $sub_size, ndr_pull_$e->{TYPE});\n"; } } - } elsif (util::is_builtin_type($e->{TYPE})) { + } 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 ($e->{POINTERS}) { pidl "\t\tndr_pull_$e->{TYPE}(ndr, NDR_SCALARS|NDR_BUFFERS);\n"; @@ -926,7 +929,7 @@ 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_policy_handle = -1;\n"; + pidl "static int hf_level = -1;\n"; foreach my $x (@{$idl}) { ($x->{TYPE} eq "MODULEHEADER") && @@ -980,9 +983,9 @@ sub Parse($$) 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_policy_handle, { \"Policy handle\", \"$module.policy\", FT_BYTES, BASE_NONE, NULL, 0x0, \"Policy handle\", 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, { \"Operation\", \"$module.array_size\", FT_UINT32, BASE_DEC, NULL, 0x0, \"Array size\", 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_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"; foreach my $x (keys(%needed)) { diff --git a/source4/build/pidl/packet-dcerpc-eparser.c b/source4/build/pidl/packet-dcerpc-eparser.c index f7cf575932..ae559e878a 100644 --- a/source4/build/pidl/packet-dcerpc-eparser.c +++ b/source4/build/pidl/packet-dcerpc-eparser.c @@ -38,6 +38,13 @@ 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) +{ + e_ndr->offset = dissect_ndr_uint16( + e_ndr->tvb, e_ndr->offset, e_ndr->pinfo, + e_ndr->tree, e_ndr->drep, hf, ptr); +} + void ndr_pull_NTSTATUS(struct e_ndr_pull *e_ndr, int hf) { e_ndr->offset = dissect_ntstatus( @@ -45,6 +52,13 @@ 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) +{ + e_ndr->offset = dissect_ndr_uint8( + e_ndr->tvb, e_ndr->offset, e_ndr->pinfo, + e_ndr->tree, e_ndr->drep, hf, NULL); +} + void ndr_pull_uint16(struct e_ndr_pull *e_ndr, int hf) { e_ndr->offset = dissect_ndr_uint16( @@ -59,6 +73,34 @@ void ndr_pull_uint32(struct e_ndr_pull *e_ndr, int hf) e_ndr->tree, e_ndr->drep, hf, NULL); } +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_string(struct e_ndr_pull *e_ndr, int hf) +{ +} + +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_dom_sid2(struct e_ndr_pull *e_ndr, int hf) +{ +} + +void ndr_pull_security_descriptor(struct e_ndr_pull *e_ndr, int hf) +{ +} + void ndr_pull_policy_handle(struct e_ndr_pull *e_ndr, int hf) { e_ndr->offset = dissect_nt_policy_hnd( @@ -66,22 +108,28 @@ void ndr_pull_policy_handle(struct e_ndr_pull *e_ndr, int hf) e_ndr->drep, hf, NULL, NULL, 0, 0); } -void ndr_pull_advance(struct e_ndr_pull *ndr, int offset) +void ndr_pull_advance(struct e_ndr_pull *e_ndr, int offset) { e_ndr->offset += offset; } +void ndr_pull_align(struct e_ndr_pull *ndr, int size) +{ + if (!(ndr->flags & LIBNDR_FLAG_NOALIGN)) { + ndr->offset = (ndr->offset + (size-1)) & ~(size-1); + } +} + void ndr_pull_subcontext_flags_fn(struct e_ndr_pull *ndr, size_t sub_size, - void *base, void (*fn)(struct e_ndr_pull *, int ndr_flags)) { struct e_ndr_pull ndr2; ndr_pull_subcontext_header(ndr, sub_size, &ndr2); - fn(&ndr2, NDR_SCALARS|NDR_BUFFERS, base); + fn(&ndr2, NDR_SCALARS|NDR_BUFFERS); if (sub_size) { - ndr_pull_advance(ndr, ndr2.data_size); +// ndr_pull_advance(ndr, ndr2.data_size); } else { ndr_pull_advance(ndr, ndr2.offset); } @@ -108,3 +156,22 @@ void ndr_pull_struct_end(struct e_ndr_pull *ndr) g_free(ndr->ofs_list); ndr->ofs_list = ofs; } + +void ndr_pull_subcontext_header(struct e_ndr_pull *ndr, + size_t sub_size, + struct e_ndr_pull *ndr2) +{ +} + +void ndr_pull_lsa_SidArray(struct e_ndr_pull *ndr, int ndr_flags) +{ +} + +void ndr_pull_samr_LogonHours(struct e_ndr_pull *ndr, int ndr_flags) +{ +} + +void ndr_pull_samr_Password(struct e_ndr_pull *ndr, int ndr_flags) +{ +} + diff --git a/source4/build/pidl/packet-dcerpc-eparser.h b/source4/build/pidl/packet-dcerpc-eparser.h index 598ae9b08e..e8b89e6600 100644 --- a/source4/build/pidl/packet-dcerpc-eparser.h +++ b/source4/build/pidl/packet-dcerpc-eparser.h @@ -51,7 +51,9 @@ 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_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_policy_handle(struct e_ndr_pull *ndr, int hf); @@ -59,6 +61,20 @@ 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, void (*fn)(struct e_ndr_pull *, int ndr_flags)); +void ndr_pull_subcontext_header(struct e_ndr_pull *ndr, + size_t sub_size, + struct e_ndr_pull *ndr2); 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_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_security_descriptor(struct e_ndr_pull *e_ndr, int hf); + +void ndr_pull_lsa_SidArray(struct e_ndr_pull *ndr, int ndr_flags); +void ndr_pull_samr_LogonHours(struct e_ndr_pull *ndr, int ndr_flags); +void ndr_pull_samr_Password(struct e_ndr_pull *ndr, int ndr_flags); |