iliaa Tue Jan 9 23:27:22 2007 UTC Modified files: (Branch: PHP_5_2) /php-src configure.in NEWS /php-src/main safe_mode.c Log: Fixed bug #40079 (php_get_current_user() not thread safe). # Original patch from wharmby at uk dot ibm dot com http://cvs.php.net/viewvc.cgi/php-src/configure.in?r1=1.579.2.52.2.35&r2=1.579.2.52.2.36&diff_format=u Index: php-src/configure.in diff -u php-src/configure.in:1.579.2.52.2.35 php-src/configure.in:1.579.2.52.2.36 --- php-src/configure.in:1.579.2.52.2.35 Thu Jan 4 23:55:56 2007 +++ php-src/configure.in Tue Jan 9 23:27:21 2007 @@ -1,4 +1,4 @@ - ## $Id: configure.in,v 1.579.2.52.2.35 2007/01/04 23:55:56 iliaa Exp $ -*- autoconf -*- + ## $Id: configure.in,v 1.579.2.52.2.36 2007/01/09 23:27:21 iliaa Exp $ -*- autoconf -*- dnl ## Process this file with autoconf to produce a configure script. divert(1) @@ -483,6 +483,7 @@ gmtime_r \ getpwnam_r \ getgrnam_r \ +getpwuid_r \ grantpt \ inet_ntoa \ inet_ntop \ http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.484&r2=1.2027.2.547.2.485&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.484 php-src/NEWS:1.2027.2.547.2.485 --- php-src/NEWS:1.2027.2.547.2.484 Tue Jan 9 23:13:05 2007 +++ php-src/NEWS Tue Jan 9 23:27:22 2007 @@ -4,6 +4,8 @@ - Added CURLOPT_TCP_NODELAY constant to Curl extension. (Sara) - Improved proc_open(). Now on Windows it can run external commands not through CMD.EXE. (Dmitry) +- Fixed bug #40079 (php_get_current_user() not thread safe). (Ilia, wharmby + at uk dot ibm dot com) - Fixed bug #40076 (zend_alloc.c: Value of enumeration constant must be in range of signed integer). (Dmitry) - Fixed bug #40073 (exif_read_data dies on certain images). (Tony, Marcus) http://cvs.php.net/viewvc.cgi/php-src/main/safe_mode.c?r1=1.62.2.1.2.5&r2=1.62.2.1.2.6&diff_format=u Index: php-src/main/safe_mode.c diff -u php-src/main/safe_mode.c:1.62.2.1.2.5 php-src/main/safe_mode.c:1.62.2.1.2.6 --- php-src/main/safe_mode.c:1.62.2.1.2.5 Mon Jan 1 09:36:11 2007 +++ php-src/main/safe_mode.c Tue Jan 9 23:27:22 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: safe_mode.c,v 1.62.2.1.2.5 2007/01/01 09:36:11 sebastian Exp $ */ +/* $Id: safe_mode.c,v 1.62.2.1.2.6 2007/01/09 23:27:22 iliaa Exp $ */ #include "php.h" @@ -228,12 +228,27 @@ return SG(request_info).current_user; #else struct passwd *pwd; +#ifdef HAVE_GETPWUID_R + struct passwd _pw; + struct passwd *retpwptr = NULL; + int pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX); + char *pwbuf = emalloc(pwbuflen); + if (getpwuid_r(pstat->st_uid, &_pw, pwbuf, pwbuflen, &retpwptr) != 0) { + efree(pwbuf); + return ""; + } + pwd = &_pw; +#else if ((pwd=getpwuid(pstat->st_uid))==NULL) { return ""; } +#endif SG(request_info).current_user_length = strlen(pwd->pw_name); SG(request_info).current_user = estrndup(pwd->pw_name, SG(request_info).current_user_length); +#ifdef HAVE_GETPWUID_R + efree(pwbuf); +#endif return SG(request_info).current_user; #endif }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php