dovecot-2.2: auth: Allow using userdb_userdb_import in passdb qu...

dovecot at dovecot.org dovecot at dovecot.org
Fri Apr 5 00:13:33 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/cd919c490ea6
changeset: 16187:cd919c490ea6
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Mar 31 17:40:12 2013 +0300
description:
auth: Allow using userdb_userdb_import in passdb query to set multiple userdb fields.

diffstat:

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

diffs (38 lines):

diff -r 9d79ef9cf337 -r cd919c490ea6 src/auth/auth-request.c
--- a/src/auth/auth-request.c	Sun Mar 31 11:23:42 2013 +0300
+++ b/src/auth/auth-request.c	Sun Mar 31 17:40:12 2013 +0300
@@ -1242,6 +1242,22 @@
 	return TRUE;
 }
 
+static void
+auth_request_userdb_userdb_import(struct auth_request *request,
+				  const char *args, const char *default_scheme)
+{
+	const char *key, *value, *const *arg = t_strsplit(args, "\t");
+
+	for (; *arg != NULL; arg++) {
+		value = strchr(*arg, '=');
+		if (value == NULL)
+			key = *arg;
+		else
+			key = t_strdup_until(*arg, value++);
+		auth_request_set_field(request, key, value, default_scheme);
+	}
+}
+
 void auth_request_set_field(struct auth_request *request,
 			    const char *name, const char *value,
 			    const char *default_scheme)
@@ -1287,6 +1303,11 @@
 		auth_request_validate_networks(request, value);
 	} else if (strncmp(name, "userdb_", 7) == 0) {
 		/* for prefetch userdb */
+		if (strcmp(name, "userdb_userdb_import") == 0) {
+			auth_request_userdb_userdb_import(request, value,
+							  default_scheme);
+			return;
+		}
 		if (request->userdb_reply == NULL)
 			auth_request_init_userdb_reply(request);
 		auth_request_set_userdb_field(request, name + 7, value);


More information about the dovecot-cvs mailing list