Mercurial > dovecot > core-2.2
changeset 4584:62e735bfb00d HEAD
If master db has extra fields set, send them to checkpassword in
environment.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 22 Aug 2006 05:49:53 +0300 |
parents | 30416fa0bdeb |
children | 26bbf71e9b5e |
files | src/auth/passdb-checkpassword.c |
diffstat | 1 files changed, 22 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/auth/passdb-checkpassword.c Fri Aug 18 14:35:59 2006 +0300 +++ b/src/auth/passdb-checkpassword.c Tue Aug 22 05:49:53 2006 +0300 @@ -182,6 +182,21 @@ } } +static void env_put_extra_fields(const char *extra_fields) +{ + const char *const *tmp; + const char *key, *p; + + for (tmp = t_strsplit(extra_fields, "\t"); *tmp != NULL; tmp++) { + key = t_str_ucase(t_strcut(*tmp, '=')); + p = strchr(*tmp, '='); + if (p == NULL) + env_put(t_strconcat(key, "=1", NULL)); + else + env_put(t_strconcat(key, p, NULL)); + } +} + static void checkpassword_verify_plain_child(struct auth_request *request, struct checkpassword_passdb_module *module, @@ -216,6 +231,13 @@ env_put(t_strconcat("MASTER_USER=", request->master_user, NULL)); } + if (request->extra_fields != NULL) { + const char *fields = + auth_stream_reply_export(request->extra_fields); + + /* extra fields could come from master db */ + env_put_extra_fields(fields); + } auth_request_log_debug(request, "checkpassword", "Executed: %s", cmd);