summaryrefslogtreecommitdiffstats
path: root/usr.bin/login
diff options
context:
space:
mode:
authoramurai <amurai@FreeBSD.org>1998-06-01 08:47:04 +0000
committeramurai <amurai@FreeBSD.org>1998-06-01 08:47:04 +0000
commitdaec9421536dea043301b78b1811faf425e5595c (patch)
treece5847dfeeeb2a864c0cb5ca1cb3306538092ee8 /usr.bin/login
parent0f778d7313fc2777a689ebb3f9e162f198928194 (diff)
downloadFreeBSD-src-daec9421536dea043301b78b1811faf425e5595c.zip
FreeBSD-src-daec9421536dea043301b78b1811faf425e5595c.tar.gz
Trim a domain part for wtmp as same as showed by "netstat -r".
Here is a some example for avoiding a confusion. It asssumes a logged host domain is "spec.co.jp". All example is longer than UT_HOSTNAMELEN value. 1) turbo.tama.spec.co.jp: 192.19.0.2 -> trubo.tama 2) turbo.tama.foo.co.jp : 192.19.0.2 -> 192.19.0.2 3) specgw.spec.co.jp : 202.32.13.1 -> specgw Submitted by: Atsushi Murai <amurai@spec.co.jp>
Diffstat (limited to 'usr.bin/login')
-rw-r--r--usr.bin/login/login.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c
index 17137f0..0c6ee3a 100644
--- a/usr.bin/login/login.c
+++ b/usr.bin/login/login.c
@@ -42,7 +42,7 @@ static char copyright[] =
static char sccsid[] = "@(#)login.c 8.4 (Berkeley) 4/2/94";
#endif
static const char rcsid[] =
- "$Id: login.c,v 1.33 1998/04/30 16:48:20 peter Exp $";
+ "$Id: login.c,v 1.34 1998/04/30 16:50:07 peter Exp $";
#endif /* not lint */
/*
@@ -118,6 +118,7 @@ int klogin __P((struct passwd *, char *, char *, char *));
#endif
extern void login __P((struct utmp *));
+extern void trimdomain __P((char *, int));
static void usage __P((void));
#define TTYGRPNAME "tty" /* name of group to own ttys */
@@ -213,6 +214,9 @@ main(argc, argv)
if (domain && (p = strchr(optarg, '.')) &&
strcasecmp(p, domain) == 0)
*p = 0;
+
+ trimdomain(optarg, UT_HOSTSIZE );
+
if (strlen(optarg) > UT_HOSTSIZE) {
struct hostent *hp = gethostbyname(optarg);
OpenPOWER on IntegriCloud