gboolean check_local;
gboolean check_authed;
+
+ guint max_dns_nesting;
+ guint max_dns_requests;
+ guint min_cache_ttl;
};
static void spf_symbol_callback (struct rspamd_task *task,
spf_module_ctx = rspamd_mempool_alloc0 (cfg->cfg_pool,
sizeof (*spf_module_ctx));
*ctx = (struct module_ctx *)spf_module_ctx;
+ spf_module_ctx->min_cache_ttl = SPF_MIN_CACHE_TTL;
+ spf_module_ctx->max_dns_nesting = SPF_MAX_NESTING;
+ spf_module_ctx->max_dns_requests = SPF_MAX_DNS_REQUESTS;
rspamd_rcl_add_doc_by_path (cfg,
NULL,
NULL,
0);
+ rspamd_rcl_add_doc_by_path (cfg,
+ "spf",
+ "Minimum cached records TTL, 0 to disable (default: 5min)",
+ "min_cache_ttl",
+ UCL_INT,
+ NULL,
+ RSPAMD_CL_FLAG_UINT,
+ NULL,
+ 0);
+ rspamd_rcl_add_doc_by_path (cfg,
+ "spf",
+ "Maximum number of nested requests (default: " G_STRINGIFY(SPF_MAX_NESTING) ")",
+ "max_dns_nesting",
+ UCL_INT,
+ NULL,
+ RSPAMD_CL_FLAG_UINT,
+ NULL,
+ 0);
+ rspamd_rcl_add_doc_by_path (cfg,
+ "spf",
+ "Maximum number of dns requests to resolve SPF (default: " G_STRINGIFY(SPF_MAX_DNS_REQUESTS) ")",
+ "max_dns_requests",
+ UCL_INT,
+ NULL,
+ RSPAMD_CL_FLAG_UINT,
+ NULL,
+ 0);
+
return 0;
}
cache_size = DEFAULT_CACHE_SIZE;
}
+ if ((value =
+ rspamd_config_get_module_opt (cfg, "spf", "min_cache_ttl")) != NULL) {
+ spf_module_ctx->min_cache_ttl = ucl_obj_toint (value);
+ }
+ if ((value =
+ rspamd_config_get_module_opt (cfg, "spf", "max_dns_nesting")) != NULL) {
+ spf_module_ctx->max_dns_nesting = ucl_obj_toint (value);
+ }
+ if ((value =
+ rspamd_config_get_module_opt (cfg, "spf", "max_dns_requests")) != NULL) {
+ spf_module_ctx->max_dns_requests = ucl_obj_toint (value);
+ }
+
+ spf_library_config (spf_module_ctx->max_dns_nesting,
+ spf_module_ctx->max_dns_requests,
+ spf_module_ctx->min_cache_ttl);
+
if ((value =
rspamd_config_get_module_opt (cfg, "spf", "whitelist")) != NULL) {