]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Allow unconditional special handlers
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 26 Mar 2019 15:41:04 +0000 (15:41 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 26 Mar 2019 15:41:04 +0000 (15:41 +0000)
contrib/libucl/ucl.h
contrib/libucl/ucl_parser.c

index f7f8354c5586b36a92d7b8ce0ef9a5cbb68539fc..482812d46d838f018b070c1da8cc6f0a5f0d244a 100644 (file)
@@ -1294,12 +1294,21 @@ typedef bool (*ucl_parser_special_handler_t) (struct ucl_parser *parser,
                unsigned char **destination, size_t *dest_len,
                void *user_data);
 
+/**
+ * Special handler flags
+ */
+enum ucl_special_handler_flags {
+       UCL_SPECIAL_HANDLER_DEFAULT = 0,
+       UCL_SPECIAL_HANDLER_PREPROCESS_ALL = (1u << 0),
+};
+
 /**
  * Special handler structure
  */
 struct ucl_parser_special_handler {
        const unsigned char *magic;
        size_t magic_len;
+       enum ucl_special_handler_flags flags;
        ucl_parser_special_handler_t handler;
        void (*free_function) (unsigned char *data, size_t len, void *user_data);
        void *user_data;
index 574e240ab6d7e8425800fa83eec1eea48fc7bc00..59bfd7727cab4afc0c33c47c0aecbd934e631c08 100644 (file)
@@ -2862,8 +2862,9 @@ ucl_parser_add_chunk_full (struct ucl_parser *parser, const unsigned char *data,
                memset (chunk, 0, sizeof (*chunk));
 
                LL_FOREACH (parser->special_handlers, special_handler) {
-                       if (len >= special_handler->magic_len &&
-                                       memcmp (data, special_handler->magic, special_handler->magic_len) == 0) {
+                       if ((special_handler->flags & UCL_SPECIAL_HANDLER_PREPROCESS_ALL) ||
+                                       (len >= special_handler->magic_len &&
+                                        memcmp (data, special_handler->magic, special_handler->magic_len) == 0)) {
                                unsigned char *ndata = NULL;
                                size_t nlen = 0;