diff options
| author | Stefan Esser | 2014-02-15 19:59:25 +0100 |
|---|---|---|
| committer | Stefan Esser | 2014-02-15 19:59:25 +0100 |
| commit | 1787be2a05131dd1848e75081acb87f955af46a7 (patch) | |
| tree | ff830cc845e5a2acd0e185dda01a0207bcc27d9f | |
| parent | 130e8f93da07c0a13c0415611b01fa8a6fe2cafd (diff) | |
Add ini_set() fail mode to suhosin.disable.display_errors
| -rw-r--r-- | Changelog | 5 | ||||
| -rw-r--r-- | suhosin.c | 48 |
2 files changed, 48 insertions, 5 deletions
| @@ -5,10 +5,11 @@ | |||
| 5 | - Add changes in PHP 5.5 session handlers structures for PHP 5.5 compability | 5 | - Add changes in PHP 5.5 session handlers structures for PHP 5.5 compability |
| 6 | - Fix std post handler for PHP >= 5.3.11 | 6 | - Fix std post handler for PHP >= 5.3.11 |
| 7 | - Fix suhosin logo in phpinfo() for PHP 5.5 | 7 | - Fix suhosin logo in phpinfo() for PHP 5.5 |
| 8 | - Change fileupload handling for PHP >= 5.4.0 to use an up to date RFC1867 replacement code | 8 | - Change fileupload handling for PHP >= 5.4.0 to use an up to date RFC1867 replacement code |
| 9 | - Adapted suhosin to PHP 5.5 executor | 9 | - Adapted suhosin to PHP 5.5 executor |
| 10 | - Added some test cases for various things | 10 | - Added some test cases for various things |
| 11 | - Added suhosin.log.stdout to log to stdout (for debugging purposes only) | 11 | - Added suhosin.log.stdout to log to stdout (for debugging purposes only) |
| 12 | - Add ini_set() fail mode to suhosin.disable.display_errors | ||
| 12 | - TODO: WARN THAT FUNCTION WHITELISTS/BLACKLISTS NEVER WORKED CORRECTLY WITH PHP < 5.5 | 13 | - TODO: WARN THAT FUNCTION WHITELISTS/BLACKLISTS NEVER WORKED CORRECTLY WITH PHP < 5.5 |
| 13 | 14 | ||
| 14 | 2012-02-12 - 0.9.34 | 15 | 2012-02-12 - 0.9.34 |
| @@ -581,6 +581,43 @@ static ZEND_INI_MH(OnUpdate_cookie_plainlist) | |||
| 581 | return SUCCESS; | 581 | return SUCCESS; |
| 582 | } | 582 | } |
| 583 | 583 | ||
| 584 | static ZEND_INI_MH(OnUpdate_disable_display_errors) /* {{{ */ | ||
| 585 | { | ||
| 586 | zend_bool *p; | ||
| 587 | #ifndef ZTS | ||
| 588 | char *base = (char *) mh_arg2; | ||
| 589 | #else | ||
| 590 | char *base; | ||
| 591 | |||
| 592 | base = (char *) ts_resource(*((int *) mh_arg2)); | ||
| 593 | #endif | ||
| 594 | |||
| 595 | p = (zend_bool *) (base+(size_t) mh_arg1); | ||
| 596 | |||
| 597 | if (new_value_length == 2 && strcasecmp("on", new_value) == 0) { | ||
| 598 | *p = (zend_bool) 1; | ||
| 599 | } | ||
| 600 | else if (new_value_length == 3 && strcasecmp("yes", new_value) == 0) { | ||
| 601 | *p = (zend_bool) 1; | ||
| 602 | } | ||
| 603 | else if (new_value_length == 4 && strcasecmp("true", new_value) == 0) { | ||
| 604 | *p = (zend_bool) 1; | ||
| 605 | } | ||
| 606 | else if (new_value_length == 4 && strcasecmp("fail", new_value) == 0) { | ||
| 607 | *p = (zend_bool) 2; | ||
| 608 | } | ||
| 609 | else { | ||
| 610 | *p = (zend_bool) atoi(new_value); | ||
| 611 | } | ||
| 612 | return SUCCESS; | ||
| 613 | } | ||
| 614 | /* }}} */ | ||
| 615 | |||
| 616 | static ZEND_INI_MH(OnUpdate_fail) | ||
| 617 | { | ||
| 618 | return FAILURE; | ||
| 619 | } | ||
| 620 | |||
| 584 | /* {{{ proto void suhosin_register_cookie_variable(char *var, zval *val, zval *track_vars_array TSRMLS_DC) | 621 | /* {{{ proto void suhosin_register_cookie_variable(char *var, zval *val, zval *track_vars_array TSRMLS_DC) |
| 585 | Registers a cookie in the RAW cookie array */ | 622 | Registers a cookie in the RAW cookie array */ |
| 586 | static void suhosin_register_cookie_variable(char *var, zval *val, zval *track_vars_array TSRMLS_DC) | 623 | static void suhosin_register_cookie_variable(char *var, zval *val, zval *track_vars_array TSRMLS_DC) |
| @@ -905,7 +942,7 @@ PHP_INI_BEGIN() | |||
| 905 | STD_ZEND_INI_BOOLEAN("suhosin.coredump", "0", ZEND_INI_SYSTEM, OnUpdateBool, coredump, zend_suhosin_globals, suhosin_globals) | 942 | STD_ZEND_INI_BOOLEAN("suhosin.coredump", "0", ZEND_INI_SYSTEM, OnUpdateBool, coredump, zend_suhosin_globals, suhosin_globals) |
| 906 | STD_ZEND_INI_BOOLEAN("suhosin.stealth", "1", ZEND_INI_SYSTEM, OnUpdateBool, stealth, zend_suhosin_globals, suhosin_globals) | 943 | STD_ZEND_INI_BOOLEAN("suhosin.stealth", "1", ZEND_INI_SYSTEM, OnUpdateBool, stealth, zend_suhosin_globals, suhosin_globals) |
| 907 | STD_ZEND_INI_BOOLEAN("suhosin.apc_bug_workaround", "0", ZEND_INI_SYSTEM, OnUpdateBool, apc_bug_workaround, zend_suhosin_globals, suhosin_globals) | 944 | STD_ZEND_INI_BOOLEAN("suhosin.apc_bug_workaround", "0", ZEND_INI_SYSTEM, OnUpdateBool, apc_bug_workaround, zend_suhosin_globals, suhosin_globals) |
| 908 | STD_ZEND_INI_BOOLEAN("suhosin.disable.display_errors", "0", ZEND_INI_SYSTEM, OnUpdateBool, disable_display_errors, zend_suhosin_globals, suhosin_globals) | 945 | STD_ZEND_INI_BOOLEAN("suhosin.disable.display_errors", "0", ZEND_INI_SYSTEM, OnUpdate_disable_display_errors, disable_display_errors, zend_suhosin_globals, suhosin_globals) |
| 909 | 946 | ||
| 910 | 947 | ||
| 911 | 948 | ||
| @@ -1104,8 +1141,13 @@ PHP_MINIT_FUNCTION(suhosin) | |||
| 1104 | zend_ini_entry *i; | 1141 | zend_ini_entry *i; |
| 1105 | if (zend_hash_find(EG(ini_directives), "display_errors", sizeof("display_errors"), (void **) &i) == SUCCESS) { | 1142 | if (zend_hash_find(EG(ini_directives), "display_errors", sizeof("display_errors"), (void **) &i) == SUCCESS) { |
| 1106 | if (i->on_modify) { | 1143 | if (i->on_modify) { |
| 1107 | i->on_modify(i, "0", sizeof("0"), i->mh_arg1, i->mh_arg2, i->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC); | 1144 | if (SUHOSIN_G(disable_display_errors) > 1) { |
| 1108 | i->on_modify = NULL; | 1145 | zend_alter_ini_entry_ex("display_errors", sizeof("display_errors"), "0", sizeof("0"), ZEND_INI_SYSTEM, ZEND_INI_STAGE_STARTUP, 0 TSRMLS_CC); |
| 1146 | i->on_modify = OnUpdate_fail; | ||
| 1147 | } else { | ||
| 1148 | i->on_modify(i, "Off", sizeof("off"), i->mh_arg1, i->mh_arg2, i->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC); | ||
| 1149 | i->on_modify = NULL; | ||
| 1150 | } | ||
| 1109 | } | 1151 | } |
| 1110 | } | 1152 | } |
| 1111 | } | 1153 | } |
