From cc302d382ff9bb601d7082ca852271c6b671a58c Mon Sep 17 00:00:00 2001 From: eric Date: Fri, 23 Aug 2019 15:39:11 +0000 Subject: [PATCH] only process records of the expected type. fix an issue where CNAME records generate bogus results. ok gilles@ --- usr.sbin/smtpd/spfwalk.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/usr.sbin/smtpd/spfwalk.c b/usr.sbin/smtpd/spfwalk.c index 22b057963f9..40d4888d564 100644 --- a/usr.sbin/smtpd/spfwalk.c +++ b/usr.sbin/smtpd/spfwalk.c @@ -229,6 +229,9 @@ dispatch_mx(struct dns_rr *rr) { char buf[512]; + if (rr->rr_type != T_MX) + return; + print_dname(rr->rr.mx.exchange, buf, sizeof(buf)); buf[strlen(buf) - 1] = '\0'; if (buf[strlen(buf) - 1] == '.') @@ -243,6 +246,9 @@ dispatch_a(struct dns_rr *rr) char buffer[512]; const char *ptr; + if (rr->rr_type != T_A) + return; + if ((ptr = inet_ntop(AF_INET, &rr->rr.in_a.addr, buffer, sizeof buffer))) printf("%s\n", ptr); @@ -254,6 +260,9 @@ dispatch_aaaa(struct dns_rr *rr) char buffer[512]; const char *ptr; + if (rr->rr_type != T_AAAA) + return; + if ((ptr = inet_ntop(AF_INET6, &rr->rr.in_aaaa.addr6, buffer, sizeof buffer))) printf("%s\n", ptr); -- 2.20.1