From 81a6e16539e5e4a27c55194ae095cc4a75d08ade Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Wed, 17 Jul 2013 09:51:32 +0200 Subject: 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 --- common/tests/test-path.c | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) (limited to 'common/tests') diff --git a/common/tests/test-path.c b/common/tests/test-path.c index 1f85dbb..0077cd0 100644 --- a/common/tests/test-path.c +++ b/common/tests/test-path.c @@ -114,50 +114,21 @@ test_expand (void) #ifdef OS_UNIX putenv ("HOME=/home/blah"); check_equals_and_free ("/home/blah/my/path", - p11_path_expand ("$HOME/my/path")); - check_equals_and_free ("/home/blah/my/path", p11_path_expand ("~/my/path")); check_equals_and_free ("/home/blah", - p11_path_expand ("$HOME")); - check_equals_and_free ("/home/blah", p11_path_expand ("~")); - putenv ("TEMP=/tmpdir"); - check_equals_and_free ("/tmpdir/my/path", - p11_path_expand ("$TEMP/my/path")); - check_equals_and_free ("/tmpdir", - p11_path_expand ("$TEMP")); #else /* OS_WIN32 */ putenv ("HOME=C:\\Users\\blah"); check_equals_and_free ("C:\\Users\\blah\\path", - p11_path_expand ("$HOME/path")); - check_equals_and_free ("C:\\Users\\blah\\path", - p11_path_expand ("$HOME\\path")); - check_equals_and_free ("C:\\Users\\blah\\path", - p11_path_expand ("~/path")); + p11_path_expand ("~/my/path")); check_equals_and_free ("C:\\Users\\blah\\path", p11_path_expand ("~\\path")); - - putenv ("TEMP=C:\\Temp Directory"); - check_equals_and_free ("C:\\Temp Directory\\path", - p11_path_expand ("$TEMP/path")); - check_equals_and_free ("C:\\Temp Directory\\path", - p11_path_expand ("$TEMP\\path")); #endif putenv("HOME="); - path = p11_path_expand ("$HOME/this/is/my/path"); - assert (strstr (path, "this/is/my/path") != NULL); - free (path); - - putenv("HOME="); path = p11_path_expand ("~/this/is/my/path"); assert (strstr (path, "this/is/my/path") != NULL); free (path); - - putenv("TEMP="); - path = p11_path_expand ("$TEMP/this/is/my/path"); - assert (strstr (path, "this/is/my/path") != NULL); - free (path); } static void -- cgit v1.1