Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 254698

Summary: app-admin/diradm-2.9.3, 2.9.6: usernextfreeuid seems incorrect
Product: Gentoo Linux Reporter: Mikaël Cluseau <mcluseau>
Component: Current packagesAssignee: Robin Johnson <robbat2>
Status: RESOLVED FIXED    
Severity: major    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: diradm.common.sh that work for me
patch for diradm.common.sh#usernextfreeuid
Modified ebuild (maybe not in the best way but works)

Description Mikaël Cluseau 2009-01-12 22:05:28 UTC
The method usernextfreeuid of diradm.common.sh looks incorrect, and doesn't work for me.

Used on an empty system just moved to LDAP, it generates an empty result, because it can't find an existing user with UID > UIDNUMBERMAX.

Used on an LDAP with a "valid" user (UID = 1001), it return the highest UID found, but doesn't increment it, resulting in a duplicated UID.

Reproducible: Always

Actual Results:  
1) Empty if no user is in the range ]UIDNUMBERMIN, UIDNUMBER MAX[ ;
2) Highest UID in this range otherwise.

Expected Results:  
1) UIDNUMBERMIN + 1 (or UIDNUMBERMIN?) if no user is in the range ]UIDNUMBERMIN, UIDNUMBER MAX[ ;
2) Highest UID in this range + 1 otherwise.
Comment 1 Mikaël Cluseau 2009-01-12 22:06:55 UTC
Created attachment 178266 [details]
diradm.common.sh that work for me
Comment 2 Mikaël Cluseau 2009-01-12 22:57:31 UTC
Oops, wrong version, I was on "stable". I'm testing the ~x86 one (2.9.6)
Comment 3 Mikaël Cluseau 2009-01-12 23:19:35 UTC
The situation is a bit better.

The "no user in range" case (1) still returns empty but it's handled correctly in diradm.user.sh. The "no user" case would return $UIDNUMBERMIN, so it's OK but...

But the uidNumbers are still duplicated for the second user, because the "-gt" test that should be a "-ge" (see patch attached).

I still think there's an inconsistency because for a list of uids like say "1 2 3" will return empty, while with an empty list it will return "1001". So I did another change to get the same behaviour for "no user" : removing check for empty list. This way, it will return the same value for "no user in range" AND "no user at all".

Hope I'm clear...
Comment 4 Mikaël Cluseau 2009-01-12 23:20:46 UTC
Created attachment 178300 [details, diff]
patch for diradm.common.sh#usernextfreeuid
Comment 5 Mikaël Cluseau 2009-01-12 23:37:14 UTC
Created attachment 178301 [details]
Modified ebuild (maybe not in the best way but works)
Comment 6 subscryer 2010-04-06 11:43:54 UTC
The patch does not seem to work for me, in my case the new userid is always 1000 even if 1000 is already used by one (or more) users.
Comment 7 subscryer 2010-04-06 12:41:32 UTC
Nevermind, my fault...
Any chance that this patched version could be stabilized as 2.9.6-r1?
Comment 8 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2012-11-08 20:49:19 UTC
2.9.7 in the tree with this fix (and no other code changes, just buildsystem cleanups).