diff options
author | Stef Walter <stef@thewalter.net> | 2013-07-17 09:51:32 +0200 |
---|---|---|
committer | Stef Walter <stef@thewalter.net> | 2013-07-18 08:13:20 +0200 |
commit | 81a6e16539e5e4a27c55194ae095cc4a75d08ade (patch) | |
tree | 70e409e938e60c326f95d85ac059efb58f48286a /trust | |
parent | eb8f5859b1349f8147ba47a1da8032df192f2370 (diff) |
tools: Use $TMPDIR instead of $TEMP
TMPDIR is a more standard environment variable for locating the
temp directory on Unix. In addition since this is only used in
tests, remove the code from the generic p11_path_expand() func.
In general remove the possibility for forks to put $HOME or $TEMP
environment variables in configured paths. This was possible
due to code in p11_path_expand() but not something we supported.
https://bugzilla.redhat.com/show_bug.cgi?id=985017
Diffstat (limited to 'trust')
-rw-r--r-- | trust/tests/test-bundle.c | 4 | ||||
-rw-r--r-- | trust/tests/test-cer.c | 4 | ||||
-rw-r--r-- | trust/tests/test-module.c | 4 | ||||
-rw-r--r-- | trust/tests/test-openssl.c | 4 | ||||
-rw-r--r-- | trust/tests/test-save.c | 4 | ||||
-rw-r--r-- | trust/tests/test-token.c | 9 | ||||
-rw-r--r-- | trust/tests/test-trust.c | 6 |
7 files changed, 13 insertions, 22 deletions
diff --git a/trust/tests/test-bundle.c b/trust/tests/test-bundle.c index 10f89d2..397787f 100644 --- a/trust/tests/test-bundle.c +++ b/trust/tests/test-bundle.c @@ -78,9 +78,7 @@ setup (void *unused) p11_extract_info_init (&test.ex); - test.directory = p11_path_expand ("$TEMP/test-extract.XXXXXX"); - if (!mkdtemp (test.directory)) - assert_not_reached (); + test.directory = p11_test_directory ("test-extract"); } static void diff --git a/trust/tests/test-cer.c b/trust/tests/test-cer.c index fc4d007..846cabf 100644 --- a/trust/tests/test-cer.c +++ b/trust/tests/test-cer.c @@ -78,9 +78,7 @@ setup (void *unused) p11_extract_info_init (&test.ex); - test.directory = p11_path_expand ("$TEMP/test-extract.XXXXXX"); - if (!mkdtemp (test.directory)) - assert_fail ("mkdtemp() failed", test.directory); + test.directory = p11_test_directory ("test-extract"); } static void diff --git a/trust/tests/test-module.c b/trust/tests/test-module.c index 80747da..5920076 100644 --- a/trust/tests/test-module.c +++ b/trust/tests/test-module.c @@ -138,9 +138,7 @@ setup_writable (void *unused) rv = C_GetFunctionList (&test.module); assert (rv == CKR_OK); - test.directory = p11_path_expand ("$TEMP/test-module.XXXXXX"); - if (!mkdtemp (test.directory)) - assert_not_reached (); + test.directory = p11_test_directory ("test-module"); memset (&args, 0, sizeof (args)); if (asprintf (&arguments, "paths='%s'", test.directory) < 0) diff --git a/trust/tests/test-openssl.c b/trust/tests/test-openssl.c index 1396102..f31a41a 100644 --- a/trust/tests/test-openssl.c +++ b/trust/tests/test-openssl.c @@ -81,9 +81,7 @@ setup (void *unused) p11_extract_info_init (&test.ex); - test.directory = p11_path_expand ("$TEMP/test-extract.XXXXXX"); - if (!mkdtemp (test.directory)) - assert_not_reached (); + test.directory = p11_test_directory ("test-extract"); } static void diff --git a/trust/tests/test-save.c b/trust/tests/test-save.c index eba5632..be16141 100644 --- a/trust/tests/test-save.c +++ b/trust/tests/test-save.c @@ -63,9 +63,7 @@ struct { static void setup (void *unused) { - test.directory = p11_path_expand ("$TEMP/test-extract.XXXXXX"); - if (!mkdtemp (test.directory)) - assert_fail ("mkdtemp() failed", strerror (errno)); + test.directory = p11_test_directory ("test-extract"); } static void diff --git a/trust/tests/test-token.c b/trust/tests/test-token.c index 6b998ca..3b7d701 100644 --- a/trust/tests/test-token.c +++ b/trust/tests/test-token.c @@ -76,10 +76,7 @@ setup (void *path) static void setup_temp (void *unused) { - test.directory = p11_path_expand ("$TEMP/test-module.XXXXXX"); - if (!mkdtemp (test.directory)) - assert_not_reached (); - + test.directory = p11_test_directory ("test-module"); setup (test.directory); } @@ -268,9 +265,7 @@ test_writable_no_exist (void) p11_token *token; char *path; - directory = p11_path_expand ("$TEMP/test-module.XXXXXX"); - if (!mkdtemp (directory)) - assert_not_reached (); + directory = p11_test_directory ("test-module"); path = p11_path_build (directory, "subdir", NULL); assert (path != NULL); diff --git a/trust/tests/test-trust.c b/trust/tests/test-trust.c index 205a08a..8c69107 100644 --- a/trust/tests/test-trust.c +++ b/trust/tests/test-trust.c @@ -36,6 +36,8 @@ #include "attrs.h" #include "debug.h" +#include "message.h" +#include "path.h" #include "test.h" #include "test-trust.h" @@ -52,6 +54,10 @@ #include <string.h> #include <unistd.h> +#ifdef OS_UNIX +#include <paths.h> +#endif + void test_check_object_msg (const char *file, int line, |