|
Lines 51-60
Link Here
|
| 51 |
/* |
51 |
/* |
| 52 |
* Lock a terminal up until the given key is entered, until the root |
52 |
* Lock a terminal up until the given key is entered, until the root |
| 53 |
* password is entered, or the given interval times out. |
53 |
* password is entered, or the given interval times out. |
| 54 |
* |
54 |
* |
| 55 |
* Timeout interval is by default TIMEOUT, it can be changed with |
55 |
* Timeout interval is by default disabled. |
| 56 |
* an argument of the form -time where time is in minutes |
|
|
| 57 |
*/ |
56 |
*/ |
| 58 |
|
57 |
|
| 59 |
#include <sys/param.h> |
58 |
#include <sys/param.h> |
| 60 |
#include <sys/stat.h> |
59 |
#include <sys/stat.h> |
|
Lines 70-79
Link Here
|
| 70 |
#include <syslog.h> |
69 |
#include <syslog.h> |
| 71 |
#include <unistd.h> |
70 |
#include <unistd.h> |
| 72 |
#include <varargs.h> |
71 |
#include <varargs.h> |
| 73 |
|
72 |
|
| 74 |
#define TIMEOUT 15 |
|
|
| 75 |
|
| 76 |
void quit(), bye(), hi(); |
73 |
void quit(), bye(), hi(); |
| 77 |
static void usage __P((void)); |
74 |
static void usage __P((void)); |
| 78 |
|
75 |
|
| 79 |
struct timeval timeout; |
76 |
struct timeval timeout; |
|
Lines 99-113
Link Here
|
| 99 |
char *crypt(), *ttyname(); |
96 |
char *crypt(), *ttyname(); |
| 100 |
|
97 |
|
| 101 |
openlog("lock", LOG_ODELAY, LOG_AUTH); |
98 |
openlog("lock", LOG_ODELAY, LOG_AUTH); |
| 102 |
|
99 |
|
| 103 |
sectimeout = TIMEOUT; |
100 |
sectimeout = 0; |
| 104 |
mypw = NULL; |
101 |
mypw = NULL; |
| 105 |
usemine = 0; |
102 |
usemine = 0; |
| 106 |
no_timeout = 0; |
103 |
no_timeout = 1; |
| 107 |
while ((ch = getopt(argc, argv, "npt:")) != -1) |
104 |
while ((ch = getopt(argc, argv, "npt:")) != -1) |
| 108 |
switch((char)ch) { |
105 |
switch((char)ch) { |
| 109 |
case 't': |
106 |
case 't': |
|
|
107 |
no_timeout = 0; |
| 110 |
if ((sectimeout = atoi(optarg)) <= 0) |
108 |
if ((sectimeout = atoi(optarg)) <= 0) |
| 111 |
errx(1, "illegal timeout value"); |
109 |
errx(1, "illegal timeout value"); |
| 112 |
break; |
110 |
break; |
| 113 |
case 'p': |
111 |
case 'p': |
|
Lines 116-123
Link Here
|
| 116 |
errx(1, "unknown uid %d", getuid()); |
114 |
errx(1, "unknown uid %d", getuid()); |
| 117 |
mypw = strdup(pw->pw_passwd); |
115 |
mypw = strdup(pw->pw_passwd); |
| 118 |
break; |
116 |
break; |
| 119 |
case 'n': |
117 |
case 'n': |
|
|
118 |
/*obsolete*/ |
| 120 |
no_timeout = 1; |
119 |
no_timeout = 1; |
| 121 |
break; |
120 |
break; |
| 122 |
case '?': |
121 |
case '?': |
| 123 |
default: |
122 |
default: |