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 155199 Details for
Bug 240915
[RHEL4] userdel/usermod infinite loop with duplicate names in /etc/group or /etc/gshadow
[?]
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]
Patch to deal with multiple groups gracefully
shadow-4.0.3-update-group-fix5.patch (text/plain), 4.29 KB, created by
Chris Lalancette
on 2007-05-22 20:47:06 UTC
(
hide
)
Description:
Patch to deal with multiple groups gracefully
Filename:
MIME Type:
Creator:
Chris Lalancette
Created:
2007-05-22 20:47:06 UTC
Size:
4.29 KB
patch
obsolete
>diff -urp shadow-4.0.3.orig/lib/commonio.c shadow-4.0.3/lib/commonio.c >--- shadow-4.0.3.orig/lib/commonio.c 2007-05-22 09:56:00.000000000 -0400 >+++ shadow-4.0.3/lib/commonio.c 2007-05-22 09:44:27.000000000 -0400 >@@ -800,6 +800,37 @@ commonio_update(struct commonio_db *db, > return 1; > } > >+int >+commonio_update_entry(struct commonio_db *db, const void *oldgr, >+ const void *newgr) >+{ >+ struct commonio_entry *tmp; >+ >+ if (!db->isopen || db->readonly) { >+ errno = EINVAL; >+ return 0; >+ } >+ >+ tmp = db->head; >+ while (tmp != NULL) { >+ if (oldgr == tmp->eptr) >+ break; >+ tmp = tmp->next; >+ } >+ >+ /* Didn't find this in the database; hop out */ >+ if (tmp == NULL) >+ return 0; >+ >+ tmp->eptr = db->ops->dup(newgr); >+ if (tmp->eptr == NULL) >+ return 1; >+ tmp->changed = 1; >+ >+ db->changed = 1; >+ >+ return 1; >+} > > void > commonio_del_entry(struct commonio_db *db, const struct commonio_entry *p) >diff -urp shadow-4.0.3.orig/lib/groupio.c shadow-4.0.3/lib/groupio.c >--- shadow-4.0.3.orig/lib/groupio.c 2001-08-14 17:10:36.000000000 -0400 >+++ shadow-4.0.3/lib/groupio.c 2007-05-22 09:42:44.000000000 -0400 >@@ -136,6 +136,13 @@ gr_update(const struct group *gr) > } > > int >+gr_update_entry(const struct group *oldgr, const struct group *newgr) >+{ >+ return commonio_update_entry(&group_db, (const void *) oldgr, >+ (const void *) newgr); >+} >+ >+int > gr_remove(const char *name) > { > return commonio_remove(&group_db, name); >diff -urp shadow-4.0.3.orig/lib/groupio.h shadow-4.0.3/lib/groupio.h >--- shadow-4.0.3.orig/lib/groupio.h 2001-08-14 17:10:36.000000000 -0400 >+++ shadow-4.0.3/lib/groupio.h 2007-05-22 09:42:59.000000000 -0400 >@@ -10,4 +10,5 @@ extern int gr_remove(const char *); > extern int gr_rewind(void); > extern int gr_unlock(void); > extern int gr_update(const struct group *); >+extern int gr_update_entry(const struct group *oldgr, const struct group *newgr); > extern int gr_sort(void); >diff -urp shadow-4.0.3.orig/lib/sgroupio.c shadow-4.0.3/lib/sgroupio.c >--- shadow-4.0.3.orig/lib/sgroupio.c 2001-08-14 17:10:36.000000000 -0400 >+++ shadow-4.0.3/lib/sgroupio.c 2007-05-22 09:48:17.000000000 -0400 >@@ -161,6 +161,13 @@ sgr_update(const struct sgrp *sg) > } > > int >+sgr_update_entry(const struct sgrp *oldgr, const struct sgrp *newgr) >+{ >+ return commonio_update_entry(&gshadow_db, (const void *) oldgr, >+ (const void *) newgr); >+} >+ >+int > sgr_remove(const char *name) > { > return commonio_remove(&gshadow_db, name); >diff -urp shadow-4.0.3.orig/lib/sgroupio.h shadow-4.0.3/lib/sgroupio.h >--- shadow-4.0.3.orig/lib/sgroupio.h 2001-08-14 17:10:36.000000000 -0400 >+++ shadow-4.0.3/lib/sgroupio.h 2007-05-22 09:48:36.000000000 -0400 >@@ -11,4 +11,5 @@ extern int sgr_remove(const char *); > extern int sgr_rewind(void); > extern int sgr_unlock(void); > extern int sgr_update(const struct sgrp *); >+extern int sgr_update_entry(const struct sgrp *oldgr, const struct sgrp *newgr); > extern int sgr_sort(void); >diff -urp shadow-4.0.3.orig/src/userdel.c shadow-4.0.3/src/userdel.c >--- shadow-4.0.3.orig/src/userdel.c 2007-05-22 09:56:00.000000000 -0400 >+++ shadow-4.0.3/src/userdel.c 2007-05-22 09:48:57.000000000 -0400 >@@ -179,7 +179,7 @@ static void update_groups (void) > exit (13); /* XXX */ > } > ngrp->gr_mem = del_list (ngrp->gr_mem, user_name); >- if (!gr_update (ngrp)) >+ if (!gr_update_entry (grp, ngrp)) > fprintf (stderr, > _("%s: error updating group entry\n"), > Prog); >@@ -269,7 +269,7 @@ static void update_groups (void) > nsgrp->sg_adm = > del_list (nsgrp->sg_adm, user_name); > >- if (!sgr_update (nsgrp)) >+ if (!sgr_update_entry (sgrp, nsgrp)) > fprintf (stderr, > _("%s: error updating group entry\n"), > Prog); >diff -urp shadow-4.0.3.orig/src/usermod.c shadow-4.0.3/src/usermod.c >--- shadow-4.0.3.orig/src/usermod.c 2007-05-22 09:56:00.000000000 -0400 >+++ shadow-4.0.3/src/usermod.c 2007-05-22 09:49:41.000000000 -0400 >@@ -637,7 +637,7 @@ static int update_group (void) > continue; > > changed = 0; >- if (!gr_update (ngrp)) { >+ if (!gr_update_entry (grp, ngrp)) { > fprintf (stderr, > _("%s: error adding new group entry\n"), > Prog); >@@ -784,7 +784,7 @@ static int update_gshadow (void) > /* > * Update the group entry to reflect the changes. > */ >- if (!sgr_update (nsgrp)) { >+ if (!sgr_update_entry (sgrp, nsgrp)) { > fprintf (stderr, > _("%s: error adding new group entry\n"), > Prog);
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 240915
: 155199 |
155540
|
303718