[Pkg-php-commits] r916 - in php5/trunk/debian: . patches

Sean Finney seanius at alioth.debian.org
Tue Nov 13 22:29:09 UTC 2007


Author: seanius
Date: 2007-11-13 22:29:09 +0000 (Tue, 13 Nov 2007)
New Revision: 916

Modified:
   php5/trunk/debian/changelog
   php5/trunk/debian/patches/suhosin.patch
Log:
updated suhosin patch

Modified: php5/trunk/debian/changelog
===================================================================
--- php5/trunk/debian/changelog	2007-11-13 20:49:47 UTC (rev 915)
+++ php5/trunk/debian/changelog	2007-11-13 22:29:09 UTC (rev 916)
@@ -1,6 +1,7 @@
 php5 (5.2.5-1) UNRELEASED; urgency=low
 
   * New upstream release
+  * Updated suhosin patch for 5.2.5 minus ./configure as before.
   * Not yet released.
 
  -- Sean Finney <seanius at debian.org>  Tue, 13 Nov 2007 21:49:25 +0100

Modified: php5/trunk/debian/patches/suhosin.patch
===================================================================
--- php5/trunk/debian/patches/suhosin.patch	2007-11-13 20:49:47 UTC (rev 915)
+++ php5/trunk/debian/patches/suhosin.patch	2007-11-13 22:29:09 UTC (rev 916)
@@ -1,1195 +1,6 @@
-Index: php5-5.2.4/configure.in
-===================================================================
---- php5-5.2.4.orig/configure.in	2007-09-16 14:45:15.000000000 +0200
-+++ php5-5.2.4/configure.in	2007-09-16 14:45:15.000000000 +0200
-@@ -227,6 +227,7 @@
- sinclude(TSRM/threads.m4)
- sinclude(TSRM/tsrm.m4)
- 
-+sinclude(main/suhosin_patch.m4)
- 
- divert(2)
- 
-@@ -1304,7 +1305,7 @@
-        php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \
-        strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c \
-        network.c php_open_temporary_file.c php_logos.c \
--       output.c )
-+       output.c suhosin_patch.c )
- 
- PHP_ADD_SOURCES(main/streams, streams.c cast.c memory.c filter.c \
-        plain_wrapper.c userspace.c transports.c xp_socket.c mmap.c)
-@@ -1330,7 +1331,7 @@
-     zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \
-     zend_list.c zend_indent.c zend_builtin_functions.c zend_sprintf.c \
-     zend_ini.c zend_qsort.c zend_multibyte.c zend_ts_hash.c zend_stream.c \
--    zend_iterators.c zend_interfaces.c zend_exceptions.c zend_strtod.c)
-+    zend_iterators.c zend_interfaces.c zend_exceptions.c zend_strtod.c zend_canary.c )
- 
- if test -r "$abs_srcdir/Zend/zend_objects.c"; then
-   PHP_ADD_SOURCES(Zend, zend_objects.c zend_object_handlers.c zend_objects_API.c \
-Index: php5-5.2.4/ext/standard/basic_functions.c
-===================================================================
---- php5-5.2.4.orig/ext/standard/basic_functions.c	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/ext/standard/basic_functions.c	2007-09-16 14:45:15.000000000 +0200
-@@ -3570,7 +3570,9 @@
- 	PHP_FALIAS(socket_get_status, stream_get_meta_data,						arginfo_stream_get_meta_data)
- 
- #if (!defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
--	PHP_FE(realpath,														arginfo_realpath)
-+#undef realpath
-+	PHP_NAMED_FE(realpath,			PHP_FN(real_path),						arginfo_realpath)
-+#define realpath real_path
- #endif
- 
- #ifdef HAVE_FNMATCH
-Index: php5-5.2.4/ext/standard/dl.c
-===================================================================
---- php5-5.2.4.orig/ext/standard/dl.c	2007-09-16 14:45:15.000000000 +0200
-+++ php5-5.2.4/ext/standard/dl.c	2007-09-16 14:45:15.000000000 +0200
-@@ -228,6 +228,19 @@
- 			RETURN_FALSE;
- 		}
- 	}
-+#if SUHOSIN_PATCH
-+	if (strncmp("suhosin", module_entry->name, sizeof("suhosin")-1) == 0) {
-+		void *log_func;
-+		/* sucessfully loaded suhosin extension, now check for logging function replacement */
-+		log_func = (void *) DL_FETCH_SYMBOL(handle, "suhosin_log");
-+		if (log_func == NULL) {
-+			log_func = (void *) DL_FETCH_SYMBOL(handle, "_suhosin_log");
-+		}
-+		if (log_func != NULL) {
-+			zend_suhosin_log = log_func;
-+		}
-+	}
-+#endif	
- 	RETURN_TRUE;
- }
- /* }}} */
-Index: php5-5.2.4/ext/standard/file.c
-===================================================================
---- php5-5.2.4.orig/ext/standard/file.c	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/ext/standard/file.c	2007-09-16 14:45:15.000000000 +0200
-@@ -2361,7 +2361,7 @@
- #if (!defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
- /* {{{ proto string realpath(string path)
-    Return the resolved path */
--PHP_FUNCTION(realpath)
-+PHP_FUNCTION(real_path)
- {
- 	zval **path;
- 	char resolved_path_buff[MAXPATHLEN];
-Index: php5-5.2.4/ext/standard/file.h
-===================================================================
---- php5-5.2.4.orig/ext/standard/file.h	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/ext/standard/file.h	2007-09-16 14:45:15.000000000 +0200
-@@ -61,7 +61,7 @@
- PHP_FUNCTION(fd_set);
- PHP_FUNCTION(fd_isset);
- #if (!defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
--PHP_FUNCTION(realpath);
-+PHP_FUNCTION(real_path);
- #endif
- #ifdef HAVE_FNMATCH
- PHP_FUNCTION(fnmatch);
-Index: php5-5.2.4/ext/standard/info.c
-===================================================================
---- php5-5.2.4.orig/ext/standard/info.c	2007-09-16 14:45:15.000000000 +0200
-+++ php5-5.2.4/ext/standard/info.c	2007-09-16 14:45:15.000000000 +0200
-@@ -627,6 +627,31 @@
- 		
- 		php_info_print_table_end();
- 
-+		/* Suhosin Patch */
-+		php_info_print_box_start(0);
-+		if (expose_php && !sapi_module.phpinfo_as_text) {
-+			PUTS("<a href=\"http://www.hardened-php.net/suhosin/index.html\"><img border=\"0\" src=\"");
-+			if (SG(request_info).request_uri) {
-+				char *elem_esc = php_info_html_esc(SG(request_info).request_uri TSRMLS_CC);
-+				PUTS(elem_esc);
-+				efree(elem_esc);
-+			}
-+			PUTS("?="SUHOSIN_LOGO_GUID"\" alt=\"Suhosin logo\" /></a>\n");
-+		}
-+		PUTS("This server is protected with the Suhosin Patch ");
-+		if (sapi_module.phpinfo_as_text) {
-+			PUTS(SUHOSIN_PATCH_VERSION);
-+		} else {
-+			zend_html_puts(SUHOSIN_PATCH_VERSION, strlen(SUHOSIN_PATCH_VERSION) TSRMLS_CC);
-+		}
-+		PUTS(!sapi_module.phpinfo_as_text?"<br />":"\n");
-+		if (sapi_module.phpinfo_as_text) {
-+			PUTS("Copyright (c) 2006 Hardened-PHP Project\n");
-+		} else {
-+			PUTS("Copyright (c) 2006 <a href=\"http://www.hardened-php.net/\">Hardened-PHP Project</a>\n");
-+		}
-+		php_info_print_box_end();
-+		
- 		/* Zend Engine */
- 		php_info_print_box_start(0);
- 		if (expose_php && !sapi_module.phpinfo_as_text) {
-Index: php5-5.2.4/ext/standard/syslog.c
-===================================================================
---- php5-5.2.4.orig/ext/standard/syslog.c	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/ext/standard/syslog.c	2007-09-16 14:45:15.000000000 +0200
-@@ -42,6 +42,7 @@
-  */
- PHP_MINIT_FUNCTION(syslog)
- {
-+#if !SUHOSIN_PATCH
- 	/* error levels */
- 	REGISTER_LONG_CONSTANT("LOG_EMERG", LOG_EMERG, CONST_CS | CONST_PERSISTENT); /* system unusable */
- 	REGISTER_LONG_CONSTANT("LOG_ALERT", LOG_ALERT, CONST_CS | CONST_PERSISTENT); /* immediate action required */
-@@ -97,6 +98,7 @@
- 	/* AIX doesn't have LOG_PERROR */
- 	REGISTER_LONG_CONSTANT("LOG_PERROR", LOG_PERROR, CONST_CS | CONST_PERSISTENT); /*log to stderr*/
- #endif
-+#endif
- 	BG(syslog_device)=NULL;
- 
- 	return SUCCESS;
-Index: php5-5.2.4/main/fopen_wrappers.c
-===================================================================
---- php5-5.2.4.orig/main/fopen_wrappers.c	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/main/fopen_wrappers.c	2007-09-16 14:45:15.000000000 +0200
-@@ -111,7 +111,7 @@
- 
- 	/* normalize and expand path */
- 	if (expand_filepath(path, resolved_name TSRMLS_CC) == NULL) {
--		return -1;
-+		return -2;
- 	}
- 	
- 	path_len = strlen(resolved_name);
-@@ -180,6 +180,12 @@
- 			}
- 		}
- 
-+		if (resolved_name_len == resolved_basedir_len - 1) {
-+			if (resolved_basedir[resolved_basedir_len - 1] == PHP_DIR_SEPARATOR) {
-+				resolved_basedir_len--;
-+			}
-+		}
-+
- 		/* Check the path */
- #if defined(PHP_WIN32) || defined(NETWARE)
- 		if (strncasecmp(resolved_basedir, resolved_name, resolved_basedir_len) == 0) {
-@@ -203,7 +209,7 @@
- 		}
- 	} else {
- 		/* Unable to resolve the real path, return -1 */
--		return -1;
-+		return -3;
- 	}
- }
- /* }}} */
-@@ -222,22 +228,44 @@
- 		char *pathbuf;
- 		char *ptr;
- 		char *end;
-+		char path_copy[MAXPATHLEN];
-+		int path_len;
-+
-+		/* Special case path ends with a trailing slash */
-+		path_len = strlen(path);
-+		if (path_len >= MAXPATHLEN) {
-+			errno = EPERM; /* we deny permission to open it */
-+			return -1;
-+		}
-+		if (path_len > 0 && path[path_len-1] == PHP_DIR_SEPARATOR) {
-+			memcpy(path_copy, path, path_len+1);
-+			while (path_len > 1 && path_copy[path_len-1] == PHP_DIR_SEPARATOR) path_len--;
-+			path_copy[path_len] = '\0';
-+			path = (const char *)&path_copy;
-+		}
- 
- 		pathbuf = estrdup(PG(open_basedir));
- 
- 		ptr = pathbuf;
- 
- 		while (ptr && *ptr) {
-+			int res;
- 			end = strchr(ptr, DEFAULT_DIR_SEPARATOR);
- 			if (end != NULL) {
- 				*end = '\0';
- 				end++;
- 			}
- 
--			if (php_check_specific_open_basedir(ptr, path TSRMLS_CC) == 0) {
-+			res = php_check_specific_open_basedir(ptr, path TSRMLS_CC);
-+			if (res == 0) {
- 				efree(pathbuf);
- 				return 0;
- 			}
-+			if (res == -2) {
-+				efree(pathbuf);
-+				errno = EPERM;
-+				return -1;
-+			}
- 
- 			ptr = end;
- 		}
-Index: php5-5.2.4/main/main.c
-===================================================================
---- php5-5.2.4.orig/main/main.c	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/main/main.c	2007-09-16 14:45:15.000000000 +0200
-@@ -88,6 +88,9 @@
- 
- #include "SAPI.h"
- #include "rfc1867.h"
-+#if SUHOSIN_PATCH
-+#include "suhosin_globals.h"
-+#endif
- /* }}} */
- 
- #ifndef ZTS
-@@ -1347,7 +1350,7 @@
- 
- 	/* used to close fd's in the 3..255 range here, but it's problematic
- 	 */
--	shutdown_memory_manager(1, 1 TSRMLS_CC);
-+	shutdown_memory_manager(1, 1 TSRMLS_CC);	
- }
- /* }}} */
- 
-@@ -1388,6 +1391,9 @@
- 
- 	zend_try {
- 		shutdown_memory_manager(CG(unclean_shutdown), 0 TSRMLS_CC);
-+#if SUHOSIN_PATCH
-+		suhosin_clear_mm_canaries(TSRMLS_C);
-+#endif
- 	} zend_end_try();
- 
- 	zend_try {
-@@ -1480,6 +1486,9 @@
- 	/* 11. Free Willy (here be crashes) */
- 	zend_try {
- 		shutdown_memory_manager(CG(unclean_shutdown) || !report_memleaks, 0 TSRMLS_CC);
-+#if SUHOSIN_PATCH
-+		suhosin_clear_mm_canaries(TSRMLS_C);
-+#endif
- 	} zend_end_try();
- 
- 	/* 12. Reset max_execution_time */
-@@ -1639,6 +1648,9 @@
- #ifdef ZTS
- 	tsrm_ls = ts_resource(0);
- #endif
-+#if SUHOSIN_PATCH
-+	suhosin_startup();
-+#endif
- 
- 	module_shutdown = 0;
- 	module_startup = 1;
-@@ -1768,6 +1780,10 @@
- 	REGISTER_MAIN_STRINGL_CONSTANT("PHP_CONFIG_FILE_PATH", PHP_CONFIG_FILE_PATH, strlen(PHP_CONFIG_FILE_PATH), CONST_PERSISTENT | CONST_CS);
- 	REGISTER_MAIN_STRINGL_CONSTANT("PHP_CONFIG_FILE_SCAN_DIR", PHP_CONFIG_FILE_SCAN_DIR, sizeof(PHP_CONFIG_FILE_SCAN_DIR)-1, CONST_PERSISTENT | CONST_CS);
- 	REGISTER_MAIN_STRINGL_CONSTANT("PHP_SHLIB_SUFFIX", PHP_SHLIB_SUFFIX, sizeof(PHP_SHLIB_SUFFIX)-1, CONST_PERSISTENT | CONST_CS);
-+#if SUHOSIN_PATCH
-+	REGISTER_MAIN_LONG_CONSTANT("SUHOSIN_PATCH", 1, CONST_PERSISTENT | CONST_CS);
-+	REGISTER_MAIN_STRINGL_CONSTANT("SUHOSIN_PATCH_VERSION", SUHOSIN_PATCH_VERSION, sizeof(SUHOSIN_PATCH_VERSION)-1, CONST_PERSISTENT | CONST_CS);
-+#endif
- 	REGISTER_MAIN_STRINGL_CONSTANT("PHP_EOL", PHP_EOL, sizeof(PHP_EOL)-1, CONST_PERSISTENT | CONST_CS);
- 	REGISTER_MAIN_LONG_CONSTANT("PHP_INT_MAX", LONG_MAX, CONST_PERSISTENT | CONST_CS);
- 	REGISTER_MAIN_LONG_CONSTANT("PHP_INT_SIZE", sizeof(long), CONST_PERSISTENT | CONST_CS);
-@@ -1817,7 +1833,9 @@
- 	module_startup = 0;
- 
- 	shutdown_memory_manager(1, 0 TSRMLS_CC);
--
-+#if SUHOSIN_PATCH
-+	suhosin_clear_mm_canaries(TSRMLS_C);
-+#endif
- 	/* we're done */
- 	return SUCCESS;
- }
-@@ -1876,6 +1894,9 @@
- #ifndef ZTS
- 	zend_ini_shutdown(TSRMLS_C);
- 	shutdown_memory_manager(CG(unclean_shutdown), 1 TSRMLS_CC);
-+#if SUHOSIN_PATCH
-+	suhosin_clear_mm_canaries(TSRMLS_C);
-+#endif
- 	core_globals_dtor(&core_globals TSRMLS_CC);
- #else
- 	zend_ini_global_shutdown(TSRMLS_C);
-Index: php5-5.2.4/main/php.h
-===================================================================
---- php5-5.2.4.orig/main/php.h	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/main/php.h	2007-09-16 14:45:15.000000000 +0200
-@@ -40,6 +40,13 @@
- #undef sprintf
- #define sprintf php_sprintf
- 
-+#if SUHOSIN_PATCH
-+#if HAVE_REALPATH
-+#undef realpath
-+#define realpath php_realpath
-+#endif
-+#endif
-+
- /* PHP's DEBUG value must match Zend's ZEND_DEBUG value */
- #undef PHP_DEBUG
- #define PHP_DEBUG ZEND_DEBUG
-@@ -452,6 +459,10 @@
- #endif
- #endif /* !XtOffsetOf */
- 
-+#if SUHOSIN_PATCH
-+#include "suhosin_patch.h"
-+#endif
-+
- #endif
- 
- /*
-Index: php5-5.2.4/main/php_logos.c
-===================================================================
---- php5-5.2.4.orig/main/php_logos.c	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/main/php_logos.c	2007-09-16 14:45:15.000000000 +0200
-@@ -50,6 +50,10 @@
- 	return zend_hash_del(&phpinfo_logo_hash, logo_string, strlen(logo_string));
- }
- 
-+#if SUHOSIN_PATCH
-+#include "suhosin_logo.h"
-+#endif
-+
- int php_init_info_logos(void)
- {
- 	if(zend_hash_init(&phpinfo_logo_hash, 0, NULL, NULL, 1)==FAILURE) 
-@@ -58,6 +62,9 @@
- 	php_register_info_logo(PHP_LOGO_GUID    , "image/gif", php_logo    , sizeof(php_logo));
- 	php_register_info_logo(PHP_EGG_LOGO_GUID, "image/gif", php_egg_logo, sizeof(php_egg_logo));
- 	php_register_info_logo(ZEND_LOGO_GUID   , "image/gif", zend_logo   , sizeof(zend_logo));
-+#if SUHOSIN_PATCH
-+	php_register_info_logo(SUHOSIN_LOGO_GUID, "image/jpeg", suhosin_logo, sizeof(suhosin_logo));
-+#endif	
- 
- 	return SUCCESS;
- }
-Index: php5-5.2.4/main/snprintf.c
-===================================================================
---- php5-5.2.4.orig/main/snprintf.c	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/main/snprintf.c	2007-09-16 14:45:15.000000000 +0200
-@@ -1079,7 +1079,11 @@
- 
- 
- 				case 'n':
-+#if SUHOSIN_PATCH
-+					zend_suhosin_log(S_MISC, "'n' specifier within format string");
-+#else
- 					*(va_arg(ap, int *)) = cc;
-+#endif
- 					goto skip_output;
- 
- 					/*
-Index: php5-5.2.4/main/spprintf.c
-===================================================================
---- php5-5.2.4.orig/main/spprintf.c	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/main/spprintf.c	2007-09-16 14:45:15.000000000 +0200
-@@ -672,7 +672,11 @@
- 
- 
- 				case 'n':
-+#if SUHOSIN_PATCH
-+					zend_suhosin_log(S_MISC, "'n' specifier within format string");
-+#else
- 					*(va_arg(ap, int *)) = xbuf->len;
-+#endif
- 					goto skip_output;
- 
- 					/*
-Index: php5-5.2.4/main/suhosin_globals.h
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ php5-5.2.4/main/suhosin_globals.h	2007-09-16 14:45:15.000000000 +0200
-@@ -0,0 +1,61 @@
-+/*
-+   +----------------------------------------------------------------------+
-+   | Suhosin-Patch for PHP                                                |
-+   +----------------------------------------------------------------------+
-+   | Copyright (c) 2004-2006 Stefan Esser                                 |
-+   +----------------------------------------------------------------------+
-+   | This source file is subject to version 2.02 of the PHP license,      |
-+   | that is bundled with this package in the file LICENSE, and is        |
-+   | available at through the world-wide-web at                           |
-+   | http://www.php.net/license/2_02.txt.                                 |
-+   | If you did not receive a copy of the PHP license and are unable to   |
-+   | obtain it through the world-wide-web, please send a note to          |
-+   | license at php.net so we can mail you a copy immediately.               |
-+   +----------------------------------------------------------------------+
-+   | Author: Stefan Esser <sesser at hardened-php.net>                       |
-+   +----------------------------------------------------------------------+
-+ */
-+
-+#ifndef SUHOSIN_GLOBALS_H
-+#define SUHOSIN_GLOBALS_H
-+
-+typedef struct _suhosin_patch_globals suhosin_patch_globals_struct;
-+
-+#ifdef ZTS
-+# define SPG(v) TSRMG(suhosin_patch_globals_id, suhosin_patch_globals_struct *, v)
-+extern int suhosin_patch_globals_id;
-+#else
-+# define SPG(v) (suhosin_patch_globals.v)
-+extern struct _suhosin_patch_globals suhosin_patch_globals;
-+#endif
-+
-+
-+struct _suhosin_patch_globals {
-+	/* logging */
-+	int log_syslog;
-+	int log_syslog_facility;
-+	int log_syslog_priority;
-+	int log_sapi;
-+	int log_script;
-+	int log_phpscript;
-+	char *log_scriptname;
-+	char *log_phpscriptname;
-+	zend_bool log_phpscript_is_safe;
-+	zend_bool log_use_x_forwarded_for;
-+	
-+	/* memory manager canary protection */
-+	unsigned int canary_1;
-+	unsigned int canary_2;
-+	unsigned int canary_3;
-+	unsigned int dummy;
-+};
-+
-+
-+#endif /* SUHOSIN_GLOBALS_H */
-+
-+/*
-+ * Local variables:
-+ * tab-width: 4
-+ * c-basic-offset: 4
-+ * End:
-+ */
-Index: php5-5.2.4/main/suhosin_logo.h
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ php5-5.2.4/main/suhosin_logo.h	2007-09-16 14:45:15.000000000 +0200
-@@ -0,0 +1,178 @@
-+static unsigned char suhosin_logo[] =
-+	"\xff\xd8\xff\xe0\x00\x10\x4a\x46\x49\x46\x00\x01\x01\x01\x00\x48"
-+	"\x00\x48\x00\x00\xff\xe1\x00\x16\x45\x78\x69\x66\x00\x00\x4d\x4d"
-+	"\x00\x2a\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\xff\xdb\x00\x43"
-+	"\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01"
-+	"\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01"
-+	"\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01"
-+	"\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01"
-+	"\x01\xff\xc0\x00\x0b\x08\x00\x27\x00\x71\x01\x01\x22\x00\xff\xc4"
-+	"\x00\x1e\x00\x00\x02\x02\x02\x03\x01\x01\x00\x00\x00\x00\x00\x00"
-+	"\x00\x00\x00\x00\x09\x06\x08\x05\x07\x02\x03\x0a\x01\x04\xff\xc4"
-+	"\x00\x32\x10\x00\x01\x04\x03\x00\x02\x00\x05\x01\x05\x09\x01\x00"
-+	"\x00\x00\x00\x05\x02\x03\x04\x06\x01\x07\x08\x00\x09\x11\x12\x13"
-+	"\x14\x21\x15\x0a\x16\x31\x56\x96\x17\x18\x19\x23\x32\x41\x58\x98"
-+	"\xd4\xd6\xff\xda\x00\x08\x01\x01\x00\x00\x3f\x00\xf4\xc1\xe1\xe5"
-+	"\x69\xe9\x3e\xb9\xd1\x7c\x8a\x2e\x9d\x66\xe8\x3b\x29\x4d\x7f\x46"
-+	"\xba\x58\x55\x54\x8d\xb1\x5f\xaa\xd9\x8d\x51\x2b\xb6\x27\x5a\x69"
-+	"\xd1\x43\xaf\x16\x1a\xf0\xb2\xb1\xe9\x6d\x9f\xc2\xa4\x36\x18\xb5"
-+	"\x85\x10\x41\xbe\xfc\x09\xac\x49\x29\x11\xd4\x32\x97\xec\x08\x13"
-+	"\xc1\x2d\x20\xc3\x59\xeb\x26\x05\xd8\x6b\x76\x31\x43\x8f\x57\xcf"
-+	"\x84\x9f\x14\xa8\x53\x81\x0b\xc3\x64\x80\xa3\x02\x0a\x41\x75\xf8"
-+	"\x44\x85\x93\x81\x22\x3c\xd8\x13\xe1\xbe\xf4\x59\x91\x1f\x6a\x44"
-+	"\x77\x5c\x69\xc4\x2f\x39\x5f\x0f\x2a\x8d\xeb\xba\xf8\xc3\x56\x6c"
-+	"\x3b\x36\xa7\xda\xbd\x4d\xa1\xb5\x4e\xc6\xa7\xa4\x3a\xec\x15\x2d"
-+	"\xa5\xb3\xea\x5a\xdc\xac\x46\xac\x01\x60\xd8\x43\xc8\x8e\x8b\xb1"
-+	"\x40\x4c\x95\x8b\x34\x41\x28\x52\x91\x28\x43\xd3\xa3\xb6\xa7\x55"
-+	"\x15\xe7\x5a\x96\xcb\xf1\xda\xe5\x55\xee\xfe\x1e\xbd\xd9\x41\xd3"
-+	"\x28\xfd\x97\xca\x57\x2b\x85\x9c\xa4\x30\x95\xaa\xa5\x57\xa2\x35"
-+	"\x15\x86\xcb\x61\x34\x41\xe4\xc7\x80\x20\x18\x21\x17\x09\x85\x0b"
-+	"\x14\x9d\x21\x68\x62\x1c\x08\x11\x64\x4b\x92\xf2\xd2\xd3\x2d\x2d"
-+	"\x6a\xc2\x73\x6b\x3c\x3c\x8b\x9e\xbc\x52\xaa\xa4\xab\x81\x6c\xf6"
-+	"\xfa\xbd\x70\xc5\xc6\x7b\xc2\xaa\x22\x4f\x58\x04\x87\x25\x6a\x27"
-+	"\x1d\xa4\x3d\x20\x75\x72\x01\x09\x71\xe5\x1c\x9e\xc3\x2e\x36\xf3"
-+	"\xd0\xc6\x35\x2a\x43\x4d\x2d\x0e\x2d\xb4\xa1\x49\xce\x65\x1e\x52"
-+	"\x9e\xa1\xf6\x09\xcc\xdc\x63\x66\xa8\x01\xe9\x3b\x0d\xd7\x5a\x85"
-+	"\xbb\xc5\x65\xc0\x7b\x2e\x46\xa9\xd9\x56\x1d\x4c\x92\x72\x26\x4e"
-+	"\x86\xd5\x68\xae\xc4\xaa\x55\xce\xd7\x83\x59\xb3\x81\xee\xce\x74"
-+	"\x39\x39\x31\x9f\x8a\x25\xe8\xa5\xa5\xe5\x81\xf2\x11\x23\xcb\xa1"
-+	"\x1e\x43\x12\xe3\xb1\x2a\x2b\xcd\xc8\x8d\x25\x96\xa4\x47\x7d\x95"
-+	"\xa5\xc6\x9f\x61\xe4\x25\xc6\x5e\x69\xc4\xe7\x29\x5b\x6e\xb6\xa4"
-+	"\xad\x0b\x4e\x72\x95\x25\x58\x56\x33\x9c\x67\xce\xef\x0f\x17\xbf"
-+	"\x4c\x7b\x2d\xe6\xfe\x76\x35\x27\x5a\x07\x97\x67\xe8\xae\x8d\x71"
-+	"\x0f\xb2\x13\x99\xb9\xbc\x14\xad\xb3\xb7\xe6\x11\x6f\xe0\xda\x58"
-+	"\xb1\x08\xac\xa6\x6c\x2d\x7f\x05\xb7\x56\xd2\xe6\xcf\xbb\x4d\x0c"
-+	"\xe3\x50\xb2\xec\x91\xf0\x4a\xb8\xd6\x22\xb8\xa7\xf6\x67\xaf\xcf"
-+	"\x63\x7e\xd7\xe7\x42\xd8\xbd\xc3\x71\xa1\xf2\x7e\x9b\xa8\x97\x83"
-+	"\x6e\xd1\xdc\x4b\x06\x11\x2d\xae\x26\x61\x98\x72\x10\xf4\x42\x5d"
-+	"\x20\x4a\xa3\x73\xd7\xf2\xcd\x3c\x48\x32\xe4\x03\x9f\x80\x37\x08"
-+	"\x36\x11\xd0\xcb\x97\x6c\x08\xed\x6d\x33\x24\xa2\x1b\xb4\x77\xdf"
-+	"\x61\x5d\x5f\xc1\x43\xc2\x82\xeb\x0f\x5d\x84\x08\x68\xaa\xa4\x01"
-+	"\xe1\x19\xdf\xbc\x31\x65\xfe\xd1\xf5\x7d\x7a\xb2\x2a\x33\x50\x21"
-+	"\x2a\x56\x9d\xb1\x81\xab\xdb\x35\x78\x30\x83\xd9\x89\x1d\x31\xac"
-+	"\x96\x14\x07\x61\xbc\x20\x68\x42\x85\x33\x19\xac\xbe\xdb\x34\x56"
-+	"\xf1\xd5\xfd\x29\xa9\x28\xdb\xcb\x4c\x5a\x23\xdc\xf5\x96\xc5\x10"
-+	"\xa3\x35\x5b\x14\x68\xd3\x61\x62\x64\x76\x26\xcb\x17\x3e\x34\x98"
-+	"\x04\xa3\xc4\x20\x38\x90\x92\xe3\xc8\x07\x2c\x36\x74\x66\x26\x0e"
-+	"\x29\x02\x64\x29\x2d\x21\xe6\x16\x9c\x6b\xce\xa3\x89\xd9\x4f\xd3"
-+	"\xc4\xbd\xc5\x87\x79\x9c\x65\xf6\x39\x45\x60\xe8\xce\x9e\xab\x6d"
-+	"\x13\x15\x22\xe1\x5e\x4b\x38\x42\xc4\x1e\xd5\x76\xe0\xc5\xeb\x85"
-+	"\x07\x2d\x0f\xb8\xb6\xa6\xd6\x6d\x71\x0d\xa2\x43\x4c\x25\xea\xfa"
-+	"\xa1\xae\x4c\xe4\x7d\xbd\x76\xa9\xfb\x06\xc2\x83\x42\xeb\xad\xe7"
-+	"\xe9\x5f\x68\x6f\xba\xfb\x2f\x07\xce\xb8\x13\xc1\x9b\xeb\xb0\x76"
-+	"\x45\x57\x28\x7b\xea\xbe\x0f\xf4\x30\x7b\xa0\xed\xe4\x22\x93\x21"
-+	"\xfc\xbc\xe0\xb9\x75\xc1\x4f\xfc\xef\xb6\xfa\xa1\xfc\x64\xa1\x4a"
-+	"\x82\xc7\x33\xad\x75\xed\x82\xbd\x3d\xdb\xf7\xa8\xbe\x5e\xbb\x36"
-+	"\x62\x04\x9a\x2e\xc5\xd9\x9e\x9c\x3a\x0b\x98\x0b\x57\xac\xf1\x24"
-+	"\x62\x58\x83\x15\x5b\xa6\xf2\xda\x34\x70\x03\xce\x0f\x93\x1b\x12"
-+	"\xc7\xce\x54\x87\x33\x15\xd6\x53\x25\x1f\x2a\x90\x87\x12\xe3\x78"
-+	"\xef\x55\x77\x4d\x4a\xd8\x7e\xef\xd2\xfd\xd1\xaf\x3a\xaf\x55\xdb"
-+	"\x6a\x2d\x3d\x42\xac\x51\x79\xee\x91\xab\xe1\x05\x2d\x3c\x80\xa2"
-+	"\x43\xad\x22\x2e\xd5\x33\x13\xa4\x9e\x00\xe0\x04\x10\x84\xc8\xf2"
-+	"\x19\x30\x92\x1f\xaa\xc3\x28\xc9\x76\x30\x3f\xe9\x10\x61\x5e\x79"
-+	"\xd5\xf7\xdf\xd0\x54\xdb\xae\xb6\xae\xfa\xe8\xa3\x57\xe0\x6c\x2d"
-+	"\xf7\xbd\x49\xd6\x6e\x76\x79\xcc\x54\x0c\x5f\xff\x00\xbb\x06\x98"
-+	"\xa6\x9e\x89\x61\xb4\x6f\xc3\xe3\x6a\xc2\x4f\x59\x03\xc9\x80\x2c"
-+	"\x59\x24\x44\x70\x38\xd5\x96\x6a\x9e\x8b\x81\x64\xe5\xbc\xa0\x3c"
-+	"\x33\xaf\x17\x9d\xff\x00\x71\x1a\xd1\x3a\x80\x66\xb3\xd9\x31\x77"
-+	"\x0d\x12\xbd\xae\x29\xb5\x6a\xd6\xcf\x8d\x68\x87\x75\xcd\xe8\x65"
-+	"\x5a\xbe\x3c\x04\x7b\x34\xdb\x54\x19\xa4\x63\x9c\x2a\x5d\x23\xbe"
-+	"\xf4\xb1\x1c\x4d\x90\xec\x92\x2f\x49\x71\xf7\x14\xf2\x97\x9f\x15"
-+	"\x57\xed\x13\x21\x2a\xf5\x33\xd1\x2a\x52\x52\xac\xb7\x62\xd1\xcb"
-+	"\x46\x73\x8c\x67\x28\x56\x77\x86\xbf\x6f\x2a\x4e\x73\xfe\x95\x65"
-+	"\x0b\x5a\x3e\x38\xfc\xfc\xaa\x56\x3f\x86\x73\xe3\xb9\x4a\x52\x84"
-+	"\xa5\x08\x4e\x12\x94\x27\x09\x4a\x53\x8c\x61\x29\x4a\x71\xf0\x4a"
-+	"\x53\x8c\x7e\x31\x8c\x63\x18\xc6\x31\x8f\xc6\x31\xf8\xc7\x9f\x7c"
-+	"\xd5\xbb\xae\x5e\xe2\x1f\xab\x6e\x24\x34\x00\x8a\x25\x83\x70\x40"
-+	"\x1c\xcc\xda\x45\x7f\x66\x4e\x30\x2e\x94\x7e\x74\x49\xf0\xe4\x4e"
-+	"\x06\x5c\xa8\x2f\x89\x21\x2e\x98\x0e\xd9\x21\xc2\x0b\x21\x0f\xc4"
-+	"\x16\x6e\x48\xd9\xe4\xe3\x4a\x19\x1e\x64\x67\x54\xff\x00\x3a\x6d"
-+	"\x4f\x62\xb5\x00\x4a\xaa\x51\xfd\x2d\xe8\x0e\x6c\xaf\xc6\x7d\x6d"
-+	"\xc8\x88\xc7\x67\xea\x8a\x58\x02\x73\xe3\x65\x4d\xc9\x24\xc0\x3d"
-+	"\x57\xa3\x2e\x53\x16\x99\x4f\xe5\xe7\x19\x97\x3e\x3b\xcf\xc9\x4b"
-+	"\x99\x7f\x33\x25\xa5\xdf\xba\x77\x2b\xd3\x3e\xc2\x7b\x8b\x94\x07"
-+	"\xe9\x52\x5b\x43\x87\x34\x14\x86\x37\xcf\x41\x6b\x8e\x6a\xa5\x22"
-+	"\xab\xdb\x96\xa2\xcf\x46\xd8\x9b\x45\x93\xef\xd6\xdf\x3e\x99\x9c"
-+	"\x7e\x29\x10\x6b\x6c\xa2\xb8\x43\x05\x09\x44\x70\x8c\xb8\xaa\x54"
-+	"\x7c\x30\x36\x5e\x1c\x5e\x5b\x9f\x6c\x0d\x81\xee\xa0\x93\x8d\x67"
-+	"\x55\xf3\x87\xaf\xaa\x6b\x58\xf9\xbe\xb2\x36\x07\x42\x6e\xbd\x96"
-+	"\xe3\x9f\x1f\x8f\xc9\xf4\x9d\xae\x6a\x7d\x4c\x96\xbe\x5f\xc7\xcd"
-+	"\xf3\xb2\xf7\xcd\xf0\xcf\xc3\xe4\xf8\xfe\x37\x4f\x1c\x4d\xf6\x40"
-+	"\xf1\x6b\x7c\x4e\xe0\xa6\x71\xad\x56\xa7\x1c\x5c\x15\x6b\xfc\xf3"
-+	"\x01\x5d\xac\xf1\x75\x9a\x72\x6b\xaa\x28\xc5\x88\x6d\xfb\x33\x85"
-+	"\xe0\x4e\x61\xab\xeb\x31\x2c\x71\x08\x73\x11\x3b\xfc\xb5\xc0\x96"
-+	"\xcc\x87\x24\x44\xb5\x9b\x9e\xb3\x71\xba\xe9\xed\xb1\x4e\xd7\x76"
-+	"\x6c\xd2\xb6\x05\xb7\x5a\xde\xeb\x34\x5b\x96\x16\xfb\x59\xa9\x5c"
-+	"\x4f\x55\xca\x8a\xac\x59\xb0\xe4\x54\x39\x25\xbc\x81\x37\x2a\x09"
-+	"\x5f\x9e\x3b\x6b\x7d\x1f\x69\xf3\x34\x85\x39\x84\xa7\x28\x0b\xd3"
-+	"\xfd\xfb\x4b\x7a\xea\xe7\xd2\x3c\xd3\xda\x15\x68\xbc\x73\xd3\x22"
-+	"\x6f\xd7\x72\x5b\x2b\x66\xee\xa8\x0d\x54\xe8\x5b\xf9\x92\x96\x92"
-+	"\x93\xea\x97\x4a\xc7\x43\x10\x46\x35\xc5\xc0\x60\x8a\xe4\xc1\xb5"
-+	"\x36\xc6\xae\xed\xf7\x70\xa5\x86\x99\x3d\x91\xf8\xfd\x4e\x53\xeb"
-+	"\xbb\xbd\x6d\xec\x8f\xd7\x89\x3d\x31\x7f\xd7\x78\xba\x50\xbb\x74"
-+	"\x9d\xf6\xac\x4e\xb9\x03\x9c\x79\xd5\xe1\xbd\x17\x68\xd9\x13\x0b"
-+	"\x45\x75\x88\x00\x1d\x1f\xae\x73\x6a\x1d\x5c\x6e\x44\x9f\xa6\xfa"
-+	"\x4e\xd8\x25\x8b\xc0\xbc\xb2\x99\xe3\x17\x24\xb3\x23\xe2\x48\x8b"
-+	"\xfa\x22\xe7\x7e\x8f\xe6\x3f\x5f\x55\x0d\x75\xd3\x51\x0b\xd7\xed"
-+	"\xd3\x6f\x97\x3b\x85\x42\x80\x7e\x5f\xdc\x1b\xd6\xba\xee\xc4\x80"
-+	"\xce\x06\xa9\x15\x8c\x97\x5f\x40\x69\xb2\x4d\xc5\xb2\x5c\x1e\x01"
-+	"\x87\x7e\xe0\x36\x6d\x78\x80\x4e\x3c\x02\xec\x90\x1d\x11\x81\x74"
-+	"\xa5\x8b\xa4\xa0\x56\x06\xd5\x79\x72\x85\x57\x3b\xb2\x2e\xae\x90"
-+	"\x18\x8d\x91\xb2\x0e\x44\x19\xaa\xb4\xcc\x08\xed\x46\xfa\xd7\x2b"
-+	"\x78\x58\x72\x5d\xbb\x5e\x49\xe7\xee\xf3\x8a\x9d\x22\xa4\x19\xc8"
-+	"\xe7\x08\xc3\x90\x9b\x35\x9a\xa4\x25\x8c\x4b\x9b\xa7\xf8\xbf\x81"
-+	"\xf5\xdf\x22\x66\xf1\x7e\x9f\x66\x3d\xbb\xfa\x73\x73\x4d\xfd\x67"
-+	"\x7b\xf4\xce\xc3\x62\x2e\x6f\xbb\x0c\xa2\xdc\x69\xfc\x8a\x17\x0e"
-+	"\x3a\x9e\x83\x46\xd7\xe3\x5e\x65\x86\xc0\x51\x00\xbb\x91\xe3\xe1"
-+	"\xc1\x16\xc4\xe9\x65\x5c\x14\x3e\x44\x6a\x6b\xd1\x1e\xb0\x36\xdd"
-+	"\x0b\x7d\x8a\xeb\xaf\x58\x5b\x64\x3f\x38\xed\x52\x76\xe8\x46\xf7"
-+	"\x86\x84\xb3\x93\xb1\x0b\xe5\xfd\xfd\x0d\xe9\x6d\xe4\xf1\x1b\x1d"
-+	"\x56\xb4\x34\xe4\x6a\xf5\xa4\x9c\x2c\xc9\x64\x94\xc1\xf5\x79\x6d"
-+	"\x12\x96\xf3\x47\xc5\x48\xa8\xdb\xd8\x95\x64\x29\xcf\xf6\x88\xf1"
-+	"\x95\x7a\x98\xe8\xbc\x27\x19\xce\x73\x61\xd1\xb8\xc6\x31\x8c\xe7"
-+	"\x39\xce\x77\x9e\xbc\xc6\x31\x8c\x63\xf3\x9c\xe7\x39\xc6\x31\x8f"
-+	"\xf7\xce\x7e\x1e\x3b\x7f\x0f\x0f\x0f\x13\x57\xb9\x0a\xe1\x0b\x64"
-+	"\x5f\x58\x40\xc6\xc7\x7a\x4b\xf2\x3d\xbc\x71\xf4\xa7\xd2\xca\x14"
-+	"\xe2\x98\x1a\x30\x1e\xe0\x26\x5a\x6a\xf0\x9c\x67\x38\x66\x00\xb8"
-+	"\x72\xe6\xbe\xac\xfe\x12\xd3\x0b\x56\x73\x8c\x63\xc7\x2b\xe1\xe2"
-+	"\xe8\xdd\x7b\xff\x00\xd8\xe5\x23\x6c\xce\xa8\x69\xcf\x5e\x3a\xef"
-+	"\x77\xea\xe5\xab\x0e\x82\xdb\xd9\xed\x7a\x9e\xb8\x6d\x51\x32\xdb"
-+	"\x79\xc3\x36\x9a\x2d\xa3\x50\x39\x65\x0a\x63\x0e\xe5\xd4\x39\x12"
-+	"\xbf\x8b\x98\xa4\xa1\x2d\xad\xb3\xcf\x65\x6a\x43\x78\xb3\x3b\x07"
-+	"\xd8\xd5\xea\xae\x76\xad\x6f\xf5\xff\x00\xca\x93\xab\x96\xb0\x64"
-+	"\xeb\xd6\x4a\xd5\x87\xba\xec\x24\x60\x97\x06\x76\x03\xe3\x4c\x07"
-+	"\x29\x11\x8e\x34\x25\x02\x64\x29\xf0\x25\x48\x85\x3a\x33\x8b\x7a"
-+	"\x3c\x86\x1e\x75\xa5\x61\xc6\x97\x9f\x8d\x25\xf5\xc9\xcd\xde\xc9"
-+	"\x7d\x77\xf2\xc8\x7e\x70\xaf\x73\x5f\x2d\xec\xa2\x51\x2d\x96\xfb"
-+	"\x89\xad\x80\x57\xb2\x36\x1d\x7d\x83\x45\xac\xf3\xdb\xcc\x6c\x31"
-+	"\x4f\xcf\x30\x58\xd0\x12\x28\x90\x50\x42\x86\xfb\x48\x16\x3c\xc5"
-+	"\x9c\xf8\xe7\xcc\x29\x88\xb3\x4a\x4b\x4e\x6c\xbc\xdb\xc7\xbb\xe9"
-+	"\xb6\xa0\x8b\x11\xa1\x7d\x73\xd7\xe9\xbf\x7e\xc2\x6c\x10\x8d\xee"
-+	"\x9d\xef\x63\x3a\xe0\xf5\xbe\x8c\x3e\xa1\xc7\xc5\xd1\x00\x44\x1e"
-+	"\xf3\x51\xf2\xe2\xb0\xe3\xb5\x13\x7f\x32\xf1\x8c\xa6\x22\xfe\x1f"
-+	"\x49\x4d\xbb\xcf\x3a\x5d\xed\x4c\xd2\xfc\x85\xed\x23\xd6\xc7\x50"
-+	"\xb6\x5b\x3a\x16\x83\xb8\x6f\xfd\x32\x3f\xaa\x36\x34\xbb\xf5\x96"
-+	"\xa9\xab\xcf\x9f\x8f\xac\xc3\xca\xd5\x8b\xd8\x48\x9e\x79\xaa\x30"
-+	"\x87\xca\x58\x4d\x59\x96\xb9\x4f\xc5\x1b\x1c\xd2\xda\x5b\xe6\x57"
-+	"\x29\xa1\x28\x7a\x2b\x5b\xff\x00\x12\x2f\x5e\x3f\xf3\xbb\x8e\x7f"
-+	"\xec\xc6\x98\xff\x00\xed\x3c\xa6\xdd\xa9\xdc\x7e\xa0\xf7\xd6\x99"
-+	"\x31\xa2\xf7\xaf\x6b\xe9\x82\x74\x4b\x3d\x8f\x5e\x58\x0b\x33\xab"
-+	"\xef\xc3\xaf\x84\x64\xb9\xae\xb6\x25\x5f\x62\x8f\x1c\xe3\xf4\x51"
-+	"\xb7\x96\xe3\x0e\x30\x42\xa9\x18\x39\xbf\x9e\x2a\x1f\x74\x19\x02"
-+	"\x2d\x43\x93\x06\x63\xb1\xa7\x47\x6a\xfa\x9b\x6c\xeb\xbd\xe9\xae"
-+	"\x6a\x7b\x6f\x53\x5a\x60\x5d\xb5\xcd\xe8\x67\xeb\x35\x3b\x48\xc6"
-+	"\xa6\xb3\x04\xc8\xdf\xb8\x7e\x26\x64\xb0\xc9\x18\xb0\xa7\x33\xf2"
-+	"\x4a\x8b\x22\x3b\x8d\x4b\x89\x1d\xf6\x9d\x65\xc4\x38\xd2\x54\x9c"
-+	"\xe3\xcd\x89\xe1\xe1\xe6\x3e\x70\x81\x45\x1d\x18\xf9\x31\x83\xc8"
-+	"\xbe\x14\x82\x4b\x87\x7a\x74\x28\xd2\xdd\x12\x55\x30\xe6\x0e\x49"
-+	"\x31\x8e\x48\x69\xc5\xc0\x20\x91\xe4\x48\x41\x4c\xd8\xb9\x6a\x4e"
-+	"\x21\xce\x99\x1b\x0e\xfd\x09\x4f\xa1\x79\x0f\x0f\x0f\x0f\x0f\x0f"
-+	"\x0f\x3f\x3c\xb8\x71\x27\xc7\x72\x24\xe8\xb1\xa6\xc5\x7b\x18\xc3"
-+	"\xb1\xa5\xb0\xd4\x98\xee\xe3\x19\xc6\x71\x87\x19\x79\x2b\x6d\x78"
-+	"\xc6\x71\x8c\xe3\x0a\x4e\x71\x8c\xe3\x19\xfe\x38\xf2\x3b\xfb\x8b"
-+	"\x48\xfe\x4e\xaa\xff\x00\x4f\x08\xff\x00\xc7\xe1\xfb\x8b\x48\xfe"
-+	"\x4e\xaa\xff\x00\x4f\x08\xff\x00\xc7\xe4\x95\x86\x18\x8a\xcb\x31"
-+	"\xa3\x32\xd4\x78\xf1\xdb\x43\x2c\x47\x61\xb4\x32\xcb\x2c\xb4\x9c"
-+	"\x21\xb6\x99\x69\xbc\x25\xb6\xdb\x6d\x18\xc2\x10\xda\x12\x94\xa1"
-+	"\x38\xc2\x53\x8c\x63\x18\xc7\x9d\xbe\x7f\xff\xd9"
-+	;
-Index: php5-5.2.4/main/suhosin_patch.c
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ php5-5.2.4/main/suhosin_patch.c	2007-09-16 14:45:15.000000000 +0200
-@@ -0,0 +1,380 @@
-+/*
-+   +----------------------------------------------------------------------+
-+   | Suhosin Patch for PHP                                                |
-+   +----------------------------------------------------------------------+
-+   | Copyright (c) 2004-2006 Stefan Esser                                 |
-+   +----------------------------------------------------------------------+
-+   | This source file is subject to version 2.02 of the PHP license,      |
-+   | that is bundled with this package in the file LICENSE, and is        |
-+   | available at through the world-wide-web at                           |
-+   | http://www.php.net/license/2_02.txt.                                 |
-+   | If you did not receive a copy of the PHP license and are unable to   |
-+   | obtain it through the world-wide-web, please send a note to          |
-+   | license at php.net so we can mail you a copy immediately.               |
-+   +----------------------------------------------------------------------+
-+   | Author: Stefan Esser <sesser at hardened-php.net>                       |
-+   +----------------------------------------------------------------------+
-+ */
-+/* $Id: suhosin_patch.c,v 1.2 2004/11/21 09:38:52 ionic Exp $ */
-+
-+#include "php.h"
-+
-+#include <stdio.h>
-+#include <stdlib.h>
-+
-+#if HAVE_UNISTD_H
-+#include <unistd.h>
-+#endif
-+#include "SAPI.h"
-+#include "php_globals.h"
-+
-+#if SUHOSIN_PATCH
-+
-+#ifdef HAVE_SYS_SOCKET_H
-+#include <sys/socket.h>
-+#endif
-+
-+#if defined(PHP_WIN32) || defined(__riscos__) || defined(NETWARE)
-+#undef AF_UNIX
-+#endif
-+
-+#if defined(AF_UNIX)
-+#include <sys/un.h>
-+#endif
-+
-+#define SYSLOG_PATH  "/dev/log"
-+
-+#ifdef PHP_WIN32
-+static HANDLE log_source = 0;
-+#endif
-+
-+#include "snprintf.h"
-+
-+#include "suhosin_patch.h"
-+
-+#ifdef ZTS
-+#include "suhosin_globals.h"
-+int suhosin_patch_globals_id;
-+#else
-+struct _suhosin_patch_globals suhosin_patch_globals;
-+#endif
-+
-+static void php_security_log(int loglevel, char *fmt, ...);
-+
-+static void suhosin_patch_globals_ctor(suhosin_patch_globals_struct *suhosin_patch_globals TSRMLS_DC)
-+{
-+	memset(suhosin_patch_globals, 0, sizeof(*suhosin_patch_globals));
-+}
-+
-+PHPAPI void suhosin_startup()
-+{
-+#ifdef ZTS
-+	ts_allocate_id(&suhosin_patch_globals_id, sizeof(suhosin_patch_globals_struct), (ts_allocate_ctor) suhosin_patch_globals_ctor, NULL);
-+#else
-+	suhosin_patch_globals_ctor(&suhosin_patch_globals TSRMLS_CC);
-+#endif
-+	zend_suhosin_log = php_security_log;
-+}
-+
-+/*PHPAPI void suhosin_clear_mm_canaries(TSRMLS_D)
-+{
-+    zend_alloc_clear_mm_canaries(AG(heap));
-+	SPG(canary_1) = zend_canary();
-+	SPG(canary_2) = zend_canary();
-+	SPG(canary_3) = zend_canary();
-+}*/
-+
-+static char *loglevel2string(int loglevel)
-+{
-+	switch (loglevel) {
-+	    case S_FILES:
-+		return "FILES";
-+	    case S_INCLUDE:
-+		return "INCLUDE";
-+	    case S_MEMORY:
-+		return "MEMORY";
-+	    case S_MISC:
-+		return "MISC";
-+		case S_SESSION:
-+		return "SESSION";
-+	    case S_SQL:
-+		return "SQL";
-+	    case S_EXECUTOR:
-+		return "EXECUTOR";
-+	    case S_VARS:
-+		return "VARS";
-+	    default:
-+		return "UNKNOWN";    
-+	}
-+}
-+
-+static void php_security_log(int loglevel, char *fmt, ...)
-+{
-+	int s, r, i=0;
-+#if defined(AF_UNIX)
-+	struct sockaddr_un saun;
-+#endif
-+#ifdef PHP_WIN32
-+	LPTSTR strs[2];
-+	unsigned short etype;
-+	DWORD evid;
-+#endif
-+	char buf[4096+64];
-+	char error[4096+100];
-+	char *ip_address;
-+	char *fname;
-+	char *alertstring;
-+	int lineno;
-+	va_list ap;
-+	TSRMLS_FETCH();
-+
-+	/*SDEBUG("(suhosin_log) loglevel: %d log_syslog: %u - log_sapi: %u - log_script: %u", loglevel, SPG(log_syslog), SPG(log_sapi), SPG(log_script));*/
-+	
-+	if (SPG(log_use_x_forwarded_for)) {
-+		ip_address = sapi_getenv("HTTP_X_FORWARDED_FOR", 20 TSRMLS_CC);
-+		if (ip_address == NULL) {
-+			ip_address = "X-FORWARDED-FOR not set";
-+		}
-+	} else {
-+		ip_address = sapi_getenv("REMOTE_ADDR", 11 TSRMLS_CC);
-+		if (ip_address == NULL) {
-+			ip_address = "REMOTE_ADDR not set";
-+		}
-+	}
-+	
-+	
-+	va_start(ap, fmt);
-+	ap_php_vsnprintf(error, sizeof(error), fmt, ap);
-+	va_end(ap);
-+	while (error[i]) {
-+		if (error[i] < 32) error[i] = '.';
-+		i++;
-+	}
-+	
-+/*	if (SPG(simulation)) {
-+		alertstring = "ALERT-SIMULATION";
-+	} else { */
-+		alertstring = "ALERT";
-+/*	}*/
-+	
-+	if (zend_is_executing(TSRMLS_C)) {
-+		if (EG(current_execute_data)) {
-+			lineno = EG(current_execute_data)->opline->lineno;
-+			fname = EG(current_execute_data)->op_array->filename;
-+		} else {
-+			lineno = zend_get_executed_lineno(TSRMLS_C);
-+			fname = zend_get_executed_filename(TSRMLS_C);
-+		}
-+		ap_php_snprintf(buf, sizeof(buf), "%s - %s (attacker '%s', file '%s', line %u)", alertstring, error, ip_address, fname, lineno);
-+	} else {
-+		fname = sapi_getenv("SCRIPT_FILENAME", 15 TSRMLS_CC);
-+		if (fname==NULL) {
-+			fname = "unknown";
-+		}
-+		ap_php_snprintf(buf, sizeof(buf), "%s - %s (attacker '%s', file '%s')", alertstring, error, ip_address, fname);
-+	}
-+			
-+	/* Syslog-Logging disabled? */
-+	if (((SPG(log_syslog)|S_INTERNAL) & loglevel)==0) {
-+		goto log_sapi;
-+	}	
-+	
-+#if defined(AF_UNIX)
-+	ap_php_snprintf(error, sizeof(error), "<%u>suhosin[%u]: %s\n", (unsigned int)(SPG(log_syslog_facility)|SPG(log_syslog_priority)),getpid(),buf);
-+
-+	s = socket(AF_UNIX, SOCK_DGRAM, 0);
-+	if (s == -1) {
-+		goto log_sapi;
-+	}
-+	
-+	memset(&saun, 0, sizeof(saun));
-+	saun.sun_family = AF_UNIX;
-+	strcpy(saun.sun_path, SYSLOG_PATH);
-+	/*saun.sun_len = sizeof(saun);*/
-+	
-+	r = connect(s, (struct sockaddr *)&saun, sizeof(saun));
-+	if (r) {
-+		close(s);
-+    		s = socket(AF_UNIX, SOCK_STREAM, 0);
-+		if (s == -1) {
-+			goto log_sapi;
-+		}
-+	
-+		memset(&saun, 0, sizeof(saun));
-+		saun.sun_family = AF_UNIX;
-+		strcpy(saun.sun_path, SYSLOG_PATH);
-+		/*saun.sun_len = sizeof(saun);*/
-+
-+		r = connect(s, (struct sockaddr *)&saun, sizeof(saun));
-+		if (r) { 
-+			close(s);
-+			goto log_sapi;
-+		}
-+	}
-+	send(s, error, strlen(error), 0);
-+	
-+	close(s);
-+#endif
-+#ifdef PHP_WIN32
-+	ap_php_snprintf(error, sizeof(error), "suhosin[%u]: %s", getpid(),buf);
-+
-+	switch (SPG(log_syslog_priority)) {			/* translate UNIX type into NT type */
-+		case 1: /*LOG_ALERT:*/
-+			etype = EVENTLOG_ERROR_TYPE;
-+			break;
-+		case 6: /*LOG_INFO:*/
-+			etype = EVENTLOG_INFORMATION_TYPE;
-+			break;
-+		default:
-+			etype = EVENTLOG_WARNING_TYPE;
-+	}
-+	evid = loglevel;
-+	strs[0] = error;
-+	/* report the event */
-+	if (log_source == NULL) {
-+		log_source = RegisterEventSource(NULL, "Suhosin-Patch-" SUHOSIN_PATCH_VERSION);
-+	}
-+	ReportEvent(log_source, etype, (unsigned short) SPG(log_syslog_priority), evid, NULL, 1, 0, strs, NULL);
-+	
-+#endif
-+log_sapi:
-+	/* SAPI Logging activated? */
-+	/*SDEBUG("(suhosin_log) log_syslog: %u - log_sapi: %u - log_script: %u - log_phpscript: %u", SPG(log_syslog), SPG(log_sapi), SPG(log_script), SPG(log_phpscript));*/
-+	if (((SPG(log_sapi)|S_INTERNAL) & loglevel)!=0) {
-+		sapi_module.log_message(buf);
-+	}
-+
-+/*log_script:*/
-+	/* script logging activaed? */
-+	if (((SPG(log_script) & loglevel)!=0) && SPG(log_scriptname)!=NULL) {
-+		char cmd[8192], *cmdpos, *bufpos;
-+		FILE *in;
-+		int space;
-+		
-+		ap_php_snprintf(cmd, sizeof(cmd), "%s %s \'", SPG(log_scriptname), loglevel2string(loglevel));
-+		space = sizeof(cmd) - strlen(cmd);
-+		cmdpos = cmd + strlen(cmd);
-+		bufpos = buf;
-+		if (space <= 1) return;
-+		while (space > 2 && *bufpos) {
-+			if (*bufpos == '\'') {
-+				if (space<=5) break;
-+				*cmdpos++ = '\'';
-+				*cmdpos++ = '\\';
-+				*cmdpos++ = '\'';
-+				*cmdpos++ = '\'';
-+				bufpos++;
-+				space-=4;
-+			} else {
-+				*cmdpos++ = *bufpos++;
-+				space--;
-+			}
-+		}
-+		*cmdpos++ = '\'';
-+		*cmdpos = 0;
-+		
-+		if ((in=VCWD_POPEN(cmd, "r"))==NULL) {
-+			php_security_log(S_INTERNAL, "Unable to execute logging shell script: %s", SPG(log_scriptname));
-+			return;
-+		}
-+		/* read and forget the result */
-+		while (1) {
-+			int readbytes = fread(cmd, 1, sizeof(cmd), in);
-+			if (readbytes<=0) {
-+				break;
-+			}
-+		}
-+		pclose(in);
-+	}
-+/*log_phpscript:*/
-+	if ((SPG(log_phpscript) & loglevel)!=0 && EG(in_execution) && SPG(log_phpscriptname) && SPG(log_phpscriptname)[0]) {
-+		zend_file_handle file_handle;
-+		zend_op_array *new_op_array;
-+		zval *result = NULL;
-+		
-+		/*long orig_execution_depth = SPG(execution_depth);*/
-+		zend_bool orig_safe_mode = PG(safe_mode);
-+		char *orig_basedir = PG(open_basedir);
-+		
-+		char *phpscript = SPG(log_phpscriptname);
-+/*SDEBUG("scriptname %s", SPG(log_phpscriptname));`*/
-+#ifdef ZEND_ENGINE_2
-+		if (zend_stream_open(phpscript, &file_handle TSRMLS_CC) == SUCCESS) {
-+#else
-+		if (zend_open(phpscript, &file_handle) == SUCCESS && ZEND_IS_VALID_FILE_HANDLE(&file_handle)) {
-+			file_handle.filename = phpscript;
-+			file_handle.free_filename = 0;
-+#endif		
-+			if (!file_handle.opened_path) {
-+				file_handle.opened_path = estrndup(phpscript, strlen(phpscript));
-+			}
-+			new_op_array = zend_compile_file(&file_handle, ZEND_REQUIRE TSRMLS_CC);
-+			zend_destroy_file_handle(&file_handle TSRMLS_CC);
-+			if (new_op_array) {
-+				HashTable *active_symbol_table = EG(active_symbol_table);
-+				zval *zerror, *zerror_class;
-+				
-+				if (active_symbol_table == NULL) {
-+					active_symbol_table = &EG(symbol_table);
-+				}
-+				EG(return_value_ptr_ptr) = &result;
-+				EG(active_op_array) = new_op_array;
-+				
-+				MAKE_STD_ZVAL(zerror);
-+				MAKE_STD_ZVAL(zerror_class);
-+				ZVAL_STRING(zerror, buf, 1);
-+				ZVAL_LONG(zerror_class, loglevel);
-+
-+				zend_hash_update(active_symbol_table, "SUHOSIN_ERROR", sizeof("SUHOSIN_ERROR"), (void **)&zerror, sizeof(zval *), NULL);
-+				zend_hash_update(active_symbol_table, "SUHOSIN_ERRORCLASS", sizeof("SUHOSIN_ERRORCLASS"), (void **)&zerror_class, sizeof(zval *), NULL);
-+				
-+				/*SPG(execution_depth) = 0;*/
-+				if (SPG(log_phpscript_is_safe)) {
-+					PG(safe_mode) = 0;
-+					PG(open_basedir) = NULL;
-+				}
-+				
-+				zend_execute(new_op_array TSRMLS_CC);
-+				
-+				/*SPG(execution_depth) = orig_execution_depth;*/
-+				PG(safe_mode) = orig_safe_mode;
-+				PG(open_basedir) = orig_basedir;
-+				
-+#ifdef ZEND_ENGINE_2
-+				destroy_op_array(new_op_array TSRMLS_CC);
-+#else
-+				destroy_op_array(new_op_array);
-+#endif
-+				efree(new_op_array);
-+#ifdef ZEND_ENGINE_2
-+				if (!EG(exception))
-+#endif			
-+				{
-+					if (EG(return_value_ptr_ptr)) {
-+						zval_ptr_dtor(EG(return_value_ptr_ptr));
-+						EG(return_value_ptr_ptr) = NULL;
-+					}
-+				}
-+			} else {
-+				php_security_log(S_INTERNAL, "Unable to execute logging PHP script: %s", SPG(log_phpscriptname));
-+				return;
-+			}
-+		} else {
-+			php_security_log(S_INTERNAL, "Unable to execute logging PHP script: %s", SPG(log_phpscriptname));
-+			return;
-+		}
-+	}
-+
-+}
-+
-+
-+#endif
-+
-+/*
-+ * Local variables:
-+ * tab-width: 4
-+ * c-basic-offset: 4
-+ * End:
-+ * vim600: sw=4 ts=4 fdm=marker
-+ * vim<600: sw=4 ts=4
-+ */
-Index: php5-5.2.4/main/suhosin_patch.h
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ php5-5.2.4/main/suhosin_patch.h	2007-09-16 14:45:15.000000000 +0200
-@@ -0,0 +1,40 @@
-+/*
-+   +----------------------------------------------------------------------+
-+   | Suhosin Patch for PHP                                                |
-+   +----------------------------------------------------------------------+
-+   | Copyright (c) 2004-2006 Stefan Esser                                 |
-+   +----------------------------------------------------------------------+
-+   | This source file is subject to version 2.02 of the PHP license,      |
-+   | that is bundled with this package in the file LICENSE, and is        |
-+   | available at through the world-wide-web at                           |
-+   | http://www.php.net/license/2_02.txt.                                 |
-+   | If you did not receive a copy of the PHP license and are unable to   |
-+   | obtain it through the world-wide-web, please send a note to          |
-+   | license at php.net so we can mail you a copy immediately.               |
-+   +----------------------------------------------------------------------+
-+   | Author: Stefan Esser <sesser at hardened-php.net>                       |
-+   +----------------------------------------------------------------------+
-+ */
-+
-+#ifndef SUHOSIN_PATCH_H
-+#define SUHOSIN_PATCH_H
-+
-+#if SUHOSIN_PATCH
-+
-+#include "zend.h"
-+
-+PHPAPI void suhosin_startup();
-+#define SUHOSIN_PATCH_VERSION "0.9.6.2"
-+
-+#define SUHOSIN_LOGO_GUID "SUHO8567F54-D428-14d2-A769-00DA302A5F18"
-+
-+#endif
-+
-+#endif /* SUHOSIN_PATCH_H */
-+
-+/*
-+ * Local variables:
-+ * tab-width: 4
-+ * c-basic-offset: 4
-+ * End:
-+ */
-Index: php5-5.2.4/main/suhosin_patch.m4
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ php5-5.2.4/main/suhosin_patch.m4	2007-09-16 14:45:15.000000000 +0200
-@@ -0,0 +1,8 @@
-+dnl
-+dnl $Id: suhosin_patch.m4,v 1.1 2004/11/14 13:24:24 ionic Exp $
-+dnl
-+dnl This file contains Suhosin Patch for PHP specific autoconf functions.
-+dnl
-+
-+AC_DEFINE(SUHOSIN_PATCH, 1, [Suhosin Patch])
-+
-Index: php5-5.2.4/sapi/apache/mod_php5.c
-===================================================================
---- php5-5.2.4.orig/sapi/apache/mod_php5.c	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/sapi/apache/mod_php5.c	2007-09-16 14:45:15.000000000 +0200
-@@ -951,7 +951,11 @@
- 	{
- 		TSRMLS_FETCH();
- 		if (PG(expose_php)) {
-+#if SUHOSIN_PATCH
-+			ap_add_version_component("PHP/" PHP_VERSION " with Suhosin-Patch");
-+#else
- 			ap_add_version_component("PHP/" PHP_VERSION);
-+#endif			
- 		}
- 	}
- #endif
-Index: php5-5.2.4/sapi/apache2filter/sapi_apache2.c
-===================================================================
---- php5-5.2.4.orig/sapi/apache2filter/sapi_apache2.c	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/sapi/apache2filter/sapi_apache2.c	2007-09-16 14:45:15.000000000 +0200
-@@ -562,7 +562,11 @@
- {
- 	TSRMLS_FETCH();
- 	if (PG(expose_php)) {
-+#if SUHOSIN_PATCH
-+		ap_add_version_component(p, "PHP/" PHP_VERSION " with Suhosin-Patch");
-+#else
- 		ap_add_version_component(p, "PHP/" PHP_VERSION);
-+#endif
- 	}
- }
- 
-Index: php5-5.2.4/sapi/apache2handler/sapi_apache2.c
-===================================================================
---- php5-5.2.4.orig/sapi/apache2handler/sapi_apache2.c	2007-09-16 14:45:14.000000000 +0200
-+++ php5-5.2.4/sapi/apache2handler/sapi_apache2.c	2007-09-16 14:45:15.000000000 +0200
-@@ -372,7 +372,11 @@
- {
- 	TSRMLS_FETCH();
- 	if (PG(expose_php)) {
-+#if SUHOSIN_PATCH
-+		ap_add_version_component(p, "PHP/" PHP_VERSION " with Suhosin-Patch");
-+#else
- 		ap_add_version_component(p, "PHP/" PHP_VERSION);
-+#endif
- 	}
- }
- 
-Index: php5-5.2.4/sapi/cgi/cgi_main.c
-===================================================================
---- php5-5.2.4.orig/sapi/cgi/cgi_main.c	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/sapi/cgi/cgi_main.c	2007-09-16 14:45:15.000000000 +0200
-@@ -1595,11 +1595,19 @@
- 							SG(headers_sent) = 1;
- 							SG(request_info).no_headers = 1;
- 						}
-+#if SUHOSIN_PATCH
-+#if ZEND_DEBUG
-+						php_printf("PHP %s with Suhosin-Patch %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2007 The PHP Group\n%s", PHP_VERSION, SUHOSIN_PATCH_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
-+#else
-+						php_printf("PHP %s with Suhosin-Patch %s (%s) (built: %s %s)\nCopyright (c) 1997-2007 The PHP Group\n%s", PHP_VERSION, SUHOSIN_PATCH_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
-+#endif
-+#else
- #if ZEND_DEBUG
- 						php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2007 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
- #else
- 						php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2007 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
- #endif
-+#endif
- 						php_end_ob_buffers(1 TSRMLS_CC);
- 						exit(0);
- 						break;
-Index: php5-5.2.4/sapi/cli/php_cli.c
-===================================================================
---- php5-5.2.4.orig/sapi/cli/php_cli.c	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/sapi/cli/php_cli.c	2007-09-16 14:45:15.000000000 +0200
-@@ -779,8 +779,14 @@
- 				}
- 
- 				request_started = 1;
--				php_printf("PHP %s (%s) (built: %s %s) %s\nCopyright (c) 1997-2007 The PHP Group\n%s",
--					PHP_VERSION, sapi_module.name, __DATE__, __TIME__,
-+#if SUHOSIN_PATCH
-+				php_printf("PHP %s with Suhosin-Patch %s (%s) (built: %s %s) %s\nCopyright (c) 1997-2007 The PHP Group\n%s", 
-+					PHP_VERSION, SUHOSIN_PATCH_VERSION,
-+#else
-+			    php_printf("PHP %s (%s) (built: %s %s) %s\nCopyright (c) 1997-2007 The PHP Group\n%s",
-+					PHP_VERSION,
-+#endif
-+					sapi_module.name, __DATE__, __TIME__,
- #if ZEND_DEBUG && defined(HAVE_GCOV)
- 					"(DEBUG GCOV)",
- #elif ZEND_DEBUG
-Index: php5-5.2.4/TSRM/TSRM.h
-===================================================================
---- php5-5.2.4.orig/TSRM/TSRM.h	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/TSRM/TSRM.h	2007-09-16 14:45:15.000000000 +0200
+diff -Nura php-5.2.5/TSRM/TSRM.h suhosin-patch-5.2.5-0.9.6.2/TSRM/TSRM.h
+--- php-5.2.5/TSRM/TSRM.h	2007-04-17 08:26:32.000000000 +0200
++++ suhosin-patch-5.2.5-0.9.6.2/TSRM/TSRM.h	2007-11-10 01:38:46.000000000 +0100
 @@ -38,6 +38,13 @@
  typedef unsigned long tsrm_uintptr_t;
  #endif
@@ -1212,11 +23,10 @@
  #ifdef __cplusplus
  extern "C" {
  #endif
-Index: php5-5.2.4/TSRM/tsrm_virtual_cwd.c
-===================================================================
---- php5-5.2.4.orig/TSRM/tsrm_virtual_cwd.c	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/TSRM/tsrm_virtual_cwd.c	2007-09-16 14:45:15.000000000 +0200
-@@ -273,6 +273,177 @@
+diff -Nura php-5.2.5/TSRM/tsrm_virtual_cwd.c suhosin-patch-5.2.5-0.9.6.2/TSRM/tsrm_virtual_cwd.c
+--- php-5.2.5/TSRM/tsrm_virtual_cwd.c	2007-10-23 07:57:35.000000000 +0200
++++ suhosin-patch-5.2.5-0.9.6.2/TSRM/tsrm_virtual_cwd.c	2007-11-10 02:45:52.000000000 +0100
+@@ -273,6 +273,178 @@
  }
  /* }}} */
  
@@ -1316,8 +126,9 @@
 +                     if (errno == ENOENT) {
 +		     if (p == NULL) {
 +	         		errno = serrno;
++				return NULL;
 +                     		return (resolved);
-+    			} else if (strstr(left, "/.") == NULL && strstr(left, "./") == NULL) {
++    			} /*else if (strstr(left, "/.") == NULL && strstr(left, "./") == NULL) {
 +         				resolved_len = strlcat(resolved, "/", PATH_MAX);
 +         				resolved_len = strlcat(resolved, left, PATH_MAX);
 +         				if (resolved_len >= PATH_MAX) {
@@ -1326,7 +137,7 @@
 +         				}
 +                         		errno = serrno;
 +                         		return (resolved);
-+				}
++				} */
 +                     }
 +                     return (NULL);
 +             }
@@ -1394,10 +205,9 @@
  CWD_API void virtual_cwd_startup(void) /* {{{ */
  {
  	char cwd[MAXPATHLEN];
-Index: php5-5.2.4/TSRM/tsrm_virtual_cwd.h
-===================================================================
---- php5-5.2.4.orig/TSRM/tsrm_virtual_cwd.h	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/TSRM/tsrm_virtual_cwd.h	2007-09-16 14:45:15.000000000 +0200
+diff -Nura php-5.2.5/TSRM/tsrm_virtual_cwd.h suhosin-patch-5.2.5-0.9.6.2/TSRM/tsrm_virtual_cwd.h
+--- php-5.2.5/TSRM/tsrm_virtual_cwd.h	2007-01-22 10:31:46.000000000 +0100
++++ suhosin-patch-5.2.5-0.9.6.2/TSRM/tsrm_virtual_cwd.h	2007-11-10 01:38:46.000000000 +0100
 @@ -139,6 +139,22 @@
  
  typedef int (*verify_path_func)(const cwd_state *);
@@ -1421,32 +231,9 @@
  CWD_API void virtual_cwd_startup(void);
  CWD_API void virtual_cwd_shutdown(void);
  CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC);
-Index: php5-5.2.4/win32/build/config.w32
-===================================================================
---- php5-5.2.4.orig/win32/build/config.w32	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/win32/build/config.w32	2007-09-16 14:45:15.000000000 +0200
-@@ -299,7 +299,7 @@
- 	zend_sprintf.c zend_ini.c zend_qsort.c zend_multibyte.c zend_ts_hash.c \
- 	zend_stream.c zend_iterators.c zend_interfaces.c zend_objects.c \
- 	zend_object_handlers.c zend_objects_API.c \
--	zend_default_classes.c zend_execute.c zend_strtod.c");
-+	zend_default_classes.c zend_execute.c zend_strtod.c zend_canary.c");
- 
- ADD_SOURCES("main", "main.c snprintf.c spprintf.c safe_mode.c fopen_wrappers.c \
- 	php_scandir.c php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \
-@@ -344,6 +344,8 @@
- AC_DEFINE('HAVE_USLEEP', 1);
- AC_DEFINE('HAVE_STRCOLL', 1);
- 
-+AC_DEFINE('SUHOSIN_PATCH', 1);
-+
- /* For snapshot builders, where can we find the additional
-  * files that make up the snapshot template? */
- ARG_WITH("snapshot-template", "Path to snapshot builder template dir", "no");
-Index: php5-5.2.4/Zend/Makefile.am
-===================================================================
---- php5-5.2.4.orig/Zend/Makefile.am	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/Zend/Makefile.am	2007-09-16 14:45:15.000000000 +0200
+diff -Nura php-5.2.5/Zend/Makefile.am suhosin-patch-5.2.5-0.9.6.2/Zend/Makefile.am
+--- php-5.2.5/Zend/Makefile.am	2006-12-05 09:07:57.000000000 +0100
++++ suhosin-patch-5.2.5-0.9.6.2/Zend/Makefile.am	2007-11-10 01:38:46.000000000 +0100
 @@ -17,7 +17,7 @@
  	zend_objects_API.c zend_ts_hash.c zend_stream.c \
  	zend_default_classes.c \
@@ -1456,10 +243,167 @@
  
  libZend_la_LDFLAGS =
  libZend_la_LIBADD = @ZEND_EXTRA_LIBS@
-Index: php5-5.2.4/Zend/zend_alloc.c
-===================================================================
---- php5-5.2.4.orig/Zend/zend_alloc.c	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/Zend/zend_alloc.c	2007-09-16 14:45:15.000000000 +0200
+diff -Nura php-5.2.5/Zend/Zend.dsp suhosin-patch-5.2.5-0.9.6.2/Zend/Zend.dsp
+--- php-5.2.5/Zend/Zend.dsp	2006-12-05 09:07:57.000000000 +0100
++++ suhosin-patch-5.2.5-0.9.6.2/Zend/Zend.dsp	2007-11-10 01:38:46.000000000 +0100
+@@ -239,6 +239,10 @@
+ # End Source File
+ # Begin Source File
+ 
++SOURCE=.\zend_canary.c
++# End Source File
++# Begin Source File
++
+ SOURCE=.\zend_ts_hash.c
+ # End Source File
+ # Begin Source File
+diff -Nura php-5.2.5/Zend/ZendTS.dsp suhosin-patch-5.2.5-0.9.6.2/Zend/ZendTS.dsp
+--- php-5.2.5/Zend/ZendTS.dsp	2006-12-05 09:07:57.000000000 +0100
++++ suhosin-patch-5.2.5-0.9.6.2/Zend/ZendTS.dsp	2007-11-10 01:38:46.000000000 +0100
+@@ -273,6 +273,10 @@
+ # End Source File
+ # Begin Source File
+ 
++SOURCE=.\zend_canary.c
++# End Source File
++# Begin Source File
++
+ SOURCE=.\zend_ts_hash.c
+ # End Source File
+ # Begin Source File
+diff -Nura php-5.2.5/Zend/zend.c suhosin-patch-5.2.5-0.9.6.2/Zend/zend.c
+--- php-5.2.5/Zend/zend.c	2007-07-21 02:35:14.000000000 +0200
++++ suhosin-patch-5.2.5-0.9.6.2/Zend/zend.c	2007-11-10 01:38:46.000000000 +0100
+@@ -57,7 +57,9 @@
+ ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args);
+ int (*zend_vspprintf)(char **pbuf, size_t max_len, const char *format, va_list ap);
+ ZEND_API char *(*zend_getenv)(char *name, size_t name_len TSRMLS_DC);
+-
++#if SUHOSIN_PATCH
++ZEND_API void (*zend_suhosin_log)(int loglevel, char *fmt, ...);
++#endif
+ void (*zend_on_timeout)(int seconds TSRMLS_DC);
+ 
+ static void (*zend_message_dispatcher_p)(long message, void *data);
+@@ -74,9 +76,88 @@
+ 	return SUCCESS;
+ }
+ 
++#if SUHOSIN_PATCH
++static ZEND_INI_MH(OnUpdateSuhosin_log_syslog)
++{
++	if (!new_value) {
++		SPG(log_syslog) = S_ALL & ~S_SQL | S_MEMORY;
++	} else {
++		SPG(log_syslog) = atoi(new_value) | S_MEMORY;
++	}
++	return SUCCESS;
++}
++static ZEND_INI_MH(OnUpdateSuhosin_log_syslog_facility)
++{
++	if (!new_value) {
++		SPG(log_syslog_facility) = LOG_USER;
++	} else {
++		SPG(log_syslog_facility) = atoi(new_value);
++	}
++	return SUCCESS;
++}
++static ZEND_INI_MH(OnUpdateSuhosin_log_syslog_priority)
++{
++	if (!new_value) {
++		SPG(log_syslog_priority) = LOG_ALERT;
++	} else {
++		SPG(log_syslog_priority) = atoi(new_value);
++	}
++	return SUCCESS;
++}
++static ZEND_INI_MH(OnUpdateSuhosin_log_sapi)
++{
++	if (!new_value) {
++		SPG(log_sapi) = S_ALL & ~S_SQL;
++	} else {
++		SPG(log_sapi) = atoi(new_value);
++	}
++	return SUCCESS;
++}
++static ZEND_INI_MH(OnUpdateSuhosin_log_script)
++{
++	if (!new_value) {
++		SPG(log_script) = S_ALL & ~S_MEMORY;
++	} else {
++		SPG(log_script) = atoi(new_value) & (~S_MEMORY) & (~S_INTERNAL);
++	}
++	return SUCCESS;
++}
++static ZEND_INI_MH(OnUpdateSuhosin_log_scriptname)
++{
++	if (SPG(log_scriptname)) {
++		pefree(SPG(log_scriptname),1);
++	}
++        SPG(log_scriptname) = NULL;
++	if (new_value) {
++		SPG(log_scriptname) = pestrdup(new_value,1);
++	}
++	return SUCCESS;
++}
++static ZEND_INI_MH(OnUpdateSuhosin_log_phpscript)
++{
++	if (!new_value) {
++		SPG(log_phpscript) = S_ALL & ~S_MEMORY;
++	} else {
++		SPG(log_phpscript) = atoi(new_value) & (~S_MEMORY) & (~S_INTERNAL);
++	}
++	return SUCCESS;
++}
++#endif
+ 
+ ZEND_INI_BEGIN()
+ 	ZEND_INI_ENTRY("error_reporting",				NULL,		ZEND_INI_ALL,		OnUpdateErrorReporting)
++#if SUHOSIN_PATCH
++	ZEND_INI_ENTRY("suhosin.log.syslog",			NULL,		ZEND_INI_PERDIR|ZEND_INI_SYSTEM,	OnUpdateSuhosin_log_syslog)
++	ZEND_INI_ENTRY("suhosin.log.syslog.facility",		NULL,		ZEND_INI_PERDIR|ZEND_INI_SYSTEM,	OnUpdateSuhosin_log_syslog_facility)
++	ZEND_INI_ENTRY("suhosin.log.syslog.priority",		NULL,		ZEND_INI_PERDIR|ZEND_INI_SYSTEM,	OnUpdateSuhosin_log_syslog_priority)
++	ZEND_INI_ENTRY("suhosin.log.sapi",				NULL,		ZEND_INI_PERDIR|ZEND_INI_SYSTEM,	OnUpdateSuhosin_log_sapi)
++	ZEND_INI_ENTRY("suhosin.log.script",			NULL,		ZEND_INI_PERDIR|ZEND_INI_SYSTEM,	OnUpdateSuhosin_log_script)
++	ZEND_INI_ENTRY("suhosin.log.script.name",			NULL,		ZEND_INI_SYSTEM,	OnUpdateSuhosin_log_scriptname)
++	STD_ZEND_INI_BOOLEAN("suhosin.log.use-x-forwarded-for",	"0",		ZEND_INI_PERDIR|ZEND_INI_SYSTEM,	OnUpdateBool, log_use_x_forwarded_for,	suhosin_patch_globals_struct,	suhosin_patch_globals)
++	ZEND_INI_ENTRY("suhosin.log.phpscript",			"0",		ZEND_INI_PERDIR|ZEND_INI_SYSTEM,	OnUpdateSuhosin_log_phpscript)
++	STD_ZEND_INI_ENTRY("suhosin.log.phpscript.name",			NULL,		ZEND_INI_PERDIR|ZEND_INI_SYSTEM,	OnUpdateString, log_phpscriptname, suhosin_patch_globals_struct,	suhosin_patch_globals)
++	STD_ZEND_INI_BOOLEAN("suhosin.log.phpscript.is_safe",			"0",		ZEND_INI_SYSTEM,	OnUpdateBool, log_phpscript_is_safe,	suhosin_patch_globals_struct,	suhosin_patch_globals)
++#endif
+ 	STD_ZEND_INI_BOOLEAN("zend.ze1_compatibility_mode",	"0",	ZEND_INI_ALL,		OnUpdateBool,	ze1_compatibility_mode,	zend_executor_globals,	executor_globals)
+ #ifdef ZEND_MULTIBYTE
+ 	STD_ZEND_INI_BOOLEAN("detect_unicode", "1", ZEND_INI_ALL, OnUpdateBool, detect_unicode, zend_compiler_globals, compiler_globals)
+diff -Nura php-5.2.5/Zend/zend.h suhosin-patch-5.2.5-0.9.6.2/Zend/zend.h
+--- php-5.2.5/Zend/zend.h	2007-07-23 18:17:10.000000000 +0200
++++ suhosin-patch-5.2.5-0.9.6.2/Zend/zend.h	2007-11-10 01:38:46.000000000 +0100
+@@ -520,6 +520,9 @@
+ extern ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
+ extern int (*zend_vspprintf)(char **pbuf, size_t max_len, const char *format, va_list ap);
+ extern ZEND_API char *(*zend_getenv)(char *name, size_t name_len TSRMLS_DC);
++#if SUHOSIN_PATCH
++extern ZEND_API void (*zend_suhosin_log)(int loglevel, char *fmt, ...);
++#endif
+ 
+ 
+ ZEND_API void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
+@@ -651,6 +654,13 @@
+ #include "zend_operators.h"
+ #include "zend_variables.h"
+ 
++#if SUHOSIN_PATCH
++#include "suhosin_globals.h"
++#include "php_syslog.h"
++
++ZEND_API size_t zend_canary();
++#endif
++
+ #endif /* ZEND_H */
+ 
+ /*
+diff -Nura php-5.2.5/Zend/zend_alloc.c suhosin-patch-5.2.5-0.9.6.2/Zend/zend_alloc.c
+--- php-5.2.5/Zend/zend_alloc.c	2007-10-25 09:30:29.000000000 +0200
++++ suhosin-patch-5.2.5-0.9.6.2/Zend/zend_alloc.c	2007-11-10 01:38:46.000000000 +0100
 @@ -311,13 +311,26 @@
  #define	MEM_BLOCK_GUARD  0x2A8FCC84
  #define	MEM_BLOCK_LEAK   0x6C5E8F2D
@@ -1489,7 +433,7 @@
  } zend_mm_block_info;
  
  #if ZEND_DEBUG
-@@ -422,6 +435,9 @@
+@@ -423,6 +436,9 @@
  		int miss;
  	} cache_stat[ZEND_MM_NUM_BUCKETS+1];
  #endif
@@ -1499,7 +443,7 @@
  };
  
  #define ZEND_MM_SMALL_FREE_BUCKET(heap, index) \
-@@ -511,15 +527,15 @@
+@@ -512,15 +528,15 @@
  #define ZEND_MM_ALIGNED_SIZE(size)			((size + ZEND_MM_ALIGNMENT - 1) & ZEND_MM_ALIGNMENT_MASK)
  #define ZEND_MM_ALIGNED_HEADER_SIZE			ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_block))
  #define ZEND_MM_ALIGNED_FREE_HEADER_SIZE	ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_small_free_block))
@@ -1518,7 +462,7 @@
  
  #define ZEND_MM_BUCKET_INDEX(true_size)		((true_size>>ZEND_MM_ALIGNMENT_LOG2)-(ZEND_MM_ALIGNED_MIN_HEADER_SIZE>>ZEND_MM_ALIGNMENT_LOG2))
  
-@@ -581,6 +597,48 @@
+@@ -582,6 +598,48 @@
  
  #endif
  
@@ -1567,7 +511,7 @@
  
  #if ZEND_MM_HEAP_PROTECTION
  
-@@ -779,6 +837,12 @@
+@@ -780,6 +838,12 @@
  	if (EXPECTED(prev == mm_block)) {
  		zend_mm_free_block **rp, **cp;
  
@@ -1580,7 +524,7 @@
  #if ZEND_MM_SAFE_UNLINKING
  		if (UNEXPECTED(next != mm_block)) {
  			zend_mm_panic("zend_mm_heap corrupted");
-@@ -817,6 +881,12 @@
+@@ -818,6 +882,12 @@
  		}
  	} else {
  
@@ -1593,7 +537,7 @@
  #if ZEND_MM_SAFE_UNLINKING
  		if (UNEXPECTED(prev->next_free_block != mm_block) || UNEXPECTED(next->prev_free_block != mm_block)) {
  			zend_mm_panic("zend_mm_heap corrupted");
-@@ -864,6 +934,11 @@
+@@ -865,6 +935,11 @@
  		heap->large_free_buckets[i] = NULL;
  	}
  	heap->rest_buckets[0] = heap->rest_buckets[1] = ZEND_MM_REST_BUCKET(heap);
@@ -1605,7 +549,7 @@
  }
  
  static void zend_mm_del_segment(zend_mm_heap *heap, zend_mm_segment *segment)
-@@ -1741,6 +1816,11 @@
+@@ -1755,6 +1830,11 @@
  			best_fit = heap->cache[index];
  			heap->cache[index] = best_fit->prev_free_block;
  			heap->cached -= true_size;
@@ -1617,7 +561,7 @@
  			ZEND_MM_CHECK_MAGIC(best_fit, MEM_BLOCK_CACHED);
  			ZEND_MM_SET_DEBUG_INFO(best_fit, size, 1, 0);
  			return ZEND_MM_DATA_OF(best_fit);
-@@ -1875,6 +1955,12 @@
+@@ -1889,6 +1969,12 @@
  
  	ZEND_MM_SET_DEBUG_INFO(best_fit, size, 1, 1);
  
@@ -1630,7 +574,7 @@
  	heap->size += true_size;
  	if (heap->peak < heap->size) {
  		heap->peak = heap->size;
-@@ -1898,6 +1984,9 @@
+@@ -1912,6 +1998,9 @@
  
  	mm_block = ZEND_MM_HEADER_OF(p);
  	size = ZEND_MM_BLOCK_SIZE(mm_block);
@@ -1640,7 +584,7 @@
  	ZEND_MM_CHECK_PROTECTION(mm_block);
  
  #if ZEND_DEBUG || ZEND_MM_HEAP_PROTECTION
-@@ -1960,6 +2049,9 @@
+@@ -1974,6 +2063,9 @@
  	mm_block = ZEND_MM_HEADER_OF(p);
  	true_size = ZEND_MM_TRUE_SIZE(size);
  	orig_size = ZEND_MM_BLOCK_SIZE(mm_block);
@@ -1650,7 +594,7 @@
  	ZEND_MM_CHECK_PROTECTION(mm_block);
  
  	if (UNEXPECTED(true_size < size)) {
-@@ -1991,6 +2083,11 @@
+@@ -2005,6 +2097,11 @@
  			HANDLE_UNBLOCK_INTERRUPTIONS();
  		}
  		ZEND_MM_SET_DEBUG_INFO(mm_block, size, 0, 0);
@@ -1662,7 +606,7 @@
  		return p;
  	}
  
-@@ -2010,13 +2107,18 @@
+@@ -2024,13 +2121,18 @@
  			heap->cache[index] = best_fit->prev_free_block;
  			ZEND_MM_CHECK_MAGIC(best_fit, MEM_BLOCK_CACHED);
  			ZEND_MM_SET_DEBUG_INFO(best_fit, size, 1, 0);
@@ -1682,7 +626,7 @@
  #endif
  
  			heap->cached -= true_size - orig_size;
-@@ -2074,6 +2176,11 @@
+@@ -2088,6 +2190,11 @@
  			if (heap->peak < heap->size) {
  				heap->peak = heap->size;
  			}
@@ -1694,7 +638,7 @@
  			HANDLE_UNBLOCK_INTERRUPTIONS();
  			return p;
  		} else if (ZEND_MM_IS_FIRST_BLOCK(mm_block) &&
-@@ -2177,6 +2284,11 @@
+@@ -2191,6 +2298,11 @@
  		}
  
  		HANDLE_UNBLOCK_INTERRUPTIONS();
@@ -1706,7 +650,7 @@
  		return ZEND_MM_DATA_OF(mm_block);
  	}
  
-@@ -2184,7 +2296,7 @@
+@@ -2198,7 +2310,7 @@
  #if ZEND_DEBUG || ZEND_MM_HEAP_PROTECTION
  	memcpy(ptr, p, mm_block->debug.size);
  #else
@@ -1715,7 +659,7 @@
  #endif
  	_zend_mm_free_int(heap, p ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
  	return ptr;
-@@ -2427,6 +2539,17 @@
+@@ -2441,6 +2553,17 @@
  	zend_mm_shutdown(AG(mm_heap), full_shutdown, silent);
  }
  
@@ -1733,10 +677,9 @@
  static void alloc_globals_ctor(zend_alloc_globals *alloc_globals TSRMLS_DC)
  {
  	char *tmp;
-Index: php5-5.2.4/Zend/zend_alloc.h
-===================================================================
---- php5-5.2.4.orig/Zend/zend_alloc.h	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/Zend/zend_alloc.h	2007-09-16 14:45:15.000000000 +0200
+diff -Nura php-5.2.5/Zend/zend_alloc.h suhosin-patch-5.2.5-0.9.6.2/Zend/zend_alloc.h
+--- php-5.2.5/Zend/zend_alloc.h	2007-03-20 07:46:48.000000000 +0100
++++ suhosin-patch-5.2.5-0.9.6.2/Zend/zend_alloc.h	2007-11-10 01:38:46.000000000 +0100
 @@ -128,6 +128,9 @@
  
  ZEND_API void start_memory_manager(TSRMLS_D);
@@ -1747,114 +690,9 @@
  ZEND_API int is_zend_mm(TSRMLS_D);
  
  #if ZEND_DEBUG
-Index: php5-5.2.4/Zend/zend.c
-===================================================================
---- php5-5.2.4.orig/Zend/zend.c	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/Zend/zend.c	2007-09-16 14:45:15.000000000 +0200
-@@ -57,7 +57,9 @@
- ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args);
- int (*zend_vspprintf)(char **pbuf, size_t max_len, const char *format, va_list ap);
- ZEND_API char *(*zend_getenv)(char *name, size_t name_len TSRMLS_DC);
--
-+#if SUHOSIN_PATCH
-+ZEND_API void (*zend_suhosin_log)(int loglevel, char *fmt, ...);
-+#endif
- void (*zend_on_timeout)(int seconds TSRMLS_DC);
- 
- static void (*zend_message_dispatcher_p)(long message, void *data);
-@@ -74,9 +76,88 @@
- 	return SUCCESS;
- }
- 
-+#if SUHOSIN_PATCH
-+static ZEND_INI_MH(OnUpdateSuhosin_log_syslog)
-+{
-+	if (!new_value) {
-+		SPG(log_syslog) = S_ALL & ~S_SQL | S_MEMORY;
-+	} else {
-+		SPG(log_syslog) = atoi(new_value) | S_MEMORY;
-+	}
-+	return SUCCESS;
-+}
-+static ZEND_INI_MH(OnUpdateSuhosin_log_syslog_facility)
-+{
-+	if (!new_value) {
-+		SPG(log_syslog_facility) = LOG_USER;
-+	} else {
-+		SPG(log_syslog_facility) = atoi(new_value);
-+	}
-+	return SUCCESS;
-+}
-+static ZEND_INI_MH(OnUpdateSuhosin_log_syslog_priority)
-+{
-+	if (!new_value) {
-+		SPG(log_syslog_priority) = LOG_ALERT;
-+	} else {
-+		SPG(log_syslog_priority) = atoi(new_value);
-+	}
-+	return SUCCESS;
-+}
-+static ZEND_INI_MH(OnUpdateSuhosin_log_sapi)
-+{
-+	if (!new_value) {
-+		SPG(log_sapi) = S_ALL & ~S_SQL;
-+	} else {
-+		SPG(log_sapi) = atoi(new_value);
-+	}
-+	return SUCCESS;
-+}
-+static ZEND_INI_MH(OnUpdateSuhosin_log_script)
-+{
-+	if (!new_value) {
-+		SPG(log_script) = S_ALL & ~S_MEMORY;
-+	} else {
-+		SPG(log_script) = atoi(new_value) & (~S_MEMORY) & (~S_INTERNAL);
-+	}
-+	return SUCCESS;
-+}
-+static ZEND_INI_MH(OnUpdateSuhosin_log_scriptname)
-+{
-+	if (SPG(log_scriptname)) {
-+		pefree(SPG(log_scriptname),1);
-+	}
-+        SPG(log_scriptname) = NULL;
-+	if (new_value) {
-+		SPG(log_scriptname) = pestrdup(new_value,1);
-+	}
-+	return SUCCESS;
-+}
-+static ZEND_INI_MH(OnUpdateSuhosin_log_phpscript)
-+{
-+	if (!new_value) {
-+		SPG(log_phpscript) = S_ALL & ~S_MEMORY;
-+	} else {
-+		SPG(log_phpscript) = atoi(new_value) & (~S_MEMORY) & (~S_INTERNAL);
-+	}
-+	return SUCCESS;
-+}
-+#endif
- 
- ZEND_INI_BEGIN()
- 	ZEND_INI_ENTRY("error_reporting",				NULL,		ZEND_INI_ALL,		OnUpdateErrorReporting)
-+#if SUHOSIN_PATCH
-+	ZEND_INI_ENTRY("suhosin.log.syslog",			NULL,		ZEND_INI_PERDIR|ZEND_INI_SYSTEM,	OnUpdateSuhosin_log_syslog)
-+	ZEND_INI_ENTRY("suhosin.log.syslog.facility",		NULL,		ZEND_INI_PERDIR|ZEND_INI_SYSTEM,	OnUpdateSuhosin_log_syslog_facility)
-+	ZEND_INI_ENTRY("suhosin.log.syslog.priority",		NULL,		ZEND_INI_PERDIR|ZEND_INI_SYSTEM,	OnUpdateSuhosin_log_syslog_priority)
-+	ZEND_INI_ENTRY("suhosin.log.sapi",				NULL,		ZEND_INI_PERDIR|ZEND_INI_SYSTEM,	OnUpdateSuhosin_log_sapi)
-+	ZEND_INI_ENTRY("suhosin.log.script",			NULL,		ZEND_INI_PERDIR|ZEND_INI_SYSTEM,	OnUpdateSuhosin_log_script)
-+	ZEND_INI_ENTRY("suhosin.log.script.name",			NULL,		ZEND_INI_SYSTEM,	OnUpdateSuhosin_log_scriptname)
-+	STD_ZEND_INI_BOOLEAN("suhosin.log.use-x-forwarded-for",	"0",		ZEND_INI_PERDIR|ZEND_INI_SYSTEM,	OnUpdateBool, log_use_x_forwarded_for,	suhosin_patch_globals_struct,	suhosin_patch_globals)
-+	ZEND_INI_ENTRY("suhosin.log.phpscript",			"0",		ZEND_INI_PERDIR|ZEND_INI_SYSTEM,	OnUpdateSuhosin_log_phpscript)
-+	STD_ZEND_INI_ENTRY("suhosin.log.phpscript.name",			NULL,		ZEND_INI_PERDIR|ZEND_INI_SYSTEM,	OnUpdateString, log_phpscriptname, suhosin_patch_globals_struct,	suhosin_patch_globals)
-+	STD_ZEND_INI_BOOLEAN("suhosin.log.phpscript.is_safe",			"0",		ZEND_INI_SYSTEM,	OnUpdateBool, log_phpscript_is_safe,	suhosin_patch_globals_struct,	suhosin_patch_globals)
-+#endif
- 	STD_ZEND_INI_BOOLEAN("zend.ze1_compatibility_mode",	"0",	ZEND_INI_ALL,		OnUpdateBool,	ze1_compatibility_mode,	zend_executor_globals,	executor_globals)
- #ifdef ZEND_MULTIBYTE
- 	STD_ZEND_INI_BOOLEAN("detect_unicode", "1", ZEND_INI_ALL, OnUpdateBool, detect_unicode, zend_compiler_globals, compiler_globals)
-Index: php5-5.2.4/Zend/zend_canary.c
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ php5-5.2.4/Zend/zend_canary.c	2007-09-16 14:45:15.000000000 +0200
+diff -Nura php-5.2.5/Zend/zend_canary.c suhosin-patch-5.2.5-0.9.6.2/Zend/zend_canary.c
+--- php-5.2.5/Zend/zend_canary.c	1970-01-01 01:00:00.000000000 +0100
++++ suhosin-patch-5.2.5-0.9.6.2/Zend/zend_canary.c	2007-11-10 01:38:46.000000000 +0100
 @@ -0,0 +1,64 @@
 +/*
 +   +----------------------------------------------------------------------+
@@ -1920,10 +758,9 @@
 + * vim600: sw=4 ts=4 fdm=marker
 + * vim<600: sw=4 ts=4
 + */
-Index: php5-5.2.4/Zend/zend_compile.c
-===================================================================
---- php5-5.2.4.orig/Zend/zend_compile.c	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/Zend/zend_compile.c	2007-09-16 14:45:15.000000000 +0200
+diff -Nura php-5.2.5/Zend/zend_compile.c suhosin-patch-5.2.5-0.9.6.2/Zend/zend_compile.c
+--- php-5.2.5/Zend/zend_compile.c	2007-09-20 16:11:31.000000000 +0200
++++ suhosin-patch-5.2.5-0.9.6.2/Zend/zend_compile.c	2007-11-10 01:38:46.000000000 +0100
 @@ -54,7 +54,6 @@
  	property_info->name = zend_strndup(property_info->name, property_info->name_length);
  }
@@ -1943,10 +780,9 @@
  
  static void build_runtime_defined_function_key(zval *result, char *name, int name_length TSRMLS_DC)
  {
-Index: php5-5.2.4/Zend/zend_compile.h
-===================================================================
---- php5-5.2.4.orig/Zend/zend_compile.h	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/Zend/zend_compile.h	2007-09-16 14:45:15.000000000 +0200
+diff -Nura php-5.2.5/Zend/zend_compile.h suhosin-patch-5.2.5-0.9.6.2/Zend/zend_compile.h
+--- php-5.2.5/Zend/zend_compile.h	2007-05-18 15:12:04.000000000 +0200
++++ suhosin-patch-5.2.5-0.9.6.2/Zend/zend_compile.h	2007-11-10 01:38:46.000000000 +0100
 @@ -564,6 +564,11 @@
  
  int zendlex(znode *zendlval TSRMLS_DC);
@@ -1967,10 +803,9 @@
  END_EXTERN_C()
  
  #define ZEND_CLONE_FUNC_NAME		"__clone"
-Index: php5-5.2.4/Zend/zend_constants.c
-===================================================================
---- php5-5.2.4.orig/Zend/zend_constants.c	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/Zend/zend_constants.c	2007-09-16 14:45:15.000000000 +0200
+diff -Nura php-5.2.5/Zend/zend_constants.c suhosin-patch-5.2.5-0.9.6.2/Zend/zend_constants.c
+--- php-5.2.5/Zend/zend_constants.c	2007-07-27 18:29:11.000000000 +0200
++++ suhosin-patch-5.2.5-0.9.6.2/Zend/zend_constants.c	2007-11-10 01:38:46.000000000 +0100
 @@ -110,6 +110,75 @@
  	REGISTER_MAIN_LONG_CONSTANT("E_USER_NOTICE", E_USER_NOTICE, CONST_PERSISTENT | CONST_CS);
  
@@ -2047,25 +882,9 @@
  
  	/* true/false constants */
  	{
-Index: php5-5.2.4/Zend/Zend.dsp
-===================================================================
---- php5-5.2.4.orig/Zend/Zend.dsp	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/Zend/Zend.dsp	2007-09-16 14:45:15.000000000 +0200
-@@ -239,6 +239,10 @@
- # End Source File
- # Begin Source File
- 
-+SOURCE=.\zend_canary.c
-+# End Source File
-+# Begin Source File
-+
- SOURCE=.\zend_ts_hash.c
- # End Source File
- # Begin Source File
-Index: php5-5.2.4/Zend/zend_errors.h
-===================================================================
---- php5-5.2.4.orig/Zend/zend_errors.h	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/Zend/zend_errors.h	2007-09-16 14:45:15.000000000 +0200
+diff -Nura php-5.2.5/Zend/zend_errors.h suhosin-patch-5.2.5-0.9.6.2/Zend/zend_errors.h
+--- php-5.2.5/Zend/zend_errors.h	2007-01-01 10:35:46.000000000 +0100
++++ suhosin-patch-5.2.5-0.9.6.2/Zend/zend_errors.h	2007-11-10 01:38:46.000000000 +0100
 @@ -39,6 +39,20 @@
  #define E_ALL (E_ERROR | E_WARNING | E_PARSE | E_NOTICE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE | E_RECOVERABLE_ERROR)
  #define E_CORE (E_CORE_ERROR | E_CORE_WARNING)
@@ -2087,38 +906,9 @@
  #endif /* ZEND_ERRORS_H */
  
  /*
-Index: php5-5.2.4/Zend/zend.h
-===================================================================
---- php5-5.2.4.orig/Zend/zend.h	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/Zend/zend.h	2007-09-16 14:45:15.000000000 +0200
-@@ -520,6 +520,9 @@
- extern ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
- extern int (*zend_vspprintf)(char **pbuf, size_t max_len, const char *format, va_list ap);
- extern ZEND_API char *(*zend_getenv)(char *name, size_t name_len TSRMLS_DC);
-+#if SUHOSIN_PATCH
-+extern ZEND_API void (*zend_suhosin_log)(int loglevel, char *fmt, ...);
-+#endif
- 
- 
- ZEND_API void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
-@@ -651,6 +654,13 @@
- #include "zend_operators.h"
- #include "zend_variables.h"
- 
-+#if SUHOSIN_PATCH
-+#include "suhosin_globals.h"
-+#include "php_syslog.h"
-+
-+ZEND_API size_t zend_canary();
-+#endif
-+
- #endif /* ZEND_H */
- 
- /*
-Index: php5-5.2.4/Zend/zend_hash.c
-===================================================================
---- php5-5.2.4.orig/Zend/zend_hash.c	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/Zend/zend_hash.c	2007-09-16 14:45:15.000000000 +0200
+diff -Nura php-5.2.5/Zend/zend_hash.c suhosin-patch-5.2.5-0.9.6.2/Zend/zend_hash.c
+--- php-5.2.5/Zend/zend_hash.c	2007-07-24 20:28:39.000000000 +0200
++++ suhosin-patch-5.2.5-0.9.6.2/Zend/zend_hash.c	2007-11-10 01:38:46.000000000 +0100
 @@ -20,6 +20,7 @@
  /* $Id: zend_hash.c,v 1.121.2.4.2.8 2007/07/24 18:28:39 dmitry Exp $ */
  
@@ -2384,10 +1174,9 @@
  	if (ht->pDestructor) {
  		ht->pDestructor(p->pData);
  	}
-Index: php5-5.2.4/Zend/zend_llist.c
-===================================================================
---- php5-5.2.4.orig/Zend/zend_llist.c	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/Zend/zend_llist.c	2007-09-16 14:45:15.000000000 +0200
+diff -Nura php-5.2.5/Zend/zend_llist.c suhosin-patch-5.2.5-0.9.6.2/Zend/zend_llist.c
+--- php-5.2.5/Zend/zend_llist.c	2007-02-16 09:33:28.000000000 +0100
++++ suhosin-patch-5.2.5-0.9.6.2/Zend/zend_llist.c	2007-11-10 01:38:46.000000000 +0100
 @@ -23,6 +23,184 @@
  #include "zend_llist.h"
  #include "zend_qsort.h"
@@ -2605,18 +1394,1202 @@
  	if ((old_tail = l->tail)) {
  		if (old_tail->prev) {
  			old_tail->prev->next = NULL;
-Index: php5-5.2.4/Zend/ZendTS.dsp
-===================================================================
---- php5-5.2.4.orig/Zend/ZendTS.dsp	2007-09-16 14:45:09.000000000 +0200
-+++ php5-5.2.4/Zend/ZendTS.dsp	2007-09-16 14:45:15.000000000 +0200
-@@ -273,6 +273,10 @@
- # End Source File
- # Begin Source File
- 
-+SOURCE=.\zend_canary.c
-+# End Source File
-+# Begin Source File
-+
- SOURCE=.\zend_ts_hash.c
- # End Source File
- # Begin Source File
+diff -Nura php-5.2.5/configure.in suhosin-patch-5.2.5-0.9.6.2/configure.in
+--- php-5.2.5/configure.in	2007-11-08 14:44:11.000000000 +0100
++++ suhosin-patch-5.2.5-0.9.6.2/configure.in	2007-11-10 01:38:46.000000000 +0100
+@@ -227,6 +227,7 @@
+ sinclude(TSRM/threads.m4)
+ sinclude(TSRM/tsrm.m4)
+ 
++sinclude(main/suhosin_patch.m4)
+ 
+ divert(2)
+ 
+@@ -1301,7 +1302,7 @@
+        php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \
+        strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c \
+        network.c php_open_temporary_file.c php_logos.c \
+-       output.c )
++       output.c suhosin_patch.c )
+ 
+ PHP_ADD_SOURCES(main/streams, streams.c cast.c memory.c filter.c \
+        plain_wrapper.c userspace.c transports.c xp_socket.c mmap.c)
+@@ -1327,7 +1328,7 @@
+     zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \
+     zend_list.c zend_indent.c zend_builtin_functions.c zend_sprintf.c \
+     zend_ini.c zend_qsort.c zend_multibyte.c zend_ts_hash.c zend_stream.c \
+-    zend_iterators.c zend_interfaces.c zend_exceptions.c zend_strtod.c)
++    zend_iterators.c zend_interfaces.c zend_exceptions.c zend_strtod.c zend_canary.c )
+ 
+ if test -r "$abs_srcdir/Zend/zend_objects.c"; then
+   PHP_ADD_SOURCES(Zend, zend_objects.c zend_object_handlers.c zend_objects_API.c \
+diff -Nura php-5.2.5/ext/standard/basic_functions.c suhosin-patch-5.2.5-0.9.6.2/ext/standard/basic_functions.c
+--- php-5.2.5/ext/standard/basic_functions.c	2007-10-22 09:37:20.000000000 +0200
++++ suhosin-patch-5.2.5-0.9.6.2/ext/standard/basic_functions.c	2007-11-10 01:38:46.000000000 +0100
+@@ -3575,7 +3575,9 @@
+ 	PHP_FALIAS(socket_get_status, stream_get_meta_data,						arginfo_stream_get_meta_data)
+ 
+ #if (!defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
+-	PHP_FE(realpath,														arginfo_realpath)
++#undef realpath
++	PHP_NAMED_FE(realpath,			PHP_FN(real_path),						arginfo_realpath)
++#define realpath real_path
+ #endif
+ 
+ #ifdef HAVE_FNMATCH
+diff -Nura php-5.2.5/ext/standard/dl.c suhosin-patch-5.2.5-0.9.6.2/ext/standard/dl.c
+--- php-5.2.5/ext/standard/dl.c	2007-09-18 22:19:34.000000000 +0200
++++ suhosin-patch-5.2.5-0.9.6.2/ext/standard/dl.c	2007-11-10 01:38:46.000000000 +0100
+@@ -246,6 +246,19 @@
+ 			RETURN_FALSE;
+ 		}
+ 	}
++#if SUHOSIN_PATCH
++	if (strncmp("suhosin", module_entry->name, sizeof("suhosin")-1) == 0) {
++		void *log_func;
++		/* sucessfully loaded suhosin extension, now check for logging function replacement */
++		log_func = (void *) DL_FETCH_SYMBOL(handle, "suhosin_log");
++		if (log_func == NULL) {
++			log_func = (void *) DL_FETCH_SYMBOL(handle, "_suhosin_log");
++		}
++		if (log_func != NULL) {
++			zend_suhosin_log = log_func;
++		}
++	}
++#endif	
+ 	RETURN_TRUE;
+ }
+ /* }}} */
+diff -Nura php-5.2.5/ext/standard/file.c suhosin-patch-5.2.5-0.9.6.2/ext/standard/file.c
+--- php-5.2.5/ext/standard/file.c	2007-09-04 14:51:49.000000000 +0200
++++ suhosin-patch-5.2.5-0.9.6.2/ext/standard/file.c	2007-11-10 01:38:46.000000000 +0100
+@@ -2361,7 +2361,7 @@
+ #if (!defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
+ /* {{{ proto string realpath(string path)
+    Return the resolved path */
+-PHP_FUNCTION(realpath)
++PHP_FUNCTION(real_path)
+ {
+ 	zval **path;
+ 	char resolved_path_buff[MAXPATHLEN];
+diff -Nura php-5.2.5/ext/standard/file.h suhosin-patch-5.2.5-0.9.6.2/ext/standard/file.h
+--- php-5.2.5/ext/standard/file.h	2007-01-10 15:40:06.000000000 +0100
++++ suhosin-patch-5.2.5-0.9.6.2/ext/standard/file.h	2007-11-10 01:38:46.000000000 +0100
+@@ -61,7 +61,7 @@
+ PHP_FUNCTION(fd_set);
+ PHP_FUNCTION(fd_isset);
+ #if (!defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
+-PHP_FUNCTION(realpath);
++PHP_FUNCTION(real_path);
+ #endif
+ #ifdef HAVE_FNMATCH
+ PHP_FUNCTION(fnmatch);
+diff -Nura php-5.2.5/ext/standard/info.c suhosin-patch-5.2.5-0.9.6.2/ext/standard/info.c
+--- php-5.2.5/ext/standard/info.c	2007-07-21 03:24:26.000000000 +0200
++++ suhosin-patch-5.2.5-0.9.6.2/ext/standard/info.c	2007-11-10 01:38:46.000000000 +0100
+@@ -627,6 +627,31 @@
+ 		
+ 		php_info_print_table_end();
+ 
++		/* Suhosin Patch */
++		php_info_print_box_start(0);
++		if (expose_php && !sapi_module.phpinfo_as_text) {
++			PUTS("<a href=\"http://www.hardened-php.net/suhosin/index.html\"><img border=\"0\" src=\"");
++			if (SG(request_info).request_uri) {
++				char *elem_esc = php_info_html_esc(SG(request_info).request_uri TSRMLS_CC);
++				PUTS(elem_esc);
++				efree(elem_esc);
++			}
++			PUTS("?="SUHOSIN_LOGO_GUID"\" alt=\"Suhosin logo\" /></a>\n");
++		}
++		PUTS("This server is protected with the Suhosin Patch ");
++		if (sapi_module.phpinfo_as_text) {
++			PUTS(SUHOSIN_PATCH_VERSION);
++		} else {
++			zend_html_puts(SUHOSIN_PATCH_VERSION, strlen(SUHOSIN_PATCH_VERSION) TSRMLS_CC);
++		}
++		PUTS(!sapi_module.phpinfo_as_text?"<br />":"\n");
++		if (sapi_module.phpinfo_as_text) {
++			PUTS("Copyright (c) 2006 Hardened-PHP Project\n");
++		} else {
++			PUTS("Copyright (c) 2006 <a href=\"http://www.hardened-php.net/\">Hardened-PHP Project</a>\n");
++		}
++		php_info_print_box_end();
++		
+ 		/* Zend Engine */
+ 		php_info_print_box_start(0);
+ 		if (expose_php && !sapi_module.phpinfo_as_text) {
+diff -Nura php-5.2.5/ext/standard/syslog.c suhosin-patch-5.2.5-0.9.6.2/ext/standard/syslog.c
+--- php-5.2.5/ext/standard/syslog.c	2007-05-17 08:38:13.000000000 +0200
++++ suhosin-patch-5.2.5-0.9.6.2/ext/standard/syslog.c	2007-11-10 01:38:46.000000000 +0100
+@@ -42,6 +42,7 @@
+  */
+ PHP_MINIT_FUNCTION(syslog)
+ {
++#if !SUHOSIN_PATCH
+ 	/* error levels */
+ 	REGISTER_LONG_CONSTANT("LOG_EMERG", LOG_EMERG, CONST_CS | CONST_PERSISTENT); /* system unusable */
+ 	REGISTER_LONG_CONSTANT("LOG_ALERT", LOG_ALERT, CONST_CS | CONST_PERSISTENT); /* immediate action required */
+@@ -97,6 +98,7 @@
+ 	/* AIX doesn't have LOG_PERROR */
+ 	REGISTER_LONG_CONSTANT("LOG_PERROR", LOG_PERROR, CONST_CS | CONST_PERSISTENT); /*log to stderr*/
+ #endif
++#endif
+ 	BG(syslog_device)=NULL;
+ 
+ 	return SUCCESS;
+diff -Nura php-5.2.5/main/fopen_wrappers.c suhosin-patch-5.2.5-0.9.6.2/main/fopen_wrappers.c
+--- php-5.2.5/main/fopen_wrappers.c	2007-10-09 12:06:34.000000000 +0200
++++ suhosin-patch-5.2.5-0.9.6.2/main/fopen_wrappers.c	2007-11-10 01:38:46.000000000 +0100
+@@ -110,7 +110,7 @@
+ 
+ 	/* normalize and expand path */
+ 	if (expand_filepath(path, resolved_name TSRMLS_CC) == NULL) {
+-		return -1;
++		return -2;
+ 	}
+ 
+ 	path_len = strlen(resolved_name);
+@@ -179,6 +179,12 @@
+ 			}
+ 		}
+ 
++		if (resolved_name_len == resolved_basedir_len - 1) {
++			if (resolved_basedir[resolved_basedir_len - 1] == PHP_DIR_SEPARATOR) {
++				resolved_basedir_len--;
++			}
++		}
++
+ 		/* Check the path */
+ #if defined(PHP_WIN32) || defined(NETWARE)
+ 		if (strncasecmp(resolved_basedir, resolved_name, resolved_basedir_len) == 0) {
+@@ -202,7 +208,7 @@
+ 		}
+ 	} else {
+ 		/* Unable to resolve the real path, return -1 */
+-		return -1;
++		return -3;
+ 	}
+ }
+ /* }}} */
+@@ -221,22 +227,44 @@
+ 		char *pathbuf;
+ 		char *ptr;
+ 		char *end;
++		char path_copy[MAXPATHLEN];
++		int path_len;
++
++		/* Special case path ends with a trailing slash */
++		path_len = strlen(path);
++		if (path_len >= MAXPATHLEN) {
++			errno = EPERM; /* we deny permission to open it */
++			return -1;
++		}
++		if (path_len > 0 && path[path_len-1] == PHP_DIR_SEPARATOR) {
++			memcpy(path_copy, path, path_len+1);
++			while (path_len > 1 && path_copy[path_len-1] == PHP_DIR_SEPARATOR) path_len--;
++			path_copy[path_len] = '\0';
++			path = (const char *)&path_copy;
++		}
+ 
+ 		pathbuf = estrdup(PG(open_basedir));
+ 
+ 		ptr = pathbuf;
+ 
+ 		while (ptr && *ptr) {
++			int res;
+ 			end = strchr(ptr, DEFAULT_DIR_SEPARATOR);
+ 			if (end != NULL) {
+ 				*end = '\0';
+ 				end++;
+ 			}
+ 
+-			if (php_check_specific_open_basedir(ptr, path TSRMLS_CC) == 0) {
++			res = php_check_specific_open_basedir(ptr, path TSRMLS_CC);
++			if (res == 0) {
+ 				efree(pathbuf);
+ 				return 0;
+ 			}
++			if (res == -2) {
++				efree(pathbuf);
++				errno = EPERM;
++				return -1;
++			}
+ 
+ 			ptr = end;
+ 		}
+diff -Nura php-5.2.5/main/main.c suhosin-patch-5.2.5-0.9.6.2/main/main.c
+--- php-5.2.5/main/main.c	2007-10-18 15:11:30.000000000 +0200
++++ suhosin-patch-5.2.5-0.9.6.2/main/main.c	2007-11-10 01:38:46.000000000 +0100
+@@ -88,6 +88,9 @@
+ 
+ #include "SAPI.h"
+ #include "rfc1867.h"
++#if SUHOSIN_PATCH
++#include "suhosin_globals.h"
++#endif
+ /* }}} */
+ 
+ #ifndef ZTS
+@@ -1369,7 +1372,7 @@
+ 
+ 	/* used to close fd's in the 3..255 range here, but it's problematic
+ 	 */
+-	shutdown_memory_manager(1, 1 TSRMLS_CC);
++	shutdown_memory_manager(1, 1 TSRMLS_CC);	
+ }
+ /* }}} */
+ 
+@@ -1410,6 +1413,9 @@
+ 
+ 	zend_try {
+ 		shutdown_memory_manager(CG(unclean_shutdown), 0 TSRMLS_CC);
++#if SUHOSIN_PATCH
++		suhosin_clear_mm_canaries(TSRMLS_C);
++#endif
+ 	} zend_end_try();
+ 
+ 	zend_try {
+@@ -1502,6 +1508,9 @@
+ 	/* 11. Free Willy (here be crashes) */
+ 	zend_try {
+ 		shutdown_memory_manager(CG(unclean_shutdown) || !report_memleaks, 0 TSRMLS_CC);
++#if SUHOSIN_PATCH
++		suhosin_clear_mm_canaries(TSRMLS_C);
++#endif
+ 	} zend_end_try();
+ 
+ 	/* 12. Reset max_execution_time */
+@@ -1661,6 +1670,9 @@
+ #ifdef ZTS
+ 	tsrm_ls = ts_resource(0);
+ #endif
++#if SUHOSIN_PATCH
++	suhosin_startup();
++#endif
+ 
+ 	module_shutdown = 0;
+ 	module_startup = 1;
+@@ -1790,6 +1802,10 @@
+ 	REGISTER_MAIN_STRINGL_CONSTANT("PHP_CONFIG_FILE_PATH", PHP_CONFIG_FILE_PATH, strlen(PHP_CONFIG_FILE_PATH), CONST_PERSISTENT | CONST_CS);
+ 	REGISTER_MAIN_STRINGL_CONSTANT("PHP_CONFIG_FILE_SCAN_DIR", PHP_CONFIG_FILE_SCAN_DIR, sizeof(PHP_CONFIG_FILE_SCAN_DIR)-1, CONST_PERSISTENT | CONST_CS);
+ 	REGISTER_MAIN_STRINGL_CONSTANT("PHP_SHLIB_SUFFIX", PHP_SHLIB_SUFFIX, sizeof(PHP_SHLIB_SUFFIX)-1, CONST_PERSISTENT | CONST_CS);
++#if SUHOSIN_PATCH
++	REGISTER_MAIN_LONG_CONSTANT("SUHOSIN_PATCH", 1, CONST_PERSISTENT | CONST_CS);
++	REGISTER_MAIN_STRINGL_CONSTANT("SUHOSIN_PATCH_VERSION", SUHOSIN_PATCH_VERSION, sizeof(SUHOSIN_PATCH_VERSION)-1, CONST_PERSISTENT | CONST_CS);
++#endif
+ 	REGISTER_MAIN_STRINGL_CONSTANT("PHP_EOL", PHP_EOL, sizeof(PHP_EOL)-1, CONST_PERSISTENT | CONST_CS);
+ 	REGISTER_MAIN_LONG_CONSTANT("PHP_INT_MAX", LONG_MAX, CONST_PERSISTENT | CONST_CS);
+ 	REGISTER_MAIN_LONG_CONSTANT("PHP_INT_SIZE", sizeof(long), CONST_PERSISTENT | CONST_CS);
+@@ -1839,7 +1855,9 @@
+ 	module_startup = 0;
+ 
+ 	shutdown_memory_manager(1, 0 TSRMLS_CC);
+-
++#if SUHOSIN_PATCH
++	suhosin_clear_mm_canaries(TSRMLS_C);
++#endif
+ 	/* we're done */
+ 	return SUCCESS;
+ }
+@@ -1898,6 +1916,9 @@
+ #ifndef ZTS
+ 	zend_ini_shutdown(TSRMLS_C);
+ 	shutdown_memory_manager(CG(unclean_shutdown), 1 TSRMLS_CC);
++#if SUHOSIN_PATCH
++	suhosin_clear_mm_canaries(TSRMLS_C);
++#endif
+ 	core_globals_dtor(&core_globals TSRMLS_CC);
+ #else
+ 	zend_ini_global_shutdown(TSRMLS_C);
+diff -Nura php-5.2.5/main/php.h suhosin-patch-5.2.5-0.9.6.2/main/php.h
+--- php-5.2.5/main/php.h	2007-08-31 09:48:05.000000000 +0200
++++ suhosin-patch-5.2.5-0.9.6.2/main/php.h	2007-11-10 01:38:46.000000000 +0100
+@@ -40,6 +40,13 @@
+ #undef sprintf
+ #define sprintf php_sprintf
+ 
++#if SUHOSIN_PATCH
++#if HAVE_REALPATH
++#undef realpath
++#define realpath php_realpath
++#endif
++#endif
++
+ /* PHP's DEBUG value must match Zend's ZEND_DEBUG value */
+ #undef PHP_DEBUG
+ #define PHP_DEBUG ZEND_DEBUG
+@@ -448,6 +455,10 @@
+ #endif
+ #endif /* !XtOffsetOf */
+ 
++#if SUHOSIN_PATCH
++#include "suhosin_patch.h"
++#endif
++
+ #endif
+ 
+ /*
+diff -Nura php-5.2.5/main/php_config.h.in suhosin-patch-5.2.5-0.9.6.2/main/php_config.h.in
+--- php-5.2.5/main/php_config.h.in	2007-11-08 16:36:36.000000000 +0100
++++ suhosin-patch-5.2.5-0.9.6.2/main/php_config.h.in	2007-11-10 01:38:46.000000000 +0100
+@@ -803,6 +803,9 @@
+ /* Define if the target system has /dev/urandom device */
+ #undef HAVE_DEV_URANDOM
+ 
++/* Suhosin-Patch for PHP */
++#undef SUHOSIN_PATCH
++
+ /* Whether you have AOLserver */
+ #undef HAVE_AOLSERVER
+ 
+diff -Nura php-5.2.5/main/php_logos.c suhosin-patch-5.2.5-0.9.6.2/main/php_logos.c
+--- php-5.2.5/main/php_logos.c	2007-01-06 21:44:51.000000000 +0100
++++ suhosin-patch-5.2.5-0.9.6.2/main/php_logos.c	2007-11-10 01:38:46.000000000 +0100
+@@ -50,6 +50,10 @@
+ 	return zend_hash_del(&phpinfo_logo_hash, logo_string, strlen(logo_string));
+ }
+ 
++#if SUHOSIN_PATCH
++#include "suhosin_logo.h"
++#endif
++
+ int php_init_info_logos(void)
+ {
+ 	if(zend_hash_init(&phpinfo_logo_hash, 0, NULL, NULL, 1)==FAILURE) 
+@@ -58,6 +62,9 @@
+ 	php_register_info_logo(PHP_LOGO_GUID    , "image/gif", php_logo    , sizeof(php_logo));
+ 	php_register_info_logo(PHP_EGG_LOGO_GUID, "image/gif", php_egg_logo, sizeof(php_egg_logo));
+ 	php_register_info_logo(ZEND_LOGO_GUID   , "image/gif", zend_logo   , sizeof(zend_logo));
++#if SUHOSIN_PATCH
++	php_register_info_logo(SUHOSIN_LOGO_GUID, "image/jpeg", suhosin_logo, sizeof(suhosin_logo));
++#endif	
+ 
+ 	return SUCCESS;
+ }
+diff -Nura php-5.2.5/main/snprintf.c suhosin-patch-5.2.5-0.9.6.2/main/snprintf.c
+--- php-5.2.5/main/snprintf.c	2007-10-01 17:23:15.000000000 +0200
++++ suhosin-patch-5.2.5-0.9.6.2/main/snprintf.c	2007-11-10 01:38:46.000000000 +0100
+@@ -1080,7 +1080,11 @@
+ 
+ 
+ 				case 'n':
++#if SUHOSIN_PATCH
++					zend_suhosin_log(S_MISC, "'n' specifier within format string");
++#else
+ 					*(va_arg(ap, int *)) = cc;
++#endif
+ 					goto skip_output;
+ 
+ 					/*
+diff -Nura php-5.2.5/main/spprintf.c suhosin-patch-5.2.5-0.9.6.2/main/spprintf.c
+--- php-5.2.5/main/spprintf.c	2007-10-01 17:23:15.000000000 +0200
++++ suhosin-patch-5.2.5-0.9.6.2/main/spprintf.c	2007-11-10 01:38:46.000000000 +0100
+@@ -673,7 +673,11 @@
+ 
+ 
+ 				case 'n':
++#if SUHOSIN_PATCH
++					zend_suhosin_log(S_MISC, "'n' specifier within format string");
++#else
+ 					*(va_arg(ap, int *)) = xbuf->len;
++#endif
+ 					goto skip_output;
+ 
+ 					/*
+diff -Nura php-5.2.5/main/suhosin_globals.h suhosin-patch-5.2.5-0.9.6.2/main/suhosin_globals.h
+--- php-5.2.5/main/suhosin_globals.h	1970-01-01 01:00:00.000000000 +0100
++++ suhosin-patch-5.2.5-0.9.6.2/main/suhosin_globals.h	2007-11-10 01:38:46.000000000 +0100
+@@ -0,0 +1,61 @@
++/*
++   +----------------------------------------------------------------------+
++   | Suhosin-Patch for PHP                                                |
++   +----------------------------------------------------------------------+
++   | Copyright (c) 2004-2006 Stefan Esser                                 |
++   +----------------------------------------------------------------------+
++   | This source file is subject to version 2.02 of the PHP license,      |
++   | that is bundled with this package in the file LICENSE, and is        |
++   | available at through the world-wide-web at                           |
++   | http://www.php.net/license/2_02.txt.                                 |
++   | If you did not receive a copy of the PHP license and are unable to   |
++   | obtain it through the world-wide-web, please send a note to          |
++   | license at php.net so we can mail you a copy immediately.               |
++   +----------------------------------------------------------------------+
++   | Author: Stefan Esser <sesser at hardened-php.net>                       |
++   +----------------------------------------------------------------------+
++ */
++
++#ifndef SUHOSIN_GLOBALS_H
++#define SUHOSIN_GLOBALS_H
++
++typedef struct _suhosin_patch_globals suhosin_patch_globals_struct;
++
++#ifdef ZTS
++# define SPG(v) TSRMG(suhosin_patch_globals_id, suhosin_patch_globals_struct *, v)
++extern int suhosin_patch_globals_id;
++#else
++# define SPG(v) (suhosin_patch_globals.v)
++extern struct _suhosin_patch_globals suhosin_patch_globals;
++#endif
++
++
++struct _suhosin_patch_globals {
++	/* logging */
++	int log_syslog;
++	int log_syslog_facility;
++	int log_syslog_priority;
++	int log_sapi;
++	int log_script;
++	int log_phpscript;
++	char *log_scriptname;
++	char *log_phpscriptname;
++	zend_bool log_phpscript_is_safe;
++	zend_bool log_use_x_forwarded_for;
++	
++	/* memory manager canary protection */
++	unsigned int canary_1;
++	unsigned int canary_2;
++	unsigned int canary_3;
++	unsigned int dummy;
++};
++
++
++#endif /* SUHOSIN_GLOBALS_H */
++
++/*
++ * Local variables:
++ * tab-width: 4
++ * c-basic-offset: 4
++ * End:
++ */
+diff -Nura php-5.2.5/main/suhosin_logo.h suhosin-patch-5.2.5-0.9.6.2/main/suhosin_logo.h
+--- php-5.2.5/main/suhosin_logo.h	1970-01-01 01:00:00.000000000 +0100
++++ suhosin-patch-5.2.5-0.9.6.2/main/suhosin_logo.h	2007-11-10 01:38:46.000000000 +0100
+@@ -0,0 +1,178 @@
++static unsigned char suhosin_logo[] =
++	"\xff\xd8\xff\xe0\x00\x10\x4a\x46\x49\x46\x00\x01\x01\x01\x00\x48"
++	"\x00\x48\x00\x00\xff\xe1\x00\x16\x45\x78\x69\x66\x00\x00\x4d\x4d"
++	"\x00\x2a\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\xff\xdb\x00\x43"
++	"\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01"
++	"\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01"
++	"\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01"
++	"\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01"
++	"\x01\xff\xc0\x00\x0b\x08\x00\x27\x00\x71\x01\x01\x22\x00\xff\xc4"
++	"\x00\x1e\x00\x00\x02\x02\x02\x03\x01\x01\x00\x00\x00\x00\x00\x00"
++	"\x00\x00\x00\x00\x09\x06\x08\x05\x07\x02\x03\x0a\x01\x04\xff\xc4"
++	"\x00\x32\x10\x00\x01\x04\x03\x00\x02\x00\x05\x01\x05\x09\x01\x00"
++	"\x00\x00\x00\x05\x02\x03\x04\x06\x01\x07\x08\x00\x09\x11\x12\x13"
++	"\x14\x21\x15\x0a\x16\x31\x56\x96\x17\x18\x19\x23\x32\x41\x58\x98"
++	"\xd4\xd6\xff\xda\x00\x08\x01\x01\x00\x00\x3f\x00\xf4\xc1\xe1\xe5"
++	"\x69\xe9\x3e\xb9\xd1\x7c\x8a\x2e\x9d\x66\xe8\x3b\x29\x4d\x7f\x46"
++	"\xba\x58\x55\x54\x8d\xb1\x5f\xaa\xd9\x8d\x51\x2b\xb6\x27\x5a\x69"
++	"\xd1\x43\xaf\x16\x1a\xf0\xb2\xb1\xe9\x6d\x9f\xc2\xa4\x36\x18\xb5"
++	"\x85\x10\x41\xbe\xfc\x09\xac\x49\x29\x11\xd4\x32\x97\xec\x08\x13"
++	"\xc1\x2d\x20\xc3\x59\xeb\x26\x05\xd8\x6b\x76\x31\x43\x8f\x57\xcf"
++	"\x84\x9f\x14\xa8\x53\x81\x0b\xc3\x64\x80\xa3\x02\x0a\x41\x75\xf8"
++	"\x44\x85\x93\x81\x22\x3c\xd8\x13\xe1\xbe\xf4\x59\x91\x1f\x6a\x44"
++	"\x77\x5c\x69\xc4\x2f\x39\x5f\x0f\x2a\x8d\xeb\xba\xf8\xc3\x56\x6c"
++	"\x3b\x36\xa7\xda\xbd\x4d\xa1\xb5\x4e\xc6\xa7\xa4\x3a\xec\x15\x2d"
++	"\xa5\xb3\xea\x5a\xdc\xac\x46\xac\x01\x60\xd8\x43\xc8\x8e\x8b\xb1"
++	"\x40\x4c\x95\x8b\x34\x41\x28\x52\x91\x28\x43\xd3\xa3\xb6\xa7\x55"
++	"\x15\xe7\x5a\x96\xcb\xf1\xda\xe5\x55\xee\xfe\x1e\xbd\xd9\x41\xd3"
++	"\x28\xfd\x97\xca\x57\x2b\x85\x9c\xa4\x30\x95\xaa\xa5\x57\xa2\x35"
++	"\x15\x86\xcb\x61\x34\x41\xe4\xc7\x80\x20\x18\x21\x17\x09\x85\x0b"
++	"\x14\x9d\x21\x68\x62\x1c\x08\x11\x64\x4b\x92\xf2\xd2\xd3\x2d\x2d"
++	"\x6a\xc2\x73\x6b\x3c\x3c\x8b\x9e\xbc\x52\xaa\xa4\xab\x81\x6c\xf6"
++	"\xfa\xbd\x70\xc5\xc6\x7b\xc2\xaa\x22\x4f\x58\x04\x87\x25\x6a\x27"
++	"\x1d\xa4\x3d\x20\x75\x72\x01\x09\x71\xe5\x1c\x9e\xc3\x2e\x36\xf3"
++	"\xd0\xc6\x35\x2a\x43\x4d\x2d\x0e\x2d\xb4\xa1\x49\xce\x65\x1e\x52"
++	"\x9e\xa1\xf6\x09\xcc\xdc\x63\x66\xa8\x01\xe9\x3b\x0d\xd7\x5a\x85"
++	"\xbb\xc5\x65\xc0\x7b\x2e\x46\xa9\xd9\x56\x1d\x4c\x92\x72\x26\x4e"
++	"\x86\xd5\x68\xae\xc4\xaa\x55\xce\xd7\x83\x59\xb3\x81\xee\xce\x74"
++	"\x39\x39\x31\x9f\x8a\x25\xe8\xa5\xa5\xe5\x81\xf2\x11\x23\xcb\xa1"
++	"\x1e\x43\x12\xe3\xb1\x2a\x2b\xcd\xc8\x8d\x25\x96\xa4\x47\x7d\x95"
++	"\xa5\xc6\x9f\x61\xe4\x25\xc6\x5e\x69\xc4\xe7\x29\x5b\x6e\xb6\xa4"
++	"\xad\x0b\x4e\x72\x95\x25\x58\x56\x33\x9c\x67\xce\xef\x0f\x17\xbf"
++	"\x4c\x7b\x2d\xe6\xfe\x76\x35\x27\x5a\x07\x97\x67\xe8\xae\x8d\x71"
++	"\x0f\xb2\x13\x99\xb9\xbc\x14\xad\xb3\xb7\xe6\x11\x6f\xe0\xda\x58"
++	"\xb1\x08\xac\xa6\x6c\x2d\x7f\x05\xb7\x56\xd2\xe6\xcf\xbb\x4d\x0c"
++	"\xe3\x50\xb2\xec\x91\xf0\x4a\xb8\xd6\x22\xb8\xa7\xf6\x67\xaf\xcf"
++	"\x63\x7e\xd7\xe7\x42\xd8\xbd\xc3\x71\xa1\xf2\x7e\x9b\xa8\x97\x83"
++	"\x6e\xd1\xdc\x4b\x06\x11\x2d\xae\x26\x61\x98\x72\x10\xf4\x42\x5d"
++	"\x20\x4a\xa3\x73\xd7\xf2\xcd\x3c\x48\x32\xe4\x03\x9f\x80\x37\x08"
++	"\x36\x11\xd0\xcb\x97\x6c\x08\xed\x6d\x33\x24\xa2\x1b\xb4\x77\xdf"
++	"\x61\x5d\x5f\xc1\x43\xc2\x82\xeb\x0f\x5d\x84\x08\x68\xaa\xa4\x01"
++	"\xe1\x19\xdf\xbc\x31\x65\xfe\xd1\xf5\x7d\x7a\xb2\x2a\x33\x50\x21"
++	"\x2a\x56\x9d\xb1\x81\xab\xdb\x35\x78\x30\x83\xd9\x89\x1d\x31\xac"
++	"\x96\x14\x07\x61\xbc\x20\x68\x42\x85\x33\x19\xac\xbe\xdb\x34\x56"
++	"\xf1\xd5\xfd\x29\xa9\x28\xdb\xcb\x4c\x5a\x23\xdc\xf5\x96\xc5\x10"
++	"\xa3\x35\x5b\x14\x68\xd3\x61\x62\x64\x76\x26\xcb\x17\x3e\x34\x98"
++	"\x04\xa3\xc4\x20\x38\x90\x92\xe3\xc8\x07\x2c\x36\x74\x66\x26\x0e"
++	"\x29\x02\x64\x29\x2d\x21\xe6\x16\x9c\x6b\xce\xa3\x89\xd9\x4f\xd3"
++	"\xc4\xbd\xc5\x87\x79\x9c\x65\xf6\x39\x45\x60\xe8\xce\x9e\xab\x6d"
++	"\x13\x15\x22\xe1\x5e\x4b\x38\x42\xc4\x1e\xd5\x76\xe0\xc5\xeb\x85"
++	"\x07\x2d\x0f\xb8\xb6\xa6\xd6\x6d\x71\x0d\xa2\x43\x4c\x25\xea\xfa"
++	"\xa1\xae\x4c\xe4\x7d\xbd\x76\xa9\xfb\x06\xc2\x83\x42\xeb\xad\xe7"
++	"\xe9\x5f\x68\x6f\xba\xfb\x2f\x07\xce\xb8\x13\xc1\x9b\xeb\xb0\x76"
++	"\x45\x57\x28\x7b\xea\xbe\x0f\xf4\x30\x7b\xa0\xed\xe4\x22\x93\x21"
++	"\xfc\xbc\xe0\xb9\x75\xc1\x4f\xfc\xef\xb6\xfa\xa1\xfc\x64\xa1\x4a"
++	"\x82\xc7\x33\xad\x75\xed\x82\xbd\x3d\xdb\xf7\xa8\xbe\x5e\xbb\x36"
++	"\x62\x04\x9a\x2e\xc5\xd9\x9e\x9c\x3a\x0b\x98\x0b\x57\xac\xf1\x24"
++	"\x62\x58\x83\x15\x5b\xa6\xf2\xda\x34\x70\x03\xce\x0f\x93\x1b\x12"
++	"\xc7\xce\x54\x87\x33\x15\xd6\x53\x25\x1f\x2a\x90\x87\x12\xe3\x78"
++	"\xef\x55\x77\x4d\x4a\xd8\x7e\xef\xd2\xfd\xd1\xaf\x3a\xaf\x55\xdb"
++	"\x6a\x2d\x3d\x42\xac\x51\x79\xee\x91\xab\xe1\x05\x2d\x3c\x80\xa2"
++	"\x43\xad\x22\x2e\xd5\x33\x13\xa4\x9e\x00\xe0\x04\x10\x84\xc8\xf2"
++	"\x19\x30\x92\x1f\xaa\xc3\x28\xc9\x76\x30\x3f\xe9\x10\x61\x5e\x79"
++	"\xd5\xf7\xdf\xd0\x54\xdb\xae\xb6\xae\xfa\xe8\xa3\x57\xe0\x6c\x2d"
++	"\xf7\xbd\x49\xd6\x6e\x76\x79\xcc\x54\x0c\x5f\xff\x00\xbb\x06\x98"
++	"\xa6\x9e\x89\x61\xb4\x6f\xc3\xe3\x6a\xc2\x4f\x59\x03\xc9\x80\x2c"
++	"\x59\x24\x44\x70\x38\xd5\x96\x6a\x9e\x8b\x81\x64\xe5\xbc\xa0\x3c"
++	"\x33\xaf\x17\x9d\xff\x00\x71\x1a\xd1\x3a\x80\x66\xb3\xd9\x31\x77"
++	"\x0d\x12\xbd\xae\x29\xb5\x6a\xd6\xcf\x8d\x68\x87\x75\xcd\xe8\x65"
++	"\x5a\xbe\x3c\x04\x7b\x34\xdb\x54\x19\xa4\x63\x9c\x2a\x5d\x23\xbe"
++	"\xf4\xb1\x1c\x4d\x90\xec\x92\x2f\x49\x71\xf7\x14\xf2\x97\x9f\x15"
++	"\x57\xed\x13\x21\x2a\xf5\x33\xd1\x2a\x52\x52\xac\xb7\x62\xd1\xcb"
++	"\x46\x73\x8c\x67\x28\x56\x77\x86\xbf\x6f\x2a\x4e\x73\xfe\x95\x65"
++	"\x0b\x5a\x3e\x38\xfc\xfc\xaa\x56\x3f\x86\x73\xe3\xb9\x4a\x52\x84"
++	"\xa5\x08\x4e\x12\x94\x27\x09\x4a\x53\x8c\x61\x29\x4a\x71\xf0\x4a"
++	"\x53\x8c\x7e\x31\x8c\x63\x18\xc6\x31\x8f\xc6\x31\xf8\xc7\x9f\x7c"
++	"\xd5\xbb\xae\x5e\xe2\x1f\xab\x6e\x24\x34\x00\x8a\x25\x83\x70\x40"
++	"\x1c\xcc\xda\x45\x7f\x66\x4e\x30\x2e\x94\x7e\x74\x49\xf0\xe4\x4e"
++	"\x06\x5c\xa8\x2f\x89\x21\x2e\x98\x0e\xd9\x21\xc2\x0b\x21\x0f\xc4"
++	"\x16\x6e\x48\xd9\xe4\xe3\x4a\x19\x1e\x64\x67\x54\xff\x00\x3a\x6d"
++	"\x4f\x62\xb5\x00\x4a\xaa\x51\xfd\x2d\xe8\x0e\x6c\xaf\xc6\x7d\x6d"
++	"\xc8\x88\xc7\x67\xea\x8a\x58\x02\x73\xe3\x65\x4d\xc9\x24\xc0\x3d"
++	"\x57\xa3\x2e\x53\x16\x99\x4f\xe5\xe7\x19\x97\x3e\x3b\xcf\xc9\x4b"
++	"\x99\x7f\x33\x25\xa5\xdf\xba\x77\x2b\xd3\x3e\xc2\x7b\x8b\x94\x07"
++	"\xe9\x52\x5b\x43\x87\x34\x14\x86\x37\xcf\x41\x6b\x8e\x6a\xa5\x22"
++	"\xab\xdb\x96\xa2\xcf\x46\xd8\x9b\x45\x93\xef\xd6\xdf\x3e\x99\x9c"
++	"\x7e\x29\x10\x6b\x6c\xa2\xb8\x43\x05\x09\x44\x70\x8c\xb8\xaa\x54"
++	"\x7c\x30\x36\x5e\x1c\x5e\x5b\x9f\x6c\x0d\x81\xee\xa0\x93\x8d\x67"
++	"\x55\xf3\x87\xaf\xaa\x6b\x58\xf9\xbe\xb2\x36\x07\x42\x6e\xbd\x96"
++	"\xe3\x9f\x1f\x8f\xc9\xf4\x9d\xae\x6a\x7d\x4c\x96\xbe\x5f\xc7\xcd"
++	"\xf3\xb2\xf7\xcd\xf0\xcf\xc3\xe4\xf8\xfe\x37\x4f\x1c\x4d\xf6\x40"
++	"\xf1\x6b\x7c\x4e\xe0\xa6\x71\xad\x56\xa7\x1c\x5c\x15\x6b\xfc\xf3"
++	"\x01\x5d\xac\xf1\x75\x9a\x72\x6b\xaa\x28\xc5\x88\x6d\xfb\x33\x85"
++	"\xe0\x4e\x61\xab\xeb\x31\x2c\x71\x08\x73\x11\x3b\xfc\xb5\xc0\x96"
++	"\xcc\x87\x24\x44\xb5\x9b\x9e\xb3\x71\xba\xe9\xed\xb1\x4e\xd7\x76"
++	"\x6c\xd2\xb6\x05\xb7\x5a\xde\xeb\x34\x5b\x96\x16\xfb\x59\xa9\x5c"
++	"\x4f\x55\xca\x8a\xac\x59\xb0\xe4\x54\x39\x25\xbc\x81\x37\x2a\x09"
++	"\x5f\x9e\x3b\x6b\x7d\x1f\x69\xf3\x34\x85\x39\x84\xa7\x28\x0b\xd3"
++	"\xfd\xfb\x4b\x7a\xea\xe7\xd2\x3c\xd3\xda\x15\x68\xbc\x73\xd3\x22"
++	"\x6f\xd7\x72\x5b\x2b\x66\xee\xa8\x0d\x54\xe8\x5b\xf9\x92\x96\x92"
++	"\x93\xea\x97\x4a\xc7\x43\x10\x46\x35\xc5\xc0\x60\x8a\xe4\xc1\xb5"
++	"\x36\xc6\xae\xed\xf7\x70\xa5\x86\x99\x3d\x91\xf8\xfd\x4e\x53\xeb"
++	"\xbb\xbd\x6d\xec\x8f\xd7\x89\x3d\x31\x7f\xd7\x78\xba\x50\xbb\x74"
++	"\x9d\xf6\xac\x4e\xb9\x03\x9c\x79\xd5\xe1\xbd\x17\x68\xd9\x13\x0b"
++	"\x45\x75\x88\x00\x1d\x1f\xae\x73\x6a\x1d\x5c\x6e\x44\x9f\xa6\xfa"
++	"\x4e\xd8\x25\x8b\xc0\xbc\xb2\x99\xe3\x17\x24\xb3\x23\xe2\x48\x8b"
++	"\xfa\x22\xe7\x7e\x8f\xe6\x3f\x5f\x55\x0d\x75\xd3\x51\x0b\xd7\xed"
++	"\xd3\x6f\x97\x3b\x85\x42\x80\x7e\x5f\xdc\x1b\xd6\xba\xee\xc4\x80"
++	"\xce\x06\xa9\x15\x8c\x97\x5f\x40\x69\xb2\x4d\xc5\xb2\x5c\x1e\x01"
++	"\x87\x7e\xe0\x36\x6d\x78\x80\x4e\x3c\x02\xec\x90\x1d\x11\x81\x74"
++	"\xa5\x8b\xa4\xa0\x56\x06\xd5\x79\x72\x85\x57\x3b\xb2\x2e\xae\x90"
++	"\x18\x8d\x91\xb2\x0e\x44\x19\xaa\xb4\xcc\x08\xed\x46\xfa\xd7\x2b"
++	"\x78\x58\x72\x5d\xbb\x5e\x49\xe7\xee\xf3\x8a\x9d\x22\xa4\x19\xc8"
++	"\xe7\x08\xc3\x90\x9b\x35\x9a\xa4\x25\x8c\x4b\x9b\xa7\xf8\xbf\x81"
++	"\xf5\xdf\x22\x66\xf1\x7e\x9f\x66\x3d\xbb\xfa\x73\x73\x4d\xfd\x67"
++	"\x7b\xf4\xce\xc3\x62\x2e\x6f\xbb\x0c\xa2\xdc\x69\xfc\x8a\x17\x0e"
++	"\x3a\x9e\x83\x46\xd7\xe3\x5e\x65\x86\xc0\x51\x00\xbb\x91\xe3\xe1"
++	"\xc1\x16\xc4\xe9\x65\x5c\x14\x3e\x44\x6a\x6b\xd1\x1e\xb0\x36\xdd"
++	"\x0b\x7d\x8a\xeb\xaf\x58\x5b\x64\x3f\x38\xed\x52\x76\xe8\x46\xf7"
++	"\x86\x84\xb3\x93\xb1\x0b\xe5\xfd\xfd\x0d\xe9\x6d\xe4\xf1\x1b\x1d"
++	"\x56\xb4\x34\xe4\x6a\xf5\xa4\x9c\x2c\xc9\x64\x94\xc1\xf5\x79\x6d"
++	"\x12\x96\xf3\x47\xc5\x48\xa8\xdb\xd8\x95\x64\x29\xcf\xf6\x88\xf1"
++	"\x95\x7a\x98\xe8\xbc\x27\x19\xce\x73\x61\xd1\xb8\xc6\x31\x8c\xe7"
++	"\x39\xce\x77\x9e\xbc\xc6\x31\x8c\x63\xf3\x9c\xe7\x39\xc6\x31\x8f"
++	"\xf7\xce\x7e\x1e\x3b\x7f\x0f\x0f\x0f\x13\x57\xb9\x0a\xe1\x0b\x64"
++	"\x5f\x58\x40\xc6\xc7\x7a\x4b\xf2\x3d\xbc\x71\xf4\xa7\xd2\xca\x14"
++	"\xe2\x98\x1a\x30\x1e\xe0\x26\x5a\x6a\xf0\x9c\x67\x38\x66\x00\xb8"
++	"\x72\xe6\xbe\xac\xfe\x12\xd3\x0b\x56\x73\x8c\x63\xc7\x2b\xe1\xe2"
++	"\xe8\xdd\x7b\xff\x00\xd8\xe5\x23\x6c\xce\xa8\x69\xcf\x5e\x3a\xef"
++	"\x77\xea\xe5\xab\x0e\x82\xdb\xd9\xed\x7a\x9e\xb8\x6d\x51\x32\xdb"
++	"\x79\xc3\x36\x9a\x2d\xa3\x50\x39\x65\x0a\x63\x0e\xe5\xd4\x39\x12"
++	"\xbf\x8b\x98\xa4\xa1\x2d\xad\xb3\xcf\x65\x6a\x43\x78\xb3\x3b\x07"
++	"\xd8\xd5\xea\xae\x76\xad\x6f\xf5\xff\x00\xca\x93\xab\x96\xb0\x64"
++	"\xeb\xd6\x4a\xd5\x87\xba\xec\x24\x60\x97\x06\x76\x03\xe3\x4c\x07"
++	"\x29\x11\x8e\x34\x25\x02\x64\x29\xf0\x25\x48\x85\x3a\x33\x8b\x7a"
++	"\x3c\x86\x1e\x75\xa5\x61\xc6\x97\x9f\x8d\x25\xf5\xc9\xcd\xde\xc9"
++	"\x7d\x77\xf2\xc8\x7e\x70\xaf\x73\x5f\x2d\xec\xa2\x51\x2d\x96\xfb"
++	"\x89\xad\x80\x57\xb2\x36\x1d\x7d\x83\x45\xac\xf3\xdb\xcc\x6c\x31"
++	"\x4f\xcf\x30\x58\xd0\x12\x28\x90\x50\x42\x86\xfb\x48\x16\x3c\xc5"
++	"\x9c\xf8\xe7\xcc\x29\x88\xb3\x4a\x4b\x4e\x6c\xbc\xdb\xc7\xbb\xe9"
++	"\xb6\xa0\x8b\x11\xa1\x7d\x73\xd7\xe9\xbf\x7e\xc2\x6c\x10\x8d\xee"
++	"\x9d\xef\x63\x3a\xe0\xf5\xbe\x8c\x3e\xa1\xc7\xc5\xd1\x00\x44\x1e"
++	"\xf3\x51\xf2\xe2\xb0\xe3\xb5\x13\x7f\x32\xf1\x8c\xa6\x22\xfe\x1f"
++	"\x49\x4d\xbb\xcf\x3a\x5d\xed\x4c\xd2\xfc\x85\xed\x23\xd6\xc7\x50"
++	"\xb6\x5b\x3a\x16\x83\xb8\x6f\xfd\x32\x3f\xaa\x36\x34\xbb\xf5\x96"
++	"\xa9\xab\xcf\x9f\x8f\xac\xc3\xca\xd5\x8b\xd8\x48\x9e\x79\xaa\x30"
++	"\x87\xca\x58\x4d\x59\x96\xb9\x4f\xc5\x1b\x1c\xd2\xda\x5b\xe6\x57"
++	"\x29\xa1\x28\x7a\x2b\x5b\xff\x00\x12\x2f\x5e\x3f\xf3\xbb\x8e\x7f"
++	"\xec\xc6\x98\xff\x00\xed\x3c\xa6\xdd\xa9\xdc\x7e\xa0\xf7\xd6\x99"
++	"\x31\xa2\xf7\xaf\x6b\xe9\x82\x74\x4b\x3d\x8f\x5e\x58\x0b\x33\xab"
++	"\xef\xc3\xaf\x84\x64\xb9\xae\xb6\x25\x5f\x62\x8f\x1c\xe3\xf4\x51"
++	"\xb7\x96\xe3\x0e\x30\x42\xa9\x18\x39\xbf\x9e\x2a\x1f\x74\x19\x02"
++	"\x2d\x43\x93\x06\x63\xb1\xa7\x47\x6a\xfa\x9b\x6c\xeb\xbd\xe9\xae"
++	"\x6a\x7b\x6f\x53\x5a\x60\x5d\xb5\xcd\xe8\x67\xeb\x35\x3b\x48\xc6"
++	"\xa6\xb3\x04\xc8\xdf\xb8\x7e\x26\x64\xb0\xc9\x18\xb0\xa7\x33\xf2"
++	"\x4a\x8b\x22\x3b\x8d\x4b\x89\x1d\xf6\x9d\x65\xc4\x38\xd2\x54\x9c"
++	"\xe3\xcd\x89\xe1\xe1\xe6\x3e\x70\x81\x45\x1d\x18\xf9\x31\x83\xc8"
++	"\xbe\x14\x82\x4b\x87\x7a\x74\x28\xd2\xdd\x12\x55\x30\xe6\x0e\x49"
++	"\x31\x8e\x48\x69\xc5\xc0\x20\x91\xe4\x48\x41\x4c\xd8\xb9\x6a\x4e"
++	"\x21\xce\x99\x1b\x0e\xfd\x09\x4f\xa1\x79\x0f\x0f\x0f\x0f\x0f\x0f"
++	"\x0f\x3f\x3c\xb8\x71\x27\xc7\x72\x24\xe8\xb1\xa6\xc5\x7b\x18\xc3"
++	"\xb1\xa5\xb0\xd4\x98\xee\xe3\x19\xc6\x71\x87\x19\x79\x2b\x6d\x78"
++	"\xc6\x71\x8c\xe3\x0a\x4e\x71\x8c\xe3\x19\xfe\x38\xf2\x3b\xfb\x8b"
++	"\x48\xfe\x4e\xaa\xff\x00\x4f\x08\xff\x00\xc7\xe1\xfb\x8b\x48\xfe"
++	"\x4e\xaa\xff\x00\x4f\x08\xff\x00\xc7\xe4\x95\x86\x18\x8a\xcb\x31"
++	"\xa3\x32\xd4\x78\xf1\xdb\x43\x2c\x47\x61\xb4\x32\xcb\x2c\xb4\x9c"
++	"\x21\xb6\x99\x69\xbc\x25\xb6\xdb\x6d\x18\xc2\x10\xda\x12\x94\xa1"
++	"\x38\xc2\x53\x8c\x63\x18\xc7\x9d\xbe\x7f\xff\xd9"
++	;
+diff -Nura php-5.2.5/main/suhosin_patch.c suhosin-patch-5.2.5-0.9.6.2/main/suhosin_patch.c
+--- php-5.2.5/main/suhosin_patch.c	1970-01-01 01:00:00.000000000 +0100
++++ suhosin-patch-5.2.5-0.9.6.2/main/suhosin_patch.c	2007-11-10 01:38:46.000000000 +0100
+@@ -0,0 +1,380 @@
++/*
++   +----------------------------------------------------------------------+
++   | Suhosin Patch for PHP                                                |
++   +----------------------------------------------------------------------+
++   | Copyright (c) 2004-2006 Stefan Esser                                 |
++   +----------------------------------------------------------------------+
++   | This source file is subject to version 2.02 of the PHP license,      |
++   | that is bundled with this package in the file LICENSE, and is        |
++   | available at through the world-wide-web at                           |
++   | http://www.php.net/license/2_02.txt.                                 |
++   | If you did not receive a copy of the PHP license and are unable to   |
++   | obtain it through the world-wide-web, please send a note to          |
++   | license at php.net so we can mail you a copy immediately.               |
++   +----------------------------------------------------------------------+
++   | Author: Stefan Esser <sesser at hardened-php.net>                       |
++   +----------------------------------------------------------------------+
++ */
++/* $Id: suhosin_patch.c,v 1.2 2004/11/21 09:38:52 ionic Exp $ */
++
++#include "php.h"
++
++#include <stdio.h>
++#include <stdlib.h>
++
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include "SAPI.h"
++#include "php_globals.h"
++
++#if SUHOSIN_PATCH
++
++#ifdef HAVE_SYS_SOCKET_H
++#include <sys/socket.h>
++#endif
++
++#if defined(PHP_WIN32) || defined(__riscos__) || defined(NETWARE)
++#undef AF_UNIX
++#endif
++
++#if defined(AF_UNIX)
++#include <sys/un.h>
++#endif
++
++#define SYSLOG_PATH  "/dev/log"
++
++#ifdef PHP_WIN32
++static HANDLE log_source = 0;
++#endif
++
++#include "snprintf.h"
++
++#include "suhosin_patch.h"
++
++#ifdef ZTS
++#include "suhosin_globals.h"
++int suhosin_patch_globals_id;
++#else
++struct _suhosin_patch_globals suhosin_patch_globals;
++#endif
++
++static void php_security_log(int loglevel, char *fmt, ...);
++
++static void suhosin_patch_globals_ctor(suhosin_patch_globals_struct *suhosin_patch_globals TSRMLS_DC)
++{
++	memset(suhosin_patch_globals, 0, sizeof(*suhosin_patch_globals));
++}
++
++PHPAPI void suhosin_startup()
++{
++#ifdef ZTS
++	ts_allocate_id(&suhosin_patch_globals_id, sizeof(suhosin_patch_globals_struct), (ts_allocate_ctor) suhosin_patch_globals_ctor, NULL);
++#else
++	suhosin_patch_globals_ctor(&suhosin_patch_globals TSRMLS_CC);
++#endif
++	zend_suhosin_log = php_security_log;
++}
++
++/*PHPAPI void suhosin_clear_mm_canaries(TSRMLS_D)
++{
++    zend_alloc_clear_mm_canaries(AG(heap));
++	SPG(canary_1) = zend_canary();
++	SPG(canary_2) = zend_canary();
++	SPG(canary_3) = zend_canary();
++}*/
++
++static char *loglevel2string(int loglevel)
++{
++	switch (loglevel) {
++	    case S_FILES:
++		return "FILES";
++	    case S_INCLUDE:
++		return "INCLUDE";
++	    case S_MEMORY:
++		return "MEMORY";
++	    case S_MISC:
++		return "MISC";
++		case S_SESSION:
++		return "SESSION";
++	    case S_SQL:
++		return "SQL";
++	    case S_EXECUTOR:
++		return "EXECUTOR";
++	    case S_VARS:
++		return "VARS";
++	    default:
++		return "UNKNOWN";    
++	}
++}
++
++static void php_security_log(int loglevel, char *fmt, ...)
++{
++	int s, r, i=0;
++#if defined(AF_UNIX)
++	struct sockaddr_un saun;
++#endif
++#ifdef PHP_WIN32
++	LPTSTR strs[2];
++	unsigned short etype;
++	DWORD evid;
++#endif
++	char buf[4096+64];
++	char error[4096+100];
++	char *ip_address;
++	char *fname;
++	char *alertstring;
++	int lineno;
++	va_list ap;
++	TSRMLS_FETCH();
++
++	/*SDEBUG("(suhosin_log) loglevel: %d log_syslog: %u - log_sapi: %u - log_script: %u", loglevel, SPG(log_syslog), SPG(log_sapi), SPG(log_script));*/
++	
++	if (SPG(log_use_x_forwarded_for)) {
++		ip_address = sapi_getenv("HTTP_X_FORWARDED_FOR", 20 TSRMLS_CC);
++		if (ip_address == NULL) {
++			ip_address = "X-FORWARDED-FOR not set";
++		}
++	} else {
++		ip_address = sapi_getenv("REMOTE_ADDR", 11 TSRMLS_CC);
++		if (ip_address == NULL) {
++			ip_address = "REMOTE_ADDR not set";
++		}
++	}
++	
++	
++	va_start(ap, fmt);
++	ap_php_vsnprintf(error, sizeof(error), fmt, ap);
++	va_end(ap);
++	while (error[i]) {
++		if (error[i] < 32) error[i] = '.';
++		i++;
++	}
++	
++/*	if (SPG(simulation)) {
++		alertstring = "ALERT-SIMULATION";
++	} else { */
++		alertstring = "ALERT";
++/*	}*/
++	
++	if (zend_is_executing(TSRMLS_C)) {
++		if (EG(current_execute_data)) {
++			lineno = EG(current_execute_data)->opline->lineno;
++			fname = EG(current_execute_data)->op_array->filename;
++		} else {
++			lineno = zend_get_executed_lineno(TSRMLS_C);
++			fname = zend_get_executed_filename(TSRMLS_C);
++		}
++		ap_php_snprintf(buf, sizeof(buf), "%s - %s (attacker '%s', file '%s', line %u)", alertstring, error, ip_address, fname, lineno);
++	} else {
++		fname = sapi_getenv("SCRIPT_FILENAME", 15 TSRMLS_CC);
++		if (fname==NULL) {
++			fname = "unknown";
++		}
++		ap_php_snprintf(buf, sizeof(buf), "%s - %s (attacker '%s', file '%s')", alertstring, error, ip_address, fname);
++	}
++			
++	/* Syslog-Logging disabled? */
++	if (((SPG(log_syslog)|S_INTERNAL) & loglevel)==0) {
++		goto log_sapi;
++	}	
++	
++#if defined(AF_UNIX)
++	ap_php_snprintf(error, sizeof(error), "<%u>suhosin[%u]: %s\n", (unsigned int)(SPG(log_syslog_facility)|SPG(log_syslog_priority)),getpid(),buf);
++
++	s = socket(AF_UNIX, SOCK_DGRAM, 0);
++	if (s == -1) {
++		goto log_sapi;
++	}
++	
++	memset(&saun, 0, sizeof(saun));
++	saun.sun_family = AF_UNIX;
++	strcpy(saun.sun_path, SYSLOG_PATH);
++	/*saun.sun_len = sizeof(saun);*/
++	
++	r = connect(s, (struct sockaddr *)&saun, sizeof(saun));
++	if (r) {
++		close(s);
++    		s = socket(AF_UNIX, SOCK_STREAM, 0);
++		if (s == -1) {
++			goto log_sapi;
++		}
++	
++		memset(&saun, 0, sizeof(saun));
++		saun.sun_family = AF_UNIX;
++		strcpy(saun.sun_path, SYSLOG_PATH);
++		/*saun.sun_len = sizeof(saun);*/
++
++		r = connect(s, (struct sockaddr *)&saun, sizeof(saun));
++		if (r) { 
++			close(s);
++			goto log_sapi;
++		}
++	}
++	send(s, error, strlen(error), 0);
++	
++	close(s);
++#endif
++#ifdef PHP_WIN32
++	ap_php_snprintf(error, sizeof(error), "suhosin[%u]: %s", getpid(),buf);
++
++	switch (SPG(log_syslog_priority)) {			/* translate UNIX type into NT type */
++		case 1: /*LOG_ALERT:*/
++			etype = EVENTLOG_ERROR_TYPE;
++			break;
++		case 6: /*LOG_INFO:*/
++			etype = EVENTLOG_INFORMATION_TYPE;
++			break;
++		default:
++			etype = EVENTLOG_WARNING_TYPE;
++	}
++	evid = loglevel;
++	strs[0] = error;
++	/* report the event */
++	if (log_source == NULL) {
++		log_source = RegisterEventSource(NULL, "Suhosin-Patch-" SUHOSIN_PATCH_VERSION);
++	}
++	ReportEvent(log_source, etype, (unsigned short) SPG(log_syslog_priority), evid, NULL, 1, 0, strs, NULL);
++	
++#endif
++log_sapi:
++	/* SAPI Logging activated? */
++	/*SDEBUG("(suhosin_log) log_syslog: %u - log_sapi: %u - log_script: %u - log_phpscript: %u", SPG(log_syslog), SPG(log_sapi), SPG(log_script), SPG(log_phpscript));*/
++	if (((SPG(log_sapi)|S_INTERNAL) & loglevel)!=0) {
++		sapi_module.log_message(buf);
++	}
++
++/*log_script:*/
++	/* script logging activaed? */
++	if (((SPG(log_script) & loglevel)!=0) && SPG(log_scriptname)!=NULL) {
++		char cmd[8192], *cmdpos, *bufpos;
++		FILE *in;
++		int space;
++		
++		ap_php_snprintf(cmd, sizeof(cmd), "%s %s \'", SPG(log_scriptname), loglevel2string(loglevel));
++		space = sizeof(cmd) - strlen(cmd);
++		cmdpos = cmd + strlen(cmd);
++		bufpos = buf;
++		if (space <= 1) return;
++		while (space > 2 && *bufpos) {
++			if (*bufpos == '\'') {
++				if (space<=5) break;
++				*cmdpos++ = '\'';
++				*cmdpos++ = '\\';
++				*cmdpos++ = '\'';
++				*cmdpos++ = '\'';
++				bufpos++;
++				space-=4;
++			} else {
++				*cmdpos++ = *bufpos++;
++				space--;
++			}
++		}
++		*cmdpos++ = '\'';
++		*cmdpos = 0;
++		
++		if ((in=VCWD_POPEN(cmd, "r"))==NULL) {
++			php_security_log(S_INTERNAL, "Unable to execute logging shell script: %s", SPG(log_scriptname));
++			return;
++		}
++		/* read and forget the result */
++		while (1) {
++			int readbytes = fread(cmd, 1, sizeof(cmd), in);
++			if (readbytes<=0) {
++				break;
++			}
++		}
++		pclose(in);
++	}
++/*log_phpscript:*/
++	if ((SPG(log_phpscript) & loglevel)!=0 && EG(in_execution) && SPG(log_phpscriptname) && SPG(log_phpscriptname)[0]) {
++		zend_file_handle file_handle;
++		zend_op_array *new_op_array;
++		zval *result = NULL;
++		
++		/*long orig_execution_depth = SPG(execution_depth);*/
++		zend_bool orig_safe_mode = PG(safe_mode);
++		char *orig_basedir = PG(open_basedir);
++		
++		char *phpscript = SPG(log_phpscriptname);
++/*SDEBUG("scriptname %s", SPG(log_phpscriptname));`*/
++#ifdef ZEND_ENGINE_2
++		if (zend_stream_open(phpscript, &file_handle TSRMLS_CC) == SUCCESS) {
++#else
++		if (zend_open(phpscript, &file_handle) == SUCCESS && ZEND_IS_VALID_FILE_HANDLE(&file_handle)) {
++			file_handle.filename = phpscript;
++			file_handle.free_filename = 0;
++#endif		
++			if (!file_handle.opened_path) {
++				file_handle.opened_path = estrndup(phpscript, strlen(phpscript));
++			}
++			new_op_array = zend_compile_file(&file_handle, ZEND_REQUIRE TSRMLS_CC);
++			zend_destroy_file_handle(&file_handle TSRMLS_CC);
++			if (new_op_array) {
++				HashTable *active_symbol_table = EG(active_symbol_table);
++				zval *zerror, *zerror_class;
++				
++				if (active_symbol_table == NULL) {
++					active_symbol_table = &EG(symbol_table);
++				}
++				EG(return_value_ptr_ptr) = &result;
++				EG(active_op_array) = new_op_array;
++				
++				MAKE_STD_ZVAL(zerror);
++				MAKE_STD_ZVAL(zerror_class);
++				ZVAL_STRING(zerror, buf, 1);
++				ZVAL_LONG(zerror_class, loglevel);
++
++				zend_hash_update(active_symbol_table, "SUHOSIN_ERROR", sizeof("SUHOSIN_ERROR"), (void **)&zerror, sizeof(zval *), NULL);
++				zend_hash_update(active_symbol_table, "SUHOSIN_ERRORCLASS", sizeof("SUHOSIN_ERRORCLASS"), (void **)&zerror_class, sizeof(zval *), NULL);
++				
++				/*SPG(execution_depth) = 0;*/
++				if (SPG(log_phpscript_is_safe)) {
++					PG(safe_mode) = 0;
++					PG(open_basedir) = NULL;
++				}
++				
++				zend_execute(new_op_array TSRMLS_CC);
++				
++				/*SPG(execution_depth) = orig_execution_depth;*/
++				PG(safe_mode) = orig_safe_mode;
++				PG(open_basedir) = orig_basedir;
++				
++#ifdef ZEND_ENGINE_2
++				destroy_op_array(new_op_array TSRMLS_CC);
++#else
++				destroy_op_array(new_op_array);
++#endif
++				efree(new_op_array);
++#ifdef ZEND_ENGINE_2
++				if (!EG(exception))
++#endif			
++				{
++					if (EG(return_value_ptr_ptr)) {
++						zval_ptr_dtor(EG(return_value_ptr_ptr));
++						EG(return_value_ptr_ptr) = NULL;
++					}
++				}
++			} else {
++				php_security_log(S_INTERNAL, "Unable to execute logging PHP script: %s", SPG(log_phpscriptname));
++				return;
++			}
++		} else {
++			php_security_log(S_INTERNAL, "Unable to execute logging PHP script: %s", SPG(log_phpscriptname));
++			return;
++		}
++	}
++
++}
++
++
++#endif
++
++/*
++ * Local variables:
++ * tab-width: 4
++ * c-basic-offset: 4
++ * End:
++ * vim600: sw=4 ts=4 fdm=marker
++ * vim<600: sw=4 ts=4
++ */
+diff -Nura php-5.2.5/main/suhosin_patch.h suhosin-patch-5.2.5-0.9.6.2/main/suhosin_patch.h
+--- php-5.2.5/main/suhosin_patch.h	1970-01-01 01:00:00.000000000 +0100
++++ suhosin-patch-5.2.5-0.9.6.2/main/suhosin_patch.h	2007-11-10 01:38:46.000000000 +0100
+@@ -0,0 +1,40 @@
++/*
++   +----------------------------------------------------------------------+
++   | Suhosin Patch for PHP                                                |
++   +----------------------------------------------------------------------+
++   | Copyright (c) 2004-2006 Stefan Esser                                 |
++   +----------------------------------------------------------------------+
++   | This source file is subject to version 2.02 of the PHP license,      |
++   | that is bundled with this package in the file LICENSE, and is        |
++   | available at through the world-wide-web at                           |
++   | http://www.php.net/license/2_02.txt.                                 |
++   | If you did not receive a copy of the PHP license and are unable to   |
++   | obtain it through the world-wide-web, please send a note to          |
++   | license at php.net so we can mail you a copy immediately.               |
++   +----------------------------------------------------------------------+
++   | Author: Stefan Esser <sesser at hardened-php.net>                       |
++   +----------------------------------------------------------------------+
++ */
++
++#ifndef SUHOSIN_PATCH_H
++#define SUHOSIN_PATCH_H
++
++#if SUHOSIN_PATCH
++
++#include "zend.h"
++
++PHPAPI void suhosin_startup();
++#define SUHOSIN_PATCH_VERSION "0.9.6.2"
++
++#define SUHOSIN_LOGO_GUID "SUHO8567F54-D428-14d2-A769-00DA302A5F18"
++
++#endif
++
++#endif /* SUHOSIN_PATCH_H */
++
++/*
++ * Local variables:
++ * tab-width: 4
++ * c-basic-offset: 4
++ * End:
++ */
+diff -Nura php-5.2.5/main/suhosin_patch.m4 suhosin-patch-5.2.5-0.9.6.2/main/suhosin_patch.m4
+--- php-5.2.5/main/suhosin_patch.m4	1970-01-01 01:00:00.000000000 +0100
++++ suhosin-patch-5.2.5-0.9.6.2/main/suhosin_patch.m4	2007-11-10 01:38:46.000000000 +0100
+@@ -0,0 +1,8 @@
++dnl
++dnl $Id: suhosin_patch.m4,v 1.1 2004/11/14 13:24:24 ionic Exp $
++dnl
++dnl This file contains Suhosin Patch for PHP specific autoconf functions.
++dnl
++
++AC_DEFINE(SUHOSIN_PATCH, 1, [Suhosin Patch])
++
+diff -Nura php-5.2.5/sapi/apache/mod_php5.c suhosin-patch-5.2.5-0.9.6.2/sapi/apache/mod_php5.c
+--- php-5.2.5/sapi/apache/mod_php5.c	2007-08-06 14:54:57.000000000 +0200
++++ suhosin-patch-5.2.5-0.9.6.2/sapi/apache/mod_php5.c	2007-11-10 01:38:46.000000000 +0100
+@@ -951,7 +951,11 @@
+ 	{
+ 		TSRMLS_FETCH();
+ 		if (PG(expose_php)) {
++#if SUHOSIN_PATCH
++			ap_add_version_component("PHP/" PHP_VERSION " with Suhosin-Patch");
++#else
+ 			ap_add_version_component("PHP/" PHP_VERSION);
++#endif			
+ 		}
+ 	}
+ #endif
+diff -Nura php-5.2.5/sapi/apache2filter/sapi_apache2.c suhosin-patch-5.2.5-0.9.6.2/sapi/apache2filter/sapi_apache2.c
+--- php-5.2.5/sapi/apache2filter/sapi_apache2.c	2007-01-01 10:36:12.000000000 +0100
++++ suhosin-patch-5.2.5-0.9.6.2/sapi/apache2filter/sapi_apache2.c	2007-11-10 01:38:46.000000000 +0100
+@@ -562,7 +562,11 @@
+ {
+ 	TSRMLS_FETCH();
+ 	if (PG(expose_php)) {
++#if SUHOSIN_PATCH
++		ap_add_version_component(p, "PHP/" PHP_VERSION " with Suhosin-Patch");
++#else
+ 		ap_add_version_component(p, "PHP/" PHP_VERSION);
++#endif
+ 	}
+ }
+ 
+diff -Nura php-5.2.5/sapi/apache2handler/sapi_apache2.c suhosin-patch-5.2.5-0.9.6.2/sapi/apache2handler/sapi_apache2.c
+--- php-5.2.5/sapi/apache2handler/sapi_apache2.c	2007-06-28 19:23:07.000000000 +0200
++++ suhosin-patch-5.2.5-0.9.6.2/sapi/apache2handler/sapi_apache2.c	2007-11-10 01:38:46.000000000 +0100
+@@ -372,7 +372,11 @@
+ {
+ 	TSRMLS_FETCH();
+ 	if (PG(expose_php)) {
++#if SUHOSIN_PATCH
++		ap_add_version_component(p, "PHP/" PHP_VERSION " with Suhosin-Patch");
++#else
+ 		ap_add_version_component(p, "PHP/" PHP_VERSION);
++#endif
+ 	}
+ }
+ 
+diff -Nura php-5.2.5/sapi/cgi/cgi_main.c suhosin-patch-5.2.5-0.9.6.2/sapi/cgi/cgi_main.c
+--- php-5.2.5/sapi/cgi/cgi_main.c	2007-11-01 16:23:14.000000000 +0100
++++ suhosin-patch-5.2.5-0.9.6.2/sapi/cgi/cgi_main.c	2007-11-10 01:40:43.000000000 +0100
+@@ -1720,11 +1720,19 @@
+ 							SG(headers_sent) = 1;
+ 							SG(request_info).no_headers = 1;
+ 						}
++#if SUHOSIN_PATCH
++#if ZEND_DEBUG
++						php_printf("PHP %s with Suhosin-Patch %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2007 The PHP Group\n%s", PHP_VERSION, SUHOSIN_PATCH_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
++#else
++						php_printf("PHP %s with Suhosin-Patch %s (%s) (built: %s %s)\nCopyright (c) 1997-2007 The PHP Group\n%s", PHP_VERSION, SUHOSIN_PATCH_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
++#endif
++#else
+ #if ZEND_DEBUG
+ 						php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2007 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
+ #else
+ 						php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2007 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
+ #endif
++#endif
+ 						php_request_shutdown((void *) 0);
+ 						exit_status = 0;
+ 						goto out;
+diff -Nura php-5.2.5/sapi/cli/php_cli.c suhosin-patch-5.2.5-0.9.6.2/sapi/cli/php_cli.c
+--- php-5.2.5/sapi/cli/php_cli.c	2007-08-09 01:51:24.000000000 +0200
++++ suhosin-patch-5.2.5-0.9.6.2/sapi/cli/php_cli.c	2007-11-10 01:38:46.000000000 +0100
+@@ -779,8 +779,14 @@
+ 				}
+ 
+ 				request_started = 1;
+-				php_printf("PHP %s (%s) (built: %s %s) %s\nCopyright (c) 1997-2007 The PHP Group\n%s",
+-					PHP_VERSION, sapi_module.name, __DATE__, __TIME__,
++#if SUHOSIN_PATCH
++				php_printf("PHP %s with Suhosin-Patch %s (%s) (built: %s %s) %s\nCopyright (c) 1997-2007 The PHP Group\n%s", 
++					PHP_VERSION, SUHOSIN_PATCH_VERSION,
++#else
++			    php_printf("PHP %s (%s) (built: %s %s) %s\nCopyright (c) 1997-2007 The PHP Group\n%s",
++					PHP_VERSION,
++#endif
++					sapi_module.name, __DATE__, __TIME__,
+ #if ZEND_DEBUG && defined(HAVE_GCOV)
+ 					"(DEBUG GCOV)",
+ #elif ZEND_DEBUG
+diff -Nura php-5.2.5/win32/build/config.w32 suhosin-patch-5.2.5-0.9.6.2/win32/build/config.w32
+--- php-5.2.5/win32/build/config.w32	2007-04-18 11:38:59.000000000 +0200
++++ suhosin-patch-5.2.5-0.9.6.2/win32/build/config.w32	2007-11-10 01:38:46.000000000 +0100
+@@ -299,7 +299,7 @@
+ 	zend_sprintf.c zend_ini.c zend_qsort.c zend_multibyte.c zend_ts_hash.c \
+ 	zend_stream.c zend_iterators.c zend_interfaces.c zend_objects.c \
+ 	zend_object_handlers.c zend_objects_API.c \
+-	zend_default_classes.c zend_execute.c zend_strtod.c");
++	zend_default_classes.c zend_execute.c zend_strtod.c zend_canary.c");
+ 
+ ADD_SOURCES("main", "main.c snprintf.c spprintf.c safe_mode.c fopen_wrappers.c \
+ 	php_scandir.c php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \
+@@ -344,6 +344,8 @@
+ AC_DEFINE('HAVE_USLEEP', 1);
+ AC_DEFINE('HAVE_STRCOLL', 1);
+ 
++AC_DEFINE('SUHOSIN_PATCH', 1);
++
+ /* For snapshot builders, where can we find the additional
+  * files that make up the snapshot template? */
+ ARG_WITH("snapshot-template", "Path to snapshot builder template dir", "no");




More information about the Pkg-php-commits mailing list