name,
type,
NULL,
+ 0,
+ NULL,
0);
}
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;
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 (
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);
}
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;
/* 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 {
}
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;
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;
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 */
}
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);
}
* @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_t* rspamd_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
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_ */
*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;
}
*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",
"symbol",
UCL_STRING,
NULL,
+ 0,
+ NULL,
0);
rspamd_rcl_add_doc_by_path (cfg,
"fuzzy_check",
"min_length",
UCL_INT,
NULL,
+ 0,
+ NULL,
0);
rspamd_rcl_add_doc_by_path (cfg,
"fuzzy_check",
"min_bytes",
UCL_INT,
NULL,
+ 0,
+ NULL,
0);
rspamd_rcl_add_doc_by_path (cfg,
"fuzzy_check",
"min_height",
UCL_INT,
NULL,
+ 0,
+ NULL,
0);
rspamd_rcl_add_doc_by_path (cfg,
"fuzzy_check",
"min_width",
UCL_INT,
NULL,
+ 0,
+ NULL,
0);
rspamd_rcl_add_doc_by_path (cfg,
"fuzzy_check",
"timeout",
UCL_TIME,
NULL,
+ 0,
+ NULL,
0);
rspamd_rcl_add_doc_by_path (cfg,
"fuzzy_check",
"retransmits",
UCL_INT,
NULL,
+ 0,
+ NULL,
0);
rspamd_rcl_add_doc_by_path (cfg,
"fuzzy_check",
"whitelist",
UCL_STRING,
NULL,
+ 0,
+ NULL,
0);
/* Rules doc strings */
rspamd_rcl_add_doc_by_path (cfg,
"rule",
UCL_OBJECT,
NULL,
+ 0,
+ NULL,
0);
rspamd_rcl_add_doc_by_path (cfg,
"fuzzy_check.rule",
"headers",
UCL_ARRAY,
NULL,
+ 0,
+ NULL,
0);
rspamd_rcl_add_doc_by_path (cfg,
"fuzzy_check.rule",
"mime_types",
UCL_ARRAY,
NULL,
+ 0,
+ NULL,
0);
rspamd_rcl_add_doc_by_path (cfg,
"fuzzy_check.rule",
"max_score",
UCL_INT,
NULL,
+ 0,
+ NULL,
0);
rspamd_rcl_add_doc_by_path (cfg,
"fuzzy_check.rule",
"servers",
UCL_STRING,
NULL,
+ 0,
+ NULL,
0);
rspamd_rcl_add_doc_by_path (cfg,
"fuzzy_check.rule",
"read_only",
UCL_BOOLEAN,
NULL,
+ 0,
+ NULL,
0);
rspamd_rcl_add_doc_by_path (cfg,
"fuzzy_check.rule",
"skip_unknown",
UCL_BOOLEAN,
NULL,
+ 0,
+ NULL,
0);
rspamd_rcl_add_doc_by_path (cfg,
"fuzzy_check.rule",
"symbol",
UCL_STRING,
NULL,
+ 0,
+ NULL,
0);
rspamd_rcl_add_doc_by_path (cfg,
"fuzzy_check.rule",
"encryption_key",
UCL_STRING,
NULL,
+ 0,
+ NULL,
0);
rspamd_rcl_add_doc_by_path (cfg,
"fuzzy_check.rule",
"fuzzy_key",
UCL_STRING,
NULL,
+ 0,
+ NULL,
0);
rspamd_rcl_add_doc_by_path (cfg,
"fuzzy_check.rule",
"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",
"fuzzy_map",
UCL_OBJECT,
NULL,
+ 0,
+ NULL,
0);
/* Fuzzy map doc strings */
rspamd_rcl_add_doc_by_path (cfg,
"max_score",
UCL_INT,
NULL,
+ 0,
+ NULL,
0);
rspamd_rcl_add_doc_by_path (cfg,
"fuzzy_check.rule.fuzzy_map",
"flag",
UCL_INT,
NULL,
+ 0,
+ NULL,
0);
return 0;
*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",
"max_size",
UCL_INT,
NULL,
+ 0,
+ NULL,
0);
return 0;
*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",
"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;
}
*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;
}