During the exp-run in bug 208158, it was found that dns/powerdns gives

errors with libc++ 3.8.0:

dnspacket.cc:645:6: error: call to 'abs' is ambiguous
  if(abs(trc->d_time - now) > trc->d_fudge) {
     ^~~

This is because abs() is being called with unsigned arguments.  Import
upstream commit f2d05dd to fix it.

Approved by:	tremere@cainites.net
PR:		208725
MFH:		2016Q2
This commit is contained in:
Dimitry Andric 2016-04-26 18:18:15 +00:00
parent 1473042fcf
commit 4f32016ea7
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=414065

View file

@ -0,0 +1,15 @@
--- pdns/dnspacket.cc.orig 2015-11-02 10:33:21 UTC
+++ pdns/dnspacket.cc
@@ -641,9 +641,9 @@ bool checkForCorrectTSIG(const DNSPacket
string message;
q->getTSIGDetails(trc, keyname, &message);
- uint64_t now = time(0);
- if(abs(trc->d_time - now) > trc->d_fudge) {
- L<<Logger::Error<<"Packet for '"<<q->qdomain<<"' denied: TSIG (key '"<<*keyname<<"') time delta "<< abs(trc->d_time - now)<<" > 'fudge' "<<trc->d_fudge<<endl;
+ uint64_t delta = std::abs((int64_t)trc->d_time - (int64_t)time(0));
+ if(delta > trc->d_fudge) {
+ L<<Logger::Error<<"Packet for '"<<q->qdomain<<"' denied: TSIG (key '"<<*keyname<<"') time delta "<< delta <<" > 'fudge' "<<trc->d_fudge<<endl;
return false;
}