summaryrefslogtreecommitdiff
path: root/source4/build
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2004-08-16 04:08:36 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:58:00 -0500
commit644200235a7c8dc7259e13c536f75735674f80de (patch)
tree12f5dafc75daf248d977339337450ff4bebcdee8 /source4/build
parent39686072d5539003f8a2e2679311c5057ee82041 (diff)
downloadsamba-644200235a7c8dc7259e13c536f75735674f80de.tar.gz
samba-644200235a7c8dc7259e13c536f75735674f80de.tar.bz2
samba-644200235a7c8dc7259e13c536f75735674f80de.zip
r1826: Implement some stub functions: ndr_pull_{save,restore,set_offset}()
Implement ndr_pull_relative() Call ndr_pull_uintX() for ndr_pull_intX() Generate warnings for unimplemented functions pulling NTTIME and HYPER_T. Implement ndr_pull_dom_sid2() We now dissect a lot more of the samr torture test without errors. (This used to be commit 197fb3a264536ee84d4b02a8a349c6b21e91b1f5)
Diffstat (limited to 'source4/build')
-rw-r--r--source4/build/pidl/eparser.c59
-rw-r--r--source4/build/pidl/eparser.h17
-rw-r--r--source4/build/pidl/eparser.pm2
3 files changed, 72 insertions, 6 deletions
diff --git a/source4/build/pidl/eparser.c b/source4/build/pidl/eparser.c
index 541c712d51..b53bde5f1e 100644
--- a/source4/build/pidl/eparser.c
+++ b/source4/build/pidl/eparser.c
@@ -328,10 +328,46 @@ buffers:
g_free(subtrees);
}
-void ndr_pull_relative(struct ndr_pull *ndr, void *data, int size,
+void ndr_pull_save(struct ndr_pull *ndr, struct ndr_pull_save *save)
+{
+ save->offset = ndr->offset;
+}
+
+void ndr_pull_restore(struct ndr_pull *ndr, struct ndr_pull_save *save)
+{
+ ndr->offset = save->offset;
+}
+
+void ndr_pull_set_offset(struct ndr_pull *ndr, guint32 ofs)
+{
+ ndr->offset = ofs;
+}
+
+static int hf_relative_ofs = -1;
+
+void ndr_pull_relative(struct ndr_pull *ndr, proto_tree *tree,
+ void *data, int size,
void (*fn)(struct ndr_pull *, int ndr_flags,
char *name))
{
+ struct ndr_pull ndr2;
+ guint32 ofs;
+ struct ndr_pull_save save;
+
+ ndr_pull_uint32(ndr, tree, hf_relative_ofs, &ofs);
+ if (ofs == 0) {
+ return;
+ }
+ ndr_pull_save(ndr, &save);
+ ndr_pull_set_offset(ndr, ofs + ndr->ofs_list->offset);
+ ndr_pull_subcontext(ndr, &ndr2, tvb_length(ndr->tvb) - ndr->offset);
+ /* strings must be allocated by the backend functions */
+ if (ndr->flags & LIBNDR_STRING_FLAGS) {
+ fn(&ndr2, tree, NDR_SCALARS|NDR_BUFFERS);
+ } else {
+ fn(&ndr2, tree, NDR_SCALARS|NDR_BUFFERS);
+ }
+ ndr_pull_restore(ndr, &save);
}
void ndr_pull_uint8(struct ndr_pull *ndr, proto_tree *tree, int hf, uint8 *data)
@@ -364,22 +400,29 @@ void ndr_pull_uint64(struct ndr_pull *ndr, proto_tree *tree, int hf, uint64 *dat
void ndr_pull_int8(struct ndr_pull *ndr, proto_tree *tree, int hf, int8 *data)
{
+ ndr_pull_uint8(ndr, tree, hf, data);
}
void ndr_pull_int16(struct ndr_pull *ndr, proto_tree *tree, int hf, int16 *data)
{
+ ndr_pull_uint16(ndr, tree, hf, data);
}
void ndr_pull_int32(struct ndr_pull *ndr, proto_tree *tree, int hf, int32 *data)
{
+ ndr_pull_uint32(ndr, tree, hf, data);
+
}
void ndr_pull_int64(struct ndr_pull *ndr, proto_tree *tree, int hf, int64 *data)
{
+ ndr_pull_uint64(ndr, tree, hf, data);
+
}
void ndr_pull_NTTIME(struct ndr_pull *ndr, proto_tree *tree, int hf, NTTIME *data)
{
+ g_warning("%d: ndr_pull_NTTIME() not implemented", ndr->pinfo->fd->num);
}
void ndr_pull_NTSTATUS(struct ndr_pull *ndr, proto_tree *tree, int hf, NTSTATUS *data)
@@ -391,10 +434,21 @@ void ndr_pull_NTSTATUS(struct ndr_pull *ndr, proto_tree *tree, int hf, NTSTATUS
void ndr_pull_HYPER_T(struct ndr_pull *ndr, proto_tree *tree, int hf, HYPER_T *data)
{
+ g_warning("%d: ndr_pull_HYPER_T() not implemented", ndr->pinfo->fd->num);
}
+static int hf_num_auths = -1;
+
void ndr_pull_dom_sid2(struct ndr_pull *ndr, int ndr_flags, proto_tree *tree, struct dom_sid2 *data)
{
+ guint32 num_auths;
+
+ if (!(ndr_flags & NDR_SCALARS))
+ return;
+
+ ndr_pull_uint32(ndr, tree, hf_num_auths, &num_auths);
+
+ ndr_pull_dom_sid(ndr, ndr_flags, tree, data);
}
void ndr_pull_subcontext_flags_fn(struct ndr_pull *ndr, proto_tree *tree,
@@ -521,10 +575,11 @@ void proto_register_eparser(void)
{ &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_num_auths, { "Num auths", "eparser.num_auths", FT_UINT32, BASE_DEC, NULL, 0x0, "Num auths", HFILL }},
{ &hf_string_data, { "String data", "eparser.string_data", FT_BYTES, BASE_NONE, NULL, 0x0, "String data", HFILL }},
{ &hf_subcontext_size_2, { "Subcontext size2", "eparser.subcontext_size2", FT_UINT16, BASE_DEC, NULL, 0x0, "Subcontext size2", HFILL }},
{ &hf_subcontext_size_4, { "Subcontext size4", "eparser.subcontext_size4", FT_UINT16, BASE_DEC, NULL, 0x0, "Subcontext size4", HFILL }},
-// { &hf_relative_ofs, { "Relative offset", "eparser.relative_offset", FT_UINT32, BASE_DEC, NULL, 0x0, "Relative offset", HFILL }},
+ { &hf_relative_ofs, { "Relative offset", "eparser.relative_offset", FT_UINT32, BASE_DEC, NULL, 0x0, "Relative offset", HFILL }},
// { &hf_subtree_list, { "Subtree list", "", FT_UINT64, BASE_DEC, NULL, 0,"", HFILL }},
};
diff --git a/source4/build/pidl/eparser.h b/source4/build/pidl/eparser.h
index 93aaddff38..fad0de5680 100644
--- a/source4/build/pidl/eparser.h
+++ b/source4/build/pidl/eparser.h
@@ -73,6 +73,11 @@ struct ndr_pull {
int flags;
};
+struct ndr_pull_save {
+ guint32 offset;
+ struct ndr_pull_save *next;
+};
+
typedef int NTSTATUS;
typedef guint64 uint64;
typedef guint32 uint32;
@@ -116,9 +121,15 @@ void ndr_pull_array(struct ndr_pull *ndr, int ndr_flags, proto_tree *tree,
void (*pull_fn)(struct ndr_pull *, int ndr_flags,
proto_tree *tree, void *data));
-void ndr_pull_relative(struct ndr_pull *ndr, void *data, int size,
- void (*fn)(struct ndr_pull *, int ndr_flags,
- char *name));
+void ndr_pull_save(struct ndr_pull *ndr, struct ndr_pull_save *save);
+
+void ndr_pull_restore(struct ndr_pull *ndr, struct ndr_pull_save *save);
+
+void ndr_pull_set_offset(struct ndr_pull *ndr, guint32 ofs);
+
+void ndr_pull_relative(struct ndr_pull *ndr, proto_tree *tree, void *data,
+ int size, void (*fn)(struct ndr_pull *, int ndr_flags,
+ char *name));
void ndr_pull_ptr(struct ndr_pull *ndr, proto_tree *tree, int hf, guint32 *ptr);
diff --git a/source4/build/pidl/eparser.pm b/source4/build/pidl/eparser.pm
index 4030b3d731..7d2ac1df1a 100644
--- a/source4/build/pidl/eparser.pm
+++ b/source4/build/pidl/eparser.pm
@@ -356,7 +356,7 @@ sub ParseElementPullScalar($$$)
start_flags($e);
if (util::has_property($e, "relative")) {
- pidl "\tndr_pull_relative(ndr, (const void **)&$var_prefix$e->{NAME}, sizeof(*$var_prefix$e->{NAME}), (ndr_pull_flags_fn_t)ndr_pull_$e->{TYPE});\n";
+ pidl "\tndr_pull_relative(ndr, tree, (const void **)&$var_prefix$e->{NAME}, sizeof(*$var_prefix$e->{NAME}), (ndr_pull_flags_fn_t)ndr_pull_$e->{TYPE});\n";
} elsif (util::is_inline_array($e)) {
ParseArrayPull($e, "r->", "NDR_SCALARS");
} elsif (util::need_wire_pointer($e)) {