dovecot-2.1: auth: Include session ID in log line prefix.

dovecot at dovecot.org dovecot at dovecot.org
Sat Apr 28 17:41:24 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/629afda8e29d
changeset: 14489:629afda8e29d
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Apr 28 17:41:14 2012 +0300
description:
auth: Include session ID in log line prefix.

diffstat:

 src/auth/auth-request.c            |  4 ++++
 src/auth/auth-request.h            |  2 +-
 src/lib-auth/auth-client-request.c |  6 ++++++
 src/lib-auth/auth-client.h         |  1 +
 src/login-common/login-settings.c  |  2 +-
 src/login-common/sasl-server.c     |  1 +
 6 files changed, 14 insertions(+), 2 deletions(-)

diffs (90 lines):

diff -r 3b4c336ed01b -r 629afda8e29d src/auth/auth-request.c
--- a/src/auth/auth-request.c	Sat Apr 28 17:33:34 2012 +0300
+++ b/src/auth/auth-request.c	Sat Apr 28 17:41:14 2012 +0300
@@ -237,6 +237,8 @@
 		request->local_port = atoi(value);
 	else if (strcmp(key, "rport") == 0)
 		request->remote_port = atoi(value);
+	else if (strcmp(key, "session") == 0)
+		request->session_id = p_strdup(request->pool, value);
 	else
 		return FALSE;
 	return TRUE;
@@ -1856,6 +1858,8 @@
 	}
 	if (auth_request->requested_login_user != NULL)
 		str_append(str, ",master");
+	if (auth_request->session_id != NULL)
+		str_printfa(str, ",<%s>", auth_request->session_id);
 	str_append(str, "): ");
 }
 
diff -r 3b4c336ed01b -r 629afda8e29d src/auth/auth-request.h
--- a/src/auth/auth-request.h	Sat Apr 28 17:33:34 2012 +0300
+++ b/src/auth/auth-request.h	Sat Apr 28 17:41:14 2012 +0300
@@ -71,7 +71,7 @@
 	unsigned int id;
 	time_t last_access;
 
-	const char *service, *mech_name;
+	const char *service, *mech_name, *session_id;
 	struct ip_addr local_ip, remote_ip;
 	unsigned int local_port, remote_port;
 
diff -r 3b4c336ed01b -r 629afda8e29d src/lib-auth/auth-client-request.c
--- a/src/lib-auth/auth-client-request.c	Sat Apr 28 17:33:34 2012 +0300
+++ b/src/lib-auth/auth-client-request.c	Sat Apr 28 17:41:14 2012 +0300
@@ -44,6 +44,10 @@
 	if ((info->flags & AUTH_REQUEST_FLAG_VALID_CLIENT_CERT) != 0)
 		str_append(str, "\tvalid-client-cert");
 
+	if (info->session_id != NULL) {
+		str_append(str, "\tsession=");
+		str_tabescape_write(str, info->session_id);
+	}
 	if (info->cert_username != NULL) {
 		str_append(str, "\tcert_username=");
 		str_tabescape_write(str, info->cert_username);
@@ -82,6 +86,8 @@
 	request->request_info = *request_info;
 	request->request_info.mech = p_strdup(pool, request_info->mech);
 	request->request_info.service = p_strdup(pool, request_info->service);
+	request->request_info.session_id =
+		p_strdup_empty(pool, request_info->session_id);
 	request->request_info.cert_username =
 		p_strdup_empty(pool, request_info->cert_username);
 	request->request_info.initial_resp_base64 =
diff -r 3b4c336ed01b -r 629afda8e29d src/lib-auth/auth-client.h
--- a/src/lib-auth/auth-client.h	Sat Apr 28 17:33:34 2012 +0300
+++ b/src/lib-auth/auth-client.h	Sat Apr 28 17:41:14 2012 +0300
@@ -37,6 +37,7 @@
 struct auth_request_info {
 	const char *mech;
 	const char *service;
+	const char *session_id;
 	const char *cert_username;
 	enum auth_request_flags flags;
 
diff -r 3b4c336ed01b -r 629afda8e29d src/login-common/login-settings.c
--- a/src/login-common/login-settings.c	Sat Apr 28 17:33:34 2012 +0300
+++ b/src/login-common/login-settings.c	Sat Apr 28 17:41:14 2012 +0300
@@ -56,7 +56,7 @@
 static const struct login_settings login_default_settings = {
 	.login_trusted_networks = "",
 	.login_greeting = PACKAGE_NAME" ready.",
-	.login_log_format_elements = "user=<%u> method=%m rip=%r lip=%l mpid=%e %c",
+	.login_log_format_elements = "user=<%u> method=%m rip=%r lip=%l mpid=%e %c session=<%{session}>",
 	.login_log_format = "%$: %s",
 	.login_access_sockets = "",
 	.director_username_hash = "%u",
diff -r 3b4c336ed01b -r 629afda8e29d src/login-common/sasl-server.c
--- a/src/login-common/sasl-server.c	Sat Apr 28 17:33:34 2012 +0300
+++ b/src/login-common/sasl-server.c	Sat Apr 28 17:41:14 2012 +0300
@@ -318,6 +318,7 @@
 	memset(&info, 0, sizeof(info));
 	info.mech = mech->name;
 	info.service = service;
+	info.session_id = client_get_session_id(client);
 	info.cert_username = client->ssl_proxy == NULL ? NULL :
 		ssl_proxy_get_peer_name(client->ssl_proxy);
 	info.flags = client_get_auth_flags(client);


More information about the dovecot-cvs mailing list