diff options
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | doc/p11-kit-notes.xml | 4 | ||||
-rw-r--r-- | p11-kit/Makefile.am | 4 | ||||
-rw-r--r-- | p11-kit/conf.c | 8 | ||||
-rw-r--r-- | p11-kit/conf.h | 3 | ||||
-rw-r--r-- | p11-kit/modules.c | 4 | ||||
-rw-r--r-- | p11-kit/p11-kit-1.pc.in | 13 | ||||
-rw-r--r-- | p11-kit/tests/conf-test.c | 4 | ||||
-rw-r--r-- | p11-kit/tests/files/package-modules/four.module (renamed from p11-kit/tests/files/system-modules/four.module) | 0 | ||||
-rw-r--r-- | p11-kit/tests/files/package-modules/win32/four.module (renamed from p11-kit/tests/files/system-modules/win32/four.module) | 0 |
10 files changed, 31 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac index 2593d9a..bad81e1 100644 --- a/configure.ac +++ b/configure.ac @@ -104,6 +104,7 @@ AC_ARG_WITH([module-path], p11_system_config=$system_config_dir p11_system_config_file=$p11_system_config/pkcs11.conf p11_system_config_modules=$p11_system_config/modules +p11_package_config_modules='${pkgdatadir}/modules' p11_user_config="~/.pkcs11" p11_user_config_file="$p11_user_config/pkcs11.conf" p11_user_config_modules="$p11_user_config/modules" @@ -112,6 +113,7 @@ p11_module_path="$module_path" AC_SUBST(p11_system_config) AC_SUBST(p11_system_config_file) AC_SUBST(p11_system_config_modules) +AC_SUBST(p11_package_config_modules) AC_SUBST(p11_user_config) AC_SUBST(p11_user_config_file) AC_SUBST(p11_user_config_modules) @@ -303,6 +305,7 @@ AC_MSG_NOTICE([build options: Strict build: $strict_status System global config: $p11_system_config_file System module config directory: $p11_system_config_modules + Package module config directory: $p11_package_config_modules User global config: $p11_user_config_file User module config directory: $p11_user_config_modules Load relative module paths from: $p11_module_path diff --git a/doc/p11-kit-notes.xml b/doc/p11-kit-notes.xml index e030824..02a3288 100644 --- a/doc/p11-kit-notes.xml +++ b/doc/p11-kit-notes.xml @@ -26,8 +26,8 @@ can be determined by running:</para> <programlisting> -$ <command>pkg-config p11-kit-1 --variable p11_system_config_modules</command> -/etc/pkcs11/modules</programlisting> +$ <command>pkg-config p11-kit-1 --variable p11_module_configs</command> +/usr/share/p11-kit/modules</programlisting> </section> <section id="notes-paths-modules"> diff --git a/p11-kit/Makefile.am b/p11-kit/Makefile.am index 2257530..fd0b90a 100644 --- a/p11-kit/Makefile.am +++ b/p11-kit/Makefile.am @@ -36,6 +36,7 @@ lib_LTLIBRARIES = \ libp11_kit_la_CFLAGS = \ -DP11_SYSTEM_CONFIG_FILE=\""$(p11_system_config_file)"\" \ -DP11_SYSTEM_CONFIG_MODULES=\""$(p11_system_config_modules)"\" \ + -DP11_PACKAGE_CONFIG_MODULES=\""$(p11_package_config_modules)"\" \ -DP11_USER_CONFIG_FILE=\""$(p11_user_config_file)"\" \ -DP11_USER_CONFIG_MODULES=\""$(p11_user_config_modules)"\" \ -DP11_MODULE_PATH=\""$(p11_module_path)"\" \ @@ -66,6 +67,7 @@ if OS_WIN32 libp11_kit_testable_la_CFLAGS = \ -DP11_SYSTEM_CONFIG_FILE=\""$(abs_top_srcdir)/p11-kit/tests/files/system-pkcs11.conf"\" \ -DP11_SYSTEM_CONFIG_MODULES=\""$(abs_top_srcdir)/p11-kit/tests/files/system-modules/win32"\" \ + -DP11_PACKAGE_CONFIG_MODULES=\""$(abs_top_srcdir)/p11-kit/tests/files/package-modules/win32"\" \ -DP11_USER_CONFIG_FILE=\""$(abs_top_srcdir)/p11-kit/tests/files/user-pkcs11.conf"\" \ -DP11_USER_CONFIG_MODULES=\""$(abs_top_srcdir)/p11-kit/tests/files/user-modules/win32"\" \ -DP11_MODULE_PATH=\""$(abs_top_builddir)/p11-kit/tests/.libs"\" \ @@ -76,6 +78,7 @@ else libp11_kit_testable_la_CFLAGS = \ -DP11_SYSTEM_CONFIG_FILE=\""$(abs_top_srcdir)/p11-kit/tests/files/system-pkcs11.conf"\" \ -DP11_SYSTEM_CONFIG_MODULES=\""$(abs_top_srcdir)/p11-kit/tests/files/system-modules"\" \ + -DP11_PACKAGE_CONFIG_MODULES=\""$(abs_top_srcdir)/p11-kit/tests/files/package-modules"\" \ -DP11_USER_CONFIG_FILE=\""$(abs_top_srcdir)/p11-kit/tests/files/user-pkcs11.conf"\" \ -DP11_USER_CONFIG_MODULES=\""$(abs_top_srcdir)/p11-kit/tests/files/user-modules"\" \ -DP11_MODULE_PATH=\""$(abs_top_builddir)/p11-kit/tests/.libs"\" \ @@ -96,3 +99,4 @@ EXTRA_DIST = \ # Proxy module is actually same as library, so install a link install-exec-hook: $(LN_S) -f `readlink $(DESTDIR)$(libdir)/libp11-kit.so` $(DESTDIR)$(libdir)/p11-kit-proxy.so + $(MKDIR_P) $(p11_package_config_modules) diff --git a/p11-kit/conf.c b/p11-kit/conf.c index 45b1404..68b6343 100644 --- a/p11-kit/conf.c +++ b/p11-kit/conf.c @@ -633,7 +633,10 @@ load_configs_from_directory (const char *directory, } p11_dict * -_p11_conf_load_modules (int mode, const char *system_dir, const char *user_dir) +_p11_conf_load_modules (int mode, + const char *package_dir, + const char *system_dir, + const char *user_dir) { p11_dict *configs; char *path; @@ -667,7 +670,8 @@ _p11_conf_load_modules (int mode, const char *system_dir, const char *user_dir) */ if (mode != CONF_USER_ONLY) { flags = CONF_IGNORE_MISSING; - if (!load_configs_from_directory (system_dir, configs, flags)) { + if (!load_configs_from_directory (system_dir, configs, flags) || + !load_configs_from_directory (package_dir, configs, flags)) { error = errno; p11_dict_free (configs); errno = error; diff --git a/p11-kit/conf.h b/p11-kit/conf.h index 3895b0c..c4d7ae2 100644 --- a/p11-kit/conf.h +++ b/p11-kit/conf.h @@ -63,7 +63,8 @@ p11_dict * _p11_conf_load_globals (const char *system_conf, int *user_mode); /* Returns a hash of char* name -> hash_t *config */ -p11_dict * _p11_conf_load_modules (int user_mode, +p11_dict * _p11_conf_load_modules (int user_mode, + const char *package_dir, const char *system_dir, const char *user_dir); diff --git a/p11-kit/modules.c b/p11-kit/modules.c index 292bf28..62ecbe7 100644 --- a/p11-kit/modules.c +++ b/p11-kit/modules.c @@ -487,7 +487,9 @@ load_registered_modules_unlocked (void) assert (mode != CONF_USER_INVALID); - configs = _p11_conf_load_modules (mode, P11_SYSTEM_CONFIG_MODULES, + configs = _p11_conf_load_modules (mode, + P11_PACKAGE_CONFIG_MODULES, + P11_SYSTEM_CONFIG_MODULES, P11_USER_CONFIG_MODULES); if (configs == NULL) { rv = CKR_GENERAL_ERROR; diff --git a/p11-kit/p11-kit-1.pc.in b/p11-kit/p11-kit-1.pc.in index 7180497..d0d378d 100644 --- a/p11-kit/p11-kit-1.pc.in +++ b/p11-kit/p11-kit-1.pc.in @@ -4,16 +4,17 @@ libdir=@libdir@ includedir=@includedir@ datarootdir=@datarootdir@ datadir=@datadir@ +pkgdatadir=@datadir@/p11-kit sysconfdir=@sysconfdir@ -p11_system_config=@p11_system_config@ -p11_system_config_file=@p11_system_config_file@ -p11_system_config_modules=@p11_system_config_modules@ -p11_user_config=@p11_user_config@ -p11_user_config_file=@p11_user_config_file@ -p11_user_config_modules=@p11_user_config_modules@ +p11_module_configs=@p11_package_config_modules@ p11_module_path=@p11_module_path@ proxy_module=@libdir@/p11-kit-proxy.so +# This is for compatibility. Other packages were using this to determine +# the directory they should install their module configs to, so override +# this and redirect them to the new location +p11_system_config_modules=@p11_package_config_modules@ + Name: p11-kit Description: Library and proxy module for properly loading and sharing PKCS#11 modules. Version: @VERSION@ diff --git a/p11-kit/tests/conf-test.c b/p11-kit/tests/conf-test.c index 704313d..eccad29 100644 --- a/p11-kit/tests/conf-test.c +++ b/p11-kit/tests/conf-test.c @@ -263,6 +263,7 @@ test_load_modules_merge (CuTest *tc) p11_message_clear (); configs = _p11_conf_load_modules (CONF_USER_MERGE, + SRCDIR "/files/package-modules", SRCDIR "/files/system-modules", SRCDIR "/files/user-modules"); CuAssertPtrNotNull (tc, configs); @@ -295,6 +296,7 @@ test_load_modules_user_none (CuTest *tc) p11_message_clear (); configs = _p11_conf_load_modules (CONF_USER_NONE, + SRCDIR "/files/package-modules", SRCDIR "/files/system-modules", SRCDIR "/files/user-modules"); CuAssertPtrNotNull (tc, configs); @@ -325,6 +327,7 @@ test_load_modules_user_only (CuTest *tc) p11_message_clear (); configs = _p11_conf_load_modules (CONF_USER_ONLY, + SRCDIR "/files/package-modules", SRCDIR "/files/system-modules", SRCDIR "/files/user-modules"); CuAssertPtrNotNull (tc, configs); @@ -355,6 +358,7 @@ test_load_modules_no_user (CuTest *tc) p11_message_clear (); configs = _p11_conf_load_modules (CONF_USER_MERGE, + SRCDIR "/files/package-modules", SRCDIR "/files/system-modules", SRCDIR "/files/non-existant"); CuAssertPtrNotNull (tc, configs); diff --git a/p11-kit/tests/files/system-modules/four.module b/p11-kit/tests/files/package-modules/four.module index 6eace3c..6eace3c 100644 --- a/p11-kit/tests/files/system-modules/four.module +++ b/p11-kit/tests/files/package-modules/four.module diff --git a/p11-kit/tests/files/system-modules/win32/four.module b/p11-kit/tests/files/package-modules/win32/four.module index 7fd1540..7fd1540 100644 --- a/p11-kit/tests/files/system-modules/win32/four.module +++ b/p11-kit/tests/files/package-modules/win32/four.module |