shadow: update to 4.1.0

With 4.1.0-1 the default behaviour of shadow is restored and a patch
from Gentoo [1] removed.
It may be debatable whether useradd should create a new group with the
same name as the username if the primary group is not specified with
-g, or not. For now we will follow the CRUX principle to use vanila
packages whenever possible.
However, there are plans to change something in that direction [2].

[1] http://bugs.gentoo.org/show_bug.cgi?id=128715
[2] http://lists.alioth.debian.org/pipermail/pkg-shadow-devel/2007-December/006252.html
This commit is contained in:
Juergen Daubert 2008-01-29 10:31:30 +01:00
parent 5416f74ef2
commit 2ca7ecb658
8 changed files with 64 additions and 178 deletions

View File

@ -34,7 +34,6 @@ drwxr-xr-x root/root usr/man/man1/
-rw-r--r-- root/root usr/man/man1/su.1.gz
drwxr-xr-x root/root usr/man/man5/
-rw-r--r-- root/root usr/man/man5/faillog.5.gz
-rw-r--r-- root/root usr/man/man5/gshadow.5.gz
-rw-r--r-- root/root usr/man/man5/limits.5.gz
-rw-r--r-- root/root usr/man/man5/login.access.5.gz
-rw-r--r-- root/root usr/man/man5/login.defs.5.gz
@ -73,4 +72,5 @@ lrwxrwxrwx root/root usr/sbin/vigr -> vipw
-rwxr-xr-x root/root usr/sbin/vipw
drwxr-xr-x root/root var/
drwxr-xr-x root/root var/log/
-rw-r--r-- root/root var/log/faillog (EMPTY)
-rw-r--r-- root/root var/log/lastlog (EMPTY)

View File

@ -1,5 +1,4 @@
e98baece425f10e7e1dd68c412e0f7dd login.defs
05a85f1ea6bf26aec66a91b5f98a51b0 login.defs
be8f69c2701118093af3d7f3bc02af16 pwck
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
3c3a1fbfae01534de2c8bbd566200dce shadow-4.1.0.patch
dd6ca3ac424b447962d7a7af923b7bda shadow-4.1.0.tar.bz2

View File

@ -1,20 +1,18 @@
# Description: Shadow password file utilities
# URL: http://shadow.pld.org.pl/
# Packager: CRUX System Team, core-ports at crux dot nu
# URL: http://pkg-shadow.alioth.debian.org/
# Maintainer: CRUX System Team, core-ports at crux dot nu
name=shadow
version=4.0.18.1
release=5
source=(http://gentoo.osuosl.org/distfiles/$name-$version.tar.bz2
version=4.1.0
release=1
source=(ftp://pkg-shadow.alioth.debian.org/pub/pkg-shadow/$name-$version.tar.bz2
pwck login.defs
shadow-4.0.16-fix-useradd-usergroups.patch
shadow-4.0.18.1-useradd-usermod.diff)
shadow-4.1.0.patch)
build() {
cd $name-$version
patch -p0 < $SRC/shadow-4.0.16-fix-useradd-usergroups.patch
patch -p1 < $SRC/shadow-4.0.18.1-useradd-usermod.diff
patch -p1 -i $SRC/shadow-4.1.0.patch
./configure --prefix=/usr \
--mandir=/usr/man \
@ -25,21 +23,25 @@ build() {
--without-selinux \
--without-libpam
make
make DESTDIR=$PKG install
mkdir -p $PKG/etc/cron/daily $PKG/var/log
install -m 644 ../login.defs $PKG/etc
install -m 755 ../pwck $PKG/etc/cron/daily
install -d $PKG/etc/cron/daily $PKG/var/log
install -m 644 $SRC/login.defs $PKG/etc
install -m 755 $SRC/pwck $PKG/etc/cron/daily
mv $PKG/bin/{su,groups} $PKG/usr/bin
touch $PKG/var/log/lastlog
rm -rf $PKG/usr/bin/gpasswd \
$PKG/usr/man/man1/gpasswd.1 \
$PKG/usr/sbin/{chpasswd,grpconv,grpunconv,logoutd} \
$PKG/usr/sbin/{mkpasswd,newusers,pwconv,pwunconv} \
$PKG/usr/man/man8/{chpasswd.8,grpconv.8,grpunconv.8,logoutd.8} \
$PKG/usr/man/man8/{mkpasswd.8,newusers.8,pwconv.8,pwunconv.8} \
$PKG/usr/man/{man3,cs,de,es,fi,tr,fr,hu,id,it,ja,ko,pl,pt_BR,ru,zh_CN,zh_TW} \
$PKG/lib \
$PKG/etc/{login.access,limits,default}
touch $PKG/var/log/{lastlog,faillog}
rm -r $PKG/usr/bin/gpasswd \
$PKG/usr/man/man1/gpasswd.1 \
$PKG/usr/sbin/{chpasswd,grpconv,grpunconv,logoutd} \
$PKG/usr/sbin/{newusers,pwconv,pwunconv} \
$PKG/usr/man/man8/{chpasswd.8,grpconv.8,grpunconv.8,logoutd.8} \
$PKG/usr/man/man8/{newusers.8,pwconv.8,pwunconv.8} \
$PKG/usr/man/man5/gshadow.5 \
$PKG/usr/man/man3 \
$PKG/lib \
$PKG/etc/{login.access,limits,default}
}

View File

@ -42,7 +42,7 @@ PASS_CHANGE_TRIES 5
PASS_ALWAYS_WARN yes
CHFN_AUTH yes
CHFN_RESTRICT rwh
MD5_CRYPT_ENAB yes
ENCRYPT_METHOD MD5
PASS_MAX_LEN 8
DEFAULT_HOME yes
USERGROUPS_ENAB no

0
shadow/pwck Executable file → Normal file
View File

View File

@ -1,108 +0,0 @@
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
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 ();
}

View File

@ -1,42 +0,0 @@
--- shadow-4.0.18.1.orig/src/useradd.c 2006-07-28 19:42:48.000000000 +0200
+++ shadow-4.0.18.1/src/useradd.c 2006-08-04 09:24:34.000000000 +0200
@@ -203,13 +203,17 @@
long gid;
char *errptr;
+ struct group* grp = getgrnam (grname);
+ if (grp)
+ return grp;
+
gid = strtol (grname, &errptr, 10);
if (*errptr || errno == ERANGE || gid < 0) {
fprintf (stderr,
_("%s: invalid numeric argument '%s'\n"), Prog, grname);
exit (E_BAD_ARG);
}
- return getgrnam (grname);
+ return getgrgid (gid);
}
static long get_number (const char *numstr)
--- shadow-4.0.18.1.orig/src/usermod.c 2006-07-28 19:42:48.000000000 +0200
+++ shadow-4.0.18.1/src/usermod.c 2006-08-04 09:24:21.000000000 +0200
@@ -165,13 +165,17 @@
long val;
char *errptr;
+ struct group* grp = getgrnam (grname);
+ if (grp)
+ return grp;
+
val = strtol (grname, &errptr, 10);
if (*errptr || errno == ERANGE || val < 0) {
fprintf (stderr, _("%s: invalid numeric argument '%s'\n"), Prog,
grname);
exit (E_BAD_ARG);
}
- return getgrnam (grname);
+ return getgrgid (val);
}
/*

35
shadow/shadow-4.1.0.patch Normal file
View File

@ -0,0 +1,35 @@
diff -Nru shadow-4.1.0.orig/lib/encrypt.c shadow-4.1.0/lib/encrypt.c
--- shadow-4.1.0.orig/lib/encrypt.c 2008-01-22 18:32:09.000000000 +0100
+++ shadow-4.1.0/lib/encrypt.c 2008-01-22 18:35:08.000000000 +0100
@@ -32,6 +32,7 @@
#ident "$Id: encrypt.c 1457 2007-11-24 00:37:37Z nekral-guest $"
#include <unistd.h>
+#include <stdio.h>
#include "prototypes.h"
#include "defines.h"
char *pw_encrypt (const char *clear, const char *salt)
diff -Nru shadow-4.1.0.orig/libmisc/salt.c shadow-4.1.0/libmisc/salt.c
--- shadow-4.1.0.orig/libmisc/salt.c 2008-01-22 18:32:09.000000000 +0100
+++ shadow-4.1.0/libmisc/salt.c 2008-01-22 18:32:50.000000000 +0100
@@ -13,6 +13,7 @@
#include <sys/time.h>
#include <stdlib.h>
+#include <stdio.h>
#include <assert.h>
#include "prototypes.h"
#include "defines.h"
diff -Nru shadow-4.1.0.orig/src/usermod.c shadow-4.1.0/src/usermod.c
--- shadow-4.1.0.orig/src/usermod.c 2008-01-22 18:32:09.000000000 +0100
+++ shadow-4.1.0/src/usermod.c 2008-01-22 18:37:06.000000000 +0100
@@ -1146,7 +1146,9 @@
pw_locked = 0;
spw_locked = 0;
gr_locked = 0;
+#ifdef SHADOWGRP
sgr_locked = 0;
+#endif
/*
* Close the DBM and/or flat files