]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap, pop3: Added rawlog_dir setting to store IMAP/POP3 traffic logs.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 13 Sep 2016 04:22:03 +0000 (07:22 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 15 Sep 2016 05:55:59 +0000 (08:55 +0300)
This at least partially replaces the "rawlog" post-login binary. For now
the "rawlog" binary supports some parameters, which aren't configurable
for rawlog_dir.

src/imap/imap-client.c
src/imap/imap-settings.c
src/imap/imap-settings.h
src/pop3/pop3-client.c
src/pop3/pop3-settings.c
src/pop3/pop3-settings.h

index c95faff8751aac8c3675e8e33a41ba4f0918ccf1..162bdb869faf20f74cc19e119c62fa7f101debd4 100644 (file)
@@ -7,6 +7,7 @@
 #include "hostpid.h"
 #include "net.h"
 #include "iostream.h"
+#include "iostream-rawlog.h"
 #include "istream.h"
 #include "ostream.h"
 #include "time-util.h"
@@ -123,6 +124,11 @@ struct client *client_create(int fd_in, int fd_out, const char *session_id,
        client->notify_count_changes = TRUE;
        client->notify_flag_changes = TRUE;
 
+       if (set->rawlog_dir[0] != '\0') {
+               (void)iostream_rawlog_create(set->rawlog_dir, &client->input,
+                                            &client->output);
+       }
+
        mail_namespaces_set_storage_callbacks(user->namespaces,
                                              &mail_storage_callbacks, client);
 
index d3e869cf80623333a0a75a830fba02c6c87ac9ce..3864ec03ccae3aad59ae751238b3c1274901d3b4 100644 (file)
@@ -63,6 +63,7 @@ struct service_settings imap_service_settings = {
 
 static const struct setting_define imap_setting_defines[] = {
        DEF(SET_BOOL, verbose_proctitle),
+       DEF(SET_STR_VARS, rawlog_dir),
 
        DEF(SET_SIZE, imap_max_line_length),
        DEF(SET_TIME, imap_idle_notify_interval),
@@ -82,6 +83,7 @@ static const struct setting_define imap_setting_defines[] = {
 
 static const struct imap_settings imap_default_settings = {
        .verbose_proctitle = FALSE,
+       .rawlog_dir = "",
 
        /* RFC-2683 recommends at least 8000 bytes. Some clients however don't
           break large message sets to multiple commands, so we're pretty
index e4e70506c3f6161824956e7ddf05075f5bdf06f1..cfb9dccc58592aae527ab3a5ea54bee5729496da 100644 (file)
@@ -15,6 +15,7 @@ enum imap_client_workarounds {
 
 struct imap_settings {
        bool verbose_proctitle;
+       const char *rawlog_dir;
 
        /* imap: */
        uoff_t imap_max_line_length;
index 69faff06322c4f1300748dcd1ba48f9eb1993c76..a0a00aa000782bb3090b9fca8366daef159436a6 100644 (file)
@@ -7,6 +7,7 @@
 #include "iostream.h"
 #include "istream.h"
 #include "ostream.h"
+#include "iostream-rawlog.h"
 #include "crc32.h"
 #include "str.h"
 #include "llist.h"
@@ -400,6 +401,11 @@ int client_create(int fd_in, int fd_out, const char *session_id,
        o_stream_set_no_error_handling(client->output, TRUE);
        o_stream_set_flush_callback(client->output, client_output, client);
 
+       if (set->rawlog_dir[0] != '\0') {
+               (void)iostream_rawlog_create(set->rawlog_dir, &client->input,
+                                            &client->output);
+       }
+
        p_array_init(&client->module_contexts, client->pool, 5);
        client->io = io_add_istream(client->input, client_input, client);
         client->last_input = ioloop_time;
index f74b9ed0fe32d8e27a91d12c1a5ece675682ef6e..dc3fb921fe28b4044317e47b8d2d2f3a76fe85d6 100644 (file)
@@ -60,6 +60,7 @@ struct service_settings pop3_service_settings = {
 
 static const struct setting_define pop3_setting_defines[] = {
        DEF(SET_BOOL, verbose_proctitle),
+       DEF(SET_STR_VARS, rawlog_dir),
 
        DEF(SET_BOOL, pop3_no_flag_updates),
        DEF(SET_BOOL, pop3_enable_last),
@@ -78,6 +79,7 @@ static const struct setting_define pop3_setting_defines[] = {
 
 static const struct pop3_settings pop3_default_settings = {
        .verbose_proctitle = FALSE,
+       .rawlog_dir = "",
 
        .pop3_no_flag_updates = FALSE,
        .pop3_enable_last = FALSE,
index 3ea4a0079d9ee62b76737daee2dfba9c54893bcc..cf50f980d530bf41e8b8a369589e0d1a8df264c8 100644 (file)
@@ -16,6 +16,7 @@ enum pop3_delete_type {
 
 struct pop3_settings {
        bool verbose_proctitle;
+       const char *rawlog_dir;
 
        /* pop3: */
        bool pop3_no_flag_updates;