diff options
author | charnier <charnier@FreeBSD.org> | 1997-07-22 07:39:43 +0000 |
---|---|---|
committer | charnier <charnier@FreeBSD.org> | 1997-07-22 07:39:43 +0000 |
commit | f14112b4c134a5852fee28531c399c2877a8ad5c (patch) | |
tree | 8ec7d2d10db2b5e4e0f361b4ce2ef0607902ba91 /usr.bin/login/login.c | |
parent | 651e4c77827af8a163183a41586f11242d15fd12 (diff) | |
download | FreeBSD-src-f14112b4c134a5852fee28531c399c2877a8ad5c.zip FreeBSD-src-f14112b4c134a5852fee28531c399c2877a8ad5c.tar.gz |
= -> ==, strcpy -> strncpy from OpenBSD.
update man page. Add usage().
Obtained from: OpenBSD
Diffstat (limited to 'usr.bin/login/login.c')
-rw-r--r-- | usr.bin/login/login.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c index 77edbbf..ec6ed39 100644 --- a/usr.bin/login/login.c +++ b/usr.bin/login/login.c @@ -38,7 +38,11 @@ static char copyright[] = #endif #ifndef lint +#if 0 static char sccsid[] = "@(#)login.c 8.4 (Berkeley) 4/2/94"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ /* @@ -113,6 +117,7 @@ int klogin __P((struct passwd *, char *, char *, char *)); #endif extern void login __P((struct utmp *)); +static void usage __P((void)); #define TTYGRPNAME "tty" /* name of group to own ttys */ #define DEFAULT_BACKOFF 3 @@ -226,9 +231,7 @@ main(argc, argv) default: if (!uid) syslog(LOG_ERR, "invalid flag %c", ch); - (void)fprintf(stderr, - "usage: login [-fp] [-h hostname] [username]\n"); - exit(1); + usage(); } argc -= optind; argv += optind; @@ -318,7 +321,8 @@ main(argc, argv) badlogin(tbuf); failures = 0; } - (void)strcpy(tbuf, username); + (void)strncpy(tbuf, username, sizeof tbuf-1); + tbuf[sizeof tbuf-1] = '\0'; if ((pwd = getpwnam(username)) != NULL) salt = pwd->pw_passwd; @@ -801,6 +805,12 @@ main(argc, argv) err(1, "%s", shell); } +static void +usage() +{ + (void)fprintf(stderr, "usage: login [-fp] [-h hostname] [username]\n"); + exit(1); +} /* * Allow for authentication style and/or kerberos instance |