]> source.dussan.org Git - rspamd.git/commitdiff
Add 'required' and 'default' values for doc strings
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 4 Jan 2016 18:44:18 +0000 (18:44 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 4 Jan 2016 18:44:18 +0000 (18:44 +0000)
src/libserver/cfg_rcl.c
src/libserver/cfg_rcl.h
src/plugins/dkim_check.c
src/plugins/fuzzy_check.c
src/plugins/regexp.c
src/plugins/spf.c
src/plugins/surbl.c

index c0daef15edf5429050d1fa8b5cf05117e2ad0fea..d17fa4b7b85e6f43aad3c18836c3871f01b14534 100644 (file)
@@ -1235,6 +1235,8 @@ rspamd_rcl_add_section (struct rspamd_rcl_section **top,
                                name,
                                type,
                                NULL,
+                               0,
+                               NULL,
                                0);
        }
 
@@ -1258,8 +1260,14 @@ rspamd_rcl_add_section_doc (struct rspamd_rcl_section **top,
        new->type = type;
        new->strict_type = strict_type;
 
-       new->doc_ref = rspamd_rcl_add_doc_obj (doc_target, doc_string,
-                       name, type, NULL, 0);
+       new->doc_ref = rspamd_rcl_add_doc_obj (doc_target,
+                       doc_string,
+                       name,
+                       type,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
 
        HASH_ADD_KEYPTR (hh, *top, new->name, strlen (new->name), new);
        return new;
@@ -1282,8 +1290,14 @@ rspamd_rcl_add_default_handler (struct rspamd_rcl_section *section,
        new->pd.flags = flags;
 
        if (section->doc_ref != NULL) {
-               rspamd_rcl_add_doc_obj (section->doc_ref, doc_string, name, UCL_NULL,
-                               handler, flags);
+               rspamd_rcl_add_doc_obj (section->doc_ref,
+                               doc_string,
+                               name,
+                               UCL_NULL,
+                               handler,
+                               flags,
+                               NULL,
+                               0);
        }
 
        HASH_ADD_KEYPTR (hh, section->default_parser, new->key, strlen (
@@ -2812,8 +2826,14 @@ rspamd_rcl_register_worker_option (struct rspamd_config *cfg,
                doc_target = doc_obj;
        }
 
-       rspamd_rcl_add_doc_obj ((ucl_object_t *)doc_target, doc_string, name, UCL_NULL,
-                       handler, flags);
+       rspamd_rcl_add_doc_obj ((ucl_object_t *) doc_target,
+                       doc_string,
+                       name,
+                       UCL_NULL,
+                       handler,
+                       flags,
+                       NULL,
+                       0);
 }
 
 
@@ -3044,7 +3064,9 @@ rspamd_rcl_add_doc_obj (ucl_object_t *doc_target,
                const char *doc_name,
                ucl_type_t type,
                rspamd_rcl_default_handler_t handler,
-               gint flags)
+               gint flags,
+               const char *default_value,
+               gboolean required)
 {
        ucl_object_t *doc_obj;
 
@@ -3056,7 +3078,8 @@ rspamd_rcl_add_doc_obj (ucl_object_t *doc_target,
 
        /* Insert doc string itself */
        if (doc_string) {
-               ucl_object_insert_key (doc_obj, ucl_object_fromstring (doc_string),
+               ucl_object_insert_key (doc_obj,
+                               ucl_object_fromstring_common (doc_string, 0, 0),
                                "data", 0, false);
        }
        else {
@@ -3071,6 +3094,17 @@ rspamd_rcl_add_doc_obj (ucl_object_t *doc_target,
        }
 
        rspamd_rcl_doc_obj_from_handler (doc_obj, handler, flags);
+
+       ucl_object_insert_key (doc_obj,
+                       ucl_object_frombool (required),
+                       "required", 0, false);
+
+       if (default_value) {
+               ucl_object_insert_key (doc_obj,
+                               ucl_object_fromstring_common (default_value, 0, 0),
+                               "default", 0, false);
+       }
+
        ucl_object_insert_key (doc_target, doc_obj, doc_name, 0, true);
 
        return doc_obj;
@@ -3083,7 +3117,9 @@ rspamd_rcl_add_doc_by_path (struct rspamd_config *cfg,
                const char *doc_name,
                ucl_type_t type,
                rspamd_rcl_default_handler_t handler,
-               gint flags)
+               gint flags,
+               const char *default_value,
+               gboolean required)
 {
        const ucl_object_t *found, *cur;
        ucl_object_t *obj;
@@ -3092,14 +3128,26 @@ rspamd_rcl_add_doc_by_path (struct rspamd_config *cfg,
        if (doc_path == NULL) {
                /* Assume top object */
                return rspamd_rcl_add_doc_obj (cfg->doc_strings,
-                               doc_string, doc_name, type, handler, flags);
+                               doc_string,
+                               doc_name,
+                               type,
+                               handler,
+                               flags,
+                               default_value,
+                               required);
        }
        else {
                found = ucl_lookup_path (cfg->doc_strings, doc_path);
 
                if (found != NULL) {
                        return rspamd_rcl_add_doc_obj ((ucl_object_t *) found,
-                                       doc_string, doc_name, type, handler, flags);
+                                       doc_string,
+                                       doc_name,
+                                       type,
+                                       handler,
+                                       flags,
+                                       default_value,
+                                       required);
                }
 
                /* Otherwise we need to insert all components of the path */
@@ -3131,5 +3179,11 @@ rspamd_rcl_add_doc_by_path (struct rspamd_config *cfg,
        }
 
        return rspamd_rcl_add_doc_obj ((ucl_object_t *) cur,
-                       doc_string, doc_name, type, handler, flags);
+                       doc_string,
+                       doc_name,
+                       type,
+                       handler,
+                       flags,
+                       default_value,
+                       required);
 }
index b114e765c93afee1c3d5031e50ac69cf62ddb749..352ca95de0cb88844b6ddd5c5581f1c233b3b4f1 100644 (file)
@@ -352,12 +352,14 @@ void rspamd_rcl_register_worker_parser (struct rspamd_config *cfg, gint type,
  * @param doc_target target object where to insert documentation (top object is used if this is NULL)
  * @param doc_object documentation object to insert
  */
-ucl_object_trspamd_rcl_add_doc_obj (ucl_object_t *doc_target,
+ucl_object_t *rspamd_rcl_add_doc_obj (ucl_object_t *doc_target,
                const char *doc_string,
                const char *doc_name,
                ucl_type_t type,
                rspamd_rcl_default_handler_t handler,
-               gint flags);
+               gint flags,
+               const char *default_value,
+               gboolean required);
 
 /**
  * Adds new documentation option specified by path `doc_path` that should be
@@ -369,5 +371,7 @@ ucl_object_t *rspamd_rcl_add_doc_by_path (struct rspamd_config *cfg,
                const char *doc_name,
                ucl_type_t type,
                rspamd_rcl_default_handler_t handler,
-               gint flags);
+               gint flags,
+               const char *default_value,
+               gboolean required);
 #endif /* CFG_RCL_H_ */
index 8a3546a108eff0f0be61f78c7076c321f229f756..0e09bacd69b880e2a31301697c86f3107e5ce8f3 100644 (file)
@@ -112,42 +112,114 @@ dkim_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
 
        *ctx = (struct module_ctx *)dkim_module_ctx;
 
-       rspamd_rcl_add_doc_by_path (cfg, NULL,
+       rspamd_rcl_add_doc_by_path (cfg,
+                       NULL,
                        "DKIM check plugin",
-                       "dkim", UCL_OBJECT, NULL, 0);
-       rspamd_rcl_add_doc_by_path (cfg, "dkim",
+                       "dkim",
+                       UCL_OBJECT,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "dkim",
                        "Map of IP addresses that should be excluded from DKIM checks",
-                       "whitelist", UCL_STRING, NULL, 0);
-       rspamd_rcl_add_doc_by_path (cfg, "dkim",
+                       "whitelist",
+                       UCL_STRING,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "dkim",
                        "Symbol that is added if DKIM check is successful",
-                       "symbol_allow", UCL_STRING, NULL, 0);
-       rspamd_rcl_add_doc_by_path (cfg, "dkim",
+                       "symbol_allow",
+                       UCL_STRING,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "dkim",
                        "Symbol that is added if DKIM check is unsuccessful",
-                       "symbol_reject", UCL_STRING, NULL, 0);
-       rspamd_rcl_add_doc_by_path (cfg, "dkim",
+                       "symbol_reject",
+                       UCL_STRING,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "dkim",
                        "Symbol that is added if DKIM check can't be completed (e.g. DNS failure)",
-                       "symbol_tempfail", UCL_STRING, NULL, 0);
-       rspamd_rcl_add_doc_by_path (cfg, "dkim",
+                       "symbol_tempfail",
+                       UCL_STRING,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "dkim",
                        "Size of DKIM keys cache",
-                       "dkim_cache_size", UCL_INT, NULL, 0);
-       rspamd_rcl_add_doc_by_path (cfg, "dkim",
+                       "dkim_cache_size",
+                       UCL_INT,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "dkim",
                        "Allow this time difference when checking DKIM signature time validity",
-                       "time_jitter", UCL_TIME, NULL, 0);
-       rspamd_rcl_add_doc_by_path (cfg, "dkim",
+                       "time_jitter",
+                       UCL_TIME,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "dkim",
                        "Domains to check DKIM for (check all domains if this option is empty)",
-                       "domains", UCL_STRING, NULL, 0);
-       rspamd_rcl_add_doc_by_path (cfg, "dkim",
+                       "domains",
+                       UCL_STRING,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "dkim",
                        "Map of domains that are treated as 'trusted' meaning that DKIM policy failure has more significant score",
-                       "trusted_domains", UCL_STRING, NULL, 0);
-       rspamd_rcl_add_doc_by_path (cfg, "dkim",
+                       "trusted_domains",
+                       UCL_STRING,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "dkim",
                        "Multiply dkim score by this factor for trusted domains",
-                       "strict_multiplier", UCL_FLOAT, NULL, 0);
-       rspamd_rcl_add_doc_by_path (cfg, "dkim",
+                       "strict_multiplier",
+                       UCL_FLOAT,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "dkim",
                        "Check DKIM policies merely for `trusted_domains`",
-                       "trusted_only", UCL_BOOLEAN, NULL, 0);
-       rspamd_rcl_add_doc_by_path (cfg, "dkim",
+                       "trusted_only",
+                       UCL_BOOLEAN,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "dkim",
                        "Do not check messages with multiple DKIM signatures",
-                       "skip_multi", UCL_BOOLEAN, NULL, 0);
+                       "skip_multi",
+                       UCL_BOOLEAN,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
 
        return 0;
 }
index eb1e97786c0117fc8a7614feaa2012d69e88b753..ea94021ed6b1acd293675cc9de81588fd118e0bb 100644 (file)
@@ -525,9 +525,15 @@ fuzzy_check_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
 
        *ctx = (struct module_ctx *)fuzzy_module_ctx;
 
-       rspamd_rcl_add_doc_by_path (cfg, NULL,
+       rspamd_rcl_add_doc_by_path (cfg,
+                       NULL,
                        "Fuzzy check plugin",
-                       "fuzzy_check", UCL_OBJECT, NULL, 0);
+                       "fuzzy_check",
+                       UCL_OBJECT,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
 
        rspamd_rcl_add_doc_by_path (cfg,
                        "fuzzy_check",
@@ -535,6 +541,8 @@ fuzzy_check_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
                        "symbol",
                        UCL_STRING,
                        NULL,
+                       0,
+                       NULL,
                        0);
        rspamd_rcl_add_doc_by_path (cfg,
                        "fuzzy_check",
@@ -542,6 +550,8 @@ fuzzy_check_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
                        "min_length",
                        UCL_INT,
                        NULL,
+                       0,
+                       NULL,
                        0);
        rspamd_rcl_add_doc_by_path (cfg,
                        "fuzzy_check",
@@ -549,6 +559,8 @@ fuzzy_check_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
                        "min_bytes",
                        UCL_INT,
                        NULL,
+                       0,
+                       NULL,
                        0);
        rspamd_rcl_add_doc_by_path (cfg,
                        "fuzzy_check",
@@ -556,6 +568,8 @@ fuzzy_check_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
                        "min_height",
                        UCL_INT,
                        NULL,
+                       0,
+                       NULL,
                        0);
        rspamd_rcl_add_doc_by_path (cfg,
                        "fuzzy_check",
@@ -563,6 +577,8 @@ fuzzy_check_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
                        "min_width",
                        UCL_INT,
                        NULL,
+                       0,
+                       NULL,
                        0);
        rspamd_rcl_add_doc_by_path (cfg,
                        "fuzzy_check",
@@ -570,6 +586,8 @@ fuzzy_check_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
                        "timeout",
                        UCL_TIME,
                        NULL,
+                       0,
+                       NULL,
                        0);
        rspamd_rcl_add_doc_by_path (cfg,
                        "fuzzy_check",
@@ -577,6 +595,8 @@ fuzzy_check_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
                        "retransmits",
                        UCL_INT,
                        NULL,
+                       0,
+                       NULL,
                        0);
        rspamd_rcl_add_doc_by_path (cfg,
                        "fuzzy_check",
@@ -584,6 +604,8 @@ fuzzy_check_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
                        "whitelist",
                        UCL_STRING,
                        NULL,
+                       0,
+                       NULL,
                        0);
        /* Rules doc strings */
        rspamd_rcl_add_doc_by_path (cfg,
@@ -592,6 +614,8 @@ fuzzy_check_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
                        "rule",
                        UCL_OBJECT,
                        NULL,
+                       0,
+                       NULL,
                        0);
        rspamd_rcl_add_doc_by_path (cfg,
                        "fuzzy_check.rule",
@@ -599,6 +623,8 @@ fuzzy_check_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
                        "headers",
                        UCL_ARRAY,
                        NULL,
+                       0,
+                       NULL,
                        0);
        rspamd_rcl_add_doc_by_path (cfg,
                        "fuzzy_check.rule",
@@ -606,6 +632,8 @@ fuzzy_check_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
                        "mime_types",
                        UCL_ARRAY,
                        NULL,
+                       0,
+                       NULL,
                        0);
        rspamd_rcl_add_doc_by_path (cfg,
                        "fuzzy_check.rule",
@@ -613,6 +641,8 @@ fuzzy_check_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
                        "max_score",
                        UCL_INT,
                        NULL,
+                       0,
+                       NULL,
                        0);
        rspamd_rcl_add_doc_by_path (cfg,
                        "fuzzy_check.rule",
@@ -620,6 +650,8 @@ fuzzy_check_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
                        "servers",
                        UCL_STRING,
                        NULL,
+                       0,
+                       NULL,
                        0);
        rspamd_rcl_add_doc_by_path (cfg,
                        "fuzzy_check.rule",
@@ -627,6 +659,8 @@ fuzzy_check_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
                        "read_only",
                        UCL_BOOLEAN,
                        NULL,
+                       0,
+                       NULL,
                        0);
        rspamd_rcl_add_doc_by_path (cfg,
                        "fuzzy_check.rule",
@@ -634,6 +668,8 @@ fuzzy_check_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
                        "skip_unknown",
                        UCL_BOOLEAN,
                        NULL,
+                       0,
+                       NULL,
                        0);
        rspamd_rcl_add_doc_by_path (cfg,
                        "fuzzy_check.rule",
@@ -641,6 +677,8 @@ fuzzy_check_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
                        "symbol",
                        UCL_STRING,
                        NULL,
+                       0,
+                       NULL,
                        0);
        rspamd_rcl_add_doc_by_path (cfg,
                        "fuzzy_check.rule",
@@ -648,6 +686,8 @@ fuzzy_check_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
                        "encryption_key",
                        UCL_STRING,
                        NULL,
+                       0,
+                       NULL,
                        0);
        rspamd_rcl_add_doc_by_path (cfg,
                        "fuzzy_check.rule",
@@ -655,6 +695,8 @@ fuzzy_check_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
                        "fuzzy_key",
                        UCL_STRING,
                        NULL,
+                       0,
+                       NULL,
                        0);
        rspamd_rcl_add_doc_by_path (cfg,
                        "fuzzy_check.rule",
@@ -662,14 +704,18 @@ fuzzy_check_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
                        "fuzzy_shingles_key",
                        UCL_STRING,
                        NULL,
+                       0,
+                       NULL,
                        0);
        rspamd_rcl_add_doc_by_path (cfg,
                        "fuzzy_check.rule",
                        "Lua script that returns boolean function to check if this task "
-                                       "should be considered when learning fuzzy storage",
+                                               "should be considered when learning fuzzy storage",
                        "learn_condition",
                        UCL_STRING,
                        NULL,
+                       0,
+                       NULL,
                        0);
        rspamd_rcl_add_doc_by_path (cfg,
                        "fuzzy_check.rule",
@@ -677,6 +723,8 @@ fuzzy_check_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
                        "fuzzy_map",
                        UCL_OBJECT,
                        NULL,
+                       0,
+                       NULL,
                        0);
        /* Fuzzy map doc strings */
        rspamd_rcl_add_doc_by_path (cfg,
@@ -685,6 +733,8 @@ fuzzy_check_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
                        "max_score",
                        UCL_INT,
                        NULL,
+                       0,
+                       NULL,
                        0);
        rspamd_rcl_add_doc_by_path (cfg,
                        "fuzzy_check.rule.fuzzy_map",
@@ -692,6 +742,8 @@ fuzzy_check_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
                        "flag",
                        UCL_INT,
                        NULL,
+                       0,
+                       NULL,
                        0);
 
        return 0;
index ddabe672eea180fa80f2e12c1c42f4ce5c2c58da..566136bf011b7fa4c3b17768e091cb2a9723feed 100644 (file)
@@ -102,9 +102,15 @@ regexp_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
 
        *ctx = (struct module_ctx *)regexp_module_ctx;
 
-       rspamd_rcl_add_doc_by_path (cfg, NULL,
+       rspamd_rcl_add_doc_by_path (cfg,
+                       NULL,
                        "Regular expressions rules plugin",
-                       "regexp", UCL_OBJECT, NULL, 0);
+                       "regexp",
+                       UCL_OBJECT,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
 
        rspamd_rcl_add_doc_by_path (cfg,
                        "regexp",
@@ -112,6 +118,8 @@ regexp_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
                        "max_size",
                        UCL_INT,
                        NULL,
+                       0,
+                       NULL,
                        0);
 
        return 0;
index 200270b117f361e9296bb183ce27d5e5e848f0c9..d7f1031c7dbf6177bea96015e57468c533fdb248 100644 (file)
@@ -97,25 +97,51 @@ spf_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
 
        *ctx = (struct module_ctx *)spf_module_ctx;
 
-       rspamd_rcl_add_doc_by_path (cfg, NULL,
+       rspamd_rcl_add_doc_by_path (cfg,
+                       NULL,
                        "SPF check plugin",
-                       "spf", UCL_OBJECT, NULL, 0);
+                       "spf",
+                       UCL_OBJECT,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
 
-       rspamd_rcl_add_doc_by_path (cfg, "spf",
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "spf",
                        "Map of IP addresses that should be excluded from SPF checks (in addition to `local_networks`)",
-                       "whitelist", UCL_STRING, NULL, 0);
-       rspamd_rcl_add_doc_by_path (cfg, "spf",
+                       "whitelist",
+                       UCL_STRING,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "spf",
                        "Symbol that is added if SPF check is successful",
-                       "symbol_allow", UCL_STRING, NULL, 0);
-       rspamd_rcl_add_doc_by_path (cfg, "spf",
+                       "symbol_allow",
+                       UCL_STRING,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "spf",
                        "Symbol that is added if SPF policy is set to 'deny'",
-                       "symbol_fail", UCL_STRING, NULL, 0);
+                       "symbol_fail",
+                       UCL_STRING,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
        rspamd_rcl_add_doc_by_path (cfg,
                        "spf",
                        "Symbol that is added if SPF policy is set to 'undefined'",
                        "symbol_softfail",
                        UCL_STRING,
                        NULL,
+                       0,
+                       NULL,
                        0);
        rspamd_rcl_add_doc_by_path (cfg,
                        "spf",
@@ -123,13 +149,27 @@ spf_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
                        "symbol_neutral",
                        UCL_STRING,
                        NULL,
+                       0,
+                       NULL,
                        0);
-       rspamd_rcl_add_doc_by_path (cfg, "spf",
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "spf",
                        "Size of SPF parsed records cache",
-                       "spf_cache_size", UCL_INT, NULL, 0);
-       rspamd_rcl_add_doc_by_path (cfg, "spf",
+                       "spf_cache_size",
+                       UCL_INT,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "spf",
                        "Maximum lifetime for the elements in the SPF cache",
-                       "spf_cache_expire", UCL_TIME, NULL, 0);
+                       "spf_cache_expire",
+                       UCL_TIME,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
 
        return 0;
 }
index 1c5e0625b8b51d820a6d6c303fdc55af3d3b97d8..7572a0df8a8031b3e6bc1d488f31897e165be269 100644 (file)
@@ -292,52 +292,142 @@ surbl_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
 
        *ctx = (struct module_ctx *)surbl_module_ctx;
 
-       rspamd_rcl_add_doc_by_path (cfg, NULL,
+       rspamd_rcl_add_doc_by_path (cfg,
+                       NULL,
                        "URL blacklist plugin",
-                       "surbl", UCL_OBJECT, NULL, 0);
-       rspamd_rcl_add_doc_by_path (cfg, "surbl",
+                       "surbl",
+                       UCL_OBJECT,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "surbl",
                        "List of redirector servers",
-                       "redirector", UCL_STRING, NULL, 0);
-       rspamd_rcl_add_doc_by_path (cfg, "surbl",
+                       "redirector",
+                       UCL_STRING,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "surbl",
                        "Map of domains that should be checked with redirector",
-                       "redirector_hosts_map", UCL_STRING, NULL, 0);
-       rspamd_rcl_add_doc_by_path (cfg, "surbl",
+                       "redirector_hosts_map",
+                       UCL_STRING,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "surbl",
                        "Connect timeout for redirector",
-                       "redirector_connect_timeout", UCL_TIME, NULL, 0);
-       rspamd_rcl_add_doc_by_path (cfg, "surbl",
+                       "redirector_connect_timeout",
+                       UCL_TIME,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "surbl",
                        "Read timeout for redirector",
-                       "redirector_read_timeout", UCL_TIME, NULL, 0);
-       rspamd_rcl_add_doc_by_path (cfg, "surbl",
+                       "redirector_read_timeout",
+                       UCL_TIME,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "surbl",
                        "Maximum number of URLs to process per message",
-                       "max_urls", UCL_INT, NULL, 0);
-       rspamd_rcl_add_doc_by_path (cfg, "surbl",
+                       "max_urls",
+                       UCL_INT,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "surbl",
                        "Rules for TLD composition",
-                       "exceptions", UCL_STRING, NULL, 0);
-       rspamd_rcl_add_doc_by_path (cfg, "surbl",
+                       "exceptions",
+                       UCL_STRING,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "surbl",
                        "Map of whitelisted domains",
-                       "whitelist", UCL_STRING, NULL, 0);
-       rspamd_rcl_add_doc_by_path (cfg, "surbl",
+                       "whitelist",
+                       UCL_STRING,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "surbl",
                        "URL blacklist rule",
-                       "rule", UCL_OBJECT, NULL, 0);
+                       "rule",
+                       UCL_OBJECT,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
        /* Rules doc strings */
-       rspamd_rcl_add_doc_by_path (cfg, "surbl.rule",
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "surbl.rule",
                        "Name of DNS black list (e.g. `multi.surbl.com`)",
-                       "suffix", UCL_STRING, NULL, 0);
-       rspamd_rcl_add_doc_by_path (cfg, "surbl.rule",
+                       "suffix",
+                       UCL_STRING,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "surbl.rule",
                        "Symbol to insert (if no bits or suffixes are defined)",
-                       "symbol", UCL_STRING, NULL, 0);
-       rspamd_rcl_add_doc_by_path (cfg, "surbl.rule",
+                       "symbol",
+                       UCL_STRING,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "surbl.rule",
                        "Do not try to check URLs with IP address instead of hostname",
-                       "no_ip", UCL_BOOLEAN, NULL, 0);
-       rspamd_rcl_add_doc_by_path (cfg, "surbl.rule",
+                       "no_ip",
+                       UCL_BOOLEAN,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "surbl.rule",
                        "Resolve URL host and then check against the specified suffix with reversed IP octets",
-                       "resolve_ip", UCL_BOOLEAN, NULL, 0);
-       rspamd_rcl_add_doc_by_path (cfg, "surbl.rule",
+                       "resolve_ip",
+                       UCL_BOOLEAN,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "surbl.rule",
                        "Parse IP bits in DNS reply, the content is 'symbol = <bit>'",
-                       "bits", UCL_OBJECT, NULL, 0);
-       rspamd_rcl_add_doc_by_path (cfg, "surbl.rule",
+                       "bits",
+                       UCL_OBJECT,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
+       rspamd_rcl_add_doc_by_path (cfg,
+                       "surbl.rule",
                        "Parse IP addresses in DNS reply, the content is 'symbol = address'",
-                       "ips", UCL_OBJECT, NULL, 0);
+                       "ips",
+                       UCL_OBJECT,
+                       NULL,
+                       0,
+                       NULL,
+                       0);
 
        return 0;
 }