]> 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)
committerGitLab <gitlab@git.dovecot.net>
Tue, 13 Sep 2016 07:31:06 +0000 (10:31 +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 806e662c428d5ede8e32f9e5d3093b6053a6b3b1..1ba81bfe75e75c71b83fc2d7b9306a28a0f1d320 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 9ba77a88a33c6fbdb0751025d84509d91c11f3a2..3e6e50906ec6dfcc179cc382d01952b44ec54864 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),
@@ -83,6 +84,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 69e60d89480c124db751dbe2d016fa60a5084ac8..7adb8e093133d86b1f53484ff866005a9305f901 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 19988c8134a40eb127e0b309a88f49ff5317f43b..bc91f85076ab3dc8fee95d217cbd2d8d3d5fa04d 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;