summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-11-19 17:56:35 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:28:20 -0500
commitf4c4e0cf7fde6c5b5cffef2e3ad4ec24bb8fb894 (patch)
treea031f6fdb063ffe7580088accc572aa4ff9b703e /source4
parent08452bd7389dc7a18aa2620724a2029bd2e9c640 (diff)
downloadsamba-f4c4e0cf7fde6c5b5cffef2e3ad4ec24bb8fb894.tar.gz
samba-f4c4e0cf7fde6c5b5cffef2e3ad4ec24bb8fb894.tar.bz2
samba-f4c4e0cf7fde6c5b5cffef2e3ad4ec24bb8fb894.zip
r19790: Check in the PIDL change and the converted unixinfo and winbind pipes without
waiting for comments. This is what version control is for, and it does fix a segfault I ran into ;-) Nevertheless, Jelmer & Jerry, please take a look! Thanks, Volker (This used to be commit 10dcaf89ed07b9d5d1c89da33b50fcaadead32b2)
Diffstat (limited to 'source4')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm17
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4.pm29
2 files changed, 35 insertions, 11 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm b/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
index c939feb1b9..6cfab753e9 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
@@ -10,7 +10,7 @@ use strict;
use Parse::Pidl::Typelist qw(hasType getType mapType scalar_is_reference);
use Parse::Pidl::Util qw(has_property ParseExpr is_constant);
use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred);
-use Parse::Pidl::Samba4 qw(DeclLong);
+use Parse::Pidl::Samba4 qw(DeclLong_cli IsUniqueOut);
use vars qw($VERSION);
$VERSION = '0.01';
@@ -36,7 +36,7 @@ sub ParseFunction($$)
my $ufn = "DCERPC_".uc($fn->{NAME});
foreach (@{$fn->{ELEMENTS}}) {
- $defargs .= ", " . DeclLong($_);
+ $defargs .= ", " . DeclLong_cli($_);
}
fn_declare "NTSTATUS rpccli_$fn->{NAME}(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx$defargs)";
pidl "{";
@@ -48,7 +48,12 @@ sub ParseFunction($$)
foreach (@{$fn->{ELEMENTS}}) {
if (grep(/in/, @{$_->{DIRECTION}})) {
+ if ( IsUniqueOut($_) ) {
+ pidl "r.in.$_->{NAME} = *$_->{NAME};";
+ }
+ else {
pidl "r.in.$_->{NAME} = $_->{NAME};";
+ }
}
}
@@ -79,12 +84,8 @@ sub ParseFunction($$)
fatal($e, "[out] argument is not a pointer or array") if ($e->{LEVELS}[0]->{TYPE} ne "POINTER" and $e->{LEVELS}[0]->{TYPE} ne "ARRAY");
- if ( ($e->{LEVELS}[0]->{TYPE} eq "POINTER") && ($e->{LEVELS}[0]->{POINTER_TYPE} eq "unique") ) {
- pidl "if ( $e->{NAME} ) {";
- indent;
- pidl "*$e->{NAME} = *r.out.$e->{NAME};";
- deindent;
- pidl "}";
+ if ( IsUniqueOut($e) ) {
+ pidl "*$e->{NAME} = r.out.$e->{NAME};";
} else {
pidl "*$e->{NAME} = *r.out.$e->{NAME};";
}
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4.pm b/source4/pidl/lib/Parse/Pidl/Samba4.pm
index 4ef2daa591..e11bd6a5ff 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4.pm
@@ -7,7 +7,7 @@ package Parse::Pidl::Samba4;
require Exporter;
@ISA = qw(Exporter);
-@EXPORT = qw(is_intree choose_header DeclLong);
+@EXPORT = qw(is_intree choose_header DeclLong DeclLong_cli IsUniqueOut);
use Parse::Pidl::Util qw(has_property is_constant);
use Parse::Pidl::Typelist qw(mapType scalar_is_reference);
@@ -32,9 +32,19 @@ sub choose_header($$)
return "#include <$out>";
}
-sub DeclLong($)
+sub IsUniqueOut($)
{
- my($element) = shift;
+ my ($e) = shift;
+
+ return grep(/out/, @{$e->{DIRECTION}}) &&
+ ((($e->{LEVELS}[0]->{TYPE} eq "POINTER") &&
+ ($e->{LEVELS}[0]->{POINTER_TYPE} eq "unique")) ||
+ ($e->{LEVELS}[0]->{TYPE} eq "ARRAY"));
+}
+
+sub DeclLong_int($$)
+{
+ my($element,$cli) = @_;
my $ret = "";
if (has_property($element, "represent_as")) {
@@ -57,6 +67,9 @@ sub DeclLong($)
not has_property($element, "charset");
$numstar++;
}
+ if ($cli && IsUniqueOut($element)) {
+ $numstar++;
+ }
$ret.="*" foreach (1..$numstar);
}
$ret.=$element->{NAME};
@@ -68,4 +81,14 @@ sub DeclLong($)
return $ret;
}
+sub DeclLong($)
+{
+ return DeclLong_int($_, 0);
+}
+
+sub DeclLong_cli($)
+{
+ return DeclLong_int($_, 1);
+}
+
1;