Bug 198920

Summary: useradd UID/GID overflow, wrong return code
Product: [Fedora] Fedora Reporter: Josef Kubin <jkubin>
Component: shadow-utilsAssignee: Peter Vrabec <pvrabec>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 5   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-08-04 13:35:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
fix candidate
none
another variant, from upstream none

Description Josef Kubin 2006-07-14 16:23:46 UTC
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:

Comment 1 Peter Vrabec 2006-07-18 12:35:40 UTC
Created attachment 132596 [details]
fix candidate

Comment 2 Josef Kubin 2006-07-21 20:06:49 UTC
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 ...

Comment 3 Peter Vrabec 2006-07-27 11:44:39 UTC
Created attachment 133142 [details]
another variant, from upstream