diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-06-02 03:08:56 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-06-02 03:08:56 +0000 |
commit | 5df157777ce6cba9c00dbd14404740e1d8c46783 (patch) | |
tree | 28ae4b197ab0d53369147c905ce8d038f69c324b | |
parent | 950ea97907ef344fd7d0f342c186c9efca41c811 (diff) |
if hostname==domainname and has only one dot, trim less severely for -h option; based on code from wisner@gryphon.com
-rw-r--r-- | usr.bin/login/login.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c index 50eb1afd8b3..02031ce178d 100644 --- a/usr.bin/login/login.c +++ b/usr.bin/login/login.c @@ -1,4 +1,4 @@ -/* $OpenBSD: login.c,v 1.20 1997/04/19 21:01:12 deraadt Exp $ */ +/* $OpenBSD: login.c,v 1.21 1997/06/02 03:08:55 deraadt Exp $ */ /* $NetBSD: login.c,v 1.13 1996/05/15 23:50:16 jtc Exp $ */ /*- @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)login.c 8.4 (Berkeley) 4/2/94"; #endif -static char rcsid[] = "$OpenBSD: login.c,v 1.20 1997/04/19 21:01:12 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: login.c,v 1.21 1997/06/02 03:08:55 deraadt Exp $"; #endif /* not lint */ /* @@ -156,6 +156,11 @@ main(argc, argv) syslog(LOG_ERR, "couldn't get local hostname: %m"); else domain = strchr(localhost, '.'); + if (domain) { + domain++; + if (*domain && strchr(domain, '.') == NULL) + domain = localhost; + } fflag = hflag = pflag = 0; uid = getuid(); @@ -169,7 +174,7 @@ main(argc, argv) errx(1, "-h option: %s", strerror(EPERM)); hflag = 1; if (domain && (p = strchr(optarg, '.')) && - strcasecmp(p, domain) == 0) + strcasecmp(p+1, domain) == 0) *p = 0; hostname = optarg; break; |