From: Aki Tuomi Date: Fri, 25 Nov 2016 07:48:43 +0000 (+0200) Subject: lib-dcrypt: Add module_dir setting X-Git-Tag: 2.2.27~37 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3dfbf3b3760d498f718113dc04ccacf748e60d83;p=thirdparty%2Fdovecot%2Fcore.git lib-dcrypt: Add module_dir setting This is needed for unit tests that require dcrypt, so that they can load backend without installing it first. --- diff --git a/src/lib-dcrypt/dcrypt.c b/src/lib-dcrypt/dcrypt.c index dc6e0077a0..897fcf9801 100644 --- a/src/lib-dcrypt/dcrypt.c +++ b/src/lib-dcrypt/dcrypt.c @@ -5,7 +5,9 @@ static struct module *dcrypt_module = NULL; static struct dcrypt_vfs *dcrypt_vfs = NULL; -static const struct dcrypt_settings dcrypt_default_set; +static const struct dcrypt_settings dcrypt_default_set = { + .module_dir = DCRYPT_MODULE_DIR, +}; bool dcrypt_initialize(const char *backend, const struct dcrypt_settings *set, const char **error_r) { @@ -24,7 +26,7 @@ bool dcrypt_initialize(const char *backend, const struct dcrypt_settings *set, c memset(&mod_set, 0, sizeof(mod_set)); mod_set.abi_version = DOVECOT_ABI_VERSION; mod_set.require_init_funcs = TRUE; - if (module_dir_try_load_missing(&dcrypt_module, DCRYPT_MODULE_DIR, + if (module_dir_try_load_missing(&dcrypt_module, set->module_dir, implementation, &mod_set, &error) < 0) { if (error_r != NULL) *error_r = error; diff --git a/src/lib-dcrypt/dcrypt.h b/src/lib-dcrypt/dcrypt.h index f150053ca6..676c9711e8 100644 --- a/src/lib-dcrypt/dcrypt.h +++ b/src/lib-dcrypt/dcrypt.h @@ -52,6 +52,8 @@ enum dcrypt_key_kind { struct dcrypt_settings { /* OpenSSL engine to use */ const char *crypto_device; + /* Look for backends in this directory */ + const char *module_dir; }; /**