[svn-upgrade] Integrating new upstream version, shadow (19990827)

This commit is contained in:
nekral-guest
2007-10-07 11:44:08 +00:00
parent 45c6603cc8
commit 446e664caa
71 changed files with 12874 additions and 3576 deletions

View File

@@ -1,6 +1,6 @@
# Makefile.in generated automatically by automake 1.3 from Makefile.am
# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -11,7 +11,7 @@
# PARTICULAR PURPOSE.
SHELL = /bin/sh
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
@@ -29,7 +29,7 @@ mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DISTDIR =
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -43,7 +43,7 @@ AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
@@ -56,11 +56,13 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias = @host_alias@
host_triplet = @host@
AS = @AS@
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
CPP = @CPP@
DATADIRNAME = @DATADIRNAME@
DLLTOOL = @DLLTOOL@
GENCAT = @GENCAT@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
@@ -84,6 +86,7 @@ MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
NM = @NM@
OBJDUMP = @OBJDUMP@
PACKAGE = @PACKAGE@
POFILES = @POFILES@
POSUB = @POSUB@
@@ -121,14 +124,12 @@ DEFS = -DLOCALEDIR=\"$(localedir)\" -I. -I$(srcdir) -I.. @DEFS@
# and installation would be much simpler (just two directories,
# $prefix/bin and $prefix/sbin, no install-data hacks...)
bin_PROGRAMS = login \
su
ubin_PROGRAMS = faillog lastlog \
chage chfn chsh expiry gpasswd newgrp passwd
usbin_PROGRAMS = chpasswd dpasswd groupadd groupdel groupmod \
logoutd mkpasswd newusers \
useradd userdel usermod grpck pwck vipw \
grpconv grpunconv pwconv pwunconv
bin_PROGRAMS = login su
ubin_PROGRAMS = faillog lastlog chage chfn chsh expiry gpasswd newgrp passwd
usbin_PROGRAMS = chpasswd dpasswd groupadd groupdel groupmod logoutd mkpasswd newusers useradd userdel usermod grpck pwck vipw grpconv grpunconv pwconv pwunconv
EXTRA_DIST = shadowconfig.sh
@@ -368,9 +369,10 @@ pwunconv_DEPENDENCIES = ../lib/libshadow.la ../libmisc/libmisc.a \
../lib/libshadow.a
pwunconv_LDFLAGS =
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
HEADERS = $(noinst_HEADERS)
DIST_COMMON = Makefile.am Makefile.in
@@ -379,15 +381,14 @@ DIST_COMMON = Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP = --best
GZIP_ENV = --best
SOURCES = login.c su.c groups.c id.c sulogin.c faillog.c lastlog.c chage.c chfn.c chsh.c expiry.c gpasswd.c newgrp.c passwd.c chpasswd.c dpasswd.c groupadd.c groupdel.c groupmod.c logoutd.c mkpasswd.c newusers.c useradd.c userdel.c usermod.c grpck.c pwck.c vipw.c grpconv.c grpunconv.c pwconv.c pwunconv.c
OBJECTS = login.o su.o groups.o id.o sulogin.o faillog.o lastlog.o chage.o chfn.o chsh.o expiry.o gpasswd.o newgrp.o passwd.o chpasswd.o dpasswd.o groupadd.o groupdel.o groupmod.o logoutd.o mkpasswd.o newusers.o useradd.o userdel.o usermod.o grpck.o pwck.o vipw.o grpconv.o grpunconv.o pwconv.o pwunconv.o
all: Makefile $(PROGRAMS) $(HEADERS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .S .c .lo .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps src/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@@ -409,15 +410,15 @@ install-binPROGRAMS: $(bin_PROGRAMS)
$(mkinstalldirs) $(DESTDIR)$(bindir)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
list='$(bin_PROGRAMS)'; for p in $$list; do \
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
done
mostlyclean-noinstPROGRAMS:
@@ -443,15 +444,15 @@ install-ubinPROGRAMS: $(ubin_PROGRAMS)
$(mkinstalldirs) $(DESTDIR)$(ubindir)
@list='$(ubin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(ubindir)/`echo $$p|sed '$(transform)'`"; \
$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(ubindir)/`echo $$p|sed '$(transform)'`; \
echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(ubindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(ubindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
else :; fi; \
done
uninstall-ubinPROGRAMS:
@$(NORMAL_UNINSTALL)
list='$(ubin_PROGRAMS)'; for p in $$list; do \
rm -f $(DESTDIR)$(ubindir)/`echo $$p|sed '$(transform)'`; \
rm -f $(DESTDIR)$(ubindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
done
mostlyclean-usbinPROGRAMS:
@@ -468,15 +469,15 @@ install-usbinPROGRAMS: $(usbin_PROGRAMS)
$(mkinstalldirs) $(DESTDIR)$(usbindir)
@list='$(usbin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(usbindir)/`echo $$p|sed '$(transform)'`"; \
$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(usbindir)/`echo $$p|sed '$(transform)'`; \
echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(usbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(usbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
else :; fi; \
done
uninstall-usbinPROGRAMS:
@$(NORMAL_UNINSTALL)
list='$(usbin_PROGRAMS)'; for p in $$list; do \
rm -f $(DESTDIR)$(usbindir)/`echo $$p|sed '$(transform)'`; \
rm -f $(DESTDIR)$(usbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
done
.c.o:
@@ -648,8 +649,12 @@ pwunconv: $(pwunconv_OBJECTS) $(pwunconv_DEPENDENCIES)
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
@@ -677,9 +682,13 @@ subdir = src
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file; \
if test -d $$d/$$file; then \
cp -pr $$/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
chage.o: chage.c ../config.h ../lib/rcsid.h ../lib/prototypes.h \
../lib/defines.h ../lib/gshadow_.h ../lib/pwio.h \
@@ -774,70 +783,80 @@ vipw.o: vipw.c ../config.h ../lib/rcsid.h ../lib/defines.h \
../lib/gshadow_.h ../lib/prototypes.h ../lib/pwio.h \
../lib/shadowio.h ../lib/groupio.h ../lib/sgroupio.h
info:
dvi:
check: all
$(MAKE)
installcheck:
install-exec: install-binPROGRAMS
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am: install-binPROGRAMS
@$(NORMAL_INSTALL)
$(MAKE) install-exec-hook
$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
install-exec: install-exec-am
install-data: install-ubinPROGRAMS install-usbinPROGRAMS
install-data-am: install-ubinPROGRAMS install-usbinPROGRAMS
@$(NORMAL_INSTALL)
$(MAKE) install-data-hook
install: install-exec install-data all
@:
uninstall: uninstall-binPROGRAMS uninstall-ubinPROGRAMS uninstall-usbinPROGRAMS
$(MAKE) $(AM_MAKEFLAGS) install-data-hook
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-binPROGRAMS uninstall-ubinPROGRAMS \
uninstall-usbinPROGRAMS
uninstall: uninstall-am
all-am: Makefile $(PROGRAMS) $(HEADERS)
all-redirect: all-am
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DATADIR)$(bindir) $(DATADIR)$(ubindir) \
$(DATADIR)$(usbindir)
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(ubindir) \
$(DESTDIR)$(usbindir)
mostlyclean-generic:
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-rm -f Makefile $(DISTCLEANFILES)
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
mostlyclean: mostlyclean-binPROGRAMS mostlyclean-noinstPROGRAMS \
mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-noinstPROGRAMS \
mostlyclean-ubinPROGRAMS mostlyclean-usbinPROGRAMS \
mostlyclean-compile mostlyclean-libtool \
mostlyclean-tags mostlyclean-generic
clean: clean-binPROGRAMS clean-noinstPROGRAMS clean-ubinPROGRAMS \
clean-usbinPROGRAMS clean-compile clean-libtool \
clean-tags clean-generic mostlyclean
mostlyclean: mostlyclean-am
distclean: distclean-binPROGRAMS distclean-noinstPROGRAMS \
clean-am: clean-binPROGRAMS clean-noinstPROGRAMS clean-ubinPROGRAMS \
clean-usbinPROGRAMS clean-compile clean-libtool \
clean-tags clean-generic mostlyclean-am
clean: clean-am
distclean-am: distclean-binPROGRAMS distclean-noinstPROGRAMS \
distclean-ubinPROGRAMS distclean-usbinPROGRAMS \
distclean-compile distclean-libtool distclean-tags \
distclean-generic clean
-rm -f config.status
distclean-generic clean-am
-rm -f libtool
maintainer-clean: maintainer-clean-binPROGRAMS \
distclean: distclean-am
maintainer-clean-am: maintainer-clean-binPROGRAMS \
maintainer-clean-noinstPROGRAMS \
maintainer-clean-ubinPROGRAMS \
maintainer-clean-usbinPROGRAMS maintainer-clean-compile \
maintainer-clean-libtool maintainer-clean-tags \
maintainer-clean-generic distclean
maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
mostlyclean-noinstPROGRAMS distclean-noinstPROGRAMS \
@@ -850,10 +869,12 @@ uninstall-usbinPROGRAMS install-usbinPROGRAMS mostlyclean-compile \
distclean-compile clean-compile maintainer-clean-compile \
mostlyclean-libtool distclean-libtool clean-libtool \
maintainer-clean-libtool tags mostlyclean-tags distclean-tags \
clean-tags maintainer-clean-tags distdir info dvi installcheck \
install-exec install-data install uninstall all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
check-am installcheck-am installcheck install-exec-am install-exec \
install-data-am install-data install-am install uninstall-am uninstall \
all-redirect all-am all installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
install-exec-hook:

View File

@@ -30,7 +30,7 @@
#include <config.h>
#include "rcsid.h"
RCSID(PKG_VER "$Id: chage.c,v 1.15 1999/06/07 16:40:45 marekm Exp $")
RCSID(PKG_VER "$Id: chage.c,v 1.16 1999/08/27 19:02:51 marekm Exp $")
#include <sys/types.h>
#include <stdio.h>
@@ -306,10 +306,10 @@ list_fields(void)
* is when the active will be disabled.
*/
printf ("Password Inactive:\t");
printf(_("Password Inactive:\t"));
if (lastday <= 0 || inactdays <= 0 ||
maxdays >= 10000*(DAY/SCALE) || maxdays <= 0) {
printf ("Never\n");
printf (_("Never\n"));
} else {
expires = changed + (maxdays + inactdays) * SCALE;
print_date(expires);
@@ -320,9 +320,9 @@ list_fields(void)
* password expiring or not.
*/
printf ("Account Expires:\t");
printf(_("Account Expires:\t"));
if (expdays <= 0) {
printf ("Never\n");
printf (_("Never\n"));
} else {
expires = expdays * SCALE;
print_date(expires);

View File

@@ -30,7 +30,7 @@
#include <config.h>
#include "rcsid.h"
RCSID(PKG_VER "$Id: dpasswd.c,v 1.9 1999/06/07 16:40:45 marekm Exp $")
RCSID(PKG_VER "$Id: dpasswd.c,v 1.10 1999/08/27 19:02:51 marekm Exp $")
#include <sys/types.h>
#include <sys/stat.h>
@@ -133,13 +133,13 @@ main(int argc, char **argv)
dent.du_passwd = ""; /* XXX warning: const */
again:
if (! (cp = getpass(_("Shell password:"))))
if (! (cp = getpass(_("Shell password: "))))
exit (1);
STRFCPY(pass, cp);
strzero(cp);
if (! (cp = getpass(_("re-enter Shell password:"))))
if (! (cp = getpass(_("re-enter Shell password: "))))
exit (1);
if (strcmp (pass, cp)) {

View File

@@ -30,7 +30,7 @@
#include <config.h>
#include "rcsid.h"
RCSID(PKG_VER "$Id: gpasswd.c,v 1.14 1999/06/07 16:40:45 marekm Exp $")
RCSID(PKG_VER "$Id: gpasswd.c,v 1.15 1999/08/27 19:02:51 marekm Exp $")
#include <sys/types.h>
#include <stdio.h>
@@ -537,12 +537,12 @@ main(int argc, char **argv)
printf(_("Changing the password for group %s\n"), group);
for (retries = 0; retries < RETRIES; retries++) {
if (! (cp = getpass(_("New Password:"))))
if (! (cp = getpass(_("New Password: "))))
exit (1);
STRFCPY(pass, cp);
strzero(cp);
if (! (cp = getpass (_("Re-enter new password:"))))
if (! (cp = getpass (_("Re-enter new password: "))))
exit (1);
if (strcmp(pass, cp) == 0) {

View File

@@ -30,7 +30,7 @@
#include <config.h>
#include "rcsid.h"
RCSID(PKG_VER "$Id: login.c,v 1.15 1999/06/07 16:40:45 marekm Exp $")
RCSID(PKG_VER "$Id: login.c,v 1.16 1999/08/27 19:02:51 marekm Exp $")
#include "prototypes.h"
#include "defines.h"
@@ -218,7 +218,6 @@ setup_tty(void)
* Add your favorite terminal modes here ...
*/
#ifndef USE_SGTTY
termio.c_lflag |= ISIG|ICANON|ECHO|ECHOE;
termio.c_iflag |= ICRNL;
@@ -261,8 +260,6 @@ setup_tty(void)
* effect after the first username login
*/
#else
#endif /* !BSD */
STTY(0, &termio);
}

View File

@@ -30,7 +30,7 @@
#include <config.h>
#include "rcsid.h"
RCSID(PKG_VER "$Id: logoutd.c,v 1.13 1999/06/07 16:40:45 marekm Exp $")
RCSID(PKG_VER "$Id: logoutd.c,v 1.14 1999/08/27 19:02:51 marekm Exp $")
#include <sys/types.h>
#include <sys/stat.h>
@@ -51,59 +51,18 @@ RCSID(PKG_VER "$Id: logoutd.c,v 1.13 1999/06/07 16:40:45 marekm Exp $")
static char *Prog;
static char *mesg_buf = "login time exceeded\r\n"; /* XXX warning: const */
static int mesg_len = 21;
static int mesg_size;
#ifndef DEFAULT_HUP_MESG
#define DEFAULT_HUP_MESG "login time exceeded\r\n"
#endif
#ifndef HUP_MESG_FILE
#define HUP_MESG_FILE "/etc/logoutd.mesg"
#endif
/* local function prototypes */
static RETSIGTYPE reload_mesg P_((int));
static int check_login P_((const struct utmp *));
int main P_((int, char **));
/*
* reload_mesg - reload the message that is output when killing a process
*/
static RETSIGTYPE
reload_mesg(int sig)
{
int fd;
struct stat sb;
signal (sig, reload_mesg);
if (stat (HUP_MESG_FILE, &sb))
return;
if ((sb.st_mode & S_IFMT) != S_IFREG)
return;
if ((fd = open (HUP_MESG_FILE, O_RDONLY)) != -1) {
if (sb.st_size + 1 > mesg_size) {
if (mesg_buf && mesg_size)
free (mesg_buf);
mesg_len = sb.st_size;
mesg_size = mesg_len + 1;
if (! (mesg_buf = (char *) malloc (mesg_len + 1)))
goto end;
} else
mesg_len = sb.st_size;
if (read (fd, mesg_buf, mesg_len) != mesg_len) {
mesg_len = 0;
goto end;
}
} else
return;
end:
close (fd);
}
/*
* check_login - check if user (struct utmp) allowed to stay logged in
@@ -140,6 +99,47 @@ check_login(const struct utmp *ut)
return 1;
}
static void
send_mesg_to_tty(int tty_fd)
{
TERMIO oldt, newt;
FILE *mesg_file, *tty_file;
int c, is_tty;
tty_file = fdopen(tty_fd, "w");
if (!tty_file)
return;
is_tty = (GTTY(tty_fd, &oldt) == 0);
if (is_tty) {
/* Suggested by Ivan Nejgebauar <ian@unsux.ns.ac.yu>:
set OPOST before writing the message. */
newt = oldt;
newt.c_oflag |= OPOST;
STTY(tty_fd, &newt);
}
mesg_file = fopen(HUP_MESG_FILE, "r");
if (mesg_file) {
while ((c = getc(mesg_file)) != EOF) {
if (c == '\n')
putc('\r', tty_file);
putc(c, tty_file);
}
fclose(mesg_file);
} else {
fputs(DEFAULT_HUP_MESG, tty_file);
}
fflush(tty_file);
fclose(tty_file);
if (is_tty) {
STTY(tty_fd, &oldt);
}
}
/*
* logoutd - logout daemon to enforce /etc/porttime file policy
*
@@ -154,6 +154,7 @@ main(int argc, char **argv)
{
int i;
int status;
pid_t pid;
struct utmp *ut;
char user[sizeof(ut->ut_user) + 1]; /* terminating NUL */
char tty_name[sizeof(ut->ut_line) + 6]; /* /dev/ + NUL */
@@ -177,14 +178,19 @@ main(int argc, char **argv)
setpgid(getpid(), getpid()); /* BSD || SUN || SUN4 */
#endif /* !HAVE_SETPGRP */
reload_mesg (SIGHUP);
/*
* Put this process in the background.
*/
if ((i = fork ()))
exit (i < 0 ? 1:0);
pid = fork();
if (pid > 0) {
/* parent */
exit(0);
} else if (pid < 0) {
/* error */
perror("fork");
exit(1);
}
#endif /* !DEBUG */
/*
@@ -201,9 +207,6 @@ main(int argc, char **argv)
*/
while (1) {
#ifndef DEBUG
sleep(60);
#endif
/*
* Attempt to re-open the utmp file. The file is only
@@ -233,8 +236,15 @@ main(int argc, char **argv)
* keeps the scan from waiting on other ports to die.
*/
if (fork() != 0)
pid = fork();
if (pid > 0) {
/* parent */
continue;
} else if (pid < 0) {
/* failed - give up until the next scan */
break;
}
/* child */
if (strncmp(ut->ut_line, "/dev/", 5) != 0)
strcpy(tty_name, "/dev/");
@@ -245,22 +255,10 @@ main(int argc, char **argv)
#ifndef O_NOCTTY
#define O_NOCTTY 0
#endif
if ((tty_fd = open (tty_name,
O_WRONLY|O_NDELAY|O_NOCTTY)) != -1) {
/* Suggested by Ivan Nejgebauar <ian@unsux.ns.ac.yu>: set OPOST
before writing the message. --marekm */
TERMIO oldt, newt;
GTTY(tty_fd, &oldt);
newt = oldt;
#ifdef OPOST
newt.c_oflag |= OPOST;
#else /* XXX - I'm too young to know bsd sgtty, sorry :). --marekm */
#endif
STTY(tty_fd, &newt);
write (tty_fd, mesg_buf, mesg_len);
STTY(tty_fd, &oldt);
close (tty_fd);
tty_fd = open(tty_name, O_WRONLY|O_NDELAY|O_NOCTTY);
if (tty_fd != -1) {
send_mesg_to_tty(tty_fd);
close(tty_fd);
sleep(10);
}
#ifdef USER_PROCESS /* USG_UTMP */
@@ -282,19 +280,11 @@ main(int argc, char **argv)
close (tty_fd);
#endif /* BSD || SUN || SUN4 */
#if 0
SYSLOG((LOG_NOTICE,
"logged off user `%.*s' on `%.*s'\n",
(int) sizeof(ut->ut_user), ut->ut_user,
(int) sizeof(ut->ut_line), ut->ut_line));
#else
/* avoid gcc warnings about %.*s in syslog() */
strncpy(user, ut->ut_line, sizeof(user) - 1);
user[sizeof(user) - 1] = '\0';
SYSLOG((LOG_NOTICE, "logged off user `%s' on `%s'\n",
user, tty_name));
#endif
/*
* This child has done all it can, drop dead.
@@ -305,6 +295,9 @@ main(int argc, char **argv)
endutent();
#ifndef DEBUG
sleep(60);
#endif
/*
* Reap any dead babies ...
*/

View File

@@ -30,7 +30,7 @@
#include <config.h>
#include "rcsid.h"
RCSID(PKG_VER "$Id: newgrp.c,v 1.13 1999/07/09 18:02:43 marekm Exp $")
RCSID(PKG_VER "$Id: newgrp.c,v 1.14 1999/08/27 19:02:51 marekm Exp $")
#include <stdio.h>
#include <errno.h>
@@ -66,7 +66,7 @@ usage(void)
if (is_newgrp)
fprintf (stderr, _("usage: newgrp [ - ] [ group ]\n"));
else
fprintf (stderr, _("usage: sg group [ command ]\n"));
fprintf (stderr, _("usage: sg group [[-c] command ]\n"));
}
/*
@@ -163,7 +163,15 @@ main(int argc, char **argv)
exit (1);
}
if (argc > 0) {
command = argv[1];
/* skip -c if specified so both forms work:
"sg group -c command" (as in the man page) or
"sg group command" (as in the usage message). */
if (argc > 1 && strcmp(argv[0], "-c") == 0)
command = argv[1];
else
command = argv[0];
cflag++;
}
} else {
@@ -209,8 +217,6 @@ main(int argc, char **argv)
for (;;) {
grouplist = (GETGROUPS_T *) xmalloc(i * sizeof(GETGROUPS_T));
ngroups = getgroups(i, grouplist);
/* XXX Bug#38672
login: newgrp/sg fails with user in 17 groups */
if (i > ngroups && !(ngroups == -1 && errno == EINVAL))
break;
/* not enough room, so try allocating a larger buffer */
@@ -288,7 +294,7 @@ main(int argc, char **argv)
* the decryption from the group file.
*/
if (! (cp = getpass (_("Password:"))))
if (! (cp = getpass (_("Password: "))))
goto failure;
/*
@@ -443,6 +449,12 @@ okay:
addenv(*envp++, NULL);
}
/* sanitize_env() removes $HOME from the environment (maybe it
shouldn't - please tell me if you are sure that $HOME can't
cause security problems) - add it from user's passwd entry.
*/
addenv("HOME", pwd->pw_dir);
/*
* exec the login shell and go away. we are trying to get
* back to the previous environment which should be the

View File

@@ -30,7 +30,7 @@
#include <config.h>
#include "rcsid.h"
RCSID(PKG_VER "$Id: passwd.c,v 1.17 1999/07/09 18:02:43 marekm Exp $")
RCSID(PKG_VER "$Id: passwd.c,v 1.18 1999/08/27 19:02:51 marekm Exp $")
#include "prototypes.h"
#include "defines.h"
@@ -353,7 +353,7 @@ new_password(const struct passwd *pw)
if (! amroot && crypt_passwd[0]) {
#endif
if (!(clear = getpass(_("Old password:"))))
if (!(clear = getpass(_("Old password: "))))
return -1;
cipher = pw_encrypt(clear, crypt_passwd);
@@ -398,7 +398,7 @@ Please use a combination of upper and lower case letters and numbers.\n"),
warned = 0;
for (i = getdef_num("PASS_CHANGE_TRIES", 5); i > 0; i--) {
if (!(cp = getpass(_("New password:")))) {
if (!(cp = getpass(_("New password: ")))) {
memzero(orig, sizeof orig);
return -1;
}
@@ -421,7 +421,7 @@ Please use a combination of upper and lower case letters and numbers.\n"),
warned++;
continue;
}
if (!(cp = getpass(_("Re-enter new password:")))) {
if (!(cp = getpass(_("Re-enter new password: ")))) {
memzero(orig, sizeof orig);
return -1;
}

View File

@@ -30,7 +30,7 @@
#include <config.h>
#include "rcsid.h"
RCSID(PKG_VER "$Id: sulogin.c,v 1.9 1999/06/07 16:40:45 marekm Exp $")
RCSID(PKG_VER "$Id: sulogin.c,v 1.10 1999/08/27 19:02:51 marekm Exp $")
#include "prototypes.h"
#include "defines.h"
@@ -94,12 +94,6 @@ main(int argc, char **argv)
char **envp = environ;
TERMIO termio;
#ifdef USE_SGTTY
ioctl (0, TIOCGETP, &termio);
termio.sg_flags |= (ECHO|CRMOD);
termio.sg_flags &= ~(RAW|CBREAK);
ioctl (0, TIOCSETN, &termio);
#endif
#ifdef USE_TERMIO
ioctl (0, TCGETA, &termio);
termio.c_iflag |= (ICRNL|IXON);