summaryrefslogtreecommitdiff
path: root/log.c
diff options
context:
space:
mode:
Diffstat (limited to 'log.c')
-rw-r--r--log.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/log.c b/log.c
index 50cd0f8..905108d 100644
--- a/log.c
+++ b/log.c
@@ -114,7 +114,6 @@ PHP_SUHOSIN7_API void suhosin_log(int loglevel, char *fmt, ...)
114 char *alertstring; 114 char *alertstring;
115 int lineno = 0; 115 int lineno = 0;
116 va_list ap; 116 va_list ap;
117 // TSRMLS_FETCH();
118 117
119 getcaller = (loglevel & S_GETCALLER) == S_GETCALLER; 118 getcaller = (loglevel & S_GETCALLER) == S_GETCALLER;
120 119
@@ -157,7 +156,7 @@ PHP_SUHOSIN7_API void suhosin_log(int loglevel, char *fmt, ...)
157 alertstring = "ALERT"; 156 alertstring = "ALERT";
158 } 157 }
159 158
160 if (zend_is_executing(TSRMLS_C)) { 159 if (zend_is_executing()) {
161 zend_execute_data *exdata = EG(current_execute_data); 160 zend_execute_data *exdata = EG(current_execute_data);
162 if (exdata) { 161 if (exdata) {
163 if (getcaller && exdata->prev_execute_data && exdata->prev_execute_data->opline && exdata->prev_execute_data->func) { 162 if (getcaller && exdata->prev_execute_data && exdata->prev_execute_data->opline && exdata->prev_execute_data->func) {
@@ -171,8 +170,8 @@ PHP_SUHOSIN7_API void suhosin_log(int loglevel, char *fmt, ...)
171 fname = "[unknown filename]"; 170 fname = "[unknown filename]";
172 } 171 }
173 } else { 172 } else {
174 lineno = zend_get_executed_lineno(TSRMLS_C); 173 lineno = zend_get_executed_lineno();
175 fname = (char *)zend_get_executed_filename(TSRMLS_C); 174 fname = (char *)zend_get_executed_filename();
176 } 175 }
177 ap_php_snprintf(buf, sizeof(buf), "%s - %s (attacker '%s', file '%s', line %u)", alertstring, error, ip_address, fname, lineno); 176 ap_php_snprintf(buf, sizeof(buf), "%s - %s (attacker '%s', file '%s', line %u)", alertstring, error, ip_address, fname, lineno);
178 } else { 177 } else {
@@ -287,7 +286,7 @@ log_sapi:
287 /* SAPI Logging activated? */ 286 /* SAPI Logging activated? */
288 // SDEBUG("(suhosin_log) log_syslog: %ld - log_sapi: %ld - log_script: %ld - log_phpscript: %ld", SUHOSIN7_G(log_syslog), SUHOSIN7_G(log_sapi), SUHOSIN7_G(log_script), SUHOSIN7_G(log_phpscript)); 287 // SDEBUG("(suhosin_log) log_syslog: %ld - log_sapi: %ld - log_script: %ld - log_phpscript: %ld", SUHOSIN7_G(log_syslog), SUHOSIN7_G(log_sapi), SUHOSIN7_G(log_script), SUHOSIN7_G(log_phpscript));
289 if (sapi_module.log_message && ((SUHOSIN7_G(log_sapi)|S_INTERNAL) & loglevel)!=0) { 288 if (sapi_module.log_message && ((SUHOSIN7_G(log_sapi)|S_INTERNAL) & loglevel)!=0) {
290 sapi_module.log_message(buf TSRMLS_CC); 289 sapi_module.log_message(buf);
291 } 290 }
292 if ((SUHOSIN7_G(log_stdout) & loglevel)!=0) { 291 if ((SUHOSIN7_G(log_stdout) & loglevel)!=0) {
293 fprintf(stdout, "%s\n", buf); 292 fprintf(stdout, "%s\n", buf);
@@ -372,12 +371,12 @@ log_sapi:
372// 371//
373// char *phpscript = SUHOSIN7_G(log_phpscriptname); 372// char *phpscript = SUHOSIN7_G(log_phpscriptname);
374// SDEBUG("scriptname %s", SUHOSIN7_G(log_phpscriptname)); 373// SDEBUG("scriptname %s", SUHOSIN7_G(log_phpscriptname));
375// if (zend_stream_open(phpscript, &file_handle TSRMLS_CC) == SUCCESS) { 374// if (zend_stream_open(phpscript, &file_handle) == SUCCESS) {
376// if (!file_handle.opened_path) { 375// if (!file_handle.opened_path) {
377// file_handle.opened_path = estrndup(phpscript, strlen(phpscript)); 376// file_handle.opened_path = estrndup(phpscript, strlen(phpscript));
378// } 377// }
379// new_op_array = zend_compile_file(&file_handle, ZEND_REQUIRE TSRMLS_CC); 378// new_op_array = zend_compile_file(&file_handle, ZEND_REQUIRE);
380// zend_destroy_file_handle(&file_handle TSRMLS_CC); 379// zend_destroy_file_handle(&file_handle);
381// if (new_op_array) { 380// if (new_op_array) {
382// HashTable *active_symbol_table = EG(active_symbol_table); 381// HashTable *active_symbol_table = EG(active_symbol_table);
383// zval *zerror, *zerror_class; 382// zval *zerror, *zerror_class;
@@ -401,12 +400,12 @@ log_sapi:
401// PG(open_basedir) = NULL; 400// PG(open_basedir) = NULL;
402// } 401// }
403// 402//
404// zend_execute(new_op_array TSRMLS_CC); 403// zend_execute(new_op_array);
405// 404//
406// SUHOSIN7_G(execution_depth) = orig_execution_depth; 405// SUHOSIN7_G(execution_depth) = orig_execution_depth;
407// PG(open_basedir) = orig_basedir; 406// PG(open_basedir) = orig_basedir;
408// 407//
409// destroy_op_array(new_op_array TSRMLS_CC); 408// destroy_op_array(new_op_array);
410// efree(new_op_array); 409// efree(new_op_array);
411// 410//
412// if (!EG(exception)) 411// if (!EG(exception))