diff options
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r-- | usr.sbin/smtpd/spfwalk.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/usr.sbin/smtpd/spfwalk.c b/usr.sbin/smtpd/spfwalk.c index 6ba83faffd3..83a675959b5 100644 --- a/usr.sbin/smtpd/spfwalk.c +++ b/usr.sbin/smtpd/spfwalk.c @@ -15,6 +15,7 @@ */ #include <sys/socket.h> +#include <sys/tree.h> #include <arpa/inet.h> #include <arpa/nameser.h> @@ -31,7 +32,9 @@ #include <strings.h> #include <unistd.h> +#define LINE_MAX 1024 #include "smtpd-defines.h" +#include "smtpd-api.h" #include "unpack_dns.h" #include "parser.h" @@ -49,6 +52,8 @@ int ip_v4 = 0; int ip_v6 = 0; int ip_both = 1; +struct dict seen; + int spfwalk(int argc, struct parameter *argv) { @@ -74,6 +79,7 @@ spfwalk(int argc, struct parameter *argv) argv += optind; argc -= optind; + dict_init(&seen); event_init(); while ((linelen = getline(&line, &linesize, stdin)) != -1) { @@ -158,6 +164,9 @@ dispatch_txt(struct dns_rr *rr) if (*end == '.') *end = '\0'; + if (dict_set(&seen, *ap, &seen)) + continue; + if (strncasecmp("ip4:", *ap, 4) == 0) { if (ip_v4 == 1 || ip_both == 1) printf("%s\n", *(ap) + 4); |