Deleted Added
full compact
lock.c (227169) lock.c (231994)
1/*
2 * Copyright (c) 1980, 1987, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Bob Toxen.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 28 unchanged lines hidden (view full) ---

37#endif /* not lint */
38
39#ifndef lint
40#if 0
41static char sccsid[] = "@(#)lock.c 8.1 (Berkeley) 6/6/93";
42#endif
43#endif /* not lint */
44#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1980, 1987, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Bob Toxen.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 28 unchanged lines hidden (view full) ---

37#endif /* not lint */
38
39#ifndef lint
40#if 0
41static char sccsid[] = "@(#)lock.c 8.1 (Berkeley) 6/6/93";
42#endif
43#endif /* not lint */
44#include <sys/cdefs.h>
45__FBSDID("$FreeBSD: head/usr.bin/lock/lock.c 227169 2011-11-06 08:15:48Z ed $");
45__FBSDID("$FreeBSD: head/usr.bin/lock/lock.c 231994 2012-02-22 06:27:20Z kevlo $");
46
47/*
48 * Lock a terminal up until the given key is entered or the given
49 * interval times out.
50 *
51 * Timeout interval is by default TIMEOUT, it can be changed with
52 * an argument of the form -time where time is in minutes
53 */

--- 35 unchanged lines hidden (view full) ---

89main(int argc, char **argv)
90{
91 struct passwd *pw;
92 struct timeval timval;
93 time_t timval_sec;
94 struct itimerval ntimer, otimer;
95 struct tm *timp;
96 int ch, failures, sectimeout, usemine, vtylock;
46
47/*
48 * Lock a terminal up until the given key is entered or the given
49 * interval times out.
50 *
51 * Timeout interval is by default TIMEOUT, it can be changed with
52 * an argument of the form -time where time is in minutes
53 */

--- 35 unchanged lines hidden (view full) ---

89main(int argc, char **argv)
90{
91 struct passwd *pw;
92 struct timeval timval;
93 time_t timval_sec;
94 struct itimerval ntimer, otimer;
95 struct tm *timp;
96 int ch, failures, sectimeout, usemine, vtylock;
97 char *ap, *mypw, *ttynam, *tzn;
97 char *ap, *cryptpw, *mypw, *ttynam, *tzn;
98 char hostname[MAXHOSTNAMELEN], s[BUFSIZ], s1[BUFSIZ];
99
100 openlog("lock", LOG_ODELAY, LOG_AUTH);
101
102 sectimeout = TIMEOUT;
103 pw = NULL;
104 mypw = NULL;
105 usemine = 0;

--- 111 unchanged lines hidden (view full) ---

217 (void)printf("Key: ");
218 if (!fgets(s, sizeof(s), stdin)) {
219 clearerr(stdin);
220 hi(0);
221 goto tryagain;
222 }
223 if (usemine) {
224 s[strlen(s) - 1] = '\0';
98 char hostname[MAXHOSTNAMELEN], s[BUFSIZ], s1[BUFSIZ];
99
100 openlog("lock", LOG_ODELAY, LOG_AUTH);
101
102 sectimeout = TIMEOUT;
103 pw = NULL;
104 mypw = NULL;
105 usemine = 0;

--- 111 unchanged lines hidden (view full) ---

217 (void)printf("Key: ");
218 if (!fgets(s, sizeof(s), stdin)) {
219 clearerr(stdin);
220 hi(0);
221 goto tryagain;
222 }
223 if (usemine) {
224 s[strlen(s) - 1] = '\0';
225 if (!strcmp(mypw, crypt(s, mypw)))
225 cryptpw = crypt(s, mypw);
226 if (cryptpw == NULL || !strcmp(mypw, cryptpw))
226 break;
227 }
228 else if (!strcmp(s, s1))
229 break;
230 (void)printf("\07\n");
231 failures++;
232 if (getuid() == 0)
233 syslog(LOG_NOTICE, "%d ROOT UNLOCK FAILURE%s (%s on %s)",

--- 59 unchanged lines hidden ---
227 break;
228 }
229 else if (!strcmp(s, s1))
230 break;
231 (void)printf("\07\n");
232 failures++;
233 if (getuid() == 0)
234 syslog(LOG_NOTICE, "%d ROOT UNLOCK FAILURE%s (%s on %s)",

--- 59 unchanged lines hidden ---