[PATCH] pidl --samba3-ndr-client

Gerald (Jerry) Carter jerry at samba.org
Thu Sep 28 18:49:35 GMT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jelmer,

This fixes

(a) The dereferencing of unique pointers in the
    out parameters I mentioned yesterday
(b) Bailing on RPC faults so we dont' segv trying to print
    the out structure in log level = 10

I'm going to check in my autogenerated code but will
let you decide what we should do with this patch in
particular.



cheers, jerry
=====================================================================
Samba                                    ------- http://www.samba.org
Centeris                         -----------  http://www.centeris.com
"What man is a man who does not make the world better?"      --Balian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFHBk/IR7qMdg1EfYRAlvMAJ9kNMes+P8+IpLTvNh3yXzPtWCv3wCgjE5O
9ORXgKvuWqe6pT/ujXM2Tes=
=u4fC
-----END PGP SIGNATURE-----
-------------- next part --------------
Index: lib/Parse/Pidl/Samba3/ClientNDR.pm
===================================================================
--- lib/Parse/Pidl/Samba3/ClientNDR.pm	(revision 18972)
+++ lib/Parse/Pidl/Samba3/ClientNDR.pm	(working copy)
@@ -58,6 +58,14 @@
 	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 @@
 
 		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"";


More information about the samba-technical mailing list