aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-11-20 17:38:44 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-11-20 20:45:22 +0000
commitdc506fc54b60f4bcc7390447a0d80bfd6f799e54 (patch)
tree48b33f254444571d9195d50ed191374ac9f7e3b4 /src
parentdc09c49cad817ea3ef9616a7e40f920aff63b1a7 (diff)
downloadrspamd-dc506fc54b60f4bcc7390447a0d80bfd6f799e54.tar.gz
rspamd-dc506fc54b60f4bcc7390447a0d80bfd6f799e54.zip
[Minor] Improve debugging in spf
Diffstat (limited to 'src')
-rw-r--r--src/libserver/spf.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libserver/spf.c b/src/libserver/spf.c
index 372b20189..6de2fa4b9 100644
--- a/src/libserver/spf.c
+++ b/src/libserver/spf.c
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#include <contrib/librdns/rdns.h>
#include "config.h"
#include "dns.h"
#include "spf.h"
@@ -611,6 +612,7 @@ spf_record_dns_callback (struct rdns_reply *reply, gpointer arg)
struct rspamd_task *task;
struct spf_addr *addr;
struct spf_record *rec;
+ const struct rdns_request_name *req_name;
rec = cb->rec;
task = rec->task;
@@ -619,6 +621,8 @@ spf_record_dns_callback (struct rdns_reply *reply, gpointer arg)
addr = cb->addr;
if (reply->code == RDNS_RC_NOERROR) {
+ req_name = rdns_request_get_name (reply->request, NULL);
+
LL_FOREACH (reply->entries, elt_data) {
/* Adjust ttl if a resolved record has lower ttl than spf record itself */
if ((guint)elt_data->ttl < rec->ttl) {
@@ -693,6 +697,12 @@ spf_record_dns_callback (struct rdns_reply *reply, gpointer arg)
case SPF_RESOLVE_REDIRECT:
if (elt_data->type == RDNS_REQUEST_TXT) {
cb->addr->flags |= RSPAMD_SPF_FLAG_RESOLVED;
+ if (reply->entries) {
+ msg_debug_spf ("got redirection record for %s: '%s'",
+ req_name->name,
+ reply->entries[0].content.txt.data);
+ }
+
if (!spf_process_txt_record (rec, cb->resolved, reply)) {
cb->addr->flags |= RSPAMD_SPF_FLAG_PERMFAIL;
}
@@ -702,6 +712,12 @@ spf_record_dns_callback (struct rdns_reply *reply, gpointer arg)
break;
case SPF_RESOLVE_INCLUDE:
if (elt_data->type == RDNS_REQUEST_TXT) {
+ if (reply->entries) {
+ msg_debug_spf ("got include record for %s: '%s'",
+ req_name->name,
+ reply->entries[0].content.txt.data);
+ }
+
cb->addr->flags |= RSPAMD_SPF_FLAG_RESOLVED;
spf_process_txt_record (rec, cb->resolved, reply);
}