summaryrefslogtreecommitdiff
path: root/src/sp_utils.c
diff options
context:
space:
mode:
authorjvoisin2018-01-10 17:38:24 +0100
committerjvoisin2018-01-10 17:38:24 +0100
commit6f21bff1d40326f69bc3b75b1b83b03623180365 (patch)
tree09cc459ca549693d69f35098046d8ad64f3cde91 /src/sp_utils.c
parent773c9b94c6978ccd41c5a46f0d03448fd0c039a7 (diff)
Rework the priority of bl/wl in eval
Diffstat (limited to 'src/sp_utils.c')
-rw-r--r--src/sp_utils.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/sp_utils.c b/src/sp_utils.c
index 8a1ed87..19b7179 100644
--- a/src/sp_utils.c
+++ b/src/sp_utils.c
@@ -7,6 +7,8 @@
7#include <string.h> 7#include <string.h>
8#include <unistd.h> 8#include <unistd.h>
9 9
10ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus)
11
10static inline void _sp_log_err(const char* fmt, ...) { 12static inline void _sp_log_err(const char* fmt, ...) {
11 char* msg; 13 char* msg;
12 va_list args; 14 va_list args;
@@ -394,3 +396,22 @@ int hook_regexp(const pcre* regexp, HashTable* hook_table,
394 ZEND_HASH_FOREACH_END(); 396 ZEND_HASH_FOREACH_END();
395 return SUCCESS; 397 return SUCCESS;
396} 398}
399
400bool check_is_in_eval_whitelist(const char* const function_name) {
401 const sp_list_node* it = SNUFFLEUPAGUS_G(config).config_eval->whitelist;
402
403 if (!it->head) {
404 return false;
405 }
406
407 /* yes, we could use a HashTable instead, but since the list is pretty
408 * small, it doesn't maka a difference in practise. */
409 while (it && it->data) {
410 if (0 == strcmp(function_name, (char*)(it->data))) {
411 /* We've got a match, the function is whiteslited. */
412 return true;
413 }
414 it = it->next;
415 }
416 return false;
417}