summaryrefslogtreecommitdiff
path: root/pidl/lib/Parse/Pidl/Samba4/Python.pm
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2009-03-01 16:39:35 +0100
committerJelmer Vernooij <jelmer@samba.org>2009-03-01 16:39:35 +0100
commit09ac816b36e45fd537af2f7fe7c57a11f5c744f5 (patch)
tree4d5d44c27a2395a39efc62359f6e4b6976f2ba2e /pidl/lib/Parse/Pidl/Samba4/Python.pm
parent235244f4cc707130dd130afce88bde49606bd501 (diff)
parent54bc27e9374742d37b1ed9012d1cfe8f5ace6d40 (diff)
downloadsamba-09ac816b36e45fd537af2f7fe7c57a11f5c744f5.tar.gz
samba-09ac816b36e45fd537af2f7fe7c57a11f5c744f5.tar.bz2
samba-09ac816b36e45fd537af2f7fe7c57a11f5c744f5.zip
Merge branch 'master' of git://git.samba.org/samba into teventfix
Conflicts: lib/tevent/pytevent.c
Diffstat (limited to 'pidl/lib/Parse/Pidl/Samba4/Python.pm')
-rw-r--r--pidl/lib/Parse/Pidl/Samba4/Python.pm19
1 files changed, 18 insertions, 1 deletions
diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm
index 48785f5b0a..6099fe5cae 100644
--- a/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -275,7 +275,24 @@ sub PythonStruct($$$$$$)
$self->pidl("if (!PyArg_ParseTuple(args, \"s#:__ndr_unpack__\", &blob.data, &blob.length))");
$self->pidl("\treturn NULL;");
$self->pidl("");
- $self->pidl("err = ndr_pull_struct_blob_all(&blob, py_talloc_get_mem_ctx(py_obj), NULL, object, (ndr_pull_flags_fn_t)ndr_pull_$name);");
+
+ # This disgusting hack works around the fact that ndr_pull_struct_blob_all will always fail on structures with relative pointers.
+ # So, map ndr_unpack to ndr_pull_struct_blob_all only if we don't have any relative pointers in this
+ my $got_relative = 0;
+ if ($#{$d->{ELEMENTS}} > -1) {
+ foreach my $e (@{$d->{ELEMENTS}}) {
+ my $l = $e->{LEVELS}[0];
+ if ($l->{TYPE} eq "POINTER" and ($l->{POINTER_TYPE} eq "relative")) {
+ $got_relative = 1;
+ last;
+ }
+ }
+ }
+ if ($got_relative == 0) {
+ $self->pidl("err = ndr_pull_struct_blob_all(&blob, py_talloc_get_mem_ctx(py_obj), NULL, object, (ndr_pull_flags_fn_t)ndr_pull_$name);");
+ } else {
+ $self->pidl("err = ndr_pull_struct_blob(&blob, py_talloc_get_mem_ctx(py_obj), NULL, object, (ndr_pull_flags_fn_t)ndr_pull_$name);");
+ }
$self->pidl("if (err != NDR_ERR_SUCCESS) {");
$self->indent;
$self->pidl("PyErr_SetNdrError(err);");