cvs: php-src(PHP_5_2) /main config.w32.h fopen_wrappers.c php.h safe_mode.c /win32 glob.c globals.c php5dll.dsp php5dllts.dsp php_win32_globals.h
pwd.c pwd.h /win32/build config.w32 config.w32.h.in
| From: | Dmitry Stogov | Date: | Fri, 10 Nov 2006 09:56:17 +0000 |
| Subject: | cvs: php-src(PHP_5_2) /main config.w32.h fopen_wrappers.c php.h safe_mode.c /win32 glob.c globals.c php5dll.dsp php5dllts.dsp php_win32_globals.h pwd.c pwd.h /win32/build config.w32 config.w32.h.in |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-41431@lists.php.net to get a copy of this message | ||
dmitry Fri Nov 10 09:56:17 2006 UTC
Removed files: (Branch: PHP_5_2)
/php-src/win32 pwd.c pwd.h
Modified files:
/php-src/win32 glob.c globals.c php5dll.dsp php5dllts.dsp
php_win32_globals.h
/php-src/win32/build config.w32 config.w32.h.in
/php-src/main config.w32.h fopen_wrappers.c php.h safe_mode.c
Log:
Simplify the code base as this getpwd() was used only once
http://cvs.php.net/viewvc.cgi/php-src/win32/glob.c?r1=1.6&r2=1.6.6.1&diff_format=u Index: php-src/win32/glob.c diff -u php-src/win32/glob.c:1.6 php-src/win32/glob.c:1.6.6.1 --- php-src/win32/glob.c:1.6 Sat Sep 20 03:22:36 2003 +++ php-src/win32/glob.c Fri Nov 10 09:56:16 2006 @@ -34,7 +34,7 @@ * SUCH DAMAGE. */ -/* $Id: glob.c,v 1.6 2003/09/20 03:22:36 sniper Exp $ */ +/* $Id: glob.c,v 1.6.6.1 2006/11/10 09:56:16 dmitry Exp $ */ /* * glob(3) -- a superset of the one defined in POSIX 1003.2. @@ -81,8 +81,6 @@ #include <dirent.h> #include <pwd.h> #include <unistd.h> -#else -#include "win32/pwd.h" #endif #include <errno.h> #include "glob.h" @@ -359,7 +357,9 @@ size_t patbuf_len; glob_t *pglob; { +#ifndef PHP_WIN32 struct passwd *pwd; +#endif char *h; const Char *p; Char *b, *eb; @@ -399,10 +399,14 @@ /* * Expand a ~user */ +#ifndef PHP_WIN32 if ((pwd = getpwnam((char*) patbuf)) == NULL) return pattern; else h = pwd->pw_dir; +#else + return pattern; +#endif } /* Copy the home directory */ http://cvs.php.net/viewvc.cgi/php-src/win32/globals.c?r1=1.5.2.1&r2=1.5.2.1.2.1&diff_format=u Index: php-src/win32/globals.c diff -u php-src/win32/globals.c:1.5.2.1 php-src/win32/globals.c:1.5.2.1.2.1 --- php-src/win32/globals.c:1.5.2.1 Sun Jan 1 12:50:19 2006 +++ php-src/win32/globals.c Fri Nov 10 09:56:16 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: globals.c,v 1.5.2.1 2006/01/01 12:50:19 sniper Exp $ */ +/* $Id: globals.c,v 1.5.2.1.2.1 2006/11/10 09:56:16 dmitry Exp $ */ #include "php.h" #include "php_win32_globals.h" @@ -43,8 +43,6 @@ #endif ; - STR_FREE(wg->login_name); - memset(wg, 0, sizeof(*wg)); return SUCCESS; } http://cvs.php.net/viewvc.cgi/php-src/win32/php5dll.dsp?r1=1.3&r2=1.3.4.1&diff_format=u Index: php-src/win32/php5dll.dsp diff -u php-src/win32/php5dll.dsp:1.3 php-src/win32/php5dll.dsp:1.3.4.1 --- php-src/win32/php5dll.dsp:1.3 Sun Jun 19 22:15:27 2005 +++ php-src/win32/php5dll.dsp Fri Nov 10 09:56:16 2006 @@ -1552,10 +1552,6 @@ # End Source File # Begin Source File -SOURCE=..\win32\pwd.c -# End Source File -# Begin Source File - SOURCE=..\win32\readdir.c # End Source File # Begin Source File @@ -1628,10 +1624,6 @@ # End Source File # Begin Source File -SOURCE=..\win32\pwd.h -# End Source File -# Begin Source File - SOURCE=..\win32\readdir.h # End Source File # Begin Source File http://cvs.php.net/viewvc.cgi/php-src/win32/php5dllts.dsp?r1=1.6.4.2&r2=1.6.4.3&diff_format=u Index: php-src/win32/php5dllts.dsp diff -u php-src/win32/php5dllts.dsp:1.6.4.2 php-src/win32/php5dllts.dsp:1.6.4.3 --- php-src/win32/php5dllts.dsp:1.6.4.2 Wed Sep 13 17:33:24 2006 +++ php-src/win32/php5dllts.dsp Fri Nov 10 09:56:16 2006 @@ -2391,10 +2391,6 @@ # End Source File # Begin Source File -SOURCE=..\win32\pwd.c -# End Source File -# Begin Source File - SOURCE=..\win32\readdir.c # End Source File # Begin Source File @@ -2480,10 +2476,6 @@ # End Source File # Begin Source File -SOURCE=..\win32\pwd.h -# End Source File -# Begin Source File - SOURCE=..\win32\readdir.h # End Source File # Begin Source File http://cvs.php.net/viewvc.cgi/php-src/win32/php_win32_globals.h?r1=1.4.2.1&r2=1.4.2.1.2.1&diff_format=u Index: php-src/win32/php_win32_globals.h diff -u php-src/win32/php_win32_globals.h:1.4.2.1 php-src/win32/php_win32_globals.h:1.4.2.1.2.1 --- php-src/win32/php_win32_globals.h:1.4.2.1 Sun Jan 1 12:50:19 2006 +++ php-src/win32/php_win32_globals.h Fri Nov 10 09:56:16 2006 @@ -16,15 +16,13 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_win32_globals.h,v 1.4.2.1 2006/01/01 12:50:19 sniper Exp $ */ +/* $Id: php_win32_globals.h,v 1.4.2.1.2.1 2006/11/10 09:56:16 dmitry Exp $ */ #ifndef PHP_WIN32_GLOBALS_H #define PHP_WIN32_GLOBALS_H /* misc globals for thread-safety under win32 */ -#include "pwd.h" - typedef struct _php_win32_core_globals php_win32_core_globals; #ifdef ZTS @@ -40,12 +38,6 @@ char *log_header; HANDLE log_source; - /* getpwuid */ - struct passwd pwd; - - /* getlogin */ - char *login_name; - /* time */ struct timeval starttime; __int64 lasttime, freq; http://cvs.php.net/viewvc.cgi/php-src/win32/build/config.w32?r1=1.40.2.8.2.1&r2=1.40.2.8.2.2&diff_format=u Index: php-src/win32/build/config.w32 diff -u php-src/win32/build/config.w32:1.40.2.8.2.1 php-src/win32/build/config.w32:1.40.2.8.2.2 --- php-src/win32/build/config.w32:1.40.2.8.2.1 Tue Jul 18 09:06:33 2006 +++ php-src/win32/build/config.w32 Fri Nov 10 09:56:16 2006 @@ -1,5 +1,5 @@ // vim:ft=javascript -// $Id: config.w32,v 1.40.2.8.2.1 2006/07/18 09:06:33 dmitry Exp $ +// $Id: config.w32,v 1.40.2.8.2.2 2006/11/10 09:56:16 dmitry Exp $ // "Master" config file; think of it as a configure.in // equivalent. @@ -264,7 +264,7 @@ ADD_SOURCES("main/streams", "streams.c cast.c memory.c filter.c plain_wrapper.c \ userspace.c transports.c xp_socket.c mmap.c"); -ADD_SOURCES("win32", "crypt_win32.c flock.c glob.c md5crypt.c pwd.c readdir.c \ +ADD_SOURCES("win32", "crypt_win32.c flock.c glob.c md5crypt.c readdir.c \ registry.c select.c sendmail.c time.c wfile.c winutil.c wsyslog.c globals.c"); ADD_SOURCES("regex", "regcomp.c regerror.c regexec.c regfree.c"); http://cvs.php.net/viewvc.cgi/php-src/win32/build/config.w32.h.in?r1=1.7.2.4&r2=1.7.2.4.2.1&diff_format=u Index: php-src/win32/build/config.w32.h.in diff -u php-src/win32/build/config.w32.h.in:1.7.2.4 php-src/win32/build/config.w32.h.in:1.7.2.4.2.1 --- php-src/win32/build/config.w32.h.in:1.7.2.4 Tue Mar 14 14:19:00 2006 +++ php-src/win32/build/config.w32.h.in Fri Nov 10 09:56:16 2006 @@ -1,6 +1,6 @@ /* Build Configuration Template for Win32. - $Id: config.w32.h.in,v 1.7.2.4 2006/03/14 14:19:00 dmitry Exp $ + $Id: config.w32.h.in,v 1.7.2.4.2.1 2006/11/10 09:56:16 dmitry Exp $ */ /* Default PHP / PEAR directories */ @@ -100,7 +100,7 @@ #define HAVE_ASSERT_H 1 #define HAVE_FCNTL_H 1 #define HAVE_GRP_H 0 -#define HAVE_PWD_H 1 +#undef HAVE_PWD_H #define HAVE_STRING_H 1 #undef HAVE_SYS_FILE_H #undef HAVE_SYS_SOCKET_H http://cvs.php.net/viewvc.cgi/php-src/main/config.w32.h?r1=1.85.4.1.2.1&r2=1.85.4.1.2.2&diff_format=u Index: php-src/main/config.w32.h diff -u php-src/main/config.w32.h:1.85.4.1.2.1 php-src/main/config.w32.h:1.85.4.1.2.2 --- php-src/main/config.w32.h:1.85.4.1.2.1 Mon Jun 5 09:00:15 2006 +++ php-src/main/config.w32.h Fri Nov 10 09:56:16 2006 @@ -2,7 +2,7 @@ Build Configuration for Win32. This has only been tested with MS VisualC++ 6 (and later). - $Id: config.w32.h,v 1.85.4.1.2.1 2006/06/05 09:00:15 stas Exp $ + $Id: config.w32.h,v 1.85.4.1.2.2 2006/11/10 09:56:16 dmitry Exp $ */ /* Default PHP / PEAR directories */ @@ -162,7 +162,7 @@ #define HAVE_ASSERT_H 1 #define HAVE_FCNTL_H 1 #define HAVE_GRP_H 0 -#define HAVE_PWD_H 1 +#undef HAVE_PWD_H #define HAVE_STRING_H 1 #undef HAVE_SYS_FILE_H #undef HAVE_SYS_SOCKET_H http://cvs.php.net/viewvc.cgi/php-src/main/fopen_wrappers.c?r1=1.175.2.3.2.1&r2=1.175.2.3.2.2&diff_format=u Index: php-src/main/fopen_wrappers.c diff -u php-src/main/fopen_wrappers.c:1.175.2.3.2.1 php-src/main/fopen_wrappers.c:1.175.2.3.2.2 --- php-src/main/fopen_wrappers.c:1.175.2.3.2.1 Sat Jul 1 11:35:34 2006 +++ php-src/main/fopen_wrappers.c Fri Nov 10 09:56:16 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: fopen_wrappers.c,v 1.175.2.3.2.1 2006/07/01 11:35:34 nlopess Exp $ */ +/* $Id: fopen_wrappers.c,v 1.175.2.3.2.2 2006/11/10 09:56:16 dmitry Exp $ */ /* {{{ includes */ @@ -46,12 +46,8 @@ #include "php_network.h" #if HAVE_PWD_H -#ifdef PHP_WIN32 -#include "win32/pwd.h" -#else #include <pwd.h> #endif -#endif #include <sys/types.h> #if HAVE_SYS_SOCKET_H http://cvs.php.net/viewvc.cgi/php-src/main/php.h?r1=1.221.2.4.2.3&r2=1.221.2.4.2.4&diff_format=u Index: php-src/main/php.h diff -u php-src/main/php.h:1.221.2.4.2.3 php-src/main/php.h:1.221.2.4.2.4 --- php-src/main/php.h:1.221.2.4.2.3 Mon Sep 4 08:18:15 2006 +++ php-src/main/php.h Fri Nov 10 09:56:16 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php.h,v 1.221.2.4.2.3 2006/09/04 08:18:15 dmitry Exp $ */ +/* $Id: php.h,v 1.221.2.4.2.4 2006/11/10 09:56:16 dmitry Exp $ */ #ifndef PHP_H #define PHP_H @@ -199,7 +199,6 @@ #if HAVE_PWD_H # ifdef PHP_WIN32 -#include "win32/pwd.h" #include "win32/param.h" # else #include <pwd.h> http://cvs.php.net/viewvc.cgi/php-src/main/safe_mode.c?r1=1.62.2.1.2.2&r2=1.62.2.1.2.3&diff_format=u Index: php-src/main/safe_mode.c diff -u php-src/main/safe_mode.c:1.62.2.1.2.2 php-src/main/safe_mode.c:1.62.2.1.2.3 --- php-src/main/safe_mode.c:1.62.2.1.2.2 Sat Jul 1 11:35:34 2006 +++ php-src/main/safe_mode.c Fri Nov 10 09:56:16 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: safe_mode.c,v 1.62.2.1.2.2 2006/07/01 11:35:34 nlopess Exp $ */ +/* $Id: safe_mode.c,v 1.62.2.1.2.3 2006/11/10 09:56:16 dmitry Exp $ */ #include "php.h" @@ -197,7 +197,6 @@ PHPAPI char *php_get_current_user() { - struct passwd *pwd; struct stat *pstat; TSRMLS_FETCH(); @@ -213,15 +212,29 @@ if (!pstat) { return ""; - } + } else { +#ifdef PHP_WIN32 + char name[256]; + DWORD len = sizeof(name)-1; + + if (!GetUserName(name, &len)) { + return ""; + } + name[len] = '\0'; + SG(request_info).current_user_length = len; + SG(request_info).current_user = estrndup(name, len); + return SG(request_info).current_user; +#else + struct passwd *pwd; - if ((pwd=getpwuid(pstat->st_uid))==NULL) { - return ""; - } - 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); - - return SG(request_info).current_user; + if ((pwd=getpwuid(pstat->st_uid))==NULL) { + return ""; + } + 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); + return SG(request_info).current_user; +#endif + } } /*
http://cvs.php.net/viewvc.cgi/php-src/win32/glob.c?r1=1.6&r2=1.6.6.1&diff_format=u Index: php-src/win32/glob.c diff -u php-src/win32/glob.c:1.6 php-src/win32/glob.c:1.6.6.1 --- php-src/win32/glob.c:1.6 Sat Sep 20 03:22:36 2003 +++ php-src/win32/glob.c Fri Nov 10 09:56:16 2006 @@ -34,7 +34,7 @@ * SUCH DAMAGE. */ -/* $Id: glob.c,v 1.6 2003/09/20 03:22:36 sniper Exp $ */ +/* $Id: glob.c,v 1.6.6.1 2006/11/10 09:56:16 dmitry Exp $ */ /* * glob(3) -- a superset of the one defined in POSIX 1003.2. @@ -81,8 +81,6 @@ #include <dirent.h> #include <pwd.h> #include <unistd.h> -#else -#include "win32/pwd.h" #endif #include <errno.h> #include "glob.h" @@ -359,7 +357,9 @@ size_t patbuf_len; glob_t *pglob; { +#ifndef PHP_WIN32 struct passwd *pwd; +#endif char *h; const Char *p; Char *b, *eb; @@ -399,10 +399,14 @@ /* * Expand a ~user */ +#ifndef PHP_WIN32 if ((pwd = getpwnam((char*) patbuf)) == NULL) return pattern; else h = pwd->pw_dir; +#else + return pattern; +#endif } /* Copy the home directory */ http://cvs.php.net/viewvc.cgi/php-src/win32/globals.c?r1=1.5.2.1&r2=1.5.2.1.2.1&diff_format=u Index: php-src/win32/globals.c diff -u php-src/win32/globals.c:1.5.2.1 php-src/win32/globals.c:1.5.2.1.2.1 --- php-src/win32/globals.c:1.5.2.1 Sun Jan 1 12:50:19 2006 +++ php-src/win32/globals.c Fri Nov 10 09:56:16 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: globals.c,v 1.5.2.1 2006/01/01 12:50:19 sniper Exp $ */ +/* $Id: globals.c,v 1.5.2.1.2.1 2006/11/10 09:56:16 dmitry Exp $ */ #include "php.h" #include "php_win32_globals.h" @@ -43,8 +43,6 @@ #endif ; - STR_FREE(wg->login_name); - memset(wg, 0, sizeof(*wg)); return SUCCESS; } http://cvs.php.net/viewvc.cgi/php-src/win32/php5dll.dsp?r1=1.3&r2=1.3.4.1&diff_format=u Index: php-src/win32/php5dll.dsp diff -u php-src/win32/php5dll.dsp:1.3 php-src/win32/php5dll.dsp:1.3.4.1 --- php-src/win32/php5dll.dsp:1.3 Sun Jun 19 22:15:27 2005 +++ php-src/win32/php5dll.dsp Fri Nov 10 09:56:16 2006 @@ -1552,10 +1552,6 @@ # End Source File # Begin Source File -SOURCE=..\win32\pwd.c -# End Source File -# Begin Source File - SOURCE=..\win32\readdir.c # End Source File # Begin Source File @@ -1628,10 +1624,6 @@ # End Source File # Begin Source File -SOURCE=..\win32\pwd.h -# End Source File -# Begin Source File - SOURCE=..\win32\readdir.h # End Source File # Begin Source File http://cvs.php.net/viewvc.cgi/php-src/win32/php5dllts.dsp?r1=1.6.4.2&r2=1.6.4.3&diff_format=u Index: php-src/win32/php5dllts.dsp diff -u php-src/win32/php5dllts.dsp:1.6.4.2 php-src/win32/php5dllts.dsp:1.6.4.3 --- php-src/win32/php5dllts.dsp:1.6.4.2 Wed Sep 13 17:33:24 2006 +++ php-src/win32/php5dllts.dsp Fri Nov 10 09:56:16 2006 @@ -2391,10 +2391,6 @@ # End Source File # Begin Source File -SOURCE=..\win32\pwd.c -# End Source File -# Begin Source File - SOURCE=..\win32\readdir.c # End Source File # Begin Source File @@ -2480,10 +2476,6 @@ # End Source File # Begin Source File -SOURCE=..\win32\pwd.h -# End Source File -# Begin Source File - SOURCE=..\win32\readdir.h # End Source File # Begin Source File http://cvs.php.net/viewvc.cgi/php-src/win32/php_win32_globals.h?r1=1.4.2.1&r2=1.4.2.1.2.1&diff_format=u Index: php-src/win32/php_win32_globals.h diff -u php-src/win32/php_win32_globals.h:1.4.2.1 php-src/win32/php_win32_globals.h:1.4.2.1.2.1 --- php-src/win32/php_win32_globals.h:1.4.2.1 Sun Jan 1 12:50:19 2006 +++ php-src/win32/php_win32_globals.h Fri Nov 10 09:56:16 2006 @@ -16,15 +16,13 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_win32_globals.h,v 1.4.2.1 2006/01/01 12:50:19 sniper Exp $ */ +/* $Id: php_win32_globals.h,v 1.4.2.1.2.1 2006/11/10 09:56:16 dmitry Exp $ */ #ifndef PHP_WIN32_GLOBALS_H #define PHP_WIN32_GLOBALS_H /* misc globals for thread-safety under win32 */ -#include "pwd.h" - typedef struct _php_win32_core_globals php_win32_core_globals; #ifdef ZTS @@ -40,12 +38,6 @@ char *log_header; HANDLE log_source; - /* getpwuid */ - struct passwd pwd; - - /* getlogin */ - char *login_name; - /* time */ struct timeval starttime; __int64 lasttime, freq; http://cvs.php.net/viewvc.cgi/php-src/win32/build/config.w32?r1=1.40.2.8.2.1&r2=1.40.2.8.2.2&diff_format=u Index: php-src/win32/build/config.w32 diff -u php-src/win32/build/config.w32:1.40.2.8.2.1 php-src/win32/build/config.w32:1.40.2.8.2.2 --- php-src/win32/build/config.w32:1.40.2.8.2.1 Tue Jul 18 09:06:33 2006 +++ php-src/win32/build/config.w32 Fri Nov 10 09:56:16 2006 @@ -1,5 +1,5 @@ // vim:ft=javascript -// $Id: config.w32,v 1.40.2.8.2.1 2006/07/18 09:06:33 dmitry Exp $ +// $Id: config.w32,v 1.40.2.8.2.2 2006/11/10 09:56:16 dmitry Exp $ // "Master" config file; think of it as a configure.in // equivalent. @@ -264,7 +264,7 @@ ADD_SOURCES("main/streams", "streams.c cast.c memory.c filter.c plain_wrapper.c \ userspace.c transports.c xp_socket.c mmap.c"); -ADD_SOURCES("win32", "crypt_win32.c flock.c glob.c md5crypt.c pwd.c readdir.c \ +ADD_SOURCES("win32", "crypt_win32.c flock.c glob.c md5crypt.c readdir.c \ registry.c select.c sendmail.c time.c wfile.c winutil.c wsyslog.c globals.c"); ADD_SOURCES("regex", "regcomp.c regerror.c regexec.c regfree.c"); http://cvs.php.net/viewvc.cgi/php-src/win32/build/config.w32.h.in?r1=1.7.2.4&r2=1.7.2.4.2.1&diff_format=u Index: php-src/win32/build/config.w32.h.in diff -u php-src/win32/build/config.w32.h.in:1.7.2.4 php-src/win32/build/config.w32.h.in:1.7.2.4.2.1 --- php-src/win32/build/config.w32.h.in:1.7.2.4 Tue Mar 14 14:19:00 2006 +++ php-src/win32/build/config.w32.h.in Fri Nov 10 09:56:16 2006 @@ -1,6 +1,6 @@ /* Build Configuration Template for Win32. - $Id: config.w32.h.in,v 1.7.2.4 2006/03/14 14:19:00 dmitry Exp $ + $Id: config.w32.h.in,v 1.7.2.4.2.1 2006/11/10 09:56:16 dmitry Exp $ */ /* Default PHP / PEAR directories */ @@ -100,7 +100,7 @@ #define HAVE_ASSERT_H 1 #define HAVE_FCNTL_H 1 #define HAVE_GRP_H 0 -#define HAVE_PWD_H 1 +#undef HAVE_PWD_H #define HAVE_STRING_H 1 #undef HAVE_SYS_FILE_H #undef HAVE_SYS_SOCKET_H http://cvs.php.net/viewvc.cgi/php-src/main/config.w32.h?r1=1.85.4.1.2.1&r2=1.85.4.1.2.2&diff_format=u Index: php-src/main/config.w32.h diff -u php-src/main/config.w32.h:1.85.4.1.2.1 php-src/main/config.w32.h:1.85.4.1.2.2 --- php-src/main/config.w32.h:1.85.4.1.2.1 Mon Jun 5 09:00:15 2006 +++ php-src/main/config.w32.h Fri Nov 10 09:56:16 2006 @@ -2,7 +2,7 @@ Build Configuration for Win32. This has only been tested with MS VisualC++ 6 (and later). - $Id: config.w32.h,v 1.85.4.1.2.1 2006/06/05 09:00:15 stas Exp $ + $Id: config.w32.h,v 1.85.4.1.2.2 2006/11/10 09:56:16 dmitry Exp $ */ /* Default PHP / PEAR directories */ @@ -162,7 +162,7 @@ #define HAVE_ASSERT_H 1 #define HAVE_FCNTL_H 1 #define HAVE_GRP_H 0 -#define HAVE_PWD_H 1 +#undef HAVE_PWD_H #define HAVE_STRING_H 1 #undef HAVE_SYS_FILE_H #undef HAVE_SYS_SOCKET_H http://cvs.php.net/viewvc.cgi/php-src/main/fopen_wrappers.c?r1=1.175.2.3.2.1&r2=1.175.2.3.2.2&diff_format=u Index: php-src/main/fopen_wrappers.c diff -u php-src/main/fopen_wrappers.c:1.175.2.3.2.1 php-src/main/fopen_wrappers.c:1.175.2.3.2.2 --- php-src/main/fopen_wrappers.c:1.175.2.3.2.1 Sat Jul 1 11:35:34 2006 +++ php-src/main/fopen_wrappers.c Fri Nov 10 09:56:16 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: fopen_wrappers.c,v 1.175.2.3.2.1 2006/07/01 11:35:34 nlopess Exp $ */ +/* $Id: fopen_wrappers.c,v 1.175.2.3.2.2 2006/11/10 09:56:16 dmitry Exp $ */ /* {{{ includes */ @@ -46,12 +46,8 @@ #include "php_network.h" #if HAVE_PWD_H -#ifdef PHP_WIN32 -#include "win32/pwd.h" -#else #include <pwd.h> #endif -#endif #include <sys/types.h> #if HAVE_SYS_SOCKET_H http://cvs.php.net/viewvc.cgi/php-src/main/php.h?r1=1.221.2.4.2.3&r2=1.221.2.4.2.4&diff_format=u Index: php-src/main/php.h diff -u php-src/main/php.h:1.221.2.4.2.3 php-src/main/php.h:1.221.2.4.2.4 --- php-src/main/php.h:1.221.2.4.2.3 Mon Sep 4 08:18:15 2006 +++ php-src/main/php.h Fri Nov 10 09:56:16 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php.h,v 1.221.2.4.2.3 2006/09/04 08:18:15 dmitry Exp $ */ +/* $Id: php.h,v 1.221.2.4.2.4 2006/11/10 09:56:16 dmitry Exp $ */ #ifndef PHP_H #define PHP_H @@ -199,7 +199,6 @@ #if HAVE_PWD_H # ifdef PHP_WIN32 -#include "win32/pwd.h" #include "win32/param.h" # else #include <pwd.h> http://cvs.php.net/viewvc.cgi/php-src/main/safe_mode.c?r1=1.62.2.1.2.2&r2=1.62.2.1.2.3&diff_format=u Index: php-src/main/safe_mode.c diff -u php-src/main/safe_mode.c:1.62.2.1.2.2 php-src/main/safe_mode.c:1.62.2.1.2.3 --- php-src/main/safe_mode.c:1.62.2.1.2.2 Sat Jul 1 11:35:34 2006 +++ php-src/main/safe_mode.c Fri Nov 10 09:56:16 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: safe_mode.c,v 1.62.2.1.2.2 2006/07/01 11:35:34 nlopess Exp $ */ +/* $Id: safe_mode.c,v 1.62.2.1.2.3 2006/11/10 09:56:16 dmitry Exp $ */ #include "php.h" @@ -197,7 +197,6 @@ PHPAPI char *php_get_current_user() { - struct passwd *pwd; struct stat *pstat; TSRMLS_FETCH(); @@ -213,15 +212,29 @@ if (!pstat) { return ""; - } + } else { +#ifdef PHP_WIN32 + char name[256]; + DWORD len = sizeof(name)-1; + + if (!GetUserName(name, &len)) { + return ""; + } + name[len] = '\0'; + SG(request_info).current_user_length = len; + SG(request_info).current_user = estrndup(name, len); + return SG(request_info).current_user; +#else + struct passwd *pwd; - if ((pwd=getpwuid(pstat->st_uid))==NULL) { - return ""; - } - 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); - - return SG(request_info).current_user; + if ((pwd=getpwuid(pstat->st_uid))==NULL) { + return ""; + } + 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); + return SG(request_info).current_user; +#endif + } } /*