dovecot-2.2: auth: Added %{orig_user}, %{orig_username} and %{or...
dovecot at dovecot.org
dovecot at dovecot.org
Mon May 5 11:29:17 UTC 2014
details: http://hg.dovecot.org/dovecot-2.2/rev/1e099feb1dea
changeset: 17315:1e099feb1dea
user: Timo Sirainen <tss at iki.fi>
date: Mon May 05 14:28:33 2014 +0300
description:
auth: Added %{orig_user}, %{orig_username} and %{orig_domain} variables
diffstat:
src/auth/auth-request.c | 12 ++++++++++++
src/auth/auth-request.h | 2 +-
2 files changed, 13 insertions(+), 1 deletions(-)
diffs (48 lines):
diff -r 32b6a95c95cc -r 1e099feb1dea src/auth/auth-request.c
--- a/src/auth/auth-request.c Mon May 05 14:18:31 2014 +0300
+++ b/src/auth/auth-request.c Mon May 05 14:28:33 2014 +0300
@@ -2027,6 +2027,9 @@
{ '\0', NULL, "domain_last" },
{ '\0', NULL, "master_user" },
{ '\0', NULL, "session_pid" },
+ { '\0', NULL, "orig_user" },
+ { '\0', NULL, "orig_username" },
+ { '\0', NULL, "orig_domain" },
/* be sure to update AUTH_REQUEST_VAR_TAB_COUNT */
{ '\0', NULL, NULL }
};
@@ -2039,6 +2042,7 @@
const unsigned int auth_count =
N_ELEMENTS(auth_request_var_expand_static_tab);
struct var_expand_table *tab, *ret_tab;
+ const char *orig_user;
if (escape_func == NULL)
escape_func = escape_none;
@@ -2116,6 +2120,14 @@
escape_func(auth_request->master_user, auth_request);
tab[26].value = auth_request->session_pid == (pid_t)-1 ? NULL :
dec2str(auth_request->session_pid);
+
+ orig_user = auth_request->original_username != NULL ?
+ auth_request->original_username : auth_request->user;
+ tab[27].value = escape_func(orig_user, auth_request);
+ tab[28].value = escape_func(t_strcut(orig_user, '@'), auth_request);
+ tab[29].value = strchr(orig_user, '@');
+ if (tab[29].value != NULL)
+ tab[29].value = escape_func(tab[29].value+1, auth_request);
return ret_tab;
}
diff -r 32b6a95c95cc -r 1e099feb1dea src/auth/auth-request.h
--- a/src/auth/auth-request.h Mon May 05 14:18:31 2014 +0300
+++ b/src/auth/auth-request.h Mon May 05 14:28:33 2014 +0300
@@ -149,7 +149,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 27
+#define AUTH_REQUEST_VAR_TAB_COUNT 30
extern const struct var_expand_table
auth_request_var_expand_static_tab[AUTH_REQUEST_VAR_TAB_COUNT+1];
More information about the dovecot-cvs
mailing list