From 30342dd7f1a9b1d87b58bf53988362b0359f2a41 Mon Sep 17 00:00:00 2001
From: Vincent Bernat <bernat@debian.org>
Date: Sun, 15 Feb 2009 17:02:48 +0000
Subject: [PATCH] Add patch from Kris Popendorf to log failed logins. Closes:
 #505267.

---
 debian/changelog                       |  1 +
 debian/patches/log-failed-logins.patch | 13 +++++++++++++
 debian/patches/series                  |  1 +
 3 files changed, 15 insertions(+)
 create mode 100644 debian/patches/log-failed-logins.patch

diff --git a/debian/changelog b/debian/changelog
index 0460688..abd3bd3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -16,6 +16,7 @@ roundcube (0.2~stable-1) unstable; urgency=low
   * Fix pending l10n issues:
       + Update English debconf template. Closes: #473794.
       + Add Swedish translation thanks to Martin Bagge. Closes: #508752.
+  * Add patch from Kris Popendorf to log failed logins. Closes: #505267.
 
  -- Vincent Bernat <bernat@debian.org>  Sun, 15 Feb 2009 16:18:58 +0100
 
diff --git a/debian/patches/log-failed-logins.patch b/debian/patches/log-failed-logins.patch
new file mode 100644
index 0000000..09bfc71
--- /dev/null
+++ b/debian/patches/log-failed-logins.patch
@@ -0,0 +1,13 @@
+Log failed logins.
+--- roundcube-0.1.1/index.php	2008-11-11 18:17:37.939438895 +0900
++++ roundcube-0.1.1-secured/index.php	2008-11-11 18:01:06.000000000 +0900
+@@ -101,6 +101,9 @@
+   }
+   else {
+     $OUTPUT->show_message($IMAP->error_code < -1 ? 'imaperror' : 'loginfailed', 'warning');
++    if($IMAP->error_code != -1){
++      file_put_contents('php://stderr',"[".strftime("%c")."] [roundcube] [client ".$_SERVER['REMOTE_ADDR']."] failed login attempt.\n");
++    }
+     $RCMAIL->kill_session();
+   }
+ }
diff --git a/debian/patches/series b/debian/patches/series
index 9753d88..67f8a01 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@ correct_install_path.patch
 use_packaged_tinymce.patch
 correct-magic-path.patch
 cve-2009-0413.patch
+log-failed-logins.patch
-- 
2.39.5