[dovecot-cvs] dovecot/src/auth passdb-checkpassword.c,1.24,1.25
cras at dovecot.org
cras at dovecot.org
Tue Aug 22 05:49:56 EEST 2006
Update of /var/lib/cvs/dovecot/src/auth
In directory talvi:/tmp/cvs-serv14629
Modified Files:
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.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- passdb-checkpassword.c 17 Aug 2006 19:48:25 -0000 1.24
+++ passdb-checkpassword.c 22 Aug 2006 02:49:53 -0000 1.25
@@ -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