diff options
| author | Stefan Esser | 2014-02-11 12:27:53 +0100 |
|---|---|---|
| committer | Stefan Esser | 2014-02-11 12:27:53 +0100 |
| commit | e7dfd0bc820e59cd8abd2e36b0320cfceb9701a8 (patch) | |
| tree | c0ff908a289c75869aa4f8c00774681550d78687 /session.c | |
| parent | 90fff832ca49aff1c7dd030a8c47acf2a38a22a0 (diff) | |
Fix problem with user space session handlers (including test case)
Diffstat (limited to 'session.c')
| -rw-r--r-- | session.c | 21 |
1 files changed, 18 insertions, 3 deletions
| @@ -728,7 +728,12 @@ static int suhosin_hook_s_read(void **mod_data, const char *key, char **val, int | |||
| 728 | }*/ | 728 | }*/ |
| 729 | 729 | ||
| 730 | /* protect dumb session handlers */ | 730 | /* protect dumb session handlers */ |
| 731 | if (key == NULL || !key[0] || *mod_data == NULL) { | 731 | if (key == NULL || !key[0] || |
| 732 | (*mod_data == NULL | ||
| 733 | #if PHP_VERSION_ID >= 50400 | ||
| 734 | && !SESSION_G(mod_user_implemented) | ||
| 735 | #endif | ||
| 736 | )) { | ||
| 732 | regenerate: | 737 | regenerate: |
| 733 | SDEBUG("regenerating key is %s", key); | 738 | SDEBUG("regenerating key is %s", key); |
| 734 | KEY = SESSION_G(id) = SESSION_G(mod)->s_create_sid(&SESSION_G(mod_data), NULL TSRMLS_CC); | 739 | KEY = SESSION_G(id) = SESSION_G(mod)->s_create_sid(&SESSION_G(mod_data), NULL TSRMLS_CC); |
| @@ -777,7 +782,12 @@ static int suhosin_hook_s_write(void **mod_data, const char *key, const char *va | |||
| 777 | char *v = (char *)val; | 782 | char *v = (char *)val; |
| 778 | 783 | ||
| 779 | /* protect dumb session handlers */ | 784 | /* protect dumb session handlers */ |
| 780 | if (key == NULL || !key[0] || val == NULL || strlen(key) > SUHOSIN_G(session_max_id_length) || *mod_data == NULL) { | 785 | if (key == NULL || !key[0] || val == NULL || strlen(key) > SUHOSIN_G(session_max_id_length) || |
| 786 | (*mod_data == NULL | ||
| 787 | #if PHP_VERSION_ID >= 50400 | ||
| 788 | && !SESSION_G(mod_user_implemented) | ||
| 789 | #endif | ||
| 790 | )) { | ||
| 781 | r = FAILURE; | 791 | r = FAILURE; |
| 782 | goto return_write; | 792 | goto return_write; |
| 783 | } | 793 | } |
| @@ -820,7 +830,12 @@ static int suhosin_hook_s_destroy(void **mod_data, const char *key TSRMLS_DC) | |||
| 820 | int r; | 830 | int r; |
| 821 | 831 | ||
| 822 | /* protect dumb session handlers */ | 832 | /* protect dumb session handlers */ |
| 823 | if (key == NULL || !key[0] || strlen(key) > SUHOSIN_G(session_max_id_length) || *mod_data == NULL) { | 833 | if (key == NULL || !key[0] || strlen(key) > SUHOSIN_G(session_max_id_length) || |
| 834 | (*mod_data == NULL | ||
| 835 | #if PHP_VERSION_ID >= 50400 | ||
| 836 | && !SESSION_G(mod_user_implemented) | ||
| 837 | #endif | ||
| 838 | )) { | ||
| 824 | return FAILURE; | 839 | return FAILURE; |
| 825 | } | 840 | } |
| 826 | 841 | ||
