Bug#752678: pdns: FTBFS on hurd-i386
Source: pdns
Version: 3.3.1-4
Severity: important
Tags: patch
User: debian-hurd@lists.debian.org
Usertags: hurd
Hi,
pdns fails to build from source on GNU/Hurd due to two
reasons:
1) pdns/arguments.cc: PATH_MAX is not defined on GNU/Hurd. Replace that
construct with the usage of the *.length() method of
params["include-dir"] together with strlen() (and allocating space for /
and the string terminating \0).
2) pdns/nameserver.c: IPV6_RECVPKTINFO is not defined on GNU/Hurd, use
IPV6_RXINFO instead.
The attached patch fixes these problems.
Thanks!
Index: pdns-3.3.1/pdns/arguments.cc
===================================================================
--- pdns-3.3.1.orig/pdns/arguments.cc
+++ pdns-3.3.1/pdns/arguments.cc
@@ -459,7 +459,8 @@ bool ArgvMap::file(const char *fname, bo
struct stat st;
DIR *dir;
struct dirent *ent;
- char namebuf[PATH_MAX] = {0};
+ char *namebuf = NULL;
+ int len;
// stat
if (stat(params["include-dir"].c_str(), &st)) {
@@ -483,7 +484,9 @@ bool ArgvMap::file(const char *fname, bo
if (ent->d_name[0] == '.') continue; // skip any dots
if (boost::ends_with(ent->d_name, ".conf")) {
// ensure it's readable file
- snprintf(namebuf, sizeof namebuf, "%s/%s", params["include-dir"].c_str(), ent->d_name);
+ len = params["include-dir"].length() + 1 + strlen(ent->d_name) + 1;
+ namebuf = (char*)malloc(len);
+ snprintf(namebuf, len, "%s/%s", params["include-dir"].c_str(), ent->d_name);
if (stat(namebuf, &st) || !S_ISREG(st.st_mode)) {
L << Logger::Error << namebuf << " is not a file" << std::endl;
throw ArgException(std::string(namebuf) + " does not exist!");
@@ -497,6 +500,7 @@ bool ArgvMap::file(const char *fname, bo
L << Logger::Error << namebuf << " could not be parsed" << std::endl;
throw ArgException(fn + " could not be parsed");
}
+ free(namebuf);
}
}
Index: pdns-3.3.1/pdns/nameserver.cc
===================================================================
--- pdns-3.3.1.orig/pdns/nameserver.cc
+++ pdns-3.3.1/pdns/nameserver.cc
@@ -213,7 +213,11 @@ void UDPNameserver::bindIPv6()
if(IsAnyAddress(locala)) {
int val=1;
setsockopt(s, IPPROTO_IP, GEN_IP_PKTINFO, &val, sizeof(val)); // linux supports this, so why not - might fail on other systems
+#ifndef IPV6_RECVPKTINFO // IPV6_RXINFO same as IPV6_PKTINFO on GNU/Hurd
+ setsockopt(s, IPPROTO_IPV6, IPV6_RXINFO, &val, sizeof(val));
+#else
setsockopt(s, IPPROTO_IPV6, IPV6_RECVPKTINFO, &val, sizeof(val));
+#endif
setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &val, sizeof(val)); // if this fails, we report an error in tcpreceiver too
}
g_localaddresses.push_back(locala);
Reply to: