svn commit: trunk/busybox/loginutils
vda at busybox.net
vda at busybox.net
Tue Sep 26 16:31:02 UTC 2006
Author: vda
Date: 2006-09-26 09:31:01 -0700 (Tue, 26 Sep 2006)
New Revision: 16228
Log:
login: fix getopt_ulflags fallout (wasn't taking username supplied by getty)
Modified:
trunk/busybox/loginutils/login.c
Changeset:
Modified: trunk/busybox/loginutils/login.c
===================================================================
--- trunk/busybox/loginutils/login.c 2006-09-26 16:01:07 UTC (rev 16227)
+++ trunk/busybox/loginutils/login.c 2006-09-26 16:31:01 UTC (rev 16228)
@@ -235,13 +235,13 @@
alarm(TIMEOUT);
opt = bb_getopt_ulflags(argc, argv, "f:h:p", &opt_user, &opt_host);
-
if (opt & LOGIN_OPT_f) {
if (!amroot)
bb_error_msg_and_die("-f is for root only");
- safe_strncpy(username, opt_user, strlen(opt_user));
+ safe_strncpy(username, opt_user, sizeof(username));
}
- username[USERNAME_SIZE] = 0;
+ if (optind < argc) /* user from command line (getty) */
+ safe_strncpy(username, argv[optind], sizeof(username));
/* Let's find out and memorize our tty */
if (!isatty(0) || !isatty(1) || !isatty(2))
More information about the busybox-cvs
mailing list