aboutsummaryrefslogtreecommitdiffstats
path: root/security/ssh/files/patch-bi
blob: b4108fd81d4929810fc60e898430461219d81855 (plain) (blame)
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
--- log-server.c.orig   Thu Jan 17 05:35:33 2002
+++ log-server.c    Sat Jun 29 14:50:00 2002
@@ -163,6 +163,27 @@
   closelog();
 }
 
+#ifdef ENABLE_LOG_AUTH
+void log_auth(const char *fmt, ...)
+{
+  char buf[1024];
+  va_list args;
+  extern int log_auth_flag;
+  if (!log_auth_flag)
+    return;
+  if (log_quiet)
+    return;
+  va_start(args, fmt);
+  vsprintf(buf, fmt, args);
+  va_end(args);
+  if (log_on_stderr)
+    fprintf(stderr, "log: %s\n", buf);
+  syslog(LOG_INFO|LOG_AUTH, "%.500s", buf);
+}
+
+extern char *unauthenticated_user;
+#endif /* ENABLE_LOG_AUTH */
+
 /* Converts portable syslog severity to machine-specific syslog severity. */
 
 static int syslog_severity(int severity)
@@ -336,6 +357,11 @@
     fprintf(stderr, "fatal: %s\n", buf);
   openlog(prg_name, LOG_PID, log_facility);
   syslog(LOG_ERR, "fatal: %.500s", buf);
+#ifdef ENABLE_LOG_AUTH
+  if (unauthenticated_user)
+    log_auth("LOGIN FAILED %.100s from %.200s",
+        unauthenticated_user, get_canonical_hostname());
+#endif /* ENABLE_LOG_AUTH */
   closelog();
 
   do_fatal_cleanups();
@@ -357,6 +383,11 @@
     fprintf(stderr, "fatal: %s\n", buf);
   openlog(prg_name, LOG_PID, log_facility);
   syslog(syslog_severity(severity), "fatal: %.500s", buf);
+#ifdef ENABLE_LOG_AUTH
+  if (unauthenticated_user)
+    log_auth("LOGIN FAILED %.100s from %.200s",
+        unauthenticated_user, get_canonical_hostname());
+#endif /* ENABLE_LOG_AUTH */
   closelog();
 
   do_fatal_cleanups();