summaryrefslogtreecommitdiffstats
path: root/crypto/heimdal/appl/login
diff options
context:
space:
mode:
authorassar <assar@FreeBSD.org>2001-02-13 16:46:19 +0000
committerassar <assar@FreeBSD.org>2001-02-13 16:46:19 +0000
commitebfe6dc471c206300fd82c7c0fd145f683aa52f6 (patch)
treee66aa570ad1d12c43b32a7313b0f8e28971bf8a9 /crypto/heimdal/appl/login
parente5f617598c2db0dd51906a38ecea9208123a8b70 (diff)
downloadFreeBSD-src-ebfe6dc471c206300fd82c7c0fd145f683aa52f6.zip
FreeBSD-src-ebfe6dc471c206300fd82c7c0fd145f683aa52f6.tar.gz
import of heimdal 0.3e
Diffstat (limited to 'crypto/heimdal/appl/login')
-rw-r--r--crypto/heimdal/appl/login/ChangeLog54
-rw-r--r--crypto/heimdal/appl/login/Makefile.am29
-rw-r--r--crypto/heimdal/appl/login/Makefile.in309
-rw-r--r--crypto/heimdal/appl/login/conf.c6
-rw-r--r--crypto/heimdal/appl/login/env.c98
-rw-r--r--crypto/heimdal/appl/login/login.c269
-rw-r--r--crypto/heimdal/appl/login/login_locl.h19
-rw-r--r--crypto/heimdal/appl/login/login_protos.h14
-rw-r--r--crypto/heimdal/appl/login/read_string.c8
9 files changed, 506 insertions, 300 deletions
diff --git a/crypto/heimdal/appl/login/ChangeLog b/crypto/heimdal/appl/login/ChangeLog
index a751cae..fc9f7554 100644
--- a/crypto/heimdal/appl/login/ChangeLog
+++ b/crypto/heimdal/appl/login/ChangeLog
@@ -1,3 +1,57 @@
+2001-01-29 Assar Westerlund <assar@sics.se>
+
+ * login.c: remove some krb5_free_context that might happen at
+ unappropriate times
+
+2000-12-31 Assar Westerlund <assar@sics.se>
+
+ * login.c (main): handle krb5_init_context failure consistently
+
+2000-12-11 Assar Westerlund <assar@sics.se>
+
+ * login.c (do_login): set the group on the tty.
+ (r_flag): comment out
+ * login.c (krb5_to4): always return a value
+
+2000-10-15 Assar Westerlund <assar@sics.se>
+
+ * login.c (krb5_to4): check another return code
+
+2000-08-22 Johan Danielsson <joda@pdc.kth.se>
+
+ * login.c (do_login): set PATH to something sane;
+ (start_logout_process): avoid getting signals sent to the parent
+
+ * login_locl.h: _PATH_DEFPATH
+
+2000-07-01 Assar Westerlund <assar@sics.se>
+
+ * login.c (login_timeout): add back
+
+2000-06-28 Johan Danielsson <joda@pdc.kth.se>
+
+ * env.c: new file for environment related functions
+
+ * login.c: move environment stuff to separate file, allow
+ specifying list of environment files via login.conf
+
+2000-06-21 Assar Westerlund <assar@sics.se>
+
+ * Makefile.am (LDADD): add otp
+ * login.c: add reading of /etc/environment. From Ake Sandgren
+ <ake@cs.umu.se>
+ add otp support. From Daniel Kouril <kouril@ics.muni.cz>
+
+2000-06-09 Assar Westerlund <assar@sics.se>
+
+ * login.c (do_login): work-around for setuid and capabilities bug
+ fixed in Linux 2.2.16
+
+2000-04-09 Assar Westerlund <assar@sics.se>
+
+ * login.c: allow conversion of v5 -> v4 tickets when logging in
+ with forwarded tickets
+
1999-11-09 Johan Danielsson <joda@pdc.kth.se>
* conf.c: remove case for not having cgetent, since it's in roken
diff --git a/crypto/heimdal/appl/login/Makefile.am b/crypto/heimdal/appl/login/Makefile.am
index 22b4b62..1f458e9 100644
--- a/crypto/heimdal/appl/login/Makefile.am
+++ b/crypto/heimdal/appl/login/Makefile.am
@@ -1,4 +1,4 @@
-# $Id: Makefile.am,v 1.16 1999/10/30 08:51:45 assar Exp $
+# $Id: Makefile.am,v 1.19 2000/11/15 22:51:08 assar Exp $
include $(top_srcdir)/Makefile.am.common
@@ -6,27 +6,30 @@ INCLUDES += $(INCLUDE_krb4)
bin_PROGRAMS = login
-login_SOURCES = \
+login_SOURCES = \
+ conf.c \
+ env.c \
login.c \
+ login_access.c \
+ login_locl.h \
+ login_protos.h \
osfc2.c \
read_string.c \
- utmp_login.c \
- utmpx_login.c \
- tty.c \
+ shadow.c \
stty_default.c \
- login_access.c \
- login_locl.h \
- login_proto.h \
- conf.c \
- shadow.c
+ tty.c \
+ utmp_login.c \
+ utmpx_login.c
-LDADD = $(LIB_kafs) \
+LDADD = $(LIB_otp) \
+ $(LIB_kafs) \
$(top_builddir)/lib/krb5/libkrb5.la \
$(LIB_krb4) \
- $(top_builddir)/lib/des/libdes.la \
+ $(LIB_des) \
$(top_builddir)/lib/asn1/libasn1.la \
$(LIB_roken) \
- $(LIB_security)
+ $(LIB_security) \
+ $(DBLIB)
$(srcdir)/login_protos.h:
cd $(srcdir); perl ../../cf/make-proto.pl -o login_protos.h $(login_SOURCES) || rm -f login_protos.h
diff --git a/crypto/heimdal/appl/login/Makefile.in b/crypto/heimdal/appl/login/Makefile.in
index 10b75e8..ba353de 100644
--- a/crypto/heimdal/appl/login/Makefile.in
+++ b/crypto/heimdal/appl/login/Makefile.in
@@ -1,6 +1,6 @@
-# Makefile.in generated automatically by automake 1.4 from Makefile.am
+# Makefile.in generated automatically by automake 1.4a from Makefile.am
-# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-9, 2000 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.
@@ -10,15 +10,6 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
-# $Id: Makefile.am,v 1.16 1999/10/30 08:51:45 assar Exp $
-
-
-# $Id: Makefile.am.common,v 1.3 1999/04/01 14:58:43 joda Exp $
-
-
-# $Id: Makefile.am.common,v 1.13 1999/11/01 03:19:58 assar Exp $
-
-
SHELL = @SHELL@
srcdir = @srcdir@
@@ -40,8 +31,6 @@ mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
-DESTDIR =
-
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
@@ -54,9 +43,10 @@ AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_FLAG =
transform = @program_transform_name@
NORMAL_INSTALL = :
@@ -65,26 +55,39 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
+
+@SET_MAKE@
host_alias = @host_alias@
host_triplet = @host@
-AFS_EXTRA_LD = @AFS_EXTRA_LD@
AIX_EXTRA_KAFS = @AIX_EXTRA_KAFS@
+AMDEP = @AMDEP@
+AMTAR = @AMTAR@
+AS = @AS@
AWK = @AWK@
CANONICAL_HOST = @CANONICAL_HOST@
CATMAN = @CATMAN@
CATMANEXT = @CATMANEXT@
CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
DBLIB = @DBLIB@
+DEPDIR = @DEPDIR@
+DIR_des = @DIR_des@
+DIR_roken = @DIR_roken@
+DLLTOOL = @DLLTOOL@
EXEEXT = @EXEEXT@
EXTRA_LIB45 = @EXTRA_LIB45@
GROFF = @GROFF@
+INCLUDES_roken = @INCLUDES_roken@
INCLUDE_ = @INCLUDE_@
-LD = @LD@
LEX = @LEX@
LIBOBJS = @LIBOBJS@
LIBTOOL = @LIBTOOL@
LIB_ = @LIB_@
LIB_AUTH_SUBDIRS = @LIB_AUTH_SUBDIRS@
+LIB_des = @LIB_des@
+LIB_des_appl = @LIB_des_appl@
LIB_kdb = @LIB_kdb@
LIB_otp = @LIB_otp@
LIB_roken = @LIB_roken@
@@ -92,31 +95,43 @@ LIB_security = @LIB_security@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
-MAKE_X_PROGS_BIN_PROGS = @MAKE_X_PROGS_BIN_PROGS@
-MAKE_X_PROGS_BIN_SCRPTS = @MAKE_X_PROGS_BIN_SCRPTS@
-MAKE_X_PROGS_LIBEXEC_PROGS = @MAKE_X_PROGS_LIBEXEC_PROGS@
NEED_WRITEAUTH_FALSE = @NEED_WRITEAUTH_FALSE@
NEED_WRITEAUTH_TRUE = @NEED_WRITEAUTH_TRUE@
-NM = @NM@
NROFF = @NROFF@
+OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
+STRIP = @STRIP@
VERSION = @VERSION@
VOID_RETSIGTYPE = @VOID_RETSIGTYPE@
WFLAGS = @WFLAGS@
WFLAGS_NOIMPLICITINT = @WFLAGS_NOIMPLICITINT@
WFLAGS_NOUNUSED = @WFLAGS_NOUNUSED@
YACC = @YACC@
+dpagaix_CFLAGS = @dpagaix_CFLAGS@
+dpagaix_LDADD = @dpagaix_LDADD@
+install_sh = @install_sh@
+
+# $Id: Makefile.am,v 1.19 2000/11/15 22:51:08 assar Exp $
+
+
+# $Id: Makefile.am.common,v 1.3 1999/04/01 14:58:43 joda Exp $
+
+
+# $Id: Makefile.am.common,v 1.23 2000/12/05 09:11:09 joda Exp $
+
AUTOMAKE_OPTIONS = foreign no-dependencies
SUFFIXES = .et .h .1 .3 .5 .8 .cat1 .cat3 .cat5 .cat8 .x
-INCLUDES = -I$(top_builddir)/include $(INCLUDE_krb4)
+INCLUDES = -I$(top_builddir)/include $(INCLUDES_roken) $(INCLUDE_krb4)
AM_CFLAGS = $(WFLAGS)
+CP = cp
+
COMPILE_ET = $(top_builddir)/lib/com_err/compile_et
buildinclude = $(top_builddir)/include
@@ -136,6 +151,7 @@ LIB_getsockopt = @LIB_getsockopt@
LIB_logout = @LIB_logout@
LIB_logwtmp = @LIB_logwtmp@
LIB_odm_initialize = @LIB_odm_initialize@
+LIB_pidfile = @LIB_pidfile@
LIB_readline = @LIB_readline@
LIB_res_search = @LIB_res_search@
LIB_setpcred = @LIB_setpcred@
@@ -144,6 +160,8 @@ LIB_socket = @LIB_socket@
LIB_syslog = @LIB_syslog@
LIB_tgetent = @LIB_tgetent@
+LIBS = @LIBS@
+
HESIODLIB = @HESIODLIB@
HESIODINCLUDE = @HESIODINCLUDE@
INCLUDE_hesiod = @INCLUDE_hesiod@
@@ -152,34 +170,52 @@ LIB_hesiod = @LIB_hesiod@
INCLUDE_krb4 = @INCLUDE_krb4@
LIB_krb4 = @LIB_krb4@
+INCLUDE_openldap = @INCLUDE_openldap@
+LIB_openldap = @LIB_openldap@
+
INCLUDE_readline = @INCLUDE_readline@
LEXLIB = @LEXLIB@
-cat1dir = $(mandir)/cat1
-cat3dir = $(mandir)/cat3
-cat5dir = $(mandir)/cat5
-cat8dir = $(mandir)/cat8
-
-MANRX = \(.*\)\.\([0-9]\)
-CATSUFFIX = @CATSUFFIX@
-
NROFF_MAN = groff -mandoc -Tascii
-@KRB4_TRUE@LIB_kafs = $(top_builddir)/lib/kafs/libkafs.la $(AIX_EXTRA_KAFS)
+@KRB4_TRUE@LIB_kafs = @KRB4_TRUE@$(top_builddir)/lib/kafs/libkafs.la $(AIX_EXTRA_KAFS)
-@KRB5_TRUE@LIB_krb5 = $(top_builddir)/lib/krb5/libkrb5.la $(top_builddir)/lib/asn1/libasn1.la
-@KRB5_TRUE@LIB_gssapi = $(top_builddir)/lib/gssapi/libgssapi.la
+@KRB5_TRUE@LIB_krb5 = @KRB5_TRUE@$(top_builddir)/lib/krb5/libkrb5.la \
+@KRB5_TRUE@ $(top_builddir)/lib/asn1/libasn1.la
+@KRB5_TRUE@LIB_gssapi = @KRB5_TRUE@$(top_builddir)/lib/gssapi/libgssapi.la
CHECK_LOCAL = $(PROGRAMS)
bin_PROGRAMS = login
-login_SOURCES = login.c osfc2.c read_string.c utmp_login.c utmpx_login.c tty.c stty_default.c login_access.c login_locl.h login_proto.h conf.c shadow.c
-
-
-LDADD = $(LIB_kafs) $(top_builddir)/lib/krb5/libkrb5.la $(LIB_krb4) $(top_builddir)/lib/des/libdes.la $(top_builddir)/lib/asn1/libasn1.la $(LIB_roken) $(LIB_security)
+login_SOURCES = \
+ conf.c \
+ env.c \
+ login.c \
+ login_access.c \
+ login_locl.h \
+ login_protos.h \
+ osfc2.c \
+ read_string.c \
+ shadow.c \
+ stty_default.c \
+ tty.c \
+ utmp_login.c \
+ utmpx_login.c
+
+
+LDADD = $(LIB_otp) \
+ $(LIB_kafs) \
+ $(top_builddir)/lib/krb5/libkrb5.la \
+ $(LIB_krb4) \
+ $(LIB_des) \
+ $(top_builddir)/lib/asn1/libasn1.la \
+ $(LIB_roken) \
+ $(LIB_security) \
+ $(DBLIB)
+subdir = appl/login
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../include/config.h
CONFIG_CLEAN_FILES =
@@ -190,42 +226,41 @@ PROGRAMS = $(bin_PROGRAMS)
DEFS = @DEFS@ -I. -I$(srcdir) -I../../include
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
X_CFLAGS = @X_CFLAGS@
X_LIBS = @X_LIBS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
-login_OBJECTS = login.$(OBJEXT) osfc2.$(OBJEXT) read_string.$(OBJEXT) \
-utmp_login.$(OBJEXT) utmpx_login.$(OBJEXT) tty.$(OBJEXT) \
-stty_default.$(OBJEXT) login_access.$(OBJEXT) conf.$(OBJEXT) \
-shadow.$(OBJEXT)
+am_login_OBJECTS = conf.$(OBJEXT) env.$(OBJEXT) login.$(OBJEXT) \
+login_access.$(OBJEXT) osfc2.$(OBJEXT) read_string.$(OBJEXT) \
+shadow.$(OBJEXT) stty_default.$(OBJEXT) tty.$(OBJEXT) \
+utmp_login.$(OBJEXT) utmpx_login.$(OBJEXT)
+login_OBJECTS = $(am_login_OBJECTS)
login_LDADD = $(LDADD)
+@KRB4_FALSE@login_DEPENDENCIES = $(top_builddir)/lib/krb5/libkrb5.la \
+@KRB4_FALSE@$(top_builddir)/lib/asn1/libasn1.la
@KRB4_TRUE@login_DEPENDENCIES = $(top_builddir)/lib/kafs/libkafs.la \
@KRB4_TRUE@$(top_builddir)/lib/krb5/libkrb5.la \
-@KRB4_TRUE@$(top_builddir)/lib/des/libdes.la \
@KRB4_TRUE@$(top_builddir)/lib/asn1/libasn1.la
-@KRB4_FALSE@login_DEPENDENCIES = $(top_builddir)/lib/krb5/libkrb5.la \
-@KRB4_FALSE@$(top_builddir)/lib/des/libdes.la \
-@KRB4_FALSE@$(top_builddir)/lib/asn1/libasn1.la
login_LDFLAGS =
-CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CFLAGS = @CFLAGS@
CCLD = $(CC)
-LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+DIST_SOURCES = $(login_SOURCES)
+depcomp =
DIST_COMMON = ChangeLog Makefile.am Makefile.in
-DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-TAR = tar
GZIP_ENV = --best
SOURCES = $(login_SOURCES)
-OBJECTS = $(login_OBJECTS)
+OBJECTS = $(am_login_OBJECTS)
all: all-redirect
.SUFFIXES:
-.SUFFIXES: .1 .3 .5 .8 .S .c .cat1 .cat3 .cat5 .cat8 .et .h .lo .o .obj .s .x
+.SUFFIXES: .1 .3 .5 .8 .c .cat1 .cat3 .cat5 .cat8 .et .h .lo .o .obj .x
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/Makefile.am.common $(top_srcdir)/cf/Makefile.am.common
cd $(top_srcdir) && $(AUTOMAKE) --foreign appl/login/Makefile
@@ -248,31 +283,20 @@ 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 '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)/'`; \
+ f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 's/$$/$(EXEEXT)/'`"; \
+ echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/$$f"; \
+ $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/$$f; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
- list='$(bin_PROGRAMS)'; for p in $$list; do \
- rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 's/$$/$(EXEEXT)/'`"; \
+ echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
+ rm -f $(DESTDIR)$(bindir)/$$f; \
done
-.c.o:
- $(COMPILE) -c $<
-
-# FIXME: We should only use cygpath when building on Windows,
-# and only if it is available.
-.c.obj:
- $(COMPILE) -c `cygpath -w $<`
-
-.s.o:
- $(COMPILE) -c $<
-
-.S.o:
- $(COMPILE) -c $<
-
mostlyclean-compile:
-rm -f *.o core *.core
-rm -f *.$(OBJEXT)
@@ -284,15 +308,6 @@ distclean-compile:
maintainer-clean-compile:
-.c.lo:
- $(LIBTOOL) --mode=compile $(COMPILE) -c $<
-
-.s.lo:
- $(LIBTOOL) --mode=compile $(COMPILE) -c $<
-
-.S.lo:
- $(LIBTOOL) --mode=compile $(COMPILE) -c $<
-
mostlyclean-libtool:
-rm -f *.lo
@@ -306,26 +321,36 @@ maintainer-clean-libtool:
login$(EXEEXT): $(login_OBJECTS) $(login_DEPENDENCIES)
@rm -f login$(EXEEXT)
$(LINK) $(login_LDFLAGS) $(login_OBJECTS) $(login_LDADD) $(LIBS)
+.c.o:
+ $(COMPILE) -c $<
+.c.obj:
+ $(COMPILE) -c `cygpath -w $<`
+.c.lo:
+ $(LTCOMPILE) -c -o $@ $<
tags: TAGS
-ID: $(HEADERS) $(SOURCES) $(LISP)
- list='$(SOURCES) $(HEADERS)'; \
- unique=`for i in $$list; do echo $$i; done | \
- awk ' { files[$$0] = 1; } \
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
- here=`pwd` && cd $(srcdir) \
- && mkid -f$$here/ID $$unique $(LISP)
+ mkid -fID $$unique $(LISP)
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
- list='$(SOURCES) $(HEADERS)'; \
- unique=`for i in $$list; do echo $$i; done | \
- awk ' { files[$$0] = 1; } \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
mostlyclean-tags:
@@ -338,17 +363,16 @@ maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
-subdir = appl/login
-
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
- cp -pr $$/$$file $(distdir)/$$file; \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
else \
test -f $(distdir)/$$file \
- || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
- || cp -p $$d/$$file $(distdir)/$$file || :; \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook
@@ -377,7 +401,7 @@ uninstall: uninstall-am
all-am: Makefile $(PROGRAMS) all-local
all-redirect: all-am
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(bindir)
@@ -391,6 +415,7 @@ distclean-generic:
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
+ -rm -f Makefile.in
mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \
mostlyclean-libtool mostlyclean-tags \
mostlyclean-generic
@@ -426,7 +451,7 @@ distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
dvi-am dvi check-local check check-am installcheck-am installcheck \
install-exec-am install-exec install-data-local install-data-am \
install-data install-am install uninstall-am uninstall all-local \
-all-redirect all-am all installdirs mostlyclean-generic \
+all-redirect all-am all install-strip installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
@@ -436,7 +461,10 @@ install-suid-programs:
for file in $$foo; do \
x=$(DESTDIR)$(bindir)/$$file; \
if chown 0:0 $$x && chmod u+s $$x; then :; else \
- chmod 0 $$x; fi; done
+ echo "*"; \
+ echo "* Failed to install $$x setuid root"; \
+ echo "*"; \
+ fi; done
install-exec-hook: install-suid-programs
@@ -448,8 +476,8 @@ install-build-headers:: $(include_HEADERS) $(build_HEADERZ)
else file="$$f"; fi; \
if cmp -s $$file $(buildinclude)/$$f 2> /dev/null ; then \
: ; else \
- echo " cp $$file $(buildinclude)/$$f"; \
- cp $$file $(buildinclude)/$$f; \
+ echo " $(CP) $$file $(buildinclude)/$$f"; \
+ $(CP) $$file $(buildinclude)/$$f; \
fi ; \
done
@@ -518,87 +546,8 @@ dist-cat8-mans:
dist-hook: dist-cat1-mans dist-cat3-mans dist-cat5-mans dist-cat8-mans
-install-cat1-mans:
- @ext=1;\
- foo='$(man1_MANS)'; \
- bar='$(man_MANS)'; \
- for i in $$bar; do \
- case $$i in \
- *.1) foo="$$foo $$i";; \
- esac; done; \
- if test "$$foo"; then \
- $(mkinstalldirs) $(DESTDIR)$(cat1dir); \
- for x in $$foo; do \
- f=`echo $$x | sed 's/\.[^.]*$$/.cat1/'`; \
- if test -f "$(srcdir)/$$f"; then \
- b=`echo $$x | sed 's!$(MANRX)!\1!'`; \
- echo "$(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(cat1dir)/$$b.$(CATSUFFIX)";\
- $(INSTALL_DATA) $(srcdir)/$$g $(DESTDIR)$(cat1dir)/$$b.$(CATSUFFIX);\
- fi; \
- done ;\
- fi
-
-install-cat3-mans:
- @ext=3;\
- foo='$(man3_MANS)'; \
- bar='$(man_MANS)'; \
- for i in $$bar; do \
- case $$i in \
- *.3) foo="$$foo $$i";; \
- esac; done; \
- if test "$$foo"; then \
- $(mkinstalldirs) $(DESTDIR)$(cat3dir); \
- for x in $$foo; do \
- f=`echo $$x | sed 's/\.[^.]*$$/.cat3/'`; \
- if test -f "$(srcdir)/$$f"; then \
- b=`echo $$x | sed 's!$(MANRX)!\1!'`; \
- echo "$(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(cat3dir)/$$b.$(CATSUFFIX)";\
- $(INSTALL_DATA) $(srcdir)/$$g $(DESTDIR)$(cat3dir)/$$b.$(CATSUFFIX);\
- fi; \
- done ;\
- fi
-
-install-cat5-mans:
- @ext=5;\
- foo='$(man5_MANS)'; \
- bar='$(man_MANS)'; \
- for i in $$bar; do \
- case $$i in \
- *.5) foo="$$foo $$i";; \
- esac; done; \
- if test "$$foo"; then \
- $(mkinstalldirs) $(DESTDIR)$(cat5dir); \
- for x in $$foo; do \
- f=`echo $$x | sed 's/\.[^.]*$$/.cat5/'`; \
- if test -f "$(srcdir)/$$f"; then \
- b=`echo $$x | sed 's!$(MANRX)!\1!'`; \
- echo "$(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(cat5dir)/$$b.$(CATSUFFIX)";\
- $(INSTALL_DATA) $(srcdir)/$$g $(DESTDIR)$(cat5dir)/$$b.$(CATSUFFIX);\
- fi; \
- done ;\
- fi
-
-install-cat8-mans:
- @ext=8;\
- foo='$(man8_MANS)'; \
- bar='$(man_MANS)'; \
- for i in $$bar; do \
- case $$i in \
- *.8) foo="$$foo $$i";; \
- esac; done; \
- if test "$$foo"; then \
- $(mkinstalldirs) $(DESTDIR)$(cat8dir); \
- for x in $$foo; do \
- f=`echo $$x | sed 's/\.[^.]*$$/.cat8/'`; \
- if test -f "$(srcdir)/$$f"; then \
- b=`echo $$x | sed 's!$(MANRX)!\1!'`; \
- echo "$(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(cat8dir)/$$b.$(CATSUFFIX)";\
- $(INSTALL_DATA) $(srcdir)/$$g $(DESTDIR)$(cat8dir)/$$b.$(CATSUFFIX);\
- fi; \
- done ;\
- fi
-
-install-cat-mans: install-cat1-mans install-cat3-mans install-cat5-mans install-cat8-mans
+install-cat-mans:
+ $(SHELL) $(top_srcdir)/cf/install-catman.sh "$(INSTALL_DATA)" "$(mkinstalldirs)" "$(srcdir)" "$(DESTDIR)$(mandir)" '$(CATMANEXT)' $(man_MANS) $(man1_MANS) $(man3_MANS) $(man5_MANS) $(man8_MANS)
install-data-local: install-cat-mans
diff --git a/crypto/heimdal/appl/login/conf.c b/crypto/heimdal/appl/login/conf.c
index 6a4b2a8..85cfc00 100644
--- a/crypto/heimdal/appl/login/conf.c
+++ b/crypto/heimdal/appl/login/conf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999 Kungliga Tekniska Högskolan
+ * Copyright (c) 1999 - 2000 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -32,7 +32,7 @@
#include "login_locl.h"
-RCSID("$Id: conf.c,v 1.2 1999/11/09 18:05:49 joda Exp $");
+RCSID("$Id: conf.c,v 1.3 2000/05/29 16:52:24 assar Exp $");
static char *confbuf;
@@ -49,7 +49,7 @@ login_conf_get_string(const char *str)
char *value;
if(login_conf_init() != 0)
return NULL;
- if(cgetstr(confbuf, str, &value) < 0)
+ if(cgetstr(confbuf, (char *)str, &value) < 0)
return NULL;
return value;
}
diff --git a/crypto/heimdal/appl/login/env.c b/crypto/heimdal/appl/login/env.c
new file mode 100644
index 0000000..57f68b1
--- /dev/null
+++ b/crypto/heimdal/appl/login/env.c
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2000 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the Institute nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "login_locl.h"
+RCSID("$Id: env.c,v 1.1 2000/06/28 12:27:38 joda Exp $");
+
+/*
+ * the environment we will send to execle and the shell.
+ */
+
+char **env;
+int num_env;
+
+void
+extend_env(char *str)
+{
+ env = realloc(env, (num_env + 1) * sizeof(*env));
+ if(env == NULL)
+ errx(1, "Out of memory!");
+ env[num_env++] = str;
+}
+
+void
+add_env(const char *var, const char *value)
+{
+ int i;
+ char *str;
+ asprintf(&str, "%s=%s", var, value);
+ if(str == NULL)
+ errx(1, "Out of memory!");
+ for(i = 0; i < num_env; i++)
+ if(strncmp(env[i], var, strlen(var)) == 0 &&
+ env[i][strlen(var)] == '='){
+ free(env[i]);
+ env[i] = str;
+ return;
+ }
+
+ extend_env(str);
+}
+
+void
+copy_env(void)
+{
+ char **p;
+ for(p = environ; *p; p++)
+ extend_env(*p);
+}
+
+int
+login_read_env(const char *file)
+{
+ char **newenv;
+ char *p;
+ int i, j;
+
+ newenv = NULL;
+ i = read_environment(file, &newenv);
+ for (j = 0; j < i; j++) {
+ p = strchr(newenv[j], '=');
+ *p++ = 0;
+ add_env(newenv[j], p);
+ *--p = '=';
+ free(newenv[j]);
+ }
+ free(newenv);
+ return 0;
+}
diff --git a/crypto/heimdal/appl/login/login.c b/crypto/heimdal/appl/login/login.c
index a149449..2ada921 100644
--- a/crypto/heimdal/appl/login/login.c
+++ b/crypto/heimdal/appl/login/login.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998, 1999 Kungliga Tekniska Högskolan
+ * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -39,50 +39,9 @@
#include <sys/capability.h>
#endif
-RCSID("$Id: login.c,v 1.33 1999/12/02 17:04:55 joda Exp $");
+RCSID("$Id: login.c,v 1.46 2001/01/29 02:18:03 assar Exp $");
-/*
- * the environment we will send to execle and the shell.
- */
-
-static char **env;
-static int num_env;
-
-static void
-extend_env(char *str)
-{
- env = realloc(env, (num_env + 1) * sizeof(*env));
- if(env == NULL)
- errx(1, "Out of memory!");
- env[num_env++] = str;
-}
-
-static void
-add_env(const char *var, const char *value)
-{
- int i;
- char *str;
- asprintf(&str, "%s=%s", var, value);
- if(str == NULL)
- errx(1, "Out of memory!");
- for(i = 0; i < num_env; i++)
- if(strncmp(env[i], var, strlen(var)) == 0 &&
- env[i][strlen(var)] == '='){
- free(env[i]);
- env[i] = str;
- return;
- }
-
- extend_env(str);
-}
-
-static void
-copy_env(void)
-{
- char **p;
- for(p = environ; *p; p++)
- extend_env(*p);
-}
+static int login_timeout = 60;
static int
start_login_process(void)
@@ -118,8 +77,11 @@ start_logout_process(void)
argv0 = prog;
pid = fork();
- if(pid == 0)
+ if(pid == 0) {
+ /* avoid getting signals sent to the shell */
+ setpgid(0, getpid());
return 0;
+ }
if(pid == -1)
err(1, "fork");
/* wait for the real login process to exit */
@@ -167,7 +129,18 @@ exec_shell(const char *shell, int fallback)
err(1, "%s", shell);
}
-static enum { AUTH_KRB4, AUTH_KRB5 } auth;
+static enum { NONE = 0, AUTH_KRB4 = 1, AUTH_KRB5 = 2, AUTH_OTP = 3 } auth;
+
+#ifdef OTP
+static OtpContext otp_ctx;
+
+static int
+otp_verify(struct passwd *pwd, const char *password)
+{
+ return (otp_verify_user (&otp_ctx, password));
+}
+#endif /* OTP */
+
#ifdef KRB5
static krb5_context context;
@@ -179,19 +152,12 @@ krb5_verify(struct passwd *pwd, const char *password)
krb5_error_code ret;
krb5_principal princ;
- ret = krb5_init_context(&context);
- if(ret)
- return 1;
-
ret = krb5_parse_name(context, pwd->pw_name, &princ);
- if(ret){
- krb5_free_context(context);
+ if(ret)
return 1;
- }
ret = krb5_cc_gen_new(context, &krb5_mcc_ops, &id);
- if(ret){
+ if(ret) {
krb5_free_principal(context, princ);
- krb5_free_context(context);
return 1;
}
ret = krb5_verify_user_lrealm(context,
@@ -201,47 +167,39 @@ krb5_verify(struct passwd *pwd, const char *password)
1,
NULL);
krb5_free_principal(context, princ);
- if (ret)
- krb5_free_context (context);
return ret;
}
-static int
-krb5_start_session (const struct passwd *pwd)
-{
- krb5_error_code ret;
- char residual[64];
-
- /* copy credentials to file cache */
- snprintf(residual, sizeof(residual), "FILE:/tmp/krb5cc_%u",
- (unsigned)pwd->pw_uid);
- krb5_cc_resolve(context, residual, &id2);
- ret = krb5_cc_copy_cache(context, id, id2);
- if (ret == 0)
- add_env("KRB5CCNAME", residual);
- else {
- krb5_cc_destroy (context, id2);
- return ret;
- }
#ifdef KRB4
+static krb5_error_code
+krb5_to4 (krb5_ccache id)
+{
if (krb5_config_get_bool(context, NULL,
"libdefaults",
"krb4_get_tickets",
NULL)) {
CREDENTIALS c;
krb5_creds mcred, cred;
- krb5_realm realm;
char krb4tkfile[MAXPATHLEN];
+ krb5_error_code ret;
+ krb5_principal princ;
+
+ ret = krb5_cc_get_principal (context, id, &princ);
+ if (ret)
+ return ret;
- krb5_get_default_realm(context, &realm);
- krb5_make_principal(context, &mcred.server, realm,
- "krbtgt",
- realm,
- NULL);
- free (realm);
- ret = krb5_cc_retrieve_cred(context, id2, 0, &mcred, &cred);
+ ret = krb5_make_principal(context, &mcred.server,
+ princ->realm,
+ "krbtgt",
+ princ->realm,
+ NULL);
+ krb5_free_principal (context, princ);
+ if (ret)
+ return ret;
+
+ ret = krb5_cc_retrieve_cred(context, id, 0, &mcred, &cred);
if(ret == 0) {
- ret = krb524_convert_creds_kdc(context, id2, &cred, &c);
+ ret = krb524_convert_creds_kdc(context, id, &cred, &c);
if(ret == 0) {
snprintf(krb4tkfile,sizeof(krb4tkfile),"%s%d",TKT_ROOT,
getuid());
@@ -253,6 +211,29 @@ krb5_start_session (const struct passwd *pwd)
}
krb5_free_principal(context, mcred.server);
}
+ return 0;
+}
+#endif /* KRB4 */
+
+static int
+krb5_start_session (const struct passwd *pwd)
+{
+ krb5_error_code ret;
+ char residual[64];
+
+ /* copy credentials to file cache */
+ snprintf(residual, sizeof(residual), "FILE:/tmp/krb5cc_%u",
+ (unsigned)pwd->pw_uid);
+ krb5_cc_resolve(context, residual, &id2);
+ ret = krb5_cc_copy_cache(context, id, id2);
+ if (ret == 0)
+ add_env("KRB5CCNAME", residual);
+ else {
+ krb5_cc_destroy (context, id2);
+ return ret;
+ }
+#ifdef KRB4
+ krb5_to4 (id2);
#endif
krb5_cc_close(context, id2);
krb5_cc_destroy(context, id);
@@ -279,9 +260,6 @@ krb5_get_afs_tokens (const struct passwd *pwd)
if (!k_hasafs ())
return;
- ret = krb5_init_context(&context);
- if(ret)
- return;
ret = krb5_cc_default(context, &id2);
if (ret == 0) {
@@ -299,7 +277,6 @@ krb5_get_afs_tokens (const struct passwd *pwd)
pwd->pw_uid, pwd->pw_dir);
krb5_cc_close (context, id2);
}
- krb5_free_context (context);
}
#endif /* KRB4 */
@@ -365,14 +342,17 @@ krb4_get_afs_tokens (const struct passwd *pwd)
static int f_flag;
static int p_flag;
+#if 0
static int r_flag;
+#endif
static int version_flag;
static int help_flag;
static char *remote_host;
+static char *auth_level = NULL;
struct getargs args[] = {
+ { NULL, 'a', arg_string, &auth_level, "authentication mode" },
#if 0
- { NULL, 'a' },
{ NULL, 'd' },
#endif
{ NULL, 'f', arg_flag, &f_flag, "pre-authenticated" },
@@ -450,7 +430,7 @@ do_login(const struct passwd *pwd, char *tty, char *ttyn)
else
tty_gid = pwd->pw_gid;
- if (chown (ttyn, pwd->pw_uid, pwd->pw_gid) < 0) {
+ if (chown (ttyn, pwd->pw_uid, tty_gid) < 0) {
warn("chown %s", ttyn);
if (rootlogin == 0)
exit (1);
@@ -481,7 +461,7 @@ do_login(const struct passwd *pwd, char *tty, char *ttyn)
if(rootlogin == 0)
exit(1);
}
- if(setuid(pwd->pw_uid)){
+ if(setuid(pwd->pw_uid) || (pwd->pw_uid != 0 && setuid(0) == 0)) {
warn("setuid(%u)", (unsigned)pwd->pw_uid);
if(rootlogin == 0)
exit(1);
@@ -560,17 +540,44 @@ do_login(const struct passwd *pwd, char *tty, char *ttyn)
#ifdef KRB5
if (auth == AUTH_KRB5) {
krb5_start_session (pwd);
- krb5_finish ();
}
#ifdef KRB4
+ else if (auth == 0) {
+ krb5_error_code ret;
+ krb5_ccache id;
+
+ ret = krb5_cc_default (context, &id);
+ if (ret == 0) {
+ krb5_to4 (id);
+ krb5_cc_close (context, id);
+ }
+ }
+
krb5_get_afs_tokens (pwd);
#endif /* KRB4 */
+ krb5_finish ();
#endif /* KRB5 */
#ifdef KRB4
krb4_get_afs_tokens (pwd);
#endif /* KRB4 */
+ add_env("PATH", _PATH_DEFPATH);
+
+ {
+ const char *str = login_conf_get_string("environment");
+ char buf[MAXPATHLEN];
+
+ if(str == NULL) {
+ login_read_env(_PATH_ETC_ENVIRONMENT);
+ } else {
+ while(strsep_copy(&str, ",", buf, sizeof(buf)) != -1) {
+ if(buf[0] == '\0')
+ continue;
+ login_read_env(buf);
+ }
+ }
+ }
add_env("HOME", home_dir);
add_env("USER", pwd->pw_name);
add_env("LOGNAME", pwd->pw_name);
@@ -604,6 +611,12 @@ check_password(struct passwd *pwd, const char *password)
return 0;
}
#endif
+#ifdef OTP
+ if (otp_verify (pwd, password) == 0) {
+ auth = AUTH_OTP;
+ return 0;
+ }
+#endif
return 1;
}
@@ -614,6 +627,17 @@ usage(int status)
exit(status);
}
+static RETSIGTYPE
+sig_handler(int sig)
+{
+ if (sig == SIGALRM)
+ fprintf(stderr, "Login timed out after %d seconds\n",
+ login_timeout);
+ else
+ fprintf(stderr, "Login received signal, exiting\n");
+ exit(0);
+}
+
int
main(int argc, char **argv)
{
@@ -624,9 +648,20 @@ main(int argc, char **argv)
int optind = 0;
int ask = 1;
+ struct sigaction sa;
set_progname(argv[0]);
+#ifdef KRB5
+ {
+ krb5_error_code ret;
+
+ ret = krb5_init_context(&context);
+ if (ret)
+ errx (1, "krb5_init_context failed: %d", ret);
+ }
+#endif
+
openlog("login", LOG_ODELAY, LOG_AUTH);
if (getarg (args, sizeof(args) / sizeof(args[0]), argc, argv,
@@ -664,21 +699,41 @@ main(int argc, char **argv)
ask = 0;
}
}
+
+#if defined(DCE) && defined(AIX)
+ esetenv("AUTHSTATE", "DCE", 1);
+#endif
+
/* XXX should we care about environment on the command line? */
+
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = sig_handler;
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ sigaction(SIGALRM, &sa, NULL);
+ alarm(login_timeout);
+
for(try = 0; try < max_tries; try++){
struct passwd *pwd;
char password[128];
int ret;
char ttname[32];
char *tty, *ttyn;
+ char prompt[128];
+#ifdef OTP
+ char otp_str[256];
+#endif
if(ask){
- f_flag = r_flag = 0;
+ f_flag = 0;
+#if 0
+ r_flag = 0;
+#endif
ret = read_string("login: ", username, sizeof(username), 1);
if(ret == -3)
exit(0);
if(ret == -2)
- continue;
+ sig_handler(0); /* exit */
}
pwd = k_getpwnam(username);
#ifdef ALLOW_NULL_PASSWORD
@@ -687,11 +742,28 @@ main(int argc, char **argv)
}
else
#endif
- if(f_flag == 0) {
- ret = read_string("Password: ", password, sizeof(password), 0);
- if(ret == -3 || ret == -2)
- continue;
- }
+
+ {
+#ifdef OTP
+ if(auth_level && strcmp(auth_level, "otp") == 0 &&
+ otp_challenge(&otp_ctx, username,
+ otp_str, sizeof(otp_str)) == 0)
+ snprintf (prompt, sizeof(prompt), "%s's %s Password: ",
+ username, otp_str);
+ else
+#endif
+ strncpy(prompt, "Password: ", sizeof(prompt));
+
+ if (f_flag == 0) {
+ ret = read_string(prompt, password, sizeof(password), 0);
+ if (ret == -3) {
+ ask = 1;
+ continue;
+ }
+ if (ret == -2)
+ sig_handler(0);
+ }
+ }
if(pwd == NULL){
fprintf(stderr, "Login incorrect.\n");
@@ -724,6 +796,7 @@ main(int argc, char **argv)
pwd->pw_name, tty);
exit (1);
}
+ alarm(0);
do_login(pwd, tty, ttyn);
}
exit(1);
diff --git a/crypto/heimdal/appl/login/login_locl.h b/crypto/heimdal/appl/login/login_locl.h
index 2d2f7fd..6c5857b 100644
--- a/crypto/heimdal/appl/login/login_locl.h
+++ b/crypto/heimdal/appl/login/login_locl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1999 Kungliga Tekniska Högskolan
+ * Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $Id: login_locl.h,v 1.17 1999/12/02 17:04:55 joda Exp $ */
+/* $Id: login_locl.h,v 1.20 2000/08/22 14:05:35 joda Exp $ */
#ifndef __LOGIN_LOCL_H__
#define __LOGIN_LOCL_H__
@@ -86,6 +86,10 @@
#endif
#include <kafs.h>
+#ifdef OTP
+#include <otp.h>
+#endif
+
#ifndef _PATH_BSHELL
#define _PATH_BSHELL "/bin/sh"
#endif
@@ -121,8 +125,19 @@
#define _PATH_LOGIN_CONF "/etc/login.conf"
#endif /* _PATH_LOGIN_CONF */
+#ifndef _PATH_ETC_ENVIRONMENT
+#define _PATH_ETC_ENVIRONMENT "/etc/environment"
+#endif
+
+#ifndef _PATH_DEFPATH
+#define _PATH_DEFPATH "/usr/bin:/bin"
+#endif
+
struct spwd;
+extern char **env;
+extern int num_env;
+
#include "login_protos.h"
#endif /* __LOGIN_LOCL_H__ */
diff --git a/crypto/heimdal/appl/login/login_protos.h b/crypto/heimdal/appl/login/login_protos.h
index 173acc5..e19a598 100644
--- a/crypto/heimdal/appl/login/login_protos.h
+++ b/crypto/heimdal/appl/login/login_protos.h
@@ -14,6 +14,11 @@
#endif
void
+add_env __P((
+ const char *var,
+ const char *value));
+
+void
check_shadow __P((
const struct passwd *pw,
const struct spwd *sp));
@@ -21,9 +26,15 @@ check_shadow __P((
char *
clean_ttyname __P((char *tty));
+void
+copy_env __P((void));
+
int
do_osfc2_magic __P((uid_t uid));
+void
+extend_env __P((char *str));
+
int
login_access __P((
struct passwd *user,
@@ -32,6 +43,9 @@ login_access __P((
char *
login_conf_get_string __P((const char *str));
+int
+login_read_env __P((const char *file));
+
char *
make_id __P((char *tty));
diff --git a/crypto/heimdal/appl/login/read_string.c b/crypto/heimdal/appl/login/read_string.c
index 2c4b66b..f3cee14 100644
--- a/crypto/heimdal/appl/login/read_string.c
+++ b/crypto/heimdal/appl/login/read_string.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -33,7 +33,7 @@
#include "login_locl.h"
-RCSID("$Id: read_string.c,v 1.3 1999/12/02 17:04:56 joda Exp $");
+RCSID("$Id: read_string.c,v 1.4 2000/06/21 02:09:36 assar Exp $");
static sig_atomic_t intr_flag;
@@ -62,7 +62,7 @@ read_string(const char *prompt, char *buf, size_t len, int echo)
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
for(i = 0; i < sizeof(sigs) / sizeof(sigs[0]); i++)
- sigaction(i, &sa, &sigs[i]);
+ if (i != SIGALRM) sigaction(i, &sa, &sigs[i]);
if((tty = fopen("/dev/tty", "r")) == NULL)
tty = stdin;
@@ -104,7 +104,7 @@ read_string(const char *prompt, char *buf, size_t len, int echo)
fclose(tty);
for(i = 0; i < sizeof(sigs) / sizeof(sigs[0]); i++)
- sigaction(i, &sigs[i], NULL);
+ if (i != SIGALRM) sigaction(i, &sigs[i], NULL);
if(ret)
return -3;
OpenPOWER on IntegriCloud