libnet_join
Brad Henry
j0j0 at riod.ca
Mon Sep 5 00:12:11 GMT 2005
Andrew Bartlett wrote:
>On Sat, 2005-09-03 at 15:43 -0600, Brad Henry wrote:
>
>
>>Hello,
>>
>>Here is are two patches for libnet_join.c and libnet_join.h against the
>>SOC/SAMBA_4_0 branch (rev 9988) that fix the remaining libnet_join.c
>>problems. The biggest issue I was having was realizing that I had to use
>>mem_ctx rather than tmp_ctx for the libnet_RpcConnect() call. Without
>>that, even though I was successfully keeping the samr_pipe and
>>user_handle available across calls, the samr_pipe wasn't open.
>>
>>
>
>It is worth watching the typical pattern in this area. Currently, the
>preferred way to do this kind of thing is to allocate everything on the
>tmp_ctx, then steal it to the final returned context when done. If
>filling in a structure, they should be stolen to that structure (and a
>requirement put on that the structure itself must be allocated with
>talloc(), and not on the stack). Where we don't get that far, we
>talloc_steal to the passed in parent context, as the 'last thing' before
>success. This ensures partial failures are not kept around too long.
>
>Use talloc_report_full() to see what is on each context, at various
>parts of the function. Now, I'm a bad boy and don't do that very often,
>but that's what the tool is for. It may also be used in gdb:
>
>talloc_report_full(ptr, stdout)
>
>while stepping though the function is supported.
>
>
>
>>The only thing that libnet_join.c doesn't do at this moment is the
>>DsAddEntry() to create the CN=NTDS Settings container. I'm pretty
>>confident that it won't be too hard to add, using the code that used to
>>be in dssync.c.
>>
>>I've made some other changes locally towards integrating it into the
>>RPC-NETLOGON torture test to make sure that the code gets thoroughly
>>tested, but I wanted to know your thoughts on this before I went too far.
>>
>>
>
>That sounds like a good plan. We should be testing this a lot by
>calling all joins via it.
>
>We also need to ensure we can join ourselves, or work on the server-side
>functionality so that we do. Having a seperate RPC-JOIN test would be a
>good thing (follow up with a single test samlogon) as it would be fast
>enough to be put in the quicktest, but stresses a large area of code.
>
>
>
I definately agree, putting this stuff into the RPC-NETLOGON test was
getting messy awfully quick, so I'll start working it into a separate test.
>On to the patch itself:
>
>- ZERO_STRUCT(u_handle);
>+ ZERO_STRUCT(*u_handle);
>
>The correct macro here is ZERO_STUCTP.
>
>Finally, I assume you run things under valgrind?
>
>Andrew Bartlett
>
>
>
I'm getting the hang of valgrind and gdb. I made this change, and this
patch also includes a fix for a problem valgrind found, with
libnet_Join_primary_domain() not passing a talloc()'d libnet_JoinDomain
struct to the libnet_JoinDomain() function.
Brad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libnet_join.c.2.diff
Type: text/x-patch
Size: 9345 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20050904/67fd4284/libnet_join.c.2.bin
More information about the samba-technical
mailing list