dovecot-2.1: login: Added -R <dir> parameter to write pre-login ...

dovecot at dovecot.org dovecot at dovecot.org
Thu Sep 22 12:54:41 EEST 2011


details:   http://hg.dovecot.org/dovecot-2.1/rev/1ff636720b9f
changeset: 13539:1ff636720b9f
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Sep 22 12:54:27 2011 +0300
description:
login: Added -R <dir> parameter to write pre-login rawlogs to given directory.

diffstat:

 src/login-common/client-common.c |   7 +++++++
 src/login-common/login-common.h  |   1 +
 src/login-common/main.c          |  14 +++++++++++++-
 3 files changed, 21 insertions(+), 1 deletions(-)

diffs (80 lines):

diff -r e19a3a2d554d -r 1ff636720b9f src/login-common/client-common.c
--- a/src/login-common/client-common.c	Thu Sep 22 01:38:34 2011 +0300
+++ b/src/login-common/client-common.c	Thu Sep 22 12:54:27 2011 +0300
@@ -5,6 +5,7 @@
 #include "llist.h"
 #include "istream.h"
 #include "ostream.h"
+#include "iostream-rawlog.h"
 #include "process-title.h"
 #include "str.h"
 #include "str-sanitize.h"
@@ -36,6 +37,12 @@
 		i_stream_create_fd(client->fd, LOGIN_MAX_INBUF_SIZE, FALSE);
 	client->output =
 		o_stream_create_fd(client->fd, LOGIN_MAX_OUTBUF_SIZE, FALSE);
+
+	if (login_rawlog_dir != NULL) {
+		if (iostream_rawlog_create(login_rawlog_dir, &client->input,
+					   &client->output) < 0)
+			login_rawlog_dir = NULL;
+	}
 }
 
 struct client *
diff -r e19a3a2d554d -r 1ff636720b9f src/login-common/login-common.h
--- a/src/login-common/login-common.h	Thu Sep 22 01:38:34 2011 +0300
+++ b/src/login-common/login-common.h	Thu Sep 22 12:54:27 2011 +0300
@@ -34,6 +34,7 @@
 extern struct master_auth *master_auth;
 extern bool closing_down;
 extern struct anvil_client *anvil;
+extern const char *login_rawlog_dir;
 
 extern const struct login_settings *global_login_settings;
 extern void **global_other_settings;
diff -r e19a3a2d554d -r 1ff636720b9f src/login-common/main.c
--- a/src/login-common/main.c	Thu Sep 22 01:38:34 2011 +0300
+++ b/src/login-common/main.c	Thu Sep 22 12:54:27 2011 +0300
@@ -36,6 +36,7 @@
 struct master_auth *master_auth;
 bool closing_down;
 struct anvil_client *anvil;
+const char *login_rawlog_dir = NULL;
 
 const struct login_settings *global_login_settings;
 void **global_other_settings;
@@ -297,6 +298,13 @@
 			i_fatal("chdir(login) failed: %m");
 	}
 
+	if (login_rawlog_dir != NULL &&
+	    access(login_rawlog_dir, W_OK | X_OK) < 0) {
+		i_error("access(%s, wx) failed: %m - disabling rawlog",
+			login_rawlog_dir);
+		login_rawlog_dir = NULL;
+	}
+
 	master_service_set_avail_overflow_callback(master_service,
 						   client_destroy_oldest);
 	master_service_set_die_callback(master_service, login_die);
@@ -340,7 +348,8 @@
 	login_binary = binary;
 
 	master_service = master_service_init(login_binary->process_name,
-					     service_flags, &argc, &argv, "DS");
+					     service_flags, &argc, &argv,
+					     "DR:S");
 	master_service_init_log(master_service, t_strconcat(
 		login_binary->process_name, ": ", NULL));
 
@@ -349,6 +358,9 @@
 		case 'D':
 			allow_core_dumps = TRUE;
 			break;
+		case 'R':
+			login_rawlog_dir = optarg;
+			break;
 		case 'S':
 			ssl_connections = TRUE;
 			break;


More information about the dovecot-cvs mailing list