If you compare the output of:
net usersidlist|grep '^[^ ]'
Then the latter is missing about half the users shown by the former.
This is because of a double increment in the for loop over users in get_user_tokens(),left over from when this used to be a while loop. Bug was introduced in 1e39a619.
Confirmed as a bug on #samba-technical by kai and metze:
<ojwb> should i submit a patch?
<kai> metze: 1e39a619 was your patch, I think ojwb found a bug there indeed
<kai> ojwb: that'd be great, thanks
<ojwb> actually, first I'll build a patched version and double check it fixes the odd behaviour I was seeing
<metze> ojwb: yes, looks like a bug
I will attach a patch against git master HEAD in a moment.
I tried this patch on the Ubuntu samba package, version 2:3.4.7~dfsg-1ubuntu3.2, and it fixed the issues I was seeing with missing users in the output of "net usersidlist".
Created attachment 6218 [details]
Patch to fix this bug
Obviously correct - pushed to master and v3-6-test.