1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

Works!!!...pidl/Samba4::NDR::Parser: fix support for embedded "ref" pointers

The memory allocation of embedded "ref" pointers needs to be the
same as for all other embedded pointers.

metze
(This used to be commit 8ebf16c074)
This commit is contained in:
Stefan Metzmacher 2008-01-31 15:04:22 +01:00
parent 2670c95446
commit 4117839d77

View File

@ -929,7 +929,7 @@ sub ParseMemCtxPullFlags($$$$)
($nl->{DATA_TYPE} eq "string"));
if ($next_is_array or $next_is_string) {
return undef;
} else {
} elsif ($l->{LEVEL} eq "TOP") {
$mem_flags = "LIBNDR_FLAG_REF_ALLOC";
}
}
@ -1129,10 +1129,7 @@ sub ParsePtrPull($$$$$)
my $next_is_string = (($nl->{TYPE} eq "DATA") and
($nl->{DATA_TYPE} eq "string"));
if ($l->{POINTER_TYPE} eq "ref") {
if ($l->{LEVEL} eq "EMBEDDED") {
$self->pidl("NDR_CHECK(ndr_pull_ref_ptr($ndr, &_ptr_$e->{NAME}));");
}
if ($l->{POINTER_TYPE} eq "ref" and $l->{LEVEL} eq "TOP") {
if (!$next_is_array and !$next_is_string) {
$self->pidl("if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {");
@ -1141,16 +1138,19 @@ sub ParsePtrPull($$$$$)
}
return;
} elsif ($l->{POINTER_TYPE} eq "ref" and $l->{LEVEL} eq "EMBEDDED") {
$self->pidl("NDR_CHECK(ndr_pull_ref_ptr($ndr, &_ptr_$e->{NAME}));");
} elsif (($l->{POINTER_TYPE} eq "unique") or
($l->{POINTER_TYPE} eq "relative") or
($l->{POINTER_TYPE} eq "full")) {
$self->pidl("NDR_CHECK(ndr_pull_generic_ptr($ndr, &_ptr_$e->{NAME}));");
$self->pidl("if (_ptr_$e->{NAME}) {");
$self->indent;
} else {
die("Unhandled pointer type $l->{POINTER_TYPE}");
}
$self->pidl("if (_ptr_$e->{NAME}) {");
$self->indent;
# Don't do this for arrays, they're allocated at the actual level
# of the array
unless ($next_is_array or $next_is_string) {