diff options
author | Stef Walter <stefw@redhat.com> | 2014-10-02 08:23:18 +0200 |
---|---|---|
committer | Stef Walter <stefw@redhat.com> | 2014-10-02 08:24:44 +0200 |
commit | 76f230ced6e9ca2a598988bc00b7b971208e8f64 (patch) | |
tree | 571570603a81c1cb7af52652e8400b20d34105e9 | |
parent | 960cb9a7db1950ad1414f70b0e3ec240542601ac (diff) |
p11-kit: P11_KIT_PRIVATEDIR env var overrides private binary dir
External binaries are searched for in $(libdir)/p11-kit. The
P11_KIT_PRIVATEDIR can be used to override that, for example during
'make check'
-rw-r--r-- | p11-kit/p11-kit.c | 7 | ||||
-rw-r--r-- | p11-kit/test-transport.c | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/p11-kit/p11-kit.c b/p11-kit/p11-kit.c index f447b4c..f64359e 100644 --- a/p11-kit/p11-kit.c +++ b/p11-kit/p11-kit.c @@ -97,6 +97,7 @@ int p11_kit_external (int argc, char *argv[]) { + const char *private_dir; char *filename; char *path; @@ -111,8 +112,12 @@ p11_kit_external (int argc, if (asprintf (&filename, "p11-kit-%s", argv[0]) < 0) return_val_if_reached (1); + private_dir = secure_getenv ("P11_KIT_PRIVATEDIR"); + if (!private_dir || !private_dir[0]) + private_dir = PRIVATEDIR; + /* Add our libexec directory to the path */ - path = p11_path_build (PRIVATEDIR, filename, NULL); + path = p11_path_build (private_dir, filename, NULL); return_val_if_fail (path != NULL, 1); argv[argc] = NULL; diff --git a/p11-kit/test-transport.c b/p11-kit/test-transport.c index 5fde436..397a65a 100644 --- a/p11-kit/test-transport.c +++ b/p11-kit/test-transport.c @@ -74,6 +74,7 @@ setup_remote (void *unused) test.user_config = p11_path_build (test.directory, "pkcs11.conf", NULL); p11_test_file_write (NULL, test.user_config, data, strlen (data)); + setenv ("P11_KIT_PRIVATEDIR", BUILDDIR, 1); data = "remote: |" BUILDDIR "/p11-kit/p11-kit remote " BUILDDIR "/.libs/mock-two.so\n"; p11_test_file_write (test.user_modules, "remote.module", data, strlen (data)); |