[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@
@@ -31,7 +31,7 @@ mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DISTDIR =
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -45,7 +45,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@
@@ -58,11 +58,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@
@@ -86,6 +88,7 @@ MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
NM = @NM@
OBJDUMP = @OBJDUMP@
PACKAGE = @PACKAGE@
POFILES = @POFILES@
POSUB = @POSUB@
@@ -108,13 +111,8 @@ localedir = $(datadir)/locale
INCLUDES = -I$(top_srcdir)/libmisc -I$(top_srcdir)/lib
DEFS = -DLOCALEDIR=\"$(localedir)\" -I. -I$(srcdir) -I.. @DEFS@
libmisc_a_SOURCES = addgrps.c age.c basename.c chkname.c chkshell.c \
chowndir.c chowntty.c console.c copydir.c entry.c env.c failure.c \
fields.c getdate.y hushed.c isexpired.c limits.c list.c log.c \
login_access.c login_desrpc.c login_krb.c loginprompt.c mail.c motd.c \
myname.c obscure.c pam_pass.c pwd2spwd.c pwdcheck.c pwd_init.c rlogin.c \
salt.c setugid.c setup.c setupenv.c shell.c strtoday.c suauth.c sub.c \
sulog.c ttytype.c tz.c ulimit.c utmp.c valid.c xmalloc.c
libmisc_a_SOURCES = addgrps.c age.c basename.c chkname.c chkshell.c chowndir.c chowntty.c console.c copydir.c entry.c env.c failure.c fields.c getdate.y hushed.c isexpired.c limits.c list.c log.c login_access.c login_desrpc.c login_krb.c loginprompt.c mail.c motd.c myname.c obscure.c pam_pass.c pwd2spwd.c pwdcheck.c pwd_init.c rlogin.c salt.c setugid.c setup.c setupenv.c shell.c strtoday.c suauth.c sub.c sulog.c ttytype.c tz.c ulimit.c utmp.c valid.c xmalloc.c
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
@@ -133,9 +131,10 @@ salt.o setugid.o setup.o setupenv.o shell.o strtoday.o suauth.o sub.o \
sulog.o ttytype.o tz.o ulimit.o utmp.o valid.o xmalloc.o
AR = ar
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 getdate.c
@@ -144,15 +143,14 @@ DIST_COMMON = Makefile.am Makefile.in getdate.c
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP = --best
GZIP_ENV = --best
SOURCES = $(libmisc_a_SOURCES)
OBJECTS = $(libmisc_a_OBJECTS)
all: Makefile $(LIBRARIES) $(HEADERS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .S .c .lo .o .s .y
$(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 libmisc/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@@ -212,7 +210,7 @@ libmisc.a: $(libmisc_a_OBJECTS) $(libmisc_a_DEPENDENCIES)
$(AR) cru libmisc.a $(libmisc_a_OBJECTS) $(libmisc_a_LIBADD)
$(RANLIB) libmisc.a
.y.c:
$(YACC) $(YFLAGS) $< && mv y.tab.c $*.c
$(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*.c
if test -f y.tab.h; then \
if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
else :; fi
@@ -222,8 +220,12 @@ getdate.h: getdate.c
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=; \
@@ -251,9 +253,13 @@ subdir = libmisc
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
addgrps.o: addgrps.c ../config.h ../lib/prototypes.h ../lib/defines.h \
../lib/gshadow_.h ../lib/rcsid.h
@@ -347,69 +353,79 @@ valid.o: valid.c ../config.h ../lib/rcsid.h ../lib/prototypes.h \
xmalloc.o: xmalloc.c ../config.h ../lib/rcsid.h ../lib/defines.h \
../lib/gshadow_.h
info:
dvi:
check: all
$(MAKE)
installcheck:
install-exec:
@$(NORMAL_INSTALL)
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-exec: install-exec-am
install-data:
@$(NORMAL_INSTALL)
install: install-exec install-data all
@:
uninstall:
install-data-am:
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am:
uninstall: uninstall-am
all-am: Makefile $(LIBRARIES) $(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:
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-noinstLIBRARIES mostlyclean-compile \
-test -z "getdatehgetdatec" || rm -f getdateh getdatec
mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \
mostlyclean-libtool mostlyclean-tags \
mostlyclean-generic
clean: clean-noinstLIBRARIES clean-compile clean-libtool clean-tags \
clean-generic mostlyclean
mostlyclean: mostlyclean-am
distclean: distclean-noinstLIBRARIES distclean-compile \
clean-am: clean-noinstLIBRARIES clean-compile clean-libtool clean-tags \
clean-generic mostlyclean-am
clean: clean-am
distclean-am: distclean-noinstLIBRARIES distclean-compile \
distclean-libtool distclean-tags distclean-generic \
clean
-rm -f config.status
clean-am
-rm -f libtool
maintainer-clean: maintainer-clean-noinstLIBRARIES \
distclean: distclean-am
maintainer-clean-am: maintainer-clean-noinstLIBRARIES \
maintainer-clean-compile maintainer-clean-libtool \
maintainer-clean-tags maintainer-clean-generic \
distclean
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-noinstLIBRARIES distclean-noinstLIBRARIES \
clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
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 \
distclean-tags 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

View File

@@ -35,7 +35,7 @@
#include <config.h>
#include "rcsid.h"
RCSID("$Id: limits.c,v 1.9 1999/03/07 19:14:39 marekm Exp $")
RCSID("$Id: limits.c,v 1.10 1999/08/27 19:02:51 marekm Exp $")
#include <sys/types.h>
#include <sys/stat.h>
@@ -102,6 +102,20 @@ set_prio(const char *value)
}
static int
set_umask(const char *value)
{
mode_t mask;
char **endptr = (char **) &value;
mask = strtol(value, endptr, 8) & 0777;
if ((mask == 0) && (value == *endptr))
return 0;
umask(mask);
return 0;
}
/* Counts the number of user logins and check against the limit */
static int
check_logins(const char *name, const char *maxlogins)
@@ -158,15 +172,16 @@ check_logins(const char *name, const char *maxlogins)
* [Aa]: a = RLIMIT_AS max address space (KB)
* [Cc]: c = RLIMIT_CORE max core file size (KB)
* [Dd]: d = RLIMIT_DATA max data size (KB)
* [Ff]: f = RLIMIT_FSIZE Maximum filesize (KB)
* [Ff]: f = RLIMIT_FSIZE max file size (KB)
* [Mm]: m = RLIMIT_MEMLOCK max locked-in-memory address space (KB)
* [Nn]: n = RLIMIT_NOFILE max number of open files
* [Rr]: r = RLIMIT_RSS max resident set size (KB)
* [Ss]: s = RLIMIT_STACK max stack size (KB)
* [Tt]: t = RLIMIT_CPU max CPU time (MIN)
* [Uu]: u = RLIMIT_NPROC max number of processes
* [Kk]: k = file creation masK (umask)
* [Ll]: l = max number of logins for this user
* [Pp]: p = process priority -20..20 (negative = high priority)
* [Pp]: p = process priority -20..20 (negative = high, positive = low)
*
* Return value:
* 0 = okay, of course
@@ -254,6 +269,10 @@ do_user_limits(const char *buf, const char *name)
retval |= setrlimit_value(RLIMIT_STACK, pp, 1024);
break;
#endif
case 'k':
case 'K':
retval |= set_umask(pp);
break;
case 'l':
case 'L':
/* LIMIT the number of concurent logins */
@@ -330,6 +349,27 @@ setup_user_limits(const char *uname)
}
#endif /* LIMITS */
static void
setup_usergroups(const struct passwd *info)
{
const struct group *grp;
mode_t oldmask;
/*
* if not root, and uid == gid, and username is the same as primary
* group name, set umask group bits to be the same as owner bits
* (examples: 022 -> 002, 077 -> 007).
*/
if (info->pw_uid != 0 && info->pw_uid == info->pw_gid) {
grp = getgrgid(info->pw_gid);
if (grp && (strcmp(info->pw_name, grp->gr_name) == 0)) {
oldmask = umask(0777);
umask((oldmask & ~070) | ((oldmask >> 3) & 070));
}
}
}
/*
* set the process nice, ulimit, and umask from the password file entry
*/
@@ -341,16 +381,8 @@ setup_limits(const struct passwd *info)
int i;
long l;
#ifdef USERGROUPS
if (info->pw_uid != 0 && info->pw_uid == info->pw_gid) {
const struct group *grp;
grp = getgrgid(info->pw_gid);
if (grp && !strcmp(info->pw_name, grp->gr_name)) {
umask(umask(0) & ~070);
}
}
#endif
if (getdef_bool("USERGROUPS_ENAB"))
setup_usergroups(info);
/*
* See if the GECOS field contains values for NICE, UMASK or ULIMIT.
@@ -358,9 +390,9 @@ setup_limits(const struct passwd *info)
* values the defaults for this login session.
*/
if ( getdef_bool("QUOTAS_ENAB") ) {
if (getdef_bool("QUOTAS_ENAB")) {
#ifdef LIMITS
if (info->pw_uid)
if (info->pw_uid != 0)
if (setup_user_limits(info->pw_name) & LOGIN_ERROR_LOGIN) {
fprintf(stderr, _("Too many logins.\n"));
sleep(2);

View File

@@ -32,7 +32,7 @@
#ifdef RLOGIN
#include "rcsid.h"
RCSID("$Id: rlogin.c,v 1.4 1997/12/14 20:07:20 marekm Exp $")
RCSID("$Id: rlogin.c,v 1.5 1999/08/27 19:02:51 marekm Exp $")
#include "prototypes.h"
#include "defines.h"
@@ -140,15 +140,16 @@ do_rlogin(const char *remote_host, char *name, int namelen, char *term, int term
* Put the terminal in cooked mode with echo turned on.
*/
GTTY (0, &termio);
#ifndef USE_SGTTY
GTTY(0, &termio);
termio.c_iflag |= ICRNL|IXON;
termio.c_oflag |= OPOST|ONLCR;
termio.c_lflag |= ICANON|ECHO|ECHOE;
#ifdef CBAUD
termio.c_cflag = (termio.c_cflag & ~CBAUD) | speed_name;
#else
termio.c_cflag = (termio.c_cflag) | speed_name;
#endif
STTY (0, &termio);
STTY(0, &termio);
if (! (pwd = getpwnam (name)))
return 0;