From 5cd283d55141786af59ee67751f60b045c13662b Mon Sep 17 00:00:00 2001 From: Gilles Chehade Date: Sun, 11 Aug 2019 16:51:01 +0000 Subject: teach builtin filter rdns how to match a session that has or lacks rdns --- usr.sbin/smtpd/lka_filter.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/usr.sbin/smtpd/lka_filter.c b/usr.sbin/smtpd/lka_filter.c index 85fa0d8e25e..cab3b936bbd 100644 --- a/usr.sbin/smtpd/lka_filter.c +++ b/usr.sbin/smtpd/lka_filter.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lka_filter.c,v 1.38 2019/07/01 07:40:43 martijn Exp $ */ +/* $OpenBSD: lka_filter.c,v 1.39 2019/08/11 16:51:00 gilles Exp $ */ /* * Copyright (c) 2018 Gilles Chehade @@ -966,10 +966,15 @@ filter_check_rdns(struct filter *filter, const char *hostname) if (!filter->config->rdns) return 0; + /* this is a hack until smtp session properly deals with lack of rdns */ + ret = strcmp("", hostname); + if (ret == 0) + return filter->config->not_rdns < 0 ? !ret : ret; + /* if text_to_netaddress succeeds, * we don't have an rDNS so the filter should match */ - ret = text_to_netaddr(&netaddr, hostname); + ret = !text_to_netaddr(&netaddr, hostname); return filter->config->not_rdns < 0 ? !ret : ret; } -- cgit v1.2.3