aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authordanfe <danfe@FreeBSD.org>2018-04-10 18:58:20 +0800
committerdanfe <danfe@FreeBSD.org>2018-04-10 18:58:20 +0800
commite310a958f85c1930168ce5c6fa476cd33cf05e48 (patch)
tree312761a68df42c2227696e7c2a938f379b52a146 /mail
parent30e4eb7e3c3ccfd9528c5e22b13c31acacc63c3d (diff)
downloadfreebsd-ports-gnome-e310a958f85c1930168ce5c6fa476cd33cf05e48.tar.gz
freebsd-ports-gnome-e310a958f85c1930168ce5c6fa476cd33cf05e48.tar.zst
freebsd-ports-gnome-e310a958f85c1930168ce5c6fa476cd33cf05e48.zip
Fix dns_resolve_ipstr(), by selecting `rrtype' depending on the domain in
question. This should produce the same results as it was in the previous res_query() implementation, which queried for T_ANY and selected the first RR type returned. Requested by: maintainer
Diffstat (limited to 'mail')
-rw-r--r--mail/mailfromd/Makefile1
-rw-r--r--mail/mailfromd/files/patch-lib_dns.c55
2 files changed, 56 insertions, 0 deletions
diff --git a/mail/mailfromd/Makefile b/mail/mailfromd/Makefile
index 85bfb90ac38b..4d2e990f5002 100644
--- a/mail/mailfromd/Makefile
+++ b/mail/mailfromd/Makefile
@@ -3,6 +3,7 @@
PORTNAME= mailfromd
PORTVERSION= 8.4
+PORTREVISION= 1
CATEGORIES= mail
MASTER_SITES= http://download.gnu.org.ua/pub/release/${PORTNAME}/ \
http://download.gnu.org.ua/pub/alpha/${PORTNAME}/
diff --git a/mail/mailfromd/files/patch-lib_dns.c b/mail/mailfromd/files/patch-lib_dns.c
new file mode 100644
index 000000000000..ddf5d0644c89
--- /dev/null
+++ b/mail/mailfromd/files/patch-lib_dns.c
@@ -0,0 +1,55 @@
+From 2d91db836a95a66c7b9ad1acb9dd0ebf93fb4f44 Mon Sep 17 00:00:00 2001
+From: Sergey Poznyakoff <gray@gnu.org>
+Date: Fri, 23 Mar 2018 11:00:37 +0000
+Subject: Fix dns_resolve_ipstr
+
+* lib/dns.c (dns_resolve_ipstr): Select rrtype depending on the
+domain in question. This should produce the same results as it was
+in the previous res_query implementation, which queried for T_ANY
+and selected the first RR type returned.
+
+--- lib/dns.c.orig 2017-11-03 05:06:35 UTC
++++ lib/dns.c
+@@ -438,27 +438,35 @@ dns_resolve_ipstr(const char *ipstr, const char *domai
+ int rc;
+ adns_answer *ans;
+ char *name;
+-
+- if (!dns_str_is_ipv4(ipstr))
+- return dns_failure;
+- if (!domain) {
++ adns_rrtype type;
++
++ if (!domain || strcasecmp(domain, "in-addr.arpa") == 0) {
+ IPBUF ipbuf;
++ if (!dns_str_is_ipv4(ipstr))
++ return dns_failure;
+ if (dns_reverse_ipstr(ipstr, ipbuf))
+ return dns_failure;
+ mu_asprintf(&name, "%s.in-addr.arpa", ipbuf);
++ type = adns_r_ptr_raw;
+ } else {
+ mu_asprintf(&name, "%s.%s", ipstr, domain);
++ type = adns_r_a;
+ }
+
+- rc = adns_synchronous(get_state(), name, adns_r_ptr_raw,
++ rc = adns_synchronous(get_state(), name, type,
+ DEFAULT_QFLAGS,
+ &ans);
+ free(name);
+ if (rc)
+ return errno_to_dns_status(rc);
+ status = adns_to_dns_status(ans->status);
+- if (status == dns_success)
+- *hbuf = mu_strdup(ans->rrs.str[0]);
++ if (status == dns_success) {
++ if (ans->type == adns_r_ptr_raw) {
++ *hbuf = mu_strdup(ans->rrs.str[0]);
++ } else {
++ *hbuf = mu_strdup(inet_ntoa(ans->rrs.inaddr[0]));
++ }
++ }
+ free(ans);
+ return status;
+ }