summaryrefslogtreecommitdiff
path: root/src/sp_execute.c
diff options
context:
space:
mode:
authorkkadosh2018-03-02 13:31:36 +0000
committerjvoisin2018-03-02 14:31:36 +0100
commitbdd2cfc430d4b841c24a6c08e7934d667bdc6637 (patch)
tree271d91df0af647cec436252097e51d10696f6bc8 /src/sp_execute.c
parente822be3a2e9919663cac74463b98e208db742bcf (diff)
Implement dump() for execution of writable PHP files
Diffstat (limited to 'src/sp_execute.c')
-rw-r--r--src/sp_execute.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/sp_execute.c b/src/sp_execute.c
index 20fe509..5cf139a 100644
--- a/src/sp_execute.c
+++ b/src/sp_execute.c
@@ -1,5 +1,4 @@
1#include "php_snuffleupagus.h" 1#include "php_snuffleupagus.h"
2
3#include <errno.h> 2#include <errno.h>
4#include <string.h> 3#include <string.h>
5 4
@@ -14,6 +13,12 @@ static int (*orig_zend_stream_open)(const char *filename,
14// FIXME handle symlink 13// FIXME handle symlink
15ZEND_COLD static inline void terminate_if_writable(const char *filename) { 14ZEND_COLD static inline void terminate_if_writable(const char *filename) {
16 if (0 == access(filename, W_OK)) { 15 if (0 == access(filename, W_OK)) {
16 if (SNUFFLEUPAGUS_G(config).config_readonly_exec->dump) {
17 sp_log_request(
18 SNUFFLEUPAGUS_G(config).config_readonly_exec->dump,
19 SNUFFLEUPAGUS_G(config).config_readonly_exec->textual_representation,
20 SP_TOKEN_READONLY_EXEC);
21 }
17 if (true == SNUFFLEUPAGUS_G(config).config_readonly_exec->simulation) { 22 if (true == SNUFFLEUPAGUS_G(config).config_readonly_exec->simulation) {
18 sp_log_msg("readonly_exec", SP_LOG_SIMULATION, 23 sp_log_msg("readonly_exec", SP_LOG_SIMULATION,
19 "Attempted execution of a writable file (%s).", filename); 24 "Attempted execution of a writable file (%s).", filename);