Q about pidl client code in Samba 3

Gerald (Jerry) Carter jerry at samba.org
Wed Sep 27 22:32:01 GMT 2006


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

Gerald (Jerry) Carter wrote:
> Jelmer,
> 
> I'm looking at the return code in rpccli_winreg_EnumKey():
> 
> 	/* Return variables */
> 	*name = *r.out.name;
> 	*keyclass = *r.out.keyclass;
> 	*last_changed_time = *r.out.last_changed_time;
> 
> keyclass and last_changed_time are unique pointers so
> it seems that they should be able to be NULL in the input.
> If so, then the assignments need to be surrounded by
> pointer checks.  Does this make sense?
> 
> I'm trying to put together a patch to pidl now 
> for testing.

Assuming I'm correct with the above, how about
the attached patch.




cheers, jerry
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFGvvhIR7qMdg1EfYRAtj9AJ9uKeXwFoopG03LOpPFH3n9ZPjzTgCggOhn
/wCflYFO9aa2KWR2KmXz4I0=
=AfML
-----END PGP SIGNATURE-----
-------------- next part --------------
Index: lib/Parse/Pidl/Samba3/ClientNDR.pm
===================================================================
--- lib/Parse/Pidl/Samba3/ClientNDR.pm	(revision 18964)
+++ lib/Parse/Pidl/Samba3/ClientNDR.pm	(working copy)
@@ -71,7 +71,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