summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Denker <jsd@av8n.com>2012-11-24 17:28:10 (GMT)
committerJohn Denker <jsd@av8n.com>2012-11-24 17:28:10 (GMT)
commit348bd85500f5cb5dc4b239e98d9459dbe71f96bc (patch)
tree02ea9d6f2d156e094323e614542cd250006102a0
parent74578b918ceac9aad470f89d3320a375c0c900e8 (diff)
make rare DNS errors non-fatal
-rw-r--r--tools/greylist.c14
-rw-r--r--tools/libltgrey.c14
-rw-r--r--tools/sepofra.c3
3 files changed, 22 insertions, 9 deletions
diff --git a/tools/greylist.c b/tools/greylist.c
index 9af70eb..aaa9510 100644
--- a/tools/greylist.c
+++ b/tools/greylist.c
@@ -413,7 +413,7 @@ int whatsit::check_dns(){
int sts = check_dns_sub(addr, host, checked);
if (sts == 0) return sts;
if (sts != ex_badDNS) return sts; // possible ex_syserr
-#if 1
+#ifndef badDNSfatal
sts = 0; // demote badDNS to just a warning
#endif
cerr << progid;
@@ -431,6 +431,11 @@ int whatsit::check_dns(){
int whatsit::check_dns_sub(string &addr, string &host, vector<string> &checked){
+#ifdef badDNSfatal
+ int ex_dns_fail = ex_syserr;
+#else
+ int ex_dns_fail = ex_badDNS;
+#endif
struct addrinfo *result;
struct addrinfo *ipresult;
struct addrinfo *res;
@@ -450,11 +455,12 @@ int whatsit::check_dns_sub(string &addr, string &host, vector<string> &checked){
<< " odd error " << error
<< " in getaddrinfo for " << ipvar
<< " : " << gai_strerror(error) << endl;
- return ex_syserr;
+
+ return ex_dns_fail;
}
if (!ipresult) {
cerr << "should never happen (addr with no addrs?)" << endl;
- return ex_syserr;
+ return ex_dns_fail;
}
VUx ipAddr = parse_sockaddr(ipresult->ai_addr);
addr = ipAddr.str();
@@ -471,7 +477,7 @@ int whatsit::check_dns_sub(string &addr, string &host, vector<string> &checked){
<< " compare " << EAI_NONAME
<< " in getaddrinfo for " << ipvar
<< " :: " << gai_strerror(error) << endl;
- return ex_syserr;
+ return ex_dns_fail;
}
// loop over all returned results and check for a match.
diff --git a/tools/libltgrey.c b/tools/libltgrey.c
index 827dcee..eb6d904 100644
--- a/tools/libltgrey.c
+++ b/tools/libltgrey.c
@@ -217,7 +217,7 @@ int whatsit::check_dns(const char* ipvar, const char* namevar){
vector<string> checked;
int rslt = check_dns_sub(ipvar, namevar, addr, host, checked);
int sts = rslt;
-#if 1
+#ifndef badDNSfatal
sts = 0; // demote badDNS to just a warning
#endif
if (rslt || verbosity) {
@@ -238,6 +238,12 @@ int whatsit::check_dns(const char* ipvar, const char* namevar){
int whatsit::check_dns_sub(const char* ipvar, const char* namevar,
string &addr, string &host, vector<string> &checked){
+#ifdef badDNSfatal
+ int ex_dns_fail = ex_syserr;
+#else
+ int ex_dns_fail = ex_badDNS;
+#endif
+
struct addrinfo *result;
struct addrinfo *ipresult;
struct addrinfo *res;
@@ -259,11 +265,11 @@ int whatsit::check_dns_sub(const char* ipvar, const char* namevar,
<< " odd error " << error
<< " in getaddrinfo for " << ipvar
<< " : " << gai_strerror(error) << endl;
- return ex_syserr;
+ return ex_dns_fail;
}
if (!ipresult) {
cerr << "should never happen (addr with no addrs?)" << endl;
- return ex_syserr;
+ return ex_dns_fail;
}
// reconvert from bits to string + family info
@@ -304,7 +310,7 @@ int whatsit::check_dns_sub(const char* ipvar, const char* namevar,
<< " compare " << EAI_NONAME
<< " in getaddrinfo for " << ipvar
<< " :: " << gai_strerror(error) << endl;
- return ex_syserr;
+ return ex_dns_fail;
}
// loop over all returned results and check for a match.
diff --git a/tools/sepofra.c b/tools/sepofra.c
index 69575c4..56d02a9 100644
--- a/tools/sepofra.c
+++ b/tools/sepofra.c
@@ -91,7 +91,8 @@ void sepofra::check(
break;
}
- if ( SPF_request_set_ipv4_str( spf_request, opt_ip.c_str() ) ) {
+ if ( SPF_request_set_ipv4_str( spf_request, opt_ip.c_str() )
+ && SPF_request_set_ipv6_str( spf_request, opt_ip.c_str() ) ) {
cerr << "Invalid IP address: " << opt_ip << endl;
break;
}