=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/lock/lock.c,v retrieving revision 1.39 retrieving revision 1.40 diff -c -r1.39 -r1.40 *** src/usr.bin/lock/lock.c 2017/07/08 22:22:04 1.39 --- src/usr.bin/lock/lock.c 2017/07/08 22:27:17 1.40 *************** *** 1,4 **** ! /* $OpenBSD: lock.c,v 1.39 2017/07/08 22:22:04 tedu Exp $ */ /* $NetBSD: lock.c,v 1.8 1996/05/07 18:32:31 jtc Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: lock.c,v 1.40 2017/07/08 22:27:17 tedu Exp $ */ /* $NetBSD: lock.c,v 1.8 1996/05/07 18:32:31 jtc Exp $ */ /* *************** *** 99,106 **** * We allow "login-tries" attempts to login but start * slowing down after "login-backoff" attempts. */ ! tries = (int)login_getcapnum(lc, "login-tries", 10, 10); ! backoff = (int)login_getcapnum(lc, "login-backoff", 3, 3); } while ((ch = getopt(argc, argv, "a:npt:")) != -1) { --- 99,106 ---- * We allow "login-tries" attempts to login but start * slowing down after "login-backoff" attempts. */ ! tries = login_getcapnum(lc, "login-tries", 10, 10); ! backoff = login_getcapnum(lc, "login-backoff", 3, 3); } while ((ch = getopt(argc, argv, "a:npt:")) != -1) { *************** *** 116,122 **** usemine = 1; break; case 't': ! sectimeout = (int)strtonum(optarg, 1, INT_MAX, &errstr); if (errstr) errx(1, "timeout %s: %s", errstr, optarg); break; --- 116,122 ---- usemine = 1; break; case 't': ! sectimeout = strtonum(optarg, 1, INT_MAX, &errstr); if (errstr) errx(1, "timeout %s: %s", errstr, optarg); break; *************** *** 127,133 **** no_timeout = 1; break; default: ! (void)fprintf(stderr, "usage: %s [-np] [-a style] [-t timeout]\n", getprogname()); exit(1); --- 127,133 ---- no_timeout = 1; break; default: ! fprintf(stderr, "usage: %s [-np] [-a style] [-t timeout]\n", getprogname()); exit(1); *************** *** 153,159 **** * Don't need EOF test here, if we get EOF, then s1 != s * and the right things will happen. */ ! (void)readpassphrase("Again: ", s1, sizeof(s1), RPP_ECHO_OFF); if (strcmp(s1, s)) { warnx("\apasswords didn't match."); exit(1); --- 153,159 ---- * Don't need EOF test here, if we get EOF, then s1 != s * and the right things will happen. */ ! readpassphrase("Again: ", s1, sizeof(s1), RPP_ECHO_OFF); if (strcmp(s1, s)) { warnx("\apasswords didn't match."); exit(1); *************** *** 164,173 **** } /* set signal handlers */ ! (void)signal(SIGINT, hi); ! (void)signal(SIGQUIT, hi); ! (void)signal(SIGTSTP, hi); ! (void)signal(SIGALRM, bye); memset(&ntimer, 0, sizeof(ntimer)); ntimer.it_value = timeout; --- 164,173 ---- } /* set signal handlers */ ! signal(SIGINT, hi); ! signal(SIGQUIT, hi); ! signal(SIGTSTP, hi); ! signal(SIGALRM, bye); memset(&ntimer, 0, sizeof(ntimer)); ntimer.it_value = timeout; *************** *** 176,186 **** /* header info */ if (no_timeout) { ! (void)fprintf(stderr, "%s: %s on %s. no timeout\ntime now is %s\n", getprogname(), ttynam, hostname, date); } else { ! (void)fprintf(stderr, "%s: %s on %s. timeout in %d minutes\ntime now is %s\n", getprogname(), ttynam, hostname, sectimeout, date); } --- 176,186 ---- /* header info */ if (no_timeout) { ! fprintf(stderr, "%s: %s on %s. no timeout\ntime now is %s\n", getprogname(), ttynam, hostname, date); } else { ! fprintf(stderr, "%s: %s on %s. timeout in %d minutes\ntime now is %s\n", getprogname(), ttynam, hostname, sectimeout, date); } *************** *** 214,220 **** explicit_bzero(s1, sizeof(s1)); break; } ! (void)putc('\a', stderr); cnt %= tries; if (++cnt > backoff) { sigset_t set, oset; --- 214,220 ---- explicit_bzero(s1, sizeof(s1)); break; } ! putc('\a', stderr); cnt %= tries; if (++cnt > backoff) { sigset_t set, oset; *************** *** 233,247 **** { struct itimerval left; ! (void)dprintf(STDERR_FILENO, "%s: type in the unlock key.", getprogname()); if (!no_timeout) { ! (void)getitimer(ITIMER_REAL, &left); ! (void)dprintf(STDERR_FILENO, " timeout in %lld:%02d minutes", (long long)(left.it_value.tv_sec / 60), (int)(left.it_value.tv_sec % 60)); } ! (void)dprintf(STDERR_FILENO, "\n"); } void --- 233,247 ---- { struct itimerval left; ! dprintf(STDERR_FILENO, "%s: type in the unlock key.", getprogname()); if (!no_timeout) { ! getitimer(ITIMER_REAL, &left); ! dprintf(STDERR_FILENO, " timeout in %lld:%02d minutes", (long long)(left.it_value.tv_sec / 60), (int)(left.it_value.tv_sec % 60)); } ! dprintf(STDERR_FILENO, "\n"); } void