Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 985017

Summary: p11-kit: TEMP environment variable
Product: Red Hat Enterprise Linux 6 Reporter: Florian Weimer <fweimer>
Component: p11-kitAssignee: Stef Walter <stefw>
Status: CLOSED ERRATA QA Contact: Aleš Mareček <amarecek>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.5CC: amarecek, ksrot, stefw
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: p11-kit-0.18.5-1.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-21 11:39:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 983512    
Attachments:
Description Flags
tools: Use $TMPDIR instead of $TEMP
none
tools: Use $TMPDIR instead of $TEMP none

Description Florian Weimer 2013-07-16 14:56:40 UTC
common/path.c:expand_tempdir() uses TEMP instead of the more standard TMPDIR variable.  It is unclear whether there are any secure uses of $TEMP in configuration settings.

Comment 2 Stef Walter 2013-07-16 15:36:55 UTC
Interesting. I should look back and see why we're expanding those variables. Maybe we can drop $TEMP if it's only used in tests anyway.

Comment 3 Stef Walter 2013-07-17 07:58:07 UTC
Created attachment 774656 [details]
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.

Comment 4 Stef Walter 2013-07-18 09:58:59 UTC
Created attachment 775239 [details]
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.

Comment 5 Stef Walter 2013-07-18 14:04:16 UTC
Pushed to p11-kit git stable branch, released as part of p11-kit 0.18.5. Package built for RHEL 6.5.

Comment 7 Karel Srot 2013-07-30 09:55:38 UTC
Hi Stef,
could you please provide sample code or reproducer that allows us to verify that the TMPDIR setting is properly followed? Thank you.

Comment 8 Stef Walter 2013-07-30 10:01:45 UTC
TMPDIR is only used in test cases, so you would use the built test cases in the 0.18.5 source code to verify. Any test case that contains the function call of test_temp_directory() would be appropriate. So for example.

You can run something like:

$ TMPDIR=/blah libtool --mode=execute strace -e open tools/tests/test-save

And you should get a failure like this:

p11-kit: couldn't create temp directory: /blah/test-extract.aUCiib: No such file or directory
lt-test-save: test.c:262: test_temp_directory: Assertion `0 && "not reached"' failed.
Aborted (core dumped)

Comment 14 errata-xmlrpc 2013-11-21 11:39:47 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2013-1626.html