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-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 (+88 lines)
Line 0 Link Here
1
--- misc.cc.orig	2020-05-08 09:31:59 UTC
2
+++ misc.cc
3
@@ -57,6 +57,7 @@
4
 #include <sys/types.h>
5
 #include <pwd.h>
6
 #include <grp.h>
7
+#include <limits.h>
8
 #ifdef __FreeBSD__
9
 #  include <pthread_np.h>
10
 #endif
11
@@ -1562,4 +1563,40 @@ bool setPipeBufferSize(int fd, size_t size)
12
   errno = ENOSYS;
13
   return false;
14
 #endif /* F_SETPIPE_SZ */
15
+}
16
+
17
+static size_t getMaxHostNameSize()
18
+{
19
+#if defined(HOST_NAME_MAX)
20
+  return HOST_NAME_MAX;
21
+#endif
22
+
23
+#if defined(_SC_HOST_NAME_MAX)
24
+  auto tmp = sysconf(_SC_HOST_NAME_MAX);
25
+  if (tmp != -1) {
26
+    return tmp;
27
+  }
28
+#endif
29
+
30
+  /* _POSIX_HOST_NAME_MAX */
31
+  return 255;
32
+}
33
+
34
+std::string getCarbonHostName()
35
+{
36
+  std::string hostname;
37
+  hostname.resize(getMaxHostNameSize() + 1, 0);
38
+
39
+  if (gethostname(const_cast<char*>(hostname.c_str()), hostname.size()) != 0) {
40
+    throw std::runtime_error(stringerror());
41
+  }
42
+
43
+  auto pos = hostname.find(".");
44
+  if (pos != std::string::npos) {
45
+    hostname.resize(pos);
46
+  }
47
+
48
+  boost::replace_all(hostname, ".", "_");
49
+
50
+  return hostname;
51
 }
52
--- misc.hh.orig	2020-05-08 09:31:59 UTC
53
+++ misc.hh
54
@@ -604,6 +604,8 @@ gid_t strToGID(const string &str);
55
 unsigned int pdns_stou(const std::string& str, size_t * idx = 0, int base = 10);
56
 
57
 bool isSettingThreadCPUAffinitySupported();
58
+
59
+std::string getCarbonHostName();
60
 int mapThreadToCPUList(pthread_t tid, const std::set<int>& cpus);
61
 
62
 std::vector<ComboAddress> getResolvers(const std::string& resolvConfPath);
63
--- rec-carbon.cc.orig	2020-05-08 09:31:59 UTC
64
+++ rec-carbon.cc
65
@@ -32,17 +32,13 @@ try
66
   if(namespace_name.empty()) {
67
     namespace_name="pdns";
68
   }
69
-  if(hostname.empty()) {
70
-    char tmp[HOST_NAME_MAX+1];
71
-    memset(tmp, 0, sizeof(tmp));
72
-    if (gethostname(tmp, sizeof(tmp)) != 0) {
73
-      throw std::runtime_error("The 'carbon-ourname' setting has not been set and we are unable to determine the system's hostname: " + stringerror());
74
+  if (hostname.empty()) {
75
+    try {
76
+      hostname = getCarbonHostName();
77
     }
78
-    char *p = strchr(tmp, '.');
79
-    if(p) *p=0;
80
-
81
-    hostname=tmp;
82
-    boost::replace_all(hostname, ".", "_");    
83
+    catch(const std::exception& e) {
84
+      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());
85
+    }
86
   }
87
   if(instance_name.empty()) {
88
     instance_name="recursor";

Return to bug 246655