diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2019-08-11 16:51:01 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2019-08-11 16:51:01 +0000 |
commit | 5cd283d55141786af59ee67751f60b045c13662b (patch) | |
tree | 4210f1b01a4195e23f3d8771d5e6504d39385c6a | |
parent | 6947672abf24b66362ef84dd50a6f5792c08f495 (diff) |
teach builtin filter rdns how to match a session that has or lacks rdns
-rw-r--r-- | usr.sbin/smtpd/lka_filter.c | 9 |
1 files 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 <gilles@poolp.org> @@ -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("<unknown>", 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; } |