]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap/pop3-proxy: If auth_verbose=yes, log proxy login failures.
authorTimo Sirainen <tss@iki.fi>
Sat, 30 Aug 2008 09:34:34 +0000 (12:34 +0300)
committerTimo Sirainen <tss@iki.fi>
Sat, 30 Aug 2008 09:34:34 +0000 (12:34 +0300)
--HG--
branch : HEAD

src/imap-login/imap-proxy.c
src/pop3-login/pop3-proxy.c

index 104e38fd9e8d6635a6a8fa61a9419c2e521f65ca..2aa1d5a440c0980c4e4aa3e8f4d4f11249685b1e 100644 (file)
@@ -128,6 +128,26 @@ static int proxy_input_line(struct imap_client *client,
                   be using only Dovecot as their backend :) */
                client_send_tagline(client, line + 2);
 
+               if (verbose_auth) {
+                       str = t_str_new(128);
+                       str_printfa(str, "proxy(%s): Login failed to %s:%u",
+                                   client->common.virtual_user,
+                                   login_proxy_get_host(client->proxy),
+                                   login_proxy_get_port(client->proxy));
+                       if (strcmp(client->common.virtual_user,
+                                  client->proxy_user) != 0) {
+                               /* remote username is different, log it */
+                               str_append_c(str, '/');
+                               str_append(str, client->proxy_user);
+                       }
+                       str_append(str, ": ");
+                       if (strncasecmp(line + 2, "NO ", 3) == 0)
+                               str_append(str, line + 2 + 3);
+                       else
+                               str_append(str, line + 2);
+                       i_info("%s", str_c(str));
+               }
+
                /* allow client input again */
                i_assert(client->io == NULL);
                client->io = io_add(client->common.fd, IO_READ,
index 061cc31b83f9cc96992513c50a9cbfe94e742f89..6a9d7309897a4acc20d8b0509caf5bbfdafdd521 100644 (file)
@@ -132,6 +132,26 @@ static void proxy_input(struct istream *input, struct ostream *output,
        else
                client_send_line(client, line);
 
+       if (verbose_auth) {
+               str = t_str_new(128);
+               str_printfa(str, "proxy(%s): Login failed to %s:%u",
+                           client->common.virtual_user,
+                           login_proxy_get_host(client->proxy),
+                           login_proxy_get_port(client->proxy));
+               if (strcmp(client->common.virtual_user,
+                          client->proxy_user) != 0) {
+                       /* remote username is different, log it */
+                       str_append_c(str, '/');
+                       str_append(str, client->proxy_user);
+               }
+               str_append(str, ": ");
+               if (strncmp(line, "-ERR ", 5) == 0)
+                       str_append(str, line + 5);
+               else
+                       str_append(str, line);
+               i_info("%s", str_c(str));
+       }
+
        /* allow client input again */
        i_assert(client->io == NULL);
        client->io = io_add(client->common.fd, IO_READ,