From c02f05a103e36cfc902bcdd49aa22332760a2ae4 Mon Sep 17 00:00:00 2001 From: Joe Cai Date: Fri, 27 Sep 2013 17:55:23 +0800 Subject: [PATCH 1/2] Fix #61094 Wrong WSDL cache file name WSDL cache files are created with the format wsdl-owner_username-uri_md5sum and with permission 0600. This will result in an error when two or more users are trying to run the same script that uses the same wsdl: only the first user can access to the wsdl cache file, while a second user will encounter a SOAP-ERROR complaining about not being about to load the WSDL. The bug was introduced in commit 1a9e668a04 which was supposed to use getuid() instead of php_get_current_user() in the cache filename. --- ext/soap/php_sdl.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c index 0ac4c2ed7a9bf..2eaf52acca82e 100644 --- a/ext/soap/php_sdl.c +++ b/ext/soap/php_sdl.c @@ -30,6 +30,10 @@ #include #include +#ifdef HAVE_UNISTD_H +#include +#endif + #ifndef O_BINARY # define O_BINARY 0 #endif @@ -3228,7 +3232,12 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, long cache_wsdl TSRMLS_DC) unsigned char digest[16]; int len = strlen(SOAP_GLOBAL(cache_dir)); time_t cached; +#ifdef HAVE_UNISTD_H + char user[10]; /* storage for a 32-bit UID */ + snprintf(user, 10, "%d", getuid()); +#else char *user = php_get_current_user(TSRMLS_C); +#endif int user_len = user ? strlen(user) + 1 : 0; md5str[0] = '\0'; From fd79a501c8bac88b922f24f3272d6c59c0c7138c Mon Sep 17 00:00:00 2001 From: Joe Cai Date: Tue, 8 Oct 2013 18:09:36 +0800 Subject: [PATCH 2/2] Removed the php_get_current_user() call under win32 from ext/soap/php_sdl.c --- ext/soap/php_sdl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c index 2eaf52acca82e..41dd43121b815 100644 --- a/ext/soap/php_sdl.c +++ b/ext/soap/php_sdl.c @@ -29,6 +29,7 @@ #include #include #include +#include #ifdef HAVE_UNISTD_H #include @@ -3236,7 +3237,7 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, long cache_wsdl TSRMLS_DC) char user[10]; /* storage for a 32-bit UID */ snprintf(user, 10, "%d", getuid()); #else - char *user = php_get_current_user(TSRMLS_C); + char *user = getenv("USERNAME"); #endif int user_len = user ? strlen(user) + 1 : 0;