summaryrefslogtreecommitdiff
path: root/execute.c
diff options
context:
space:
mode:
authorBen Fuhrmannek2015-01-22 12:19:09 +0100
committerBen Fuhrmannek2015-01-22 12:19:09 +0100
commit432e8f9ab8a3029b16e03676aa643f3788faf14c (patch)
tree27e99ec0af706b4820c4d9472a01dff4c4bea5eb /execute.c
parent8affcacdbeba5fd95e1b26a6bcfc9c3030a1d893 (diff)
removed #ifdef ZEND_ENGINE_2 as it is always defined anyway
Diffstat (limited to 'execute.c')
-rw-r--r--execute.c43
1 files changed, 1 insertions, 42 deletions
diff --git a/execute.c b/execute.c
index 9c078f7..7f646fe 100644
--- a/execute.c
+++ b/execute.c
@@ -257,22 +257,11 @@ SDEBUG("xxx %p %p",SUHOSIN_G(include_whitelist),SUHOSIN_G(include_blacklist));
257} 257}
258 258
259 259
260#ifdef ZEND_ENGINE_2
261static int (*old_zend_stream_open)(const char *filename, zend_file_handle *fh TSRMLS_DC); 260static int (*old_zend_stream_open)(const char *filename, zend_file_handle *fh TSRMLS_DC);
262#else
263static zend_bool (*old_zend_open)(const char *filename, zend_file_handle *fh);
264#endif
265 261
266#ifdef ZEND_ENGINE_2
267static int suhosin_zend_stream_open(const char *filename, zend_file_handle *fh TSRMLS_DC) 262static int suhosin_zend_stream_open(const char *filename, zend_file_handle *fh TSRMLS_DC)
268{ 263{
269 zend_execute_data *exd; 264 zend_execute_data *exd;
270#else
271static zend_bool suhosin_zend_open(const char *filename, zend_file_handle *fh)
272{
273 zend_execute_data *exd;
274 TSRMLS_FETCH();
275#endif
276 exd=EG(current_execute_data); 265 exd=EG(current_execute_data);
277 if (EG(in_execution) && (exd!=NULL) && (exd->opline != NULL) && (exd->opline->opcode == ZEND_INCLUDE_OR_EVAL)) { 266 if (EG(in_execution) && (exd!=NULL) && (exd->opline != NULL) && (exd->opline->opcode == ZEND_INCLUDE_OR_EVAL)) {
278 int filetype = suhosin_check_filename((char *)filename, strlen(filename) TSRMLS_CC); 267 int filetype = suhosin_check_filename((char *)filename, strlen(filename) TSRMLS_CC);
@@ -314,11 +303,7 @@ static zend_bool suhosin_zend_open(const char *filename, zend_file_handle *fh)
314 break; 303 break;
315 } 304 }
316 } 305 }
317#ifdef ZEND_ENGINE_2
318 return old_zend_stream_open(filename, fh TSRMLS_CC); 306 return old_zend_stream_open(filename, fh TSRMLS_CC);
319#else
320 return old_zend_open(filename, fh);
321#endif
322} 307}
323 308
324 309
@@ -458,13 +443,7 @@ static void suhosin_execute_ex(zend_op_array *op_array, int zo, long dummy TSRML
458 code = 200; 443 code = 200;
459 } 444 }
460 445
461#ifdef ZEND_ENGINE_2
462 if (zend_stream_open(action, &file_handle TSRMLS_CC) == SUCCESS) { 446 if (zend_stream_open(action, &file_handle TSRMLS_CC) == SUCCESS) {
463#else
464 if (zend_open(action, &file_handle) == SUCCESS && ZEND_IS_VALID_FILE_HANDLE(&file_handle)) {
465 file_handle.filename = action;
466 file_handle.free_filename = 0;
467#endif
468 if (!file_handle.opened_path) { 447 if (!file_handle.opened_path) {
469 file_handle.opened_path = estrndup(action, strlen(action)); 448 file_handle.opened_path = estrndup(action, strlen(action));
470 } 449 }
@@ -474,15 +453,10 @@ static void suhosin_execute_ex(zend_op_array *op_array, int zo, long dummy TSRML
474 EG(return_value_ptr_ptr) = &result; 453 EG(return_value_ptr_ptr) = &result;
475 EG(active_op_array) = new_op_array; 454 EG(active_op_array) = new_op_array;
476 zend_execute(new_op_array TSRMLS_CC); 455 zend_execute(new_op_array TSRMLS_CC);
477#ifdef ZEND_ENGINE_2
478 destroy_op_array(new_op_array TSRMLS_CC); 456 destroy_op_array(new_op_array TSRMLS_CC);
479#else
480 destroy_op_array(new_op_array);
481#endif
482 efree(new_op_array); 457 efree(new_op_array);
483#ifdef ZEND_ENGINE_2 458
484 if (!EG(exception)) 459 if (!EG(exception))
485#endif
486 { 460 {
487 if (EG(return_value_ptr_ptr)) { 461 if (EG(return_value_ptr_ptr)) {
488 zval_ptr_dtor(EG(return_value_ptr_ptr)); 462 zval_ptr_dtor(EG(return_value_ptr_ptr));
@@ -1685,9 +1659,7 @@ static void suhosin_execute_internal(zend_execute_data *execute_data_ptr, int re
1685 zend_class_entry *ce = NULL; 1659 zend_class_entry *ce = NULL;
1686 internal_function_handler *ih; 1660 internal_function_handler *ih;
1687 1661
1688#ifdef ZEND_ENGINE_2
1689 ce = ((zend_internal_function *) execute_data_ptr->function_state.function)->scope; 1662 ce = ((zend_internal_function *) execute_data_ptr->function_state.function)->scope;
1690#endif
1691 lcname = (char *)((zend_internal_function *) execute_data_ptr->function_state.function)->function_name; 1663 lcname = (char *)((zend_internal_function *) execute_data_ptr->function_state.function)->function_name;
1692 function_name_strlen = strlen(lcname); 1664 function_name_strlen = strlen(lcname);
1693 1665
@@ -1705,11 +1677,7 @@ static void suhosin_execute_internal(zend_execute_data *execute_data_ptr, int re
1705 } 1677 }
1706 1678
1707#if PHP_VERSION_ID < 50500 1679#if PHP_VERSION_ID < 50500
1708#ifdef ZEND_ENGINE_2
1709 return_value = (*(temp_variable *)((char *) execute_data_ptr->Ts + execute_data_ptr->opline->result.var)).var.ptr; 1680 return_value = (*(temp_variable *)((char *) execute_data_ptr->Ts + execute_data_ptr->opline->result.var)).var.ptr;
1710#else
1711 return_value = execute_data_ptr->Ts[execute_data_ptr->opline->result.u.var].var.ptr;
1712#endif
1713#endif 1681#endif
1714 1682
1715 SDEBUG("function: %s", lcname); 1683 SDEBUG("function: %s", lcname);
@@ -1860,13 +1828,8 @@ void suhosin_hook_execute(TSRMLS_D)
1860 /* Add additional protection layer, that SHOULD 1828 /* Add additional protection layer, that SHOULD
1861 catch ZEND_INCLUDE_OR_EVAL *before* the engine tries 1829 catch ZEND_INCLUDE_OR_EVAL *before* the engine tries
1862 to execute */ 1830 to execute */
1863#ifdef ZEND_ENGINE_2
1864 old_zend_stream_open = zend_stream_open_function; 1831 old_zend_stream_open = zend_stream_open_function;
1865 zend_stream_open_function = suhosin_zend_stream_open; 1832 zend_stream_open_function = suhosin_zend_stream_open;
1866#else
1867 old_zend_open = zend_open;
1868 zend_open = suhosin_zend_open;
1869#endif
1870 1833
1871} 1834}
1872/* }}} */ 1835/* }}} */
@@ -1897,11 +1860,7 @@ void suhosin_unhook_execute()
1897 zend_hash_clean(&ihandler_table); 1860 zend_hash_clean(&ihandler_table);
1898 1861
1899 /* remove zend_open protection */ 1862 /* remove zend_open protection */
1900#ifdef ZEND_ENGINE_2
1901 zend_stream_open_function = old_zend_stream_open; 1863 zend_stream_open_function = old_zend_stream_open;
1902#else
1903 zend_open = old_zend_open;
1904#endif
1905 1864
1906} 1865}
1907/* }}} */ 1866/* }}} */