Description of problem: If somebody wants to create an user account with specific UID, switch -u takes also negative number. UID overflows ... wrong return code, useradd says that everything was OK (0) man useradd says <cite>-u ... The value must be non-negative</cite> Version-Release number of selected component (if applicable): All available ... How reproducible: Always Steps to Reproduce: useradd -u -1 -M delete; grep del /etc/passwd; userdel delete; delete:x:4294967295:4294967295::/home/delete:/bin/bash Red Hat Enterprise Linux AS (Advanced Server) version 2.1 .qa.[root@i386-21as-bos tmp]# useradd -u 2147483648 -M delete;grep del /etc/passwd; userdel delete delete:x:2147483647:2147483647::/home/delete:/bin/bash (UID isn't 2147483648) useradd -u 2147483648 -M delete; echo $? 0 .qa.[root@i386-21as-bos tmp]# useradd -u -2147483648 -M delete;grep del /etc/passwd; userdel delete delete:x:2147483648:2147483648::/home/delete:/bin/bash Actual results: Expected results: Additional info:
Created attachment 132596 [details] fix candidate
I have tested "useradd", and bug looks fixed. I found another bug inside of "usermod": useradd -u 4294967295 -M delete;grep del /etc/passwd;usermod -g 4294967295 delete;grep del /etc/passwd;userdel delete; delete:x:4294967295:4294967295::/home/delete:/bin/bash delete:x:2147483647:4294967295::/home/delete:/bin/bash UID is influenced by usermod, but I wanted to influence GID ...
Created attachment 133142 [details] another variant, from upstream