mirror of
https://github.com/php/php-src.git
synced 2026-03-24 08:12:21 +01:00
Fix GH-12838: [SOAP] Temporary WSDL cache files not being deleted
If there are two users that can execute the script that caches a WSDL, but the script is owned by a single user, then the caching code will name the cached file with the file owner username and a hash of the uri. When one of the two tries to rename the file created by the other process, this does not work because it has no permission to do so. This then leaves temporary files floating in the temp directory. To fix the immediate problem, unlink the file after rename has failed. On the long term, this has to be fixed by taking the username of the process instead of the username of the file owner. Closes GH-12841.
This commit is contained in:
4
NEWS
4
NEWS
@@ -56,6 +56,10 @@ PHP NEWS
|
||||
- PHPDBG:
|
||||
. Fixed bug GH-12675 (MEMORY_LEAK in phpdbg_prompt.c). (nielsdos)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug GH-12838 ([SOAP] Temporary WSDL cache files not being deleted).
|
||||
(nielsdos)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug GH-12721 (SplFileInfo::getFilename() segfault in combination
|
||||
with GlobIterator and no directory separator). (nielsdos)
|
||||
|
||||
@@ -2381,7 +2381,9 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s
|
||||
/* Make sure that incomplete files (e.g. due to disk space issues, see bug #66150) are not utilised. */
|
||||
if (valid_file) {
|
||||
/* This is allowed to fail, this means that another process was raced to create the file. */
|
||||
(void) VCWD_RENAME(ZSTR_VAL(temp_file_path), fn);
|
||||
if (VCWD_RENAME(ZSTR_VAL(temp_file_path), fn) < 0) {
|
||||
VCWD_UNLINK(ZSTR_VAL(temp_file_path));
|
||||
}
|
||||
}
|
||||
|
||||
smart_str_free(&buf);
|
||||
|
||||
Reference in New Issue
Block a user