You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

spf.c 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. /*-
  2. * Copyright 2016 Vsevolod Stakhov
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /***MODULE:spf
  17. * rspamd module that checks spf records of incoming email
  18. *
  19. * Allowed options:
  20. * - symbol_allow (string): symbol to insert (default: 'R_SPF_ALLOW')
  21. * - symbol_fail (string): symbol to insert (default: 'R_SPF_FAIL')
  22. * - symbol_softfail (string): symbol to insert (default: 'R_SPF_SOFTFAIL')
  23. * - symbol_na (string): symbol to insert (default: 'R_SPF_NA')
  24. * - symbol_dnsfail (string): symbol to insert (default: 'R_SPF_DNSFAIL')
  25. * - symbol_permfail (string): symbol to insert (default: 'R_SPF_PERMFAIL')
  26. * - whitelist (map): map of whitelisted networks
  27. */
  28. #include "config.h"
  29. #include "libmime/message.h"
  30. #include "libserver/spf.h"
  31. #include "libutil/hash.h"
  32. #include "libutil/map.h"
  33. #include "libutil/map_helpers.h"
  34. #include "rspamd.h"
  35. #include "libserver/mempool_vars_internal.h"
  36. #define DEFAULT_SYMBOL_FAIL "R_SPF_FAIL"
  37. #define DEFAULT_SYMBOL_SOFTFAIL "R_SPF_SOFTFAIL"
  38. #define DEFAULT_SYMBOL_NEUTRAL "R_SPF_NEUTRAL"
  39. #define DEFAULT_SYMBOL_ALLOW "R_SPF_ALLOW"
  40. #define DEFAULT_SYMBOL_DNSFAIL "R_SPF_DNSFAIL"
  41. #define DEFAULT_SYMBOL_PERMFAIL "R_SPF_PERMFAIL"
  42. #define DEFAULT_SYMBOL_NA "R_SPF_NA"
  43. #define DEFAULT_CACHE_SIZE 2048
  44. static const gchar *M = "rspamd spf plugin";
  45. struct spf_ctx {
  46. struct module_ctx ctx;
  47. const gchar *symbol_fail;
  48. const gchar *symbol_softfail;
  49. const gchar *symbol_neutral;
  50. const gchar *symbol_allow;
  51. const gchar *symbol_dnsfail;
  52. const gchar *symbol_na;
  53. const gchar *symbol_permfail;
  54. struct rspamd_radix_map_helper *whitelist_ip;
  55. rspamd_lru_hash_t *spf_hash;
  56. gboolean check_local;
  57. gboolean check_authed;
  58. };
  59. static void spf_symbol_callback (struct rspamd_task *task,
  60. struct rspamd_symcache_item *item,
  61. void *unused);
  62. /* Initialization */
  63. gint spf_module_init (struct rspamd_config *cfg, struct module_ctx **ctx);
  64. gint spf_module_config (struct rspamd_config *cfg);
  65. gint spf_module_reconfig (struct rspamd_config *cfg);
  66. module_t spf_module = {
  67. "spf",
  68. spf_module_init,
  69. spf_module_config,
  70. spf_module_reconfig,
  71. NULL,
  72. RSPAMD_MODULE_VER,
  73. (guint)-1,
  74. };
  75. static inline struct spf_ctx *
  76. spf_get_context (struct rspamd_config *cfg)
  77. {
  78. return (struct spf_ctx *)g_ptr_array_index (cfg->c_modules,
  79. spf_module.ctx_offset);
  80. }
  81. gint
  82. spf_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
  83. {
  84. struct spf_ctx *spf_module_ctx;
  85. spf_module_ctx = rspamd_mempool_alloc0 (cfg->cfg_pool,
  86. sizeof (*spf_module_ctx));
  87. *ctx = (struct module_ctx *)spf_module_ctx;
  88. rspamd_rcl_add_doc_by_path (cfg,
  89. NULL,
  90. "SPF check plugin",
  91. "spf",
  92. UCL_OBJECT,
  93. NULL,
  94. 0,
  95. NULL,
  96. 0);
  97. rspamd_rcl_add_doc_by_path (cfg,
  98. "spf",
  99. "Map of IP addresses that should be excluded from SPF checks (in addition to `local_networks`)",
  100. "whitelist",
  101. UCL_STRING,
  102. NULL,
  103. 0,
  104. NULL,
  105. 0);
  106. rspamd_rcl_add_doc_by_path (cfg,
  107. "spf",
  108. "Symbol that is added if SPF check is successful",
  109. "symbol_allow",
  110. UCL_STRING,
  111. NULL,
  112. 0,
  113. NULL,
  114. 0);
  115. rspamd_rcl_add_doc_by_path (cfg,
  116. "spf",
  117. "Symbol that is added if SPF policy is set to 'deny'",
  118. "symbol_fail",
  119. UCL_STRING,
  120. NULL,
  121. 0,
  122. NULL,
  123. 0);
  124. rspamd_rcl_add_doc_by_path (cfg,
  125. "spf",
  126. "Symbol that is added if SPF policy is set to 'undefined'",
  127. "symbol_softfail",
  128. UCL_STRING,
  129. NULL,
  130. 0,
  131. NULL,
  132. 0);
  133. rspamd_rcl_add_doc_by_path (cfg,
  134. "spf",
  135. "Symbol that is added if SPF policy is set to 'neutral'",
  136. "symbol_neutral",
  137. UCL_STRING,
  138. NULL,
  139. 0,
  140. NULL,
  141. 0);
  142. rspamd_rcl_add_doc_by_path (cfg,
  143. "spf",
  144. "Symbol that is added if SPF policy is failed due to DNS failure",
  145. "symbol_dnsfail",
  146. UCL_STRING,
  147. NULL,
  148. 0,
  149. NULL,
  150. 0);
  151. rspamd_rcl_add_doc_by_path (cfg,
  152. "spf",
  153. "Symbol that is added if no SPF policy is found",
  154. "symbol_na",
  155. UCL_STRING,
  156. NULL,
  157. 0,
  158. NULL,
  159. 0);
  160. rspamd_rcl_add_doc_by_path (cfg,
  161. "spf",
  162. "Symbol that is added if SPF policy is invalid",
  163. "symbol_permfail",
  164. UCL_STRING,
  165. NULL,
  166. 0,
  167. NULL,
  168. 0);
  169. rspamd_rcl_add_doc_by_path (cfg,
  170. "spf",
  171. "Size of SPF parsed records cache",
  172. "spf_cache_size",
  173. UCL_INT,
  174. NULL,
  175. 0,
  176. NULL,
  177. 0);
  178. return 0;
  179. }
  180. gint
  181. spf_module_config (struct rspamd_config *cfg)
  182. {
  183. const ucl_object_t *value;
  184. gint res = TRUE, cb_id;
  185. guint cache_size;
  186. struct spf_ctx *spf_module_ctx = spf_get_context (cfg);
  187. if (!rspamd_config_is_module_enabled (cfg, "spf")) {
  188. return TRUE;
  189. }
  190. spf_module_ctx->whitelist_ip = NULL;
  191. value = rspamd_config_get_module_opt (cfg, "spf", "check_local");
  192. if (value == NULL) {
  193. rspamd_config_get_module_opt (cfg, "options", "check_local");
  194. }
  195. if (value != NULL) {
  196. spf_module_ctx->check_local = ucl_obj_toboolean (value);
  197. }
  198. else {
  199. spf_module_ctx->check_local = FALSE;
  200. }
  201. value = rspamd_config_get_module_opt (cfg, "spf", "check_authed");
  202. if (value == NULL) {
  203. rspamd_config_get_module_opt (cfg, "options", "check_authed");
  204. }
  205. if (value != NULL) {
  206. spf_module_ctx->check_authed = ucl_obj_toboolean (value);
  207. }
  208. else {
  209. spf_module_ctx->check_authed = FALSE;
  210. }
  211. if ((value =
  212. rspamd_config_get_module_opt (cfg, "spf", "symbol_fail")) != NULL) {
  213. spf_module_ctx->symbol_fail = ucl_obj_tostring (value);
  214. }
  215. else {
  216. spf_module_ctx->symbol_fail = DEFAULT_SYMBOL_FAIL;
  217. }
  218. if ((value =
  219. rspamd_config_get_module_opt (cfg, "spf", "symbol_softfail")) != NULL) {
  220. spf_module_ctx->symbol_softfail = ucl_obj_tostring (value);
  221. }
  222. else {
  223. spf_module_ctx->symbol_softfail = DEFAULT_SYMBOL_SOFTFAIL;
  224. }
  225. if ((value =
  226. rspamd_config_get_module_opt (cfg, "spf", "symbol_neutral")) != NULL) {
  227. spf_module_ctx->symbol_neutral = ucl_obj_tostring (value);
  228. }
  229. else {
  230. spf_module_ctx->symbol_neutral = DEFAULT_SYMBOL_NEUTRAL;
  231. }
  232. if ((value =
  233. rspamd_config_get_module_opt (cfg, "spf", "symbol_allow")) != NULL) {
  234. spf_module_ctx->symbol_allow = ucl_obj_tostring (value);
  235. }
  236. else {
  237. spf_module_ctx->symbol_allow = DEFAULT_SYMBOL_ALLOW;
  238. }
  239. if ((value =
  240. rspamd_config_get_module_opt (cfg, "spf", "symbol_dnsfail")) != NULL) {
  241. spf_module_ctx->symbol_dnsfail = ucl_obj_tostring (value);
  242. }
  243. else {
  244. spf_module_ctx->symbol_dnsfail = DEFAULT_SYMBOL_DNSFAIL;
  245. }
  246. if ((value =
  247. rspamd_config_get_module_opt (cfg, "spf", "symbol_na")) != NULL) {
  248. spf_module_ctx->symbol_na = ucl_obj_tostring (value);
  249. }
  250. else {
  251. spf_module_ctx->symbol_na = DEFAULT_SYMBOL_NA;
  252. }
  253. if ((value =
  254. rspamd_config_get_module_opt (cfg, "spf", "symbol_permfail")) != NULL) {
  255. spf_module_ctx->symbol_permfail = ucl_obj_tostring (value);
  256. }
  257. else {
  258. spf_module_ctx->symbol_permfail = DEFAULT_SYMBOL_PERMFAIL;
  259. }
  260. if ((value =
  261. rspamd_config_get_module_opt (cfg, "spf", "spf_cache_size")) != NULL) {
  262. cache_size = ucl_obj_toint (value);
  263. }
  264. else {
  265. cache_size = DEFAULT_CACHE_SIZE;
  266. }
  267. if ((value =
  268. rspamd_config_get_module_opt (cfg, "spf", "whitelist")) != NULL) {
  269. rspamd_config_radix_from_ucl (cfg, value, "SPF whitelist",
  270. &spf_module_ctx->whitelist_ip, NULL);
  271. }
  272. cb_id = rspamd_symcache_add_symbol (cfg->cache,
  273. spf_module_ctx->symbol_fail,
  274. 0,
  275. spf_symbol_callback,
  276. NULL,
  277. SYMBOL_TYPE_NORMAL | SYMBOL_TYPE_FINE | SYMBOL_TYPE_EMPTY, -1);
  278. rspamd_symcache_add_symbol (cfg->cache,
  279. spf_module_ctx->symbol_softfail, 0,
  280. NULL, NULL,
  281. SYMBOL_TYPE_VIRTUAL,
  282. cb_id);
  283. rspamd_symcache_add_symbol (cfg->cache,
  284. spf_module_ctx->symbol_permfail, 0,
  285. NULL, NULL,
  286. SYMBOL_TYPE_VIRTUAL,
  287. cb_id);
  288. rspamd_symcache_add_symbol (cfg->cache,
  289. spf_module_ctx->symbol_na, 0,
  290. NULL, NULL,
  291. SYMBOL_TYPE_VIRTUAL,
  292. cb_id);
  293. rspamd_symcache_add_symbol (cfg->cache,
  294. spf_module_ctx->symbol_neutral, 0,
  295. NULL, NULL,
  296. SYMBOL_TYPE_VIRTUAL,
  297. cb_id);
  298. rspamd_symcache_add_symbol (cfg->cache,
  299. spf_module_ctx->symbol_allow, 0,
  300. NULL, NULL,
  301. SYMBOL_TYPE_VIRTUAL,
  302. cb_id);
  303. rspamd_symcache_add_symbol (cfg->cache,
  304. spf_module_ctx->symbol_dnsfail, 0,
  305. NULL, NULL,
  306. SYMBOL_TYPE_VIRTUAL,
  307. cb_id);
  308. spf_module_ctx->spf_hash = rspamd_lru_hash_new (
  309. cache_size,
  310. NULL,
  311. (GDestroyNotify)spf_record_unref);
  312. msg_info_config ("init internal spf module");
  313. rspamd_mempool_add_destructor (cfg->cfg_pool,
  314. (rspamd_mempool_destruct_t)rspamd_lru_hash_destroy,
  315. spf_module_ctx->spf_hash);
  316. rspamd_mempool_add_destructor (cfg->cfg_pool,
  317. (rspamd_mempool_destruct_t)rspamd_map_helper_destroy_radix,
  318. spf_module_ctx->whitelist_ip);
  319. return res;
  320. }
  321. gint
  322. spf_module_reconfig (struct rspamd_config *cfg)
  323. {
  324. return spf_module_config (cfg);
  325. }
  326. static gboolean
  327. spf_check_element (struct spf_resolved *rec, struct spf_addr *addr,
  328. struct rspamd_task *task)
  329. {
  330. gboolean res = FALSE;
  331. const guint8 *s, *d;
  332. gchar *spf_result;
  333. guint af, mask, bmask, addrlen;
  334. const gchar *spf_message, *spf_symbol;
  335. struct spf_ctx *spf_module_ctx = spf_get_context (task->cfg);
  336. if (task->from_addr == NULL) {
  337. return FALSE;
  338. }
  339. if (addr->flags & RSPAMD_SPF_FLAG_TEMPFAIL) {
  340. /* Ignore failed addresses */
  341. return FALSE;
  342. }
  343. af = rspamd_inet_address_get_af (task->from_addr);
  344. /* Basic comparing algorithm */
  345. if (((addr->flags & RSPAMD_SPF_FLAG_IPV6) && af == AF_INET6) ||
  346. ((addr->flags & RSPAMD_SPF_FLAG_IPV4) && af == AF_INET)) {
  347. d = rspamd_inet_address_get_hash_key (task->from_addr, &addrlen);
  348. if (af == AF_INET6) {
  349. s = (const guint8 *)addr->addr6;
  350. mask = addr->m.dual.mask_v6;
  351. }
  352. else {
  353. s = (const guint8 *)addr->addr4;
  354. mask = addr->m.dual.mask_v4;
  355. }
  356. /* Compare the first bytes */
  357. bmask = mask / CHAR_BIT;
  358. if (mask > addrlen * CHAR_BIT) {
  359. msg_info_task ("bad mask length: %d", mask);
  360. }
  361. else if (memcmp (s, d, bmask) == 0) {
  362. if (bmask * CHAR_BIT < mask) {
  363. /* Compare the remaining bits */
  364. s += bmask;
  365. d += bmask;
  366. mask = (0xff << (CHAR_BIT - (mask - bmask * 8))) & 0xff;
  367. if ((*s & mask) == (*d & mask)) {
  368. res = TRUE;
  369. }
  370. }
  371. else {
  372. res = TRUE;
  373. }
  374. }
  375. }
  376. else {
  377. if (addr->flags & RSPAMD_SPF_FLAG_ANY) {
  378. res = TRUE;
  379. }
  380. else {
  381. res = FALSE;
  382. }
  383. }
  384. if (res) {
  385. spf_result = rspamd_mempool_alloc (task->task_pool,
  386. strlen (addr->spf_string) + 2);
  387. switch (addr->mech) {
  388. case SPF_FAIL:
  389. spf_symbol = spf_module_ctx->symbol_fail;
  390. spf_result[0] = '-';
  391. spf_message = "(SPF): spf fail";
  392. if (addr->flags & RSPAMD_SPF_FLAG_ANY) {
  393. if (rec->perm_failed) {
  394. msg_info_task ("do not apply SPF failed policy, as we have "
  395. "some addresses unresolved");
  396. spf_symbol = spf_module_ctx->symbol_permfail;
  397. }
  398. else if (rec->temp_failed) {
  399. msg_info_task ("do not apply SPF failed policy, as we have "
  400. "some addresses unresolved");
  401. spf_symbol = spf_module_ctx->symbol_dnsfail;
  402. spf_message = "(SPF): spf DNS fail";
  403. }
  404. }
  405. break;
  406. case SPF_SOFT_FAIL:
  407. spf_symbol = spf_module_ctx->symbol_softfail;
  408. spf_message = "(SPF): spf softfail";
  409. spf_result[0] = '~';
  410. if (addr->flags & RSPAMD_SPF_FLAG_ANY) {
  411. if (rec->perm_failed) {
  412. msg_info_task ("do not apply SPF failed policy, as we have "
  413. "some addresses unresolved");
  414. spf_symbol = spf_module_ctx->symbol_permfail;
  415. }
  416. else if (rec->temp_failed) {
  417. msg_info_task ("do not apply SPF failed policy, as we have "
  418. "some addresses unresolved");
  419. spf_symbol = spf_module_ctx->symbol_dnsfail;
  420. spf_message = "(SPF): spf DNS fail";
  421. }
  422. }
  423. break;
  424. case SPF_NEUTRAL:
  425. spf_symbol = spf_module_ctx->symbol_neutral;
  426. spf_message = "(SPF): spf neutral";
  427. spf_result[0] = '?';
  428. break;
  429. default:
  430. spf_symbol = spf_module_ctx->symbol_allow;
  431. spf_message = "(SPF): spf allow";
  432. spf_result[0] = '+';
  433. break;
  434. }
  435. rspamd_strlcpy (spf_result + 1, addr->spf_string,
  436. strlen (addr->spf_string) + 1);
  437. rspamd_task_insert_result (task,
  438. spf_symbol,
  439. 1,
  440. spf_result);
  441. ucl_object_insert_key (task->messages,
  442. ucl_object_fromstring (spf_message), "spf", 0,
  443. false);
  444. return TRUE;
  445. }
  446. return FALSE;
  447. }
  448. static void
  449. spf_check_list (struct spf_resolved *rec, struct rspamd_task *task)
  450. {
  451. guint i;
  452. struct spf_addr *addr;
  453. for (i = 0; i < rec->elts->len; i ++) {
  454. addr = &g_array_index (rec->elts, struct spf_addr, i);
  455. if (spf_check_element (rec, addr, task)) {
  456. break;
  457. }
  458. }
  459. }
  460. static void
  461. spf_plugin_callback (struct spf_resolved *record, struct rspamd_task *task,
  462. gpointer ud)
  463. {
  464. struct spf_resolved *l;
  465. struct rspamd_symcache_item *item = (struct rspamd_symcache_item *)ud;
  466. struct spf_ctx *spf_module_ctx = spf_get_context (task->cfg);
  467. if (record && record->na) {
  468. rspamd_task_insert_result (task,
  469. spf_module_ctx->symbol_na,
  470. 1,
  471. NULL);
  472. }
  473. else if (record && record->elts->len == 0 && record->temp_failed) {
  474. rspamd_task_insert_result (task,
  475. spf_module_ctx->symbol_dnsfail,
  476. 1,
  477. NULL);
  478. }
  479. else if (record && record->elts->len == 0 && record->perm_failed) {
  480. rspamd_task_insert_result (task,
  481. spf_module_ctx->symbol_permfail,
  482. 1,
  483. NULL);
  484. }
  485. else if (record && record->elts->len == 0) {
  486. rspamd_task_insert_result (task,
  487. spf_module_ctx->symbol_permfail,
  488. 1,
  489. NULL);
  490. }
  491. else if (record && record->domain) {
  492. if ((l = rspamd_lru_hash_lookup (spf_module_ctx->spf_hash,
  493. record->domain, task->tv.tv_sec)) == NULL) {
  494. l = record;
  495. if (record->ttl > 0 &&
  496. !record->temp_failed &&
  497. !record->perm_failed &&
  498. !record->na) {
  499. rspamd_lru_hash_insert (spf_module_ctx->spf_hash,
  500. record->domain, spf_record_ref (l),
  501. task->tv.tv_sec, record->ttl);
  502. }
  503. }
  504. spf_record_ref (l);
  505. spf_check_list (l, task);
  506. spf_record_unref (l);
  507. }
  508. rspamd_symcache_item_async_dec_check (task, item, M);
  509. }
  510. static void
  511. spf_symbol_callback (struct rspamd_task *task,
  512. struct rspamd_symcache_item *item,
  513. void *unused)
  514. {
  515. const gchar *domain;
  516. struct spf_resolved *l;
  517. gint *dmarc_checks;
  518. struct spf_ctx *spf_module_ctx = spf_get_context (task->cfg);
  519. /* Allow dmarc */
  520. dmarc_checks = rspamd_mempool_get_variable (task->task_pool,
  521. RSPAMD_MEMPOOL_DMARC_CHECKS);
  522. if (dmarc_checks) {
  523. (*dmarc_checks) ++;
  524. }
  525. else {
  526. dmarc_checks = rspamd_mempool_alloc (task->task_pool,
  527. sizeof (*dmarc_checks));
  528. *dmarc_checks = 1;
  529. rspamd_mempool_set_variable (task->task_pool,
  530. RSPAMD_MEMPOOL_DMARC_CHECKS,
  531. dmarc_checks, NULL);
  532. }
  533. if (rspamd_match_radix_map_addr (spf_module_ctx->whitelist_ip,
  534. task->from_addr) != NULL) {
  535. rspamd_symcache_finalize_item (task, item);
  536. return;
  537. }
  538. if ((!spf_module_ctx->check_authed && task->user != NULL)
  539. || (!spf_module_ctx->check_local &&
  540. rspamd_inet_address_is_local (task->from_addr, TRUE))) {
  541. msg_info_task ("skip SPF checks for local networks and authorized users");
  542. rspamd_symcache_finalize_item (task, item);
  543. return;
  544. }
  545. domain = rspamd_spf_get_domain (task);
  546. rspamd_symcache_item_async_inc (task, item, M);
  547. if (domain) {
  548. if ((l =
  549. rspamd_lru_hash_lookup (spf_module_ctx->spf_hash, domain,
  550. task->tv.tv_sec)) != NULL) {
  551. spf_record_ref (l);
  552. spf_check_list (l, task);
  553. spf_record_unref (l);
  554. }
  555. else {
  556. if (!rspamd_spf_resolve (task, spf_plugin_callback, item)) {
  557. msg_info_task ("cannot make spf request for [%s]",
  558. task->message_id);
  559. rspamd_task_insert_result (task,
  560. spf_module_ctx->symbol_dnsfail,
  561. 1,
  562. "(SPF): spf DNS fail");
  563. }
  564. else {
  565. rspamd_symcache_item_async_inc (task, item, M);
  566. }
  567. }
  568. }
  569. rspamd_symcache_item_async_dec_check (task, item, M);
  570. }