]> granicus.if.org Git - p11-kit/commitdiff
p11-kit: P11_KIT_PRIVATEDIR env var overrides private binary dir
authorStef Walter <stefw@redhat.com>
Thu, 2 Oct 2014 06:23:18 +0000 (08:23 +0200)
committerStef Walter <stefw@redhat.com>
Thu, 2 Oct 2014 06:24:44 +0000 (08:24 +0200)
External binaries are searched for in $(libdir)/p11-kit. The
P11_KIT_PRIVATEDIR can be used to override that, for example during
'make check'

p11-kit/p11-kit.c
p11-kit/test-transport.c

index f447b4cefede271c76487760fd0074a2d1e8cbcf..f64359ec5161ba5901d15075b472e602cc302c54 100644 (file)
@@ -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;
index 5fde436448f85e14c6bc53a870103e50fda47b89..397a65a90e33fd036795ba36a42ba29b4cb855c0 100644 (file)
@@ -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));