diff options
author | Stef Walter <stefw@gnome.org> | 2013-01-29 12:53:29 +0100 |
---|---|---|
committer | Stef Walter <stefw@gnome.org> | 2013-02-05 09:42:34 +0100 |
commit | 85751aa21dd9b93d8eb51e36767b5564ce6ce005 (patch) | |
tree | b84960ea526b426fc002643d5eb48809289853f4 /p11-kit | |
parent | a9790a21302f47016a88ba9a2c904bed11efb388 (diff) |
Add a /usr/share/p11-kit/modules directory for package module configs
* Try to make /etc/pkcs11/modules for administrator use
* Override the old pkg-config variables to help packages start
using the new location
Diffstat (limited to 'p11-kit')
-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 |
8 files changed, 26 insertions, 10 deletions
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 |