shadow: merge patches

This commit is contained in:
Johannes Winkelmann 2006-09-08 15:15:18 +00:00
parent 975dabaa97
commit f63f579320
5 changed files with 54 additions and 65 deletions

View File

@ -1,7 +1,5 @@
2b8c303d972cf6fb2a4545dd17262f27 login.defs
be8f69c2701118093af3d7f3bc02af16 pwck
9e2f566e29068dc98e42ea94ac788200 shadow-4.0.15-nflg-conflict.diff
d58a29c9fa227f18545d8c43997dbb7d shadow-4.0.16-fix-useradd-usergroups.patch
aa1259020b925cd3088cb7a36fbe7753 shadow-4.0.18.1-useradd-usermod.diff
e7751d46ecf219c07ae0b028ab3335c6 shadow-4.0.18.1.tar.bz2
a588e277ff49988f0e3787c5b327d10c shadow-fix-useradd-usergroups.patch
75161be083592e2e4e7f9cdcb7369bab useradd-usergroup.diff

View File

@ -5,20 +5,15 @@
name=shadow
version=4.0.18.1
release=3
release=4
source=(ftp://ftp.pld.org.pl/software/shadow/$name-$version.tar.bz2
pwck login.defs
shadow-fix-useradd-usergroups.patch
shadow-4.0.15-nflg-conflict.diff
useradd-usergroup.diff
shadow-4.0.16-fix-useradd-usergroups.patch
shadow-4.0.18.1-useradd-usermod.diff)
build() {
cd $name-$version
patch src/useradd.c $SRC/shadow-fix-useradd-usergroups.patch
patch src/useradd.c $SRC/shadow-4.0.15-nflg-conflict.diff
patch src/useradd.c $SRC/useradd-usergroup.diff
patch -p0 < $SRC/shadow-4.0.16-fix-useradd-usergroups.patch
patch -p1 < $SRC/shadow-4.0.18.1-useradd-usermod.diff
./configure --prefix=/usr \

View File

@ -1,28 +0,0 @@
--- useradd.c.orig 2006-04-08 10:47:03.016040384 +0200
+++ useradd.c 2006-04-08 11:17:09.218455880 +0200
@@ -1214,6 +1214,16 @@
usage ();
/*
+ * Using -g and -n doesn't make sense
+ */
+ if (nflg && gflg) {
+ fprintf(stderr,
+ _("%s: options -n and -g conflict and can't be used together\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.
*/
@@ -1778,7 +1788,7 @@
/* 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 ();
}

View File

@ -1,11 +1,18 @@
2006-04-07 Mike Frysinger <vapier@gentoo.org>
Taken from
http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/shadow/files/shadow-4.0.18.1-useradd-usermod.patch?rev=1.1&view=markup
* src/useradd.c: Actually utilize the nflg by adding an -n option for the
user and by setting to USERGROUPS_ENAB from login.defs. Also fix the logic
for when the user group actually needs to be added.
http://bugs.gentoo.org/128715
--- src/useradd.c
+++ src/useradd.c
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;
@ -15,18 +22,20 @@
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,10 @@ static void get_defaults (void)
@@ -253,6 +253,12 @@ static void get_defaults (void)
const struct group *grp;
/*
+ * Pull relevant settings from login.defs first.
+ */
+ nflg = getdef_bool ("USERGROUPS_ENAB");
+ if (getdef_bool ("USERGROUPS_ENAB"))
+ nflg = -1;
+
+ /*
* Open the defaults file for reading.
*/
@@ -628,6 +633,8 @@ static void usage (void)
@@ -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"
@ -35,7 +44,7 @@
" -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 +1016,7 @@ static void process_flags (int argc, cha
@@ -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'},
@ -43,7 +52,7 @@
{"non-unique", no_argument, NULL, 'o'},
{"password", required_argument, NULL, 'p'},
{"shell", required_argument, NULL, 's'},
@@ -1016,7 +1024,7 @@ static void process_flags (int argc, cha
@@ -1016,7 +1025,7 @@ static void process_flags (int argc, cha
{NULL, 0, NULL, '\0'}
};
while ((c =
@ -52,22 +61,48 @@
long_options, NULL)) != -1) {
switch (c) {
case 'b':
@@ -1156,6 +1164,9 @@ static void process_flags (int argc, cha
@@ -1156,6 +1165,9 @@ static void process_flags (int argc, cha
case 'm':
mflg++;
break;
+ case 'n':
+ nflg++;
+ nflg = 1;
+ break;
case 'o':
oflg++;
break;
@@ -1767,7 +1778,7 @@ int main (int argc, char **argv)
@@ -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 && !gflg) {
+ if (nflg) {
find_new_gid ();
grp_add ();
}

View File

@ -1,11 +0,0 @@
--- useradd.c-r1.92 2006-04-12 10:58:55.000000000 +0200
+++ useradd.c 2006-04-12 11:05:03.000000000 +0200
@@ -1733,7 +1733,7 @@
* to that group, use useradd -g username username.
* --bero
*/
- if (!gflg) {
+ if (nflg) {
if (getgrnam (user_name)) {
fprintf (stderr,
_