Bug 198920 - useradd UID/GID overflow, wrong return code
Summary: useradd UID/GID overflow, wrong return code
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: shadow-utils
Version: 5
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Peter Vrabec
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-07-14 16:23 UTC by Josef Kubin
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-08-04 13:35:34 UTC
Type: ---
Embargoed:


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

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


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