diff options
author | amurai <amurai@FreeBSD.org> | 1998-06-01 08:47:04 +0000 |
---|---|---|
committer | amurai <amurai@FreeBSD.org> | 1998-06-01 08:47:04 +0000 |
commit | daec9421536dea043301b78b1811faf425e5595c (patch) | |
tree | ce5847dfeeeb2a864c0cb5ca1cb3306538092ee8 /usr.bin/login | |
parent | 0f778d7313fc2777a689ebb3f9e162f198928194 (diff) | |
download | FreeBSD-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.c | 6 |
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); |