dovecot-2.2: auth: When auto-loading auth mechanisms from plugin...
dovecot at dovecot.org
dovecot at dovecot.org
Sat Jan 5 01:14:35 EET 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/4ec13ce76f6e
changeset: 15558:4ec13ce76f6e
user: Timo Sirainen <tss at iki.fi>
date: Tue Dec 18 18:57:41 2012 +0200
description:
auth: When auto-loading auth mechanisms from plugins, generate the name better.
diffstat:
src/auth/mech.c | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diffs (41 lines):
diff -r 3c6a13c0d525 -r 4ec13ce76f6e src/auth/mech.c
--- a/src/auth/mech.c Thu Dec 13 12:14:57 2012 +0200
+++ b/src/auth/mech.c Tue Dec 18 18:57:41 2012 +0200
@@ -7,6 +7,7 @@
#include "passdb.h"
#include <stdlib.h>
+#include <ctype.h>
static struct mech_module_list *mech_modules;
@@ -112,6 +113,20 @@
reg->modules = list;
}
+static const char *mech_get_plugin_name(const char *name)
+{
+ string_t *str = t_str_new(32);
+
+ str_append(str, "mech_");
+ for (; *name != '\0'; name++) {
+ if (*name == '-')
+ str_append_c(str, '_');
+ else
+ str_append_c(str, i_tolower(*name));
+ }
+ return str_c(str);
+}
+
struct mechanisms_register *
mech_register_init(const struct auth_settings *set)
{
@@ -139,7 +154,7 @@
mech = mech_module_find(name);
if (mech == NULL) {
/* maybe it's a plugin. try to load it. */
- auth_module_load(t_strconcat("mech_", name, NULL));
+ auth_module_load(mech_get_plugin_name(name));
mech = mech_module_find(name);
}
if (mech == NULL)
More information about the dovecot-cvs
mailing list