Package: shadow / 1:4.2-3+deb8u4

008_login_log_failure_in_FTMP Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Goal: Log login failures to the btmp file

Notes:
 * I'm not sure login should add an entry in the FTMP file when PAM is used.
   (but nothing in /etc/login.defs indicates that the failure is not logged)

Index: git/src/login.c
===================================================================
--- git.orig/src/login.c
+++ git/src/login.c
@@ -831,6 +831,24 @@
 			(void) puts ("");
 			(void) puts (_("Login incorrect"));
 
+			if (getdef_str("FTMP_FILE") != NULL) {
+#ifdef USE_UTMPX
+				struct utmpx *failent =
+					prepare_utmpx (failent_user,
+					               tty,
+					/* FIXME: or fromhost? */hostname,
+					               utent);
+#else				/* !USE_UTMPX */
+				struct utmp *failent =
+					prepare_utmp (failent_user,
+					              tty,
+					              hostname,
+					              utent);
+#endif				/* !USE_UTMPX */
+				failtmp (failent_user, failent);
+				free (failent);
+			}
+
 			if (failcount >= retries) {
 				SYSLOG ((LOG_NOTICE,
 				         "TOO MANY LOGIN TRIES (%u)%s FOR '%s'",
Index: git/lib/getdef.c
===================================================================
--- git.orig/lib/getdef.c
+++ git/lib/getdef.c
@@ -62,6 +62,7 @@
 	{"ERASECHAR", NULL},
 	{"FAIL_DELAY", NULL},
 	{"FAKE_SHELL", NULL},
+	{"FTMP_FILE", NULL},
 	{"GID_MAX", NULL},
 	{"GID_MIN", NULL},
 	{"HUSHLOGIN_FILE", NULL},
@@ -109,7 +110,6 @@
 	{"ENVIRON_FILE", NULL},
 	{"ENV_TZ", NULL},
 	{"FAILLOG_ENAB", NULL},
-	{"FTMP_FILE", NULL},
 	{"ISSUE_FILE", NULL},
 	{"LASTLOG_ENAB", NULL},
 	{"LOGIN_STRING", NULL},