]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-dcrypt: Add module_dir setting
authorAki Tuomi <aki.tuomi@dovecot.fi>
Fri, 25 Nov 2016 07:48:43 +0000 (09:48 +0200)
committerGitLab <gitlab@git.dovecot.net>
Mon, 28 Nov 2016 09:10:13 +0000 (11:10 +0200)
This is needed for unit tests that require
dcrypt, so that they can load backend
without installing it first.

src/lib-dcrypt/dcrypt.c
src/lib-dcrypt/dcrypt.h

index 7dc983c85ed680bd36975e3c611b7a94d3753d7a..148b8026a4e80e5a445b43622daef5c0456d3b3a 100644 (file)
@@ -7,7 +7,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)
 {
@@ -26,7 +28,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;
index f150053ca636a383a26e0628877492e680e79e9f..676c9711e8cf5b0d2b8dcc8b4b80029a05d38584 100644 (file)
@@ -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;
 };
 
 /**