# HG changeset patch # User Alin Dobre # Date 1453475703 0 # Node ID de55cde023c4a69f64cd00259ccf42ca99152f8f # Parent 487036a4b545e4fb374de3dbbb098267688d8282 doveadm: Add plugins support for doveadm pw This simply tries to load all the auth plugins. The ones that aren't password scheme plugins will most likely just fail. Hopefully this will work fine so we don't need to require any specific naming rules for the plugins. Signed-off-by: Alin Dobre diff -r 487036a4b545 -r de55cde023c4 src/doveadm/Makefile.am --- a/src/doveadm/Makefile.am Fri Jan 22 17:14:37 2016 +0200 +++ b/src/doveadm/Makefile.am Fri Jan 22 15:15:03 2016 +0000 @@ -21,6 +21,7 @@ -I$(top_srcdir)/src/lib-storage \ -I$(top_srcdir)/src/auth \ -DMODULEDIR=\""$(moduledir)"\" \ + -DAUTH_MODULE_DIR=\""$(moduledir)/auth"\" \ -DDOVEADM_MODULEDIR=\""$(doveadm_moduledir)"\" \ -DPKG_RUNDIR=\""$(rundir)"\" \ -DPKG_STATEDIR=\""$(statedir)"\" \ diff -r 487036a4b545 -r de55cde023c4 src/doveadm/doveadm-pw.c --- a/src/doveadm/doveadm-pw.c Fri Jan 22 17:14:37 2016 +0200 +++ b/src/doveadm/doveadm-pw.c Fri Jan 22 15:15:03 2016 +0000 @@ -6,6 +6,7 @@ #include "randgen.h" #include "doveadm.h" #include "askpass.h" +#include "module-dir.h" #include #include @@ -14,6 +15,8 @@ #define DEFAULT_SCHEME "CRAM-MD5" +static struct module *modules = NULL; + static void cmd_pw(int argc, char *argv[]) { const char *hash = NULL; @@ -24,10 +27,19 @@ bool list_schemes = FALSE, reverse_verify = FALSE; unsigned int rounds = 0; int c; + struct module_dir_load_settings mod_set; random_init(); password_schemes_init(); - + + memset(&mod_set, 0, sizeof(mod_set)); + mod_set.abi_version = DOVECOT_ABI_VERSION; + mod_set.require_init_funcs = TRUE; + mod_set.ignore_dlopen_errors = TRUE; + + modules = module_dir_load_missing(modules, AUTH_MODULE_DIR, NULL, &mod_set); + module_dir_init(modules); + while ((c = getopt(argc, argv, "lp:r:s:t:u:V")) > 0) { switch (c) { case 'l': @@ -122,6 +134,7 @@ printf("{%s}%s\n", scheme, hash); } + module_dir_unload(&modules); password_schemes_deinit(); random_deinit(); }