pajoye                                   Fri, 10 Sep 2010 17:45:13 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=303260

Log:
- open_basedir symlink support for Windows

Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/UPGRADING
    U   php/php-src/branches/PHP_5_3/main/fopen_wrappers.c
    U   php/php-src/trunk/main/fopen_wrappers.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2010-09-10 15:11:03 UTC (rev 303259)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-09-10 17:45:13 UTC (rev 303260)
@@ -10,6 +10,7 @@
   (Andrey)
 - Improved support for is_link and related functions on Windows. (Pierre)

+- Implemented symbolic links support for open_basedir checks. (Pierre)
 - Implemented FR #51804, SplFileInfo::getLinkTarget on Windows. (Pierre)

 - Fixed symbolic resolution support when the target is a DFS share. (Pierre)

Modified: php/php-src/branches/PHP_5_3/UPGRADING
===================================================================
--- php/php-src/branches/PHP_5_3/UPGRADING      2010-09-10 15:11:03 UTC (rev 
303259)
+++ php/php-src/branches/PHP_5_3/UPGRADING      2010-09-10 17:45:13 UTC (rev 
303260)
@@ -457,6 +457,14 @@
 - Firebird and SNMP support are no longer available on Windows. Firebird 
support
   may be reintroduced in the future.

+=====================
+11.1 New in PHP 5.3.4
+=====================
+
+- open_basedir supports now symbolic links (checks the target).
+- is_link and SplFileInfo symbolic links related method are now fully supported
+  (on Windows Vista or later).
+
 ===================
 12. New in PHP 5.3:
 ===================

Modified: php/php-src/branches/PHP_5_3/main/fopen_wrappers.c
===================================================================
--- php/php-src/branches/PHP_5_3/main/fopen_wrappers.c  2010-09-10 15:11:03 UTC 
(rev 303259)
+++ php/php-src/branches/PHP_5_3/main/fopen_wrappers.c  2010-09-10 17:45:13 UTC 
(rev 303260)
@@ -173,21 +173,27 @@
        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];
+#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 = 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';
+                               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);

Modified: php/php-src/trunk/main/fopen_wrappers.c
===================================================================
--- php/php-src/trunk/main/fopen_wrappers.c     2010-09-10 15:11:03 UTC (rev 
303259)
+++ php/php-src/trunk/main/fopen_wrappers.c     2010-09-10 17:45:13 UTC (rev 
303260)
@@ -172,21 +172,27 @@
        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];
+#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 = 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';
+                               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);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to