summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2018-01-11 19:20:42 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2018-01-11 19:20:42 +0000
commit714239ddeaf485d80911e887741603f205367777 (patch)
treed4c0b2ae02a76726dde8ed4246d58a7c345d7c4b /usr.sbin
parent0fa15e9deee7d7499fcfc650f2c0f7f7c0f24463 (diff)
fix parsing of long TXT records, this prevents 'smtpctl spf walk' from
producing bogus entries with some SPF records. ok ajacoutot@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/smtpd/spfwalk.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/smtpd/spfwalk.c b/usr.sbin/smtpd/spfwalk.c
index 833841adad0..64de139d37d 100644
--- a/usr.sbin/smtpd/spfwalk.c
+++ b/usr.sbin/smtpd/spfwalk.c
@@ -145,11 +145,9 @@ dispatch_txt(struct dns_rr *rr)
char *in = buf;
char *argv[512];
char **ap = argv;
-
+ char *end;
+
print_dname(rr->rr.other.rdata, buf, sizeof(buf));
- buf[strlen(buf) - 1] = '\0';
- if (buf[strlen(buf) - 1] == '.')
- buf[strlen(buf) - 1] = '\0';
if (strncasecmp("v=spf1 ", buf, 7))
return;
@@ -157,6 +155,10 @@ dispatch_txt(struct dns_rr *rr)
if (strcasecmp(*ap, "v=spf1") == 0)
continue;
+ end = *ap + strlen(*ap)-1;
+ if (*end == '.')
+ *end = '\0';
+
if (strncasecmp("ip4:", *ap, 4) == 0) {
if (ip_v4 == 1 || ip_both == 1)
printf("%s\n", *(ap) + 4);