summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2006-10-02 16:19:05 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:20:31 -0500
commita22d785d7cdfbb662a0755552acfbf995d865d0c (patch)
treef393f916ae0571dc4b401954a41e38b1eed48442
parent91814f4b00b7088cde5c610a7e2b60d4496662b2 (diff)
downloadsamba-a22d785d7cdfbb662a0755552acfbf995d865d0c.tar.gz
samba-a22d785d7cdfbb662a0755552acfbf995d865d0c.tar.bz2
samba-a22d785d7cdfbb662a0755552acfbf995d865d0c.zip
r19049: Samba 3 client fixes
* Make sure to check for NULL pointers when dealing with [out,unique] before assigning valoues * Detect RPC faults and return immediately (This used to be commit c96dae478c2fee2fede9c853a71c8079bbb8ba47)
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm19
1 files changed, 18 insertions, 1 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm b/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
index 3b75bf33a6..c939feb1b9 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
@@ -58,6 +58,14 @@ sub ParseFunction($$)
pidl "";
pidl "status = cli_do_rpc_ndr(cli, mem_ctx, PI_$uif, $ufn, &r, (ndr_pull_flags_fn_t)ndr_pull_$fn->{NAME}, (ndr_push_flags_fn_t)ndr_push_$fn->{NAME});";
pidl "";
+
+ pidl "if ( !NT_STATUS_IS_OK(status) ) {";
+ indent;
+ pidl "return status;";
+ deindent;
+ pidl "}";
+
+ pidl "";
pidl "if (DEBUGLEVEL >= 10)";
pidl "\tNDR_PRINT_OUT_DEBUG($fn->{NAME}, &r);";
pidl "";
@@ -71,7 +79,16 @@ 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");
- pidl "*$e->{NAME} = *r.out.$e->{NAME};";
+ 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 "}";
+ } else {
+ pidl "*$e->{NAME} = *r.out.$e->{NAME};";
+ }
+
}
pidl"";