Bug 7926 - net usersidlist skips every other user
Summary: net usersidlist skips every other user
Status: RESOLVED FIXED
Alias: None
Product: Samba 3.6
Classification: Unclassified
Component: Client Tools (show other bugs)
Version: unspecified
Hardware: All All
: P3 normal
Target Milestone: ---
Assignee: Stefan Metzmacher
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-18 04:58 UTC by Olly Betts
Modified: 2011-01-18 17:53 UTC (History)
0 users

See Also:


Attachments
Patch to fix this bug (830 bytes, patch)
2011-01-18 04:58 UTC, Olly Betts
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Olly Betts 2011-01-18 04:58:19 UTC
If you compare the output of:

wbinfo -u

and:

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".
Comment 1 Olly Betts 2011-01-18 04:58:58 UTC
Created attachment 6218 [details]
Patch to fix this bug
Comment 2 Jeremy Allison 2011-01-18 17:53:28 UTC
Obviously correct - pushed to master and v3-6-test.
Thanks !

Jeremy.