auto-allocation of out pointers (was Re: svn commit: samba r18566) librpc/idl rpc_server/winreg torture/rpc

tridge at samba.org tridge at samba.org
Sat Sep 16 05:22:39 GMT 2006


Jerry,

 > We seem to be at odds here since the samba3-ndr does auto allocate
 > in the client libndr.  I was not aware that the Samba 4 generated code
 > did not. 
 > 
 > Let's clean this up next week.  

yep, it's something we need to discuss.

If you and Jelmer can convince me that auto-allocating is a good idea,
then please note that it's not just a matter of turning it on. It will
break quite a lot of code. For example, look at test_Open() in
torture/rpc/winreg.c. It does this:

	r.in.system_name = 0;
	r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
	r.out.handle = &handle;
	
	status = open_fn(p, mem_ctx, &r);

if r.out.handle was auto-allocated, then the "r.out.handle = &handle;"
line would effectively be overwritten, and the code would break as it
would no longer get the handle returned in the place it was expecting.

Once upon a time, in the early days of pidl, we did auto-allocate
output pointers, but we eventually decided it was a bad idea, except
in places like the utils/ndrdump.c tool (where it is in fact still
enabled in Samba4).

A rough grep shows me about 250 cases in source/torture/rpc/*.c which
might (would?) break if we changed this. Most cases would be quite
easy to fix, but it will still take time to get all of them right. I
expect to find quite a few places in other parts of the code that will
also break.

Cheers, Tridge


More information about the samba-technical mailing list