summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-07-04 19:55:18 +0000
committerMike Frysinger <vapier@gentoo.org>2006-07-04 19:55:18 +0000
commit9a35663cd0682925721f43961817297e12ed1956 (patch)
treea078f767bfaaaa8d8b7ade3ed28de791ef329817 /sys-apps/shadow/files
parentFixed RDEPEND wrt bug #134781; fixed DEPEND (diff)
downloadgentoo-2-9a35663cd0682925721f43961817297e12ed1956.tar.gz
gentoo-2-9a35663cd0682925721f43961817297e12ed1956.tar.bz2
gentoo-2-9a35663cd0682925721f43961817297e12ed1956.zip
Fix useradd behavior when using -g #128715 by Max Lorenz and fix segfault in userdel with -r and /dev/null #139148 by David Roussel.
(Portage version: 2.1.1_pre2-r2)
Diffstat (limited to 'sys-apps/shadow/files')
-rw-r--r--sys-apps/shadow/files/digest-shadow-4.0.16-r13
-rw-r--r--sys-apps/shadow/files/shadow-4.0.16-check-opendir.patch21
-rw-r--r--sys-apps/shadow/files/shadow-4.0.16-fix-useradd-usergroups.patch105
3 files changed, 129 insertions, 0 deletions
diff --git a/sys-apps/shadow/files/digest-shadow-4.0.16-r1 b/sys-apps/shadow/files/digest-shadow-4.0.16-r1
new file mode 100644
index 000000000000..e6b69a954530
--- /dev/null
+++ b/sys-apps/shadow/files/digest-shadow-4.0.16-r1
@@ -0,0 +1,3 @@
+MD5 1d91f7479143d1d705b94180c0d4874b shadow-4.0.16.tar.bz2 1438030
+RMD160 9ac436d89913441b448da90ece25b77e818f3bd4 shadow-4.0.16.tar.bz2 1438030
+SHA256 2cbd0af0b4682d91282d2d0ad3110e6dfcad4e365d25a3b6beaf7048dd477bdd shadow-4.0.16.tar.bz2 1438030
diff --git a/sys-apps/shadow/files/shadow-4.0.16-check-opendir.patch b/sys-apps/shadow/files/shadow-4.0.16-check-opendir.patch
new file mode 100644
index 000000000000..e0403cbaa654
--- /dev/null
+++ b/sys-apps/shadow/files/shadow-4.0.16-check-opendir.patch
@@ -0,0 +1,21 @@
+http://bugs.gentoo.org/139148
+
+e-mailed upstream
+
+Index: libmisc/copydir.c
+===================================================================
+RCS file: /cvsroot/shadow/libmisc/copydir.c,v
+retrieving revision 1.14
+diff -u -p -r1.14 copydir.c
+--- libmisc/copydir.c 7 May 2006 18:10:10 -0000 1.14
++++ libmisc/copydir.c 4 Jul 2006 19:42:22 -0000
+@@ -396,7 +396,8 @@ int remove_tree (const char *root)
+ * is made set-ID.
+ */
+
+- dir = opendir (root);
++ if (!(dir = opendir (root)))
++ return -1;
+
+ while ((ent = readdir (dir))) {
+
diff --git a/sys-apps/shadow/files/shadow-4.0.16-fix-useradd-usergroups.patch b/sys-apps/shadow/files/shadow-4.0.16-fix-useradd-usergroups.patch
new file mode 100644
index 000000000000..3170869f0277
--- /dev/null
+++ b/sys-apps/shadow/files/shadow-4.0.16-fix-useradd-usergroups.patch
@@ -0,0 +1,105 @@
+http://bugs.gentoo.org/128715
+
+exact implementation details are still in discussion upstream, but this fixes
+the behavior to not suck like current code
+
+Index: src/useradd.c
+===================================================================
+RCS file: /cvsroot/shadow/src/useradd.c,v
+retrieving revision 1.96
+diff -u -p -r1.96 useradd.c
+--- src/useradd.c 30 May 2006 18:28:45 -0000 1.96
++++ src/useradd.c 10 Jun 2006 22:13:32 -0000
+@@ -114,7 +114,7 @@ static int do_grp_update = 0; /* group f
+ static char *Prog;
+
+ static int
+- bflg = 0, /* new default root of home directory */
++ bflg = 0, /* new default root of home directory */
+ cflg = 0, /* comment (GECOS) field for new account */
+ dflg = 0, /* home directory for new account */
+ Dflg = 0, /* set/show new user default values */
+@@ -253,6 +253,12 @@ static void get_defaults (void)
+ const struct group *grp;
+
+ /*
++ * Pull relevant settings from login.defs first.
++ */
++ if (getdef_bool ("USERGROUPS_ENAB"))
++ nflg = -1;
++
++ /*
+ * Open the defaults file for reading.
+ */
+
+@@ -628,6 +634,8 @@ static void usage (void)
+ " -K, --key KEY=VALUE overrides /etc/login.defs defaults\n"
+ " -m, --create-home create home directory for the new user\n"
+ " account\n"
++ " -n, --user-group create a new group with the same name as the\n"
++ " new user\n"
+ " -o, --non-unique allow create user with duplicate\n"
+ " (non-unique) UID\n"
+ " -p, --password PASSWORD use encrypted password for the new user\n"
+@@ -1009,6 +1017,7 @@ static void process_flags (int argc, cha
+ {"skel", required_argument, NULL, 'k'},
+ {"key", required_argument, NULL, 'K'},
+ {"create-home", no_argument, NULL, 'm'},
++ {"user-group", no_argument, NULL, 'n'},
+ {"non-unique", no_argument, NULL, 'o'},
+ {"password", required_argument, NULL, 'p'},
+ {"shell", required_argument, NULL, 's'},
+@@ -1016,7 +1025,7 @@ static void process_flags (int argc, cha
+ {NULL, 0, NULL, '\0'}
+ };
+ while ((c =
+- getopt_long (argc, argv, "b:c:d:De:f:g:G:k:K:mMop:s:u:",
++ getopt_long (argc, argv, "b:c:d:De:f:g:G:k:K:mMnop:s:u:",
+ long_options, NULL)) != -1) {
+ switch (c) {
+ case 'b':
+@@ -1156,6 +1165,9 @@ static void process_flags (int argc, cha
+ case 'm':
+ mflg++;
+ break;
++ case 'n':
++ nflg = 1;
++ break;
+ case 'o':
+ oflg++;
+ break;
+@@ -1203,6 +1215,16 @@ static void process_flags (int argc, cha
+ usage ();
+
+ /*
++ * Using --gid and --user-group doesn't make sense.
++ */
++ if (nflg == -1 && gflg)
++ nflg = 0;
++ if (nflg && gflg) {
++ fprintf (stderr, _("%s: options -g and -n conflict\n"), Prog);
++ exit (E_BAD_ARG);
++ }
++
++ /*
+ * Either -D or username is required. Defaults can be set with -D
+ * for the -b, -e, -f, -g, -s options only.
+ */
+@@ -1725,7 +1747,7 @@ int main (int argc, char **argv)
+ * to that group, use useradd -g username username.
+ * --bero
+ */
+- if (!gflg) {
++ if (nflg) {
+ if (getgrnam (user_name)) {
+ fprintf (stderr,
+ _
+@@ -1759,7 +1781,7 @@ int main (int argc, char **argv)
+
+ /* do we have to add a group for that user? This is why we need to
+ * open the group files in the open_files() function --gafton */
+- if (!(nflg || gflg)) {
++ if (nflg) {
+ find_new_gid ();
+ grp_add ();
+ }