Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 149686 Details for
Bug 190523
useradd/groupadd -r should start at the top of available uids/gids
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
proposed patch, any review is appreciated
shadow-4.0.18.1-sysAccount.patch (text/plain), 2.59 KB, created by
Peter Vrabec
on 2007-03-09 14:37:16 UTC
(
hide
)
Description:
proposed patch, any review is appreciated
Filename:
MIME Type:
Creator:
Peter Vrabec
Created:
2007-03-09 14:37:16 UTC
Size:
2.59 KB
patch
obsolete
>--- shadow-4.0.18.1/src/useradd.c.sysAccount 2007-03-09 14:25:09.000000000 +0100 >+++ shadow-4.0.18.1/src/useradd.c 2007-03-09 15:10:33.000000000 +0100 >@@ -854,6 +854,7 @@ > { > const struct passwd *pwd; > uid_t uid_min, uid_max; >+ char * index; > > if (!rflg) { > uid_min = getdef_unum ("UID_MIN", 500); >@@ -862,6 +863,8 @@ > else { > uid_min = 1; > uid_max = getdef_unum ("UID_MIN", 500) - 1; >+ index = alloca (sizeof (char) * uid_max); >+ memset (index, 0, sizeof (char) * uid_max + 1); > } > > /* >@@ -901,11 +904,24 @@ > #endif > exit (E_UID_IN_USE); > } >- if (!uflg && pwd->pw_uid >= user_id) { >+ if (!uflg && !rflg && pwd->pw_uid >= user_id) { > if (pwd->pw_uid > uid_max) > continue; > user_id = pwd->pw_uid + 1; > } >+ /* create index of occupied system accounts UIDs */ >+ if (!uflg && rflg && (pwd->pw_uid <= uid_max)) >+ index[pwd->pw_uid] = 1; >+ >+ } >+ >+ /* find free system account */ >+ if(!uflg && rflg) { >+ for( user_id = uid_max; (user_id >= uid_min) && index[user_id]; user_id--); >+ if ( user_id < uid_min ) { >+ fprintf (stderr, _("%s: can't get unique UID\n"), Prog); >+ fail_exit (E_UID_IN_USE); >+ } > } > > /* >--- shadow-4.0.18.1/src/groupadd.c.sysAccount 2007-03-09 15:15:57.000000000 +0100 >+++ shadow-4.0.18.1/src/groupadd.c 2007-03-09 15:26:14.000000000 +0100 >@@ -199,6 +199,7 @@ > { > const struct group *grp; > gid_t gid_min, gid_max; >+ char * index; > > if (!rflg) { > gid_min = getdef_unum ("GID_MIN", 500); >@@ -206,7 +207,9 @@ > } else { > gid_min = 1; > gid_max = getdef_unum ("GID_MIN", 500) - 1; >- } >+ index = alloca (sizeof (char) * gid_max); >+ memset (index, 0, sizeof (char) * gid_max + 1); >+ } > > /* > * Start with some GID value if the user didn't provide us with >@@ -251,12 +254,25 @@ > Prog, (unsigned int) group_id); > fail_exit (E_GID_IN_USE); > } >- if (!gflg && grp->gr_gid >= group_id) { >+ if (!gflg && !rflg && grp->gr_gid >= group_id) { > if (grp->gr_gid > gid_max) > continue; > group_id = grp->gr_gid + 1; > } >+ /* create index of occupied system accounts UIDs */ >+ if (!gflg && rflg && (grp->gr_gid <= gid_max)) >+ index[grp->gr_gid] = 1; >+ } >+ >+ /* find free system account */ >+ if(!gflg && rflg) { >+ for( group_id = gid_max; (group_id >= gid_min) && index[group_id]; group_id--); >+ if ( group_id < gid_min ) { >+ fprintf (stderr, _("%s: can't get unique GID\n"), Prog); >+ fail_exit (E_GID_IN_USE); >+ } > } >+ > if (!gflg && group_id == gid_max + 1) { > for (group_id = gid_min; group_id < gid_max; group_id++) { > #ifdef NO_GETGRENT
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 190523
: 149686 |
149815