Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/login Re-enable login_cap processing, now that a non...



details:   https://anonhg.NetBSD.org/src/rev/d214d3be0aff
branches:  trunk
changeset: 480453:d214d3be0aff
user:      mjl <mjl%NetBSD.org@localhost>
date:      Thu Jan 13 06:52:47 2000 +0000

description:
Re-enable login_cap processing, now that a non-existing login.conf
won't make it crash. Also make it less noisy in that case.

diffstat:

 usr.bin/login/Makefile |   4 ++--
 usr.bin/login/login.c  |  26 +++++++++++++++-----------
 2 files changed, 17 insertions(+), 13 deletions(-)

diffs (88 lines):

diff -r 9fb6aec60d5d -r d214d3be0aff usr.bin/login/Makefile
--- a/usr.bin/login/Makefile    Thu Jan 13 06:48:14 2000 +0000
+++ b/usr.bin/login/Makefile    Thu Jan 13 06:52:47 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.26 2000/01/13 06:30:31 mjl Exp $
+#      $NetBSD: Makefile,v 1.27 2000/01/13 06:52:47 mjl Exp $
 #      @(#)Makefile    8.1 (Berkeley) 7/19/93
 
 SRCTOP=        ../..
@@ -11,7 +11,7 @@
 BINOWN=        root
 BINMODE=4555
 INSTALLFLAGS=-fschg
-# CFLAGS+=     -DLOGIN_CAP
+CFLAGS+=       -DLOGIN_CAP -g
 
 .include <bsd.own.mk>
 
diff -r 9fb6aec60d5d -r d214d3be0aff usr.bin/login/login.c
--- a/usr.bin/login/login.c     Thu Jan 13 06:48:14 2000 +0000
+++ b/usr.bin/login/login.c     Thu Jan 13 06:52:47 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: login.c,v 1.49 2000/01/13 06:30:31 mjl Exp $       */
+/*     $NetBSD: login.c,v 1.50 2000/01/13 06:52:47 mjl Exp $       */
 
 /*-
  * Copyright (c) 1980, 1987, 1988, 1991, 1993, 1994
@@ -44,7 +44,7 @@
 #if 0
 static char sccsid[] = "@(#)login.c    8.4 (Berkeley) 4/2/94";
 #endif
-__RCSID("$NetBSD: login.c,v 1.49 2000/01/13 06:30:31 mjl Exp $");
+__RCSID("$NetBSD: login.c,v 1.50 2000/01/13 06:52:47 mjl Exp $");
 #endif /* not lint */
 
 /*
@@ -112,8 +112,8 @@
 
 #define        TTYGRPNAME      "tty"           /* name of group to own ttys */
 
-#define DEFAULT_BACKOFF 10
-#define DEFAULT_RETRIES 3
+#define DEFAULT_BACKOFF 3
+#define DEFAULT_RETRIES 10
 
 /*
  * This bounds the time given to login.  Not a define so it can
@@ -436,7 +436,7 @@
                failures++;
                cnt++;
                /* we allow 10 tries, but after 3 we start backing off */
-               if (cnt > login_backoff || cnt >= login_retries) {
+               if (cnt > login_backoff) {
                        if (cnt >= login_retries) {
                                badlogin(username);
                                sleepexit(1);
@@ -553,12 +553,16 @@
                dofork();
 #endif
 #ifdef LOGIN_CAP
-       if (setusercontext(lc, pwd, pwd->pw_uid, LOGIN_SETALL & ~LOGIN_SETPATH)
-           != 0) {
-               syslog(LOG_ERR, "setusercontext failed");
-               exit(1);
+       if(lc) {
+               if (setusercontext(lc, pwd, pwd->pw_uid, 
+                   LOGIN_SETALL & ~LOGIN_SETPATH) != 0) {
+                       syslog(LOG_ERR, "setusercontext failed");
+                       exit(1);
+               }
        }
-#else
+       else
+#endif
+       {
        (void)setgid(pwd->pw_gid);
 
        initgroups(username, pwd->pw_gid);
@@ -571,8 +575,8 @@
                (void)setuid(0);
        else
                (void)setuid(pwd->pw_uid);
+       }
 
-#endif
 
        if (*pwd->pw_shell == '\0')
                pwd->pw_shell = _PATH_BSHELL;



Home | Main Index | Thread Index | Old Index