| Summary: | pwconv and pwunconv alter uids over 2147483647 | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 5 | Reporter: | Jeff Bastian <jbastian> | ||||
| Component: | shadow-utils | Assignee: | Peter Vrabec <pvrabec> | ||||
| Status: | CLOSED ERRATA | QA Contact: | Milos Malik <mmalik> | ||||
| Severity: | urgent | Docs Contact: | |||||
| Priority: | urgent | ||||||
| Version: | 5.6 | CC: | ebenes, jwest, mmalik, mvadkert, tmraz | ||||
| Target Milestone: | rc | Keywords: | Patch, ZStream | ||||
| Target Release: | --- | ||||||
| Hardware: | i386 | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2012-02-21 06:16:49 UTC | Type: | --- | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Bug Depends On: | |||||||
| Bug Blocks: | 690830 | ||||||
| Attachments: |
|
||||||
|
Description
Jeff Bastian
2011-02-28 20:19:46 UTC
I re-compiled shadow-utils-4.1.4.2-9 from RHEL 6 on my RHEL 5.6 system and tested it and found that pwconv and pwunconv work correctly. Created attachment 481463 [details]
patch to fix pwconv and pwconv handling of large uids and gids
The problem is the sgetpwent() and sgetgrent() functions from lib/sgetpwent.c and lib/sgetgrent.c use strtol() (or atoi() which calls strtol()) to convert the uid and gid to long ints which caps the uid to 2^31-1.
Newer versions of shadow-utils have get_uid() and get_gid() functions in lib/* that use strtoll().
I tried adding lib/get_uid.c and lib/get_gid.c to RHEL 5 shadow-utils but this conflicts with other static copies of get_uid() and get_gid() found in src/{user,group}{add,mod}.c so I just copied the functions directly into lib/sgetpwent.c and lib/sgetgrent.c as static functions.
See the attached patch.
Testing the patch from comment 2 shows it correctly preserves uid > 2147483647: [root@localhost ~]# rpm -q shadow-utils shadow-utils-4.0.17-18.el5.bz681020.i386 [root@localhost ~]# id -u bigid ; id -g bigid 3000000000 3000000000 [root@localhost ~]# pwunconv [root@localhost ~]# id -u bigid ; id -g bigid 3000000000 3000000000 [root@localhost ~]# pwconv [root@localhost ~]# id -u bigid ; id -g bigid 3000000000 3000000000 Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2012-0244.html |