aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/lock
diff options
context:
space:
mode:
authorJacques Vidrine <nectar@FreeBSD.org>1999-10-12 13:33:48 +0000
committerJacques Vidrine <nectar@FreeBSD.org>1999-10-12 13:33:48 +0000
commit65c543c7645e8a79810620721cb0fa1c570a0d59 (patch)
treeea86381d73e800dec77b5873ce00bda4bafa96f0 /usr.bin/lock
parent4b12dfb18467d638060dd88003f97d1ac460b64e (diff)
downloadsrc-65c543c7645e8a79810620721cb0fa1c570a0d59.tar.gz
src-65c543c7645e8a79810620721cb0fa1c570a0d59.zip
log root unlock attempts
PR: bin/13932
Notes
Notes: svn path=/head/; revision=52158
Diffstat (limited to 'usr.bin/lock')
-rw-r--r--usr.bin/lock/lock.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/usr.bin/lock/lock.c b/usr.bin/lock/lock.c
index d5b60ae10da1..c1ffcb532335 100644
--- a/usr.bin/lock/lock.c
+++ b/usr.bin/lock/lock.c
@@ -59,6 +59,7 @@ static const char rcsid[] =
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/time.h>
+#include <sys/types.h>
#include <sys/signal.h>
#include <err.h>
#include <ctype.h>
@@ -67,7 +68,9 @@ static const char rcsid[] =
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <syslog.h>
#include <unistd.h>
+#include <varargs.h>
#define TIMEOUT 15
@@ -91,11 +94,13 @@ main(argc, argv)
time_t timval_sec;
struct itimerval ntimer, otimer;
struct tm *timp;
- int ch, sectimeout, usemine;
+ int ch, failures, sectimeout, usemine;
char *ap, *mypw, *ttynam, *tzn;
char hostname[MAXHOSTNAMELEN], s[BUFSIZ], s1[BUFSIZ];
char *crypt(), *ttyname();
+ openlog("lock", LOG_ODELAY, LOG_AUTH);
+
sectimeout = TIMEOUT;
mypw = NULL;
usemine = 0;
@@ -181,6 +186,7 @@ main(argc, argv)
(void)printf("lock: %s on %s. timeout in %d minutes\ntime now is %.20s%s%s",
ttynam, hostname, sectimeout, ap, tzn, ap + 19);
}
+ failures = 0;
for (;;) {
(void)printf("Key: ");
@@ -197,9 +203,17 @@ main(argc, argv)
else if (!strcmp(s, s1))
break;
(void)printf("\07\n");
+ failures++;
+ if (getuid() == 0)
+ syslog(LOG_NOTICE, "%d ROOT UNLOCK FAILURE%s (%s on %s)",
+ failures, failures > 1 ? "S": "", ttynam, hostname);
if (ioctl(0, TIOCGETP, &ntty))
exit(1);
+ sleep(1); /* to discourage guessing */
}
+ if (getuid() == 0)
+ syslog(LOG_NOTICE, "ROOT UNLOCK ON hostname %s port %s",
+ hostname, ttynam);
quit();
return(0); /* not reached */
}