dovecot-2.0: auth: Added %{login_user}, %{login_username} and %{...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jun 2 21:52:37 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/5ae4a5c14f5b
changeset: 11466:5ae4a5c14f5b
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jun 02 19:52:32 2010 +0100
description:
auth: Added %{login_user}, %{login_username} and %{login_domain} variables that are set for master logins.

diffstat:

 src/auth/auth-request.c |  16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diffs (33 lines):

diff -r 49b3a9e170be -r 5ae4a5c14f5b src/auth/auth-request.c
--- a/src/auth/auth-request.c	Wed Jun 02 19:24:07 2010 +0100
+++ b/src/auth/auth-request.c	Wed Jun 02 19:52:32 2010 +0100
@@ -1496,6 +1496,9 @@
 		{ 'a', NULL, "lport" },
 		{ 'b', NULL, "rport" },
 		{ 'k', NULL, "cert" },
+		{ '\0', NULL, "login_user" },
+		{ '\0', NULL, "login_username" },
+		{ '\0', NULL, "login_domain" },
 		{ '\0', NULL, NULL }
 	};
 	struct var_expand_table *tab;
@@ -1536,6 +1539,19 @@
 	tab[12].value = dec2str(auth_request->local_port);
 	tab[13].value = dec2str(auth_request->remote_port);
 	tab[14].value = auth_request->valid_client_cert ? "valid" : "";
+
+	if (auth_request->requested_login_user != NULL) {
+		const char *login_user = auth_request->requested_login_user;
+
+		tab[15].value = escape_func(login_user, auth_request);
+		tab[16].value = escape_func(t_strcut(login_user, '@'),
+					    auth_request);
+		tab[17].value = strchr(login_user, '@');
+		if (tab[17].value != NULL) {
+			tab[17].value = escape_func(tab[17].value+1,
+						    auth_request);
+		}
+	}
 	return tab;
 }
 


More information about the dovecot-cvs mailing list