summaryrefslogtreecommitdiff
path: root/main/fopen_wrappers.c
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2010-09-10 17:45:13 +0000
committerPierre Joye <pajoye@php.net>2010-09-10 17:45:13 +0000
commit77d307ccbfe7587760b7517c1bd70f0573f35baf (patch)
tree8383d07f751b258a47ccbe8c9da35de132cc872c /main/fopen_wrappers.c
parent2b04364852bbb21cd0a1cd3b1221f1d9291725d6 (diff)
downloadphp-git-77d307ccbfe7587760b7517c1bd70f0573f35baf.tar.gz
- open_basedir symlink support for Windows
Diffstat (limited to 'main/fopen_wrappers.c')
-rw-r--r--main/fopen_wrappers.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c
index 70ae442655..9b485f778f 100644
--- a/main/fopen_wrappers.c
+++ b/main/fopen_wrappers.c
@@ -173,21 +173,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);