Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/login Fix gcc48 build without Kerberos.
details: https://anonhg.NetBSD.org/src/rev/e298d9315b46
branches: trunk
changeset: 327743:e298d9315b46
user: dholland <dholland%NetBSD.org@localhost>
date: Sun Mar 16 00:33:13 2014 +0000
description:
Fix gcc48 build without Kerberos.
While here, rectify related bug where if gethostname() failed, login
would null-terminate uninitialized stack trash and cheerfully pass it
on to kerberos. In this case, revert to "amnesiac" instead.
diffstat:
usr.bin/login/login.c | 26 +++++++++++++++++---------
1 files changed, 17 insertions(+), 9 deletions(-)
diffs (77 lines):
diff -r a471c7dc6d8e -r e298d9315b46 usr.bin/login/login.c
--- a/usr.bin/login/login.c Sun Mar 16 00:07:58 2014 +0000
+++ b/usr.bin/login/login.c Sun Mar 16 00:33:13 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: login.c,v 1.103 2012/04/29 01:26:56 wiz Exp $ */
+/* $NetBSD: login.c,v 1.104 2014/03/16 00:33:13 dholland Exp $ */
/*-
* Copyright (c) 1980, 1987, 1988, 1991, 1993, 1994
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)login.c 8.4 (Berkeley) 4/2/94";
#endif
-__RCSID("$NetBSD: login.c,v 1.103 2012/04/29 01:26:56 wiz Exp $");
+__RCSID("$NetBSD: login.c,v 1.104 2014/03/16 00:33:13 dholland Exp $");
#endif /* not lint */
/*
@@ -138,11 +138,13 @@
struct group *gr;
struct stat st;
int ask, ch, cnt, fflag, hflag, pflag, sflag, quietlog, rootlogin, rval;
- int Fflag;
uid_t uid, saved_uid;
gid_t saved_gid, saved_gids[NGROUPS_MAX];
int nsaved_gids;
- char *domain, *p, *ttyn;
+#ifdef notdef
+ char *domain;
+#endif
+ char *p, *ttyn;
const char *pwprompt;
char tbuf[MAXPATHLEN + 2], tname[sizeof(_PATH_TTY) + 10];
char localhost[MAXHOSTNAMELEN + 1];
@@ -152,6 +154,7 @@
time_t pw_warntime = _PASSWORD_WARNDAYS * SECSPERDAY;
char *loginname = NULL;
#ifdef KERBEROS5
+ int Fflag;
krb5_error_code kerror;
#endif
#if defined(KERBEROS5)
@@ -185,16 +188,19 @@
* server address.
* -s is used to force use of S/Key or equivalent.
*/
- domain = NULL;
- if (gethostname(localhost, sizeof(localhost)) < 0)
+ if (gethostname(localhost, sizeof(localhost)) < 0) {
syslog(LOG_ERR, "couldn't get local hostname: %m");
- else
- domain = strchr(localhost, '.');
+ strcpy(hostname, "amnesiac");
+ }
+#ifdef notdef
+ domain = strchr(localhost, '.');
+#endif
localhost[sizeof(localhost) - 1] = '\0';
- Fflag = fflag = hflag = pflag = sflag = 0;
+ fflag = hflag = pflag = sflag = 0;
have_ss = 0;
#ifdef KERBEROS5
+ Fflag = 0;
have_forward = 0;
#endif
uid = getuid();
@@ -210,7 +216,9 @@
#endif
break;
case 'F':
+#ifdef KERBEROS5
Fflag = 1;
+#endif
/* FALLTHROUGH */
case 'f':
fflag = 1;
Home |
Main Index |
Thread Index |
Old Index