[dovecot-cvs] dovecot/src/auth passdb-checkpassword.c, 1.18.2.6, 1.18.2.7

cras at dovecot.org cras at dovecot.org
Tue Aug 22 05:49:55 EEST 2006


Update of /var/lib/cvs/dovecot/src/auth
In directory talvi:/tmp/cvs-serv17258

Modified Files:
      Tag: branch_1_0
	passdb-checkpassword.c 
Log Message:
If master db has extra fields set, send them to checkpassword in
environment.



Index: passdb-checkpassword.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/passdb-checkpassword.c,v
retrieving revision 1.18.2.6
retrieving revision 1.18.2.7
diff -u -d -r1.18.2.6 -r1.18.2.7
--- passdb-checkpassword.c	17 Aug 2006 19:48:24 -0000	1.18.2.6
+++ passdb-checkpassword.c	22 Aug 2006 02:49:52 -0000	1.18.2.7
@@ -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);



More information about the dovecot-cvs mailing list