View | Details | Raw Unified | Return to bug 246655 | Differences between
and this patch

Collapse All | Expand All

(-)Makefile (-1 / +2 lines)
Lines 2-8 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	recursor
4
PORTNAME=	recursor
5
DISTVERSION=	4.3.0
5
DISTVERSION=	4.3.1
6
CATEGORIES=	dns
6
CATEGORIES=	dns
7
MASTER_SITES=	http://downloads.powerdns.com/releases/
7
MASTER_SITES=	http://downloads.powerdns.com/releases/
8
PKGNAMEPREFIX=	powerdns-
8
PKGNAMEPREFIX=	powerdns-
Lines 16-21 Link Here
16
16
17
BROKEN_armv6=	fails to compile: use of overloaded operator << is ambiguous
17
BROKEN_armv6=	fails to compile: use of overloaded operator << is ambiguous
18
BROKEN_armv7=	fails to compile: use of overloaded operator << is ambiguous
18
BROKEN_armv7=	fails to compile: use of overloaded operator << is ambiguous
19
BROKEN_i386=	crashes on startup (SIGSEGV)
19
BROKEN_sparc64=	fails to compile: json11.cpp: undefined reference to std::__throw_out_of_range_fmt
20
BROKEN_sparc64=	fails to compile: json11.cpp: undefined reference to std::__throw_out_of_range_fmt
20
21
21
BUILD_DEPENDS=	${LOCALBASE}/include/boost/shared_ptr.hpp:devel/boost-libs
22
BUILD_DEPENDS=	${LOCALBASE}/include/boost/shared_ptr.hpp:devel/boost-libs
(-)distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1583454090
1
TIMESTAMP = 1589879472
2
SHA256 (pdns-recursor-4.3.0.tar.bz2) = 2bc130f287dfdb32e03d0b38a4ac24baf1117f96eca9b407611c847fa08a628f
2
SHA256 (pdns-recursor-4.3.1.tar.bz2) = 54230852fcad3c6291651069c383f7ea88c5d29ce3c561decb2f40a063f52fd9
3
SIZE (pdns-recursor-4.3.0.tar.bz2) = 1349359
3
SIZE (pdns-recursor-4.3.1.tar.bz2) = 1334817
(-)files/patch-configure (-3 / +3 lines)
Lines 1-6 Link Here
1
--- configure.orig	2020-03-02 07:50:20.000000000 -0500
1
--- configure.orig	2020-05-08 09:56:25 UTC
2
+++ configure	2020-03-02 07:50:20.000000000 -0500
2
+++ configure
3
@@ -21139,8 +21139,10 @@
3
@@ -21467,8 +21467,10 @@ fi
4
             { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openssl/crypto.h in $ssldir" >&5
4
             { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openssl/crypto.h in $ssldir" >&5
5
 $as_echo_n "checking for openssl/crypto.h in $ssldir... " >&6; }
5
 $as_echo_n "checking for openssl/crypto.h in $ssldir... " >&6; }
6
             if test -f "$ssldir/include/openssl/crypto.h"; then
6
             if test -f "$ssldir/include/openssl/crypto.h"; then
(-)files/patch-dns_random.cc (-12 lines)
Lines 1-12 Link Here
1
--- dns_random.cc.orig	2018-11-29 12:53:42 UTC
2
+++ dns_random.cc
3
@@ -40,7 +40,9 @@
4
 #include <openssl/rand.h>
5
 #endif
6
 #if defined(HAVE_GETRANDOM)
7
+extern "C" {
8
 #include <sys/random.h>
9
+}
10
 #endif
11
 
12
 static enum DNS_RNG {
(-)files/patch-dnsname.hh (-3 / +3 lines)
Lines 1-5 Link Here
1
--- dnsname.hh.orig	2020-03-02 07:49:54.000000000 -0500
1
--- dnsname.hh.orig	2020-05-08 09:31:59 UTC
2
+++ dnsname.hh	2020-03-02 07:49:54.000000000 -0500
2
+++ dnsname.hh
3
@@ -33,7 +33,7 @@
3
@@ -33,7 +33,7 @@
4
 #include <boost/version.hpp>
4
 #include <boost/version.hpp>
5
 
5
 
Lines 9-15 Link Here
9
 #include <boost/container/string.hpp>
9
 #include <boost/container/string.hpp>
10
 #endif
10
 #endif
11
 
11
 
12
@@ -138,7 +138,7 @@
12
@@ -138,7 +138,7 @@ class DNSName (public)
13
   inline bool canonCompare(const DNSName& rhs) const;
13
   inline bool canonCompare(const DNSName& rhs) const;
14
   bool slowCanonCompare(const DNSName& rhs) const;  
14
   bool slowCanonCompare(const DNSName& rhs) const;  
15
 
15
 
(-)files/patch-hostnamemax (+90 lines)
Line 0 Link Here
1
diff --git misc.cc misc.cc
2
index f9248af42a..5cb4dbe812 100644
3
--- misc.cc
4
+++ misc.cc
5
@@ -57,6 +57,7 @@
6
 #include <sys/types.h>
7
 #include <pwd.h>
8
 #include <grp.h>
9
+#include <limits.h>
10
 #ifdef __FreeBSD__
11
 #  include <pthread_np.h>
12
 #endif
13
@@ -1563,3 +1564,39 @@ bool setPipeBufferSize(int fd, size_t size)
14
   return false;
15
 #endif /* F_SETPIPE_SZ */
16
 }
17
+
18
+static size_t getMaxHostNameSize()
19
+{
20
+#if defined(HOST_NAME_MAX)
21
+  return HOST_NAME_MAX;
22
+#endif
23
+
24
+#if defined(_SC_HOST_NAME_MAX)
25
+  auto tmp = sysconf(_SC_HOST_NAME_MAX);
26
+  if (tmp != -1) {
27
+    return tmp;
28
+  }
29
+#endif
30
+
31
+  /* _POSIX_HOST_NAME_MAX */
32
+  return 255;
33
+}
34
+
35
+std::string getCarbonHostName()
36
+{
37
+  std::string hostname;
38
+  hostname.resize(getMaxHostNameSize() + 1, 0);
39
+
40
+  if (gethostname(const_cast<char*>(hostname.c_str()), hostname.size()) != 0) {
41
+    throw std::runtime_error(stringerror());
42
+  }
43
+
44
+  auto pos = hostname.find(".");
45
+  if (pos != std::string::npos) {
46
+    hostname.resize(pos);
47
+  }
48
+
49
+  boost::replace_all(hostname, ".", "_");
50
+
51
+  return hostname;
52
+}
53
diff --git misc.hh misc.hh
54
index 4bd9439a87..795e8ec855 100644
55
--- misc.hh
56
+++ misc.hh
57
@@ -607,3 +607,5 @@ bool isSettingThreadCPUAffinitySupported();
58
 int mapThreadToCPUList(pthread_t tid, const std::set<int>& cpus);
59
 
60
 std::vector<ComboAddress> getResolvers(const std::string& resolvConfPath);
61
+
62
+std::string getCarbonHostName();
63
diff --git rec-carbon.cc rec-carbon.cc
64
index 4e0cedb00f..458a25d5ca 100644
65
--- rec-carbon.cc
66
+++ rec-carbon.cc
67
@@ -32,17 +32,13 @@ try
68
   if(namespace_name.empty()) {
69
     namespace_name="pdns";
70
   }
71
-  if(hostname.empty()) {
72
-    char tmp[HOST_NAME_MAX+1];
73
-    memset(tmp, 0, sizeof(tmp));
74
-    if (gethostname(tmp, sizeof(tmp)) != 0) {
75
-      throw std::runtime_error("The 'carbon-ourname' setting has not been set and we are unable to determine the system's hostname: " + stringerror());
76
+  if (hostname.empty()) {
77
+    try {
78
+      hostname = getCarbonHostName();
79
+    }
80
+    catch(const std::exception& e) {
81
+      throw std::runtime_error(std::string("The 'carbon-ourname' setting has not been set and we are unable to determine the system's hostname: ") + e.what());
82
     }
83
-    char *p = strchr(tmp, '.');
84
-    if(p) *p=0;
85
-
86
-    hostname=tmp;
87
-    boost::replace_all(hostname, ".", "_");    
88
   }
89
   if(instance_name.empty()) {
90
     instance_name="recursor";
(-)files/patch-pdns_recursor.cc (-3 / +3 lines)
Lines 1-6 Link Here
1
--- pdns_recursor.cc.orig	2020-03-02 07:49:54.000000000 -0500
1
--- pdns_recursor.cc.orig	2020-05-08 09:31:59 UTC
2
+++ pdns_recursor.cc	2020-03-02 07:49:54.000000000 -0500
2
+++ pdns_recursor.cc
3
@@ -4639,12 +4639,12 @@
3
@@ -4640,12 +4640,12 @@ int main(int argc, char **argv)
4
 #define SYSTEMD_SETID_MSG ". When running inside systemd, use the User and Group settings in the unit-file!"
4
 #define SYSTEMD_SETID_MSG ". When running inside systemd, use the User and Group settings in the unit-file!"
5
         SYSTEMD_SETID_MSG
5
         SYSTEMD_SETID_MSG
6
 #endif
6
 #endif

Return to bug 246655