dovecot-2.2: auth: Added %{domain_first} and %{domain_last} vari...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Aug 12 19:02:23 EEST 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/179f90dc0b1c
changeset: 16690:179f90dc0b1c
user: Timo Sirainen <tss at iki.fi>
date: Mon Aug 12 19:02:07 2013 +0300
description:
auth: Added %{domain_first} and %{domain_last} variables.
They are both equal to %d normally, but differ when there are multiple '@'
characters in the domain.
diffstat:
src/auth/auth-request.c | 11 +++++++++++
src/auth/auth-request.h | 2 +-
2 files changed, 12 insertions(+), 1 deletions(-)
diffs (40 lines):
diff -r e6c2a1344f86 -r 179f90dc0b1c src/auth/auth-request.c
--- a/src/auth/auth-request.c Mon Aug 12 17:24:05 2013 +0300
+++ b/src/auth/auth-request.c Mon Aug 12 19:02:07 2013 +0300
@@ -1915,6 +1915,9 @@
{ '\0', NULL, "real_rip" },
{ '\0', NULL, "real_lport" },
{ '\0', NULL, "real_rport" },
+ { '\0', NULL, "domain_first" },
+ { '\0', NULL, "domain_last" },
+ /* be sure to update AUTH_REQUEST_VAR_TAB_COUNT */
{ '\0', NULL, NULL }
};
@@ -1991,6 +1994,14 @@
tab[20].value = net_ip2addr(&auth_request->real_remote_ip);
tab[21].value = dec2str(auth_request->real_local_port);
tab[22].value = dec2str(auth_request->real_remote_port);
+ tab[23].value = strchr(auth_request->user, '@');
+ if (tab[23].value != NULL) {
+ tab[23].value = escape_func(t_strcut(tab[23].value+1, '@'),
+ auth_request);
+ }
+ tab[24].value = strrchr(auth_request->user, '@');
+ if (tab[24].value != NULL)
+ tab[24].value = escape_func(tab[24].value+1, auth_request);
return ret_tab;
}
diff -r e6c2a1344f86 -r 179f90dc0b1c src/auth/auth-request.h
--- a/src/auth/auth-request.h Mon Aug 12 17:24:05 2013 +0300
+++ b/src/auth/auth-request.h Mon Aug 12 19:02:07 2013 +0300
@@ -143,7 +143,7 @@
#define AUTH_REQUEST_VAR_TAB_USER_IDX 0
#define AUTH_REQUEST_VAR_TAB_USERNAME_IDX 1
#define AUTH_REQUEST_VAR_TAB_DOMAIN_IDX 2
-#define AUTH_REQUEST_VAR_TAB_COUNT 23
+#define AUTH_REQUEST_VAR_TAB_COUNT 25
extern const struct var_expand_table auth_request_var_expand_static_tab[];
struct auth_request *
More information about the dovecot-cvs
mailing list