shadow (2.2): fix chgpasswd to work with --disable-shadowgrp
This commit is contained in:
parent
684e48d04e
commit
a65d8883f3
@ -55,6 +55,7 @@ drwxr-xr-x root/root usr/man/man8/
|
||||
-rw-r--r-- root/root usr/man/man8/vigr.8.gz
|
||||
-rw-r--r-- root/root usr/man/man8/vipw.8.gz
|
||||
drwxr-xr-x root/root usr/sbin/
|
||||
-rwxr-xr-x root/root usr/sbin/chgpasswd
|
||||
-rwxr-xr-x root/root usr/sbin/groupadd
|
||||
-rwxr-xr-x root/root usr/sbin/groupdel
|
||||
-rwxr-xr-x root/root usr/sbin/groupmod
|
||||
|
@ -1,4 +1,4 @@
|
||||
d52af1b47b7a382bff9d0be6865f05ea login.defs
|
||||
be8f69c2701118093af3d7f3bc02af16 pwck
|
||||
29b6b4f6083d841ea01f68b6f1a9137c shadow-4.0.15-nochgpasswd.diff
|
||||
01bab2b152b8f2ae0056a467fa365797 shadow-4.0.15-noshadowgrp.diff
|
||||
a0452fa989f8ba45023cc5a08136568e shadow-4.0.15.tar.bz2
|
||||
|
@ -6,17 +6,18 @@ name=shadow
|
||||
version=4.0.15
|
||||
release=1
|
||||
source=(ftp://ftp.pld.org.pl/software/shadow/$name-$version.tar.bz2 \
|
||||
pwck login.defs shadow-4.0.15-nochgpasswd.diff)
|
||||
pwck login.defs shadow-4.0.15-noshadowgrp.diff)
|
||||
|
||||
build() {
|
||||
cd $name-$version
|
||||
patch -p1 < $SRC/shadow-4.0.15-noshadowgrp.diff
|
||||
|
||||
./configure --prefix=/usr \
|
||||
--mandir=/usr/man \
|
||||
--disable-shared \
|
||||
--disable-shadowgrp \
|
||||
--disable-nls \
|
||||
--without-selinux
|
||||
patch src/Makefile $SRC/shadow-4.0.15-nochgpasswd.diff
|
||||
make
|
||||
make DESTDIR=$PKG install
|
||||
mkdir -p $PKG/etc/cron/daily $PKG/var/log
|
||||
|
@ -1,64 +0,0 @@
|
||||
--- Makefile.orig 2006-03-23 00:28:27.083554080 +0100
|
||||
+++ Makefile 2006-03-23 00:29:04.600850584 +0100
|
||||
@@ -40,7 +40,7 @@
|
||||
ubin_PROGRAMS = faillog$(EXEEXT) lastlog$(EXEEXT) chage$(EXEEXT) \
|
||||
chfn$(EXEEXT) chsh$(EXEEXT) expiry$(EXEEXT) gpasswd$(EXEEXT) \
|
||||
newgrp$(EXEEXT) passwd$(EXEEXT)
|
||||
-usbin_PROGRAMS = chgpasswd$(EXEEXT) chpasswd$(EXEEXT) \
|
||||
+usbin_PROGRAMS = chpasswd$(EXEEXT) \
|
||||
groupadd$(EXEEXT) groupdel$(EXEEXT) groupmod$(EXEEXT) \
|
||||
grpck$(EXEEXT) grpconv$(EXEEXT) grpunconv$(EXEEXT) \
|
||||
logoutd$(EXEEXT) newusers$(EXEEXT) nologin$(EXEEXT) \
|
||||
@@ -76,10 +76,6 @@
|
||||
chfn_OBJECTS = chfn.$(OBJEXT)
|
||||
chfn_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \
|
||||
$(am__DEPENDENCIES_2)
|
||||
-chgpasswd_SOURCES = chgpasswd.c
|
||||
-chgpasswd_OBJECTS = chgpasswd.$(OBJEXT)
|
||||
-chgpasswd_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \
|
||||
- $(am__DEPENDENCIES_2)
|
||||
chpasswd_SOURCES = chpasswd.c
|
||||
chpasswd_OBJECTS = chpasswd.$(OBJEXT)
|
||||
chpasswd_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \
|
||||
@@ -206,13 +202,13 @@
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
-SOURCES = chage.c chfn.c chgpasswd.c chpasswd.c chsh.c expiry.c \
|
||||
+SOURCES = chage.c chfn.c chpasswd.c chsh.c expiry.c \
|
||||
faillog.c gpasswd.c groupadd.c groupdel.c groupmod.c groups.c \
|
||||
grpck.c grpconv.c grpunconv.c id.c lastlog.c $(login_SOURCES) \
|
||||
logoutd.c newgrp.c newusers.c nologin.c passwd.c pwck.c \
|
||||
pwconv.c pwunconv.c $(su_SOURCES) sulogin.c useradd.c \
|
||||
userdel.c usermod.c vipw.c
|
||||
-DIST_SOURCES = chage.c chfn.c chgpasswd.c chpasswd.c chsh.c expiry.c \
|
||||
+DIST_SOURCES = chage.c chfn.c chpasswd.c chsh.c expiry.c \
|
||||
faillog.c gpasswd.c groupadd.c groupdel.c groupmod.c groups.c \
|
||||
grpck.c grpconv.c grpunconv.c id.c lastlog.c $(login_SOURCES) \
|
||||
logoutd.c newgrp.c newusers.c nologin.c passwd.c pwck.c \
|
||||
@@ -366,7 +362,6 @@
|
||||
AM_CPPFLAGS = -DLOCALEDIR=\"$(datadir)/locale\"
|
||||
chage_LDADD = $(LDADD) $(LIBPAM) $(LIBAUDIT) $(LIBSELINUX)
|
||||
chfn_LDADD = $(LDADD) $(LIBPAM) $(LIBSELINUX)
|
||||
-chgpasswd_LDADD = $(LDADD) $(LIBPAM) $(LIBSELINUX)
|
||||
chsh_LDADD = $(LDADD) $(LIBPAM) $(LIBSELINUX)
|
||||
chpasswd_LDADD = $(LDADD) $(LIBPAM) $(LIBSELINUX)
|
||||
gpasswd_LDADD = $(LDADD) $(LIBAUDIT) $(LIBSELINUX)
|
||||
@@ -527,9 +522,6 @@
|
||||
chfn$(EXEEXT): $(chfn_OBJECTS) $(chfn_DEPENDENCIES)
|
||||
@rm -f chfn$(EXEEXT)
|
||||
$(LINK) $(chfn_LDFLAGS) $(chfn_OBJECTS) $(chfn_LDADD) $(LIBS)
|
||||
-chgpasswd$(EXEEXT): $(chgpasswd_OBJECTS) $(chgpasswd_DEPENDENCIES)
|
||||
- @rm -f chgpasswd$(EXEEXT)
|
||||
- $(LINK) $(chgpasswd_LDFLAGS) $(chgpasswd_OBJECTS) $(chgpasswd_LDADD) $(LIBS)
|
||||
chpasswd$(EXEEXT): $(chpasswd_OBJECTS) $(chpasswd_DEPENDENCIES)
|
||||
@rm -f chpasswd$(EXEEXT)
|
||||
$(LINK) $(chpasswd_LDFLAGS) $(chpasswd_OBJECTS) $(chpasswd_LDADD) $(LIBS)
|
||||
@@ -626,7 +618,6 @@
|
||||
|
||||
include ./$(DEPDIR)/chage.Po
|
||||
include ./$(DEPDIR)/chfn.Po
|
||||
-include ./$(DEPDIR)/chgpasswd.Po
|
||||
include ./$(DEPDIR)/chpasswd.Po
|
||||
include ./$(DEPDIR)/chsh.Po
|
||||
include ./$(DEPDIR)/expiry.Po
|
127
shadow/shadow-4.0.15-noshadowgrp.diff
Normal file
127
shadow/shadow-4.0.15-noshadowgrp.diff
Normal file
@ -0,0 +1,127 @@
|
||||
--- shadow-4.0.15.orig/src/chgpasswd.c 2006-03-23 11:10:24.000000000 +0100
|
||||
+++ shadow-4.0.15/src/chgpasswd.c 2006-03-23 11:55:18.000000000 +0100
|
||||
@@ -43,7 +43,9 @@
|
||||
#include "nscd.h"
|
||||
#include "prototypes.h"
|
||||
#include "groupio.h"
|
||||
+#ifdef SHADOWGRP
|
||||
#include "sgroupio.h"
|
||||
+#endif
|
||||
/*
|
||||
* Global variables
|
||||
*/
|
||||
@@ -51,7 +53,9 @@
|
||||
static int eflg = 0;
|
||||
static int md5flg = 0;
|
||||
|
||||
-static int is_shadow_pwd;
|
||||
+#ifdef SHADOWGRP
|
||||
+static int is_shadow_grp;
|
||||
+#endif
|
||||
|
||||
/* local function prototypes */
|
||||
static void usage (void);
|
||||
@@ -78,8 +82,10 @@
|
||||
char *newpwd;
|
||||
char *cp;
|
||||
|
||||
+#ifdef SHADOWGRP
|
||||
const struct sgrp *sg;
|
||||
struct sgrp newsg;
|
||||
+#endif
|
||||
|
||||
const struct group *gr;
|
||||
struct group newgr;
|
||||
@@ -179,8 +185,9 @@
|
||||
exit (1);
|
||||
}
|
||||
|
||||
- is_shadow_pwd = sgr_file_present ();
|
||||
- if (is_shadow_pwd) {
|
||||
+#ifdef SHADOWGRP
|
||||
+ is_shadow_grp = sgr_file_present ();
|
||||
+ if (is_shadow_grp) {
|
||||
if (!sgr_lock ()) {
|
||||
fprintf (stderr, _("%s: can't lock gshadow file\n"),
|
||||
Prog);
|
||||
@@ -195,6 +202,7 @@
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* Read each line, separating the group name from the password. The
|
||||
@@ -254,33 +262,33 @@
|
||||
errors++;
|
||||
continue;
|
||||
}
|
||||
- if (is_shadow_pwd)
|
||||
- sg = sgr_locate (name);
|
||||
- else
|
||||
- sg = NULL;
|
||||
+#ifdef SHADOWGRP
|
||||
+ sg = sgr_locate (name);
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* The freshly encrypted new password is merged into the
|
||||
* user's password file entry and the last password change
|
||||
* date is set to the current date.
|
||||
*/
|
||||
- if (sg) {
|
||||
- newsg = *sg;
|
||||
- newsg.sg_passwd = cp;
|
||||
- } else {
|
||||
- newgr = *gr;
|
||||
- newgr.gr_passwd = cp;
|
||||
- }
|
||||
+#ifdef SHADOWGRP
|
||||
+ newsg = *sg;
|
||||
+ newsg.sg_passwd = cp;
|
||||
+#else
|
||||
+ newgr = *gr;
|
||||
+ newgr.gr_passwd = cp;
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* The updated password file entry is then put back and will
|
||||
* be written to the password file later, after all the
|
||||
* other entries have been updated as well.
|
||||
*/
|
||||
- if (sg)
|
||||
+#ifdef SHADOWGRP
|
||||
ok = sgr_update (&newsg);
|
||||
- else
|
||||
+#else
|
||||
ok = gr_update (&newgr);
|
||||
+#endif
|
||||
|
||||
if (!ok) {
|
||||
fprintf (stderr,
|
||||
@@ -302,12 +310,15 @@
|
||||
if (errors) {
|
||||
fprintf (stderr,
|
||||
_("%s: error detected, changes ignored\n"), Prog);
|
||||
- if (is_shadow_pwd)
|
||||
+#ifdef SHADOWGRP
|
||||
+ if (is_shadow_grp)
|
||||
sgr_unlock ();
|
||||
+#endif
|
||||
gr_unlock ();
|
||||
exit (1);
|
||||
}
|
||||
- if (is_shadow_pwd) {
|
||||
+#ifdef SHADOWGRP
|
||||
+ if (is_shadow_grp) {
|
||||
if (!sgr_close ()) {
|
||||
fprintf (stderr,
|
||||
_("%s: error updating shadow file\n"), Prog);
|
||||
@@ -316,6 +327,7 @@
|
||||
}
|
||||
sgr_unlock ();
|
||||
}
|
||||
+#endif
|
||||
if (!gr_close ()) {
|
||||
fprintf (stderr, _("%s: error updating password file\n"), Prog);
|
||||
exit (1);
|
Loading…
Reference in New Issue
Block a user