dovecot-2.0: checkpassword: Export all auth %variables to AUTH_*...

dovecot at dovecot.org dovecot at dovecot.org
Wed Nov 16 22:14:01 EET 2011


details:   http://hg.dovecot.org/dovecot-2.0/rev/629629e65d83
changeset: 12973:629629e65d83
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Nov 16 22:13:35 2011 +0200
description:
checkpassword: Export all auth %variables to AUTH_* environment.

diffstat:

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

diffs (33 lines):

diff -r 2f6c0ab7d043 -r 629629e65d83 src/auth/db-checkpassword.c
--- a/src/auth/db-checkpassword.c	Wed Nov 16 20:24:07 2011 +0200
+++ b/src/auth/db-checkpassword.c	Wed Nov 16 22:13:35 2011 +0200
@@ -86,6 +86,21 @@
 	}
 }
 
+static void env_put_auth_vars(struct auth_request *request)
+{
+	const struct var_expand_table *tab;
+	unsigned int i;
+
+	tab = auth_request_get_var_expand_table(request, NULL);
+	for (i = 0; tab[i].key != '\0' || tab[i].long_key != NULL; i++) {
+		if (tab[i].long_key != NULL && tab[i].value != NULL) {
+			env_put(t_strdup_printf("AUTH_%s=%s",
+						t_str_ucase(tab[i].long_key),
+						tab[i].value));
+		}
+	}
+}
+
 void checkpassword_setup_env(struct auth_request *request)
 {
 	/* Besides passing the standard username and password in a
@@ -128,6 +143,7 @@
 		/* extra fields could come from master db */
 		env_put_extra_fields(fields);
 	}
+	env_put_auth_vars(request);
 }
 
 const char *


More information about the dovecot-cvs mailing list