summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan2010-03-24 18:10:10 +0100
committerStefan2010-03-24 18:10:10 +0100
commit799405fc1cad4bfa4fc386ea4e46cad25b515b1d (patch)
treebb867d67d29eb8f02ed8854b7deca514137e05a0
parentb88687640649423e30c4bf8bb9808bc8acf592a3 (diff)
Fixed suhosin_header_handler to be PHP 5.3.x compatible
-rw-r--r--Changelog1
-rw-r--r--header.c20
2 files changed, 20 insertions, 1 deletions
diff --git a/Changelog b/Changelog
index 3ce9e80..4037981 100644
--- a/Changelog
+++ b/Changelog
@@ -9,6 +9,7 @@
9 - Fixed random number generator replacement error case behaviour in PHP 5.3.x 9 - Fixed random number generator replacement error case behaviour in PHP 5.3.x
10 - Fixed error case handling in function_exists() PHP 5.3.x 10 - Fixed error case handling in function_exists() PHP 5.3.x
11 - Merged changes/fixes in import_request_variables()/extract() from upstream PHP 11 - Merged changes/fixes in import_request_variables()/extract() from upstream PHP
12 - Fixed suhosin_header_handler to be PHP 5.3.x compatible
12 13
132009-08-15 - 0.9.29 142009-08-15 - 0.9.29
14 15
diff --git a/header.c b/header.c
index 92122ce..d4536d8 100644
--- a/header.c
+++ b/header.c
@@ -32,7 +32,11 @@
32#include "SAPI.h" 32#include "SAPI.h"
33#include "php_variables.h" 33#include "php_variables.h"
34 34
35#if PHP_VERSION_ID >= 50300
36static int (*orig_header_handler)(sapi_header_struct *sapi_header, sapi_header_op_enum op, sapi_headers_struct *sapi_headers TSRMLS_DC) = NULL;
37#else
35static int (*orig_header_handler)(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC) = NULL; 38static int (*orig_header_handler)(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC) = NULL;
39#endif
36 40
37char *suhosin_encrypt_single_cookie(char *name, int name_len, char *value, int value_len, char *key TSRMLS_DC) 41char *suhosin_encrypt_single_cookie(char *name, int name_len, char *value, int value_len, char *key TSRMLS_DC)
38{ 42{
@@ -221,10 +225,20 @@ char *suhosin_cookie_decryptor(TSRMLS_D)
221 225
222/* {{{ suhosin_header_handler 226/* {{{ suhosin_header_handler
223 */ 227 */
228#if PHP_VERSION_ID >= 50300
229int suhosin_header_handler(sapi_header_struct *sapi_header, sapi_header_op_enum op, sapi_headers_struct *sapi_headers TSRMLS_DC)
230#else
224int suhosin_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC) 231int suhosin_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC)
232#endif
225{ 233{
226 int retval = SAPI_HEADER_ADD, i; 234 int retval = SAPI_HEADER_ADD, i;
227 char *tmp; 235 char *tmp;
236
237#if PHP_VERSION_ID >= 50300
238 if (op != SAPI_HEADER_ADD && op != SAPI_HEADER_REPLACE) {
239 goto suhosin_skip_header_handling;
240 }
241#endif
228 242
229 if (!SUHOSIN_G(allow_multiheader) && sapi_header && sapi_header->header) { 243 if (!SUHOSIN_G(allow_multiheader) && sapi_header && sapi_header->header) {
230 244
@@ -309,10 +323,14 @@ int suhosin_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct
309 sapi_header->header_len = len; 323 sapi_header->header_len = len;
310 } 324 }
311 325
312 326suhosin_skip_header_handling:
313 /* If existing call the sapi header handler */ 327 /* If existing call the sapi header handler */
314 if (orig_header_handler) { 328 if (orig_header_handler) {
329#if PHP_VERSION_ID >= 50300
330 retval = orig_header_handler(sapi_header, op, sapi_headers TSRMLS_CC);
331#else
315 retval = orig_header_handler(sapi_header, sapi_headers TSRMLS_CC); 332 retval = orig_header_handler(sapi_header, sapi_headers TSRMLS_CC);
333#endif
316 } 334 }
317 335
318 return retval; 336 return retval;