Winbindd problem enumerating lots of groups

jra at dp.samba.org jra at dp.samba.org
Mon Jan 6 04:04:00 GMT 2003


On Sun, Jan 05, 2003 at 07:22:33PM -0500, Ken Cross wrote:
> I found and fixed a problem where winbindd had trouble enumerating
> *lots* of groups (~2000 in my case).  This is in SAMBA_3_0, but it's in
> other versions, too.
> 
> The problem was in the enum_dom_groups routine in winbindd_rcp.c, line
> 153:
> 
>   do {
>     struct acct_info *info2 = NULL;
>     uint32 count = 0, start = *num_entries;  <-- here
> 
> "start" is being re-initialized every time through the loop.  It mustn't
> be.  
> 
> The fix is easy - move it to the top of the routine a few lines up:
> 
>   uint32 start = 0;

Are you sure this is correct ? Yes, start is being initialized
to *num_entries (which starts at zero the first time through the
loop) but then at the bottom of the loop *num_entries is incremented
as so :

(*num_entries) += count;

So the next time around the loop start will be incremented
by count. It is then used as the next group index to fetch
in the call :

                status = cli_samr_enum_dom_groups(hnd->cli, mem_ctx2, &dom_pol,
                                                  &start,
                                                  0xFFFF, /* buffer size? */
                                                  &info2, &count);

The current code looks correct to me. Can you explain better
why you think this is wrong ?

Thanks,

	Jeremy.



More information about the samba-technical mailing list