Bug 198920 - useradd UID/GID overflow, wrong return code
useradd UID/GID overflow, wrong return code
Product: Fedora
Classification: Fedora
Component: shadow-utils (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Peter Vrabec
David Lawrence
Depends On:
  Show dependency treegraph
Reported: 2006-07-14 12:23 EDT by Josef Kubin
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-08-04 09:35:34 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
fix candidate (2.53 KB, patch)
2006-07-18 08:35 EDT, Peter Vrabec
no flags Details | Diff
another variant, from upstream (7.09 KB, patch)
2006-07-27 07:44 EDT, Peter Vrabec
no flags Details | Diff

  None (edit)
Description Josef Kubin 2006-07-14 12:23:46 EDT
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:

Steps to Reproduce:
useradd -u -1 -M delete; grep del /etc/passwd; userdel delete;

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

(UID isn't 2147483648)

useradd -u 2147483648 -M delete;
echo $?

.qa.[root@i386-21as-bos tmp]# useradd -u -2147483648 -M delete;grep del
/etc/passwd; userdel delete

Actual results:

Expected results:

Additional info:
Comment 1 Peter Vrabec 2006-07-18 08:35:40 EDT
Created attachment 132596 [details]
fix candidate
Comment 2 Josef Kubin 2006-07-21 16:06:49 EDT
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;


UID is influenced by usermod, but I wanted to influence GID ...
Comment 3 Peter Vrabec 2006-07-27 07:44:39 EDT
Created attachment 133142 [details]
another variant, from upstream

Note You need to log in before you can comment on or make changes to this bug.