diff options
| author | kkadosh | 2018-03-02 13:31:36 +0000 |
|---|---|---|
| committer | jvoisin | 2018-03-02 14:31:36 +0100 |
| commit | bdd2cfc430d4b841c24a6c08e7934d667bdc6637 (patch) | |
| tree | 271d91df0af647cec436252097e51d10696f6bc8 /src/sp_config_keywords.c | |
| parent | e822be3a2e9919663cac74463b98e208db742bcf (diff) | |
Implement dump() for execution of writable PHP files
Diffstat (limited to 'src/sp_config_keywords.c')
| -rw-r--r-- | src/sp_config_keywords.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/src/sp_config_keywords.c b/src/sp_config_keywords.c index c58a227..a04c88f 100644 --- a/src/sp_config_keywords.c +++ b/src/sp_config_keywords.c | |||
| @@ -82,7 +82,8 @@ int parse_global_strict(char *line) { | |||
| 82 | 82 | ||
| 83 | int parse_unserialize(char *line) { | 83 | int parse_unserialize(char *line) { |
| 84 | bool enable = false, disable = false; | 84 | bool enable = false, disable = false; |
| 85 | sp_config_unserialize *unserialize = SNUFFLEUPAGUS_G(config).config_unserialize; | 85 | sp_config_unserialize *unserialize = |
| 86 | SNUFFLEUPAGUS_G(config).config_unserialize; | ||
| 86 | 87 | ||
| 87 | sp_config_functions sp_config_funcs[] = { | 88 | sp_config_functions sp_config_funcs[] = { |
| 88 | {parse_empty, SP_TOKEN_ENABLE, &(enable)}, | 89 | {parse_empty, SP_TOKEN_ENABLE, &(enable)}, |
| @@ -110,9 +111,33 @@ int parse_unserialize(char *line) { | |||
| 110 | } | 111 | } |
| 111 | 112 | ||
| 112 | int parse_readonly_exec(char *line) { | 113 | int parse_readonly_exec(char *line) { |
| 113 | return parse_enable( | 114 | bool enable = false, disable = false; |
| 114 | line, &(SNUFFLEUPAGUS_G(config).config_readonly_exec->enable), | 115 | sp_config_readonly_exec *readonly_exec = |
| 115 | &(SNUFFLEUPAGUS_G(config).config_readonly_exec->simulation)); | 116 | SNUFFLEUPAGUS_G(config).config_readonly_exec; |
| 117 | |||
| 118 | sp_config_functions sp_config_funcs[] = { | ||
| 119 | {parse_empty, SP_TOKEN_ENABLE, &(enable)}, | ||
| 120 | {parse_empty, SP_TOKEN_DISABLE, &(disable)}, | ||
| 121 | {parse_empty, SP_TOKEN_SIMULATION, &(readonly_exec->simulation)}, | ||
| 122 | {parse_str, SP_TOKEN_DUMP, &(readonly_exec->dump)}, | ||
| 123 | {0}}; | ||
| 124 | |||
| 125 | readonly_exec->textual_representation = estrdup(line); | ||
| 126 | int ret = parse_keywords(sp_config_funcs, line); | ||
| 127 | |||
| 128 | if (0 != ret) { | ||
| 129 | return ret; | ||
| 130 | } | ||
| 131 | |||
| 132 | if (!(enable ^ disable)) { | ||
| 133 | sp_log_err("config", "A rule can't be enabled and disabled on line %zu.", | ||
| 134 | sp_line_no); | ||
| 135 | return -1; | ||
| 136 | } | ||
| 137 | |||
| 138 | SNUFFLEUPAGUS_G(config).config_readonly_exec->enable = enable; | ||
| 139 | |||
| 140 | return ret; | ||
| 116 | } | 141 | } |
| 117 | 142 | ||
| 118 | int parse_global(char *line) { | 143 | int parse_global(char *line) { |
