Hello,
I'm using a patched version of passdb-vpopmail.c to use CRAM-MD5 on the
director.
Today I updated the patch to 2.0.13.
It may be an edge-case but I think it could be useful for somebody else.
Greetings
Martin
--- dovecot-2.0.13.o/src/auth/passdb-vpopmail.c 2011-03-16 16:46:51.000000000
+0100
+++ dovecot-2.0.13/src/auth/passdb-vpopmail.c 2011-07-29 14:53:33.000000000
+0200
@@ -10,6 +10,9 @@
#include "safe-memset.h"
#include "password-scheme.h"
#include "auth-cache.h"
+#include "array.h"
+#include "str.h"
+#include "var-expand.h"
#include "userdb-vpopmail.h"
@@ -26,8 +29,38 @@
struct passdb_module module;
struct ip_addr webmail_ip;
+ ARRAY_TYPE(const_string) tmpl;
};
+static void
+vpopmail_save_fields(struct auth_request *request, const char *scheme)
+{
+ struct vpopmail_passdb_module *module =
+ (struct vpopmail_passdb_module *)request->passdb->passdb;
+ const struct var_expand_table *table;
+ const char *const *args;
+ unsigned int i, count;
+ string_t *str = t_str_new(128);
+
+ auth_request_log_debug(request, "vpopmail", "lookup");
+
+ table = auth_request_get_var_expand_table(request, NULL);
+
+ args = array_get(&module->tmpl, &count);
+ for (i = 0; i < count; i += 2) {
+ const char *key = args[i];
+ const char *value = args[i+1];
+
+ if (value != NULL) {
+ str_truncate(str, 0);
+ var_expand(str, args[i+1], table);
+ value = str_c(str);
+ }
+
+ auth_request_set_field(request, key, value, scheme);
+ }
+}
+
static bool vpopmail_is_disabled(struct auth_request *request,
const struct vqpasswd *vpw)
{
@@ -102,6 +135,7 @@
return;
}
+ vpopmail_save_fields(request,
request->passdb->passdb->default_pass_scheme);
passdb_handle_credentials(PASSDB_RESULT_OK, password, "CLEARTEXT",
callback, request);
safe_memset(password, 0, strlen(password));
@@ -127,6 +161,8 @@
if (scheme == NULL)
scheme = request->passdb->passdb->default_pass_scheme;
+ vpopmail_save_fields(request, scheme);
+
ret = auth_request_password_verify(request, password,
tmp_pass, scheme, "vpopmail");
safe_memset(crypted_pass, 0, strlen(crypted_pass));
@@ -169,6 +205,8 @@
module->module.default_pass_scheme = VPOPMAIL_DEFAULT_PASS_SCHEME;
module->module.blocking = TRUE;
+ p_array_init(&module->tmpl, pool, 16);
+
tmp = t_strsplit_spaces(args, " ");
for (; *tmp != NULL; tmp++) {
if (strncmp(*tmp, "cache_key=", 10) == 0) {
@@ -180,7 +218,18 @@
} else if (strcmp(*tmp, "blocking=no") == 0) {
module->module.blocking = FALSE;
} else {
- i_fatal("passdb vpopmail: Unknown setting: %s", *tmp);
+ const char *key = *tmp;
+ const char *value = strchr(key, '=');
+
+ if (value == NULL)
+ value = "";
+ else
+ key = t_strdup_until(key, value++);
+
+ key = p_strdup(pool, key);
+ value = p_strdup(pool, value);
+ array_append(&module->tmpl, &key, 1);
+ array_append(&module->tmpl, &value, 1);
}
}
if (!vauth_load_initialized) {