On Sat, Feb 01, 2014 at 01:17:21AM +0100, IMAP List Administration wrote:
> Hello Folks,
>
> I run a Postfix MTA on OpenBSD. Recently I migrated the server from OBSD v5.3
> to v5.4. Soon afterwards I noticed postfix was falsely rejecting mails based
> on
> a FCrDNS (forward-confirmed reverse DNS) test. FCrDNS means the DNS
> configuration of a connecting client is tested for forward and reverse DNS
> consistency.
>
> I first suspected a change in Postfix, but the developer (Wietse Venema) ruled
> out any changes to this Postfix functionality.
>
> Further investigation shows that gethostbyaddr() behaves differently on OBSD
> 5.3
> and 5.4.
>
> The problem seems to manifest itself when the DNS configuration of a client is
> "non-trivial", e.g., when there are multiple PTR records, or when there is a
> CNAME record which must be resolved before a PTR lookup can be performed.
>
> I tested using a slightly modified Postfix utility ("gethostbyaddr.c") which I
> attach below.
>
> On OBSD 5.4 this program returns correct results for "trivial" DNS client
> configurations, but "host <address> not found" for "non-trivial" ones.
>
> On OBSD 5.3 the program returns correct results in all cases.
>
> As far as I can tell, the two OBSD systems are configured identically. For
> example, /etc/resolv.conf has the same lookup order ("lookup file bind"), and
> the same nameserver.
>
> DNS tools such as "host", "dig", or Net::DNS return correct results.
>
> Here are some examples of IP-addresses that illustrate the problem:
>
> 195.234.50.30
> 72.26.200.202
> 96.47.67.46
> 173.231.138.204
>
> To summarize, gethostbyaddr() on OBSD 5.4 does not seem to be behaving
> properly
> and not as it did on 5.3.
>
> Can anyone confirm this?
>
> cheers,
>
> Rob Urban
Hi,
Thanks for your report.
The following diff fixes the problems with the example IPs you gave us.
- subsequent PTR records are now set as aliases in the hostent
- need to accept '/' in dname labels (maybe others?)
Please check if it works for you.
Eric.
Index: asr_utils.c
===================================================================
RCS file: /cvs/src/lib/libc/asr/asr_utils.c,v
retrieving revision 1.9
diff -u -p -u -r1.9 asr_utils.c
--- asr_utils.c 24 Nov 2013 23:51:29 -0000 1.9
+++ asr_utils.c 1 Feb 2014 10:34:23 -0000
@@ -55,7 +55,7 @@ dname_check_label(const char *s, size_t
return (-1);
for (l--; l; l--, s++)
- if (!(isalnum((unsigned char)*s) || *s == '_' || *s == '-'))
+ if (!(isalnum((unsigned char)*s) || *s == '_' || *s == '-' ||
*s == '/'))
return (-1);
return (0);
Index: gethostnamadr_async.c
===================================================================
RCS file: /cvs/src/lib/libc/asr/gethostnamadr_async.c,v
retrieving revision 1.23
diff -u -p -u -r1.23 gethostnamadr_async.c
--- gethostnamadr_async.c 24 Nov 2013 23:51:29 -0000 1.23
+++ gethostnamadr_async.c 1 Feb 2014 10:34:24 -0000
@@ -505,8 +505,7 @@ hostent_from_packet(int reqtype, int fam
if (strcasecmp(rr.rr_dname, dname) != 0)
continue;
if (hostent_set_cname(h, rr.rr.ptr.ptrname, 1) == -1)
- goto fail;
- /* XXX See if we need MULTI_PTRS_ARE_ALIASES */
+ hostent_add_alias(h, rr.rr.ptr.ptrname, 1);
break;
case T_A: