Ticket #1229 (closed defect: fixed)
On domain creation groupadd / useradd fails when pre-existent accounts are found leaving the domain in error state
|Reported by:||ispcomm||Owned by:|
|Priority:||major||Milestone:||ispCP ω 1.0 - RC7|
|Component:||Backend (Engine)||Version:||ispCP ω 1.0.0 - RC4|
When the system on which ispcp in installed has accounts over uid/gid 2000, the addition of new domains can fail with the following error:
sys_command() | ERROR: External command '/usr/sbin/groupadd -g 2002 vu2002' returned '4' status !
This happens because ispcp does not check if the "new" numeric account is already present in the system.
It's very easy to reproduce this error:
- Add a new user (unrelated to ispcp) to an ispcp system. The new account will get uid of the higher uid on the system+1 (and will be in the 2000+range).
- Add a new domain: ispcp fails because the next uid for omega is last+1, which conflicts with the account created in (1).
Solution: (easy): Before determining the new numeric UID/GID for a new domain, make sure it does not exist on the system. If the account exists, then simply iterate (+1, +2, 3+, etc) until a free account is found.
Complain only when all possible accounts from a system are exausted (i.e. when 65535 fails).
This problem will make ispcp break on any system where a new account is created for any reason (!!!).
The problem was diagnosed on a debian system in r1135