diff options
author | Pierre Joye <pajoye@php.net> | 2010-09-10 17:45:13 +0000 |
---|---|---|
committer | Pierre Joye <pajoye@php.net> | 2010-09-10 17:45:13 +0000 |
commit | 4d8d26d0db5f8e0e8a0effb827dce13075cf6454 (patch) | |
tree | e04410b6e258b1306828eeb42fee1d772eb49339 /main | |
parent | b4368a76cd1090184732602a8ecaadf8f824c9dc (diff) | |
download | php-git-4d8d26d0db5f8e0e8a0effb827dce13075cf6454.tar.gz |
- open_basedir symlink support for Windows
Diffstat (limited to 'main')
-rw-r--r-- | main/fopen_wrappers.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index a0a3206042..daed11bc73 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -172,21 +172,27 @@ PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path memcpy(path_tmp, resolved_name, path_len + 1); /* safe */ while (VCWD_REALPATH(path_tmp, resolved_name) == NULL) { -#ifdef HAVE_SYMLINK - if (nesting_level == 0) { - int ret; - char buf[MAXPATHLEN]; - - ret = readlink(path_tmp, buf, MAXPATHLEN - 1); - if (ret < 0) { - /* not a broken symlink, move along.. */ - } else { - /* put the real path into the path buffer */ - memcpy(path_tmp, buf, ret); - path_tmp[ret] = '\0'; +#if defined(PHP_WIN32) || defined(HAVE_SYMLINK) +#if defined(PHP_WIN32) + if (EG(windows_version_info).dwMajorVersion > 5) { +#endif + if (nesting_level == 0) { + int ret; + char buf[MAXPATHLEN]; + + ret = php_sys_readlink(path_tmp, buf, MAXPATHLEN - 1); + if (ret < 0) { + /* not a broken symlink, move along.. */ + } else { + /* put the real path into the path buffer */ + memcpy(path_tmp, buf, ret); + path_tmp[ret] = '\0'; + } } +#if defined(PHP_WIN32) } #endif +#endif #if defined(PHP_WIN32) || defined(NETWARE) path_file = strrchr(path_tmp, DEFAULT_SLASH); |