net-dns/djbdns: fix build with -Werror=implicit-function-declaration

The ipv6 patch contains fixes for most of these, so this consists of:

  1. Adding includes to a bunch of files when USE=ipv6 is not set.
  2. Adding an include to our new configurable TRUNCATELEN patches.

Closes: https://bugs.gentoo.org/926050
Signed-off-by: Michael Orlitzky <mjo@gentoo.org>
This commit is contained in:
Michael Orlitzky
2024-03-04 10:37:19 -05:00
parent ed33d5beb5
commit 755301799f
4 changed files with 109 additions and 26 deletions

View File

@@ -59,6 +59,7 @@ src_prepare() {
)
else
PATCHES=(${PATCHES[@]}
"${FILESDIR}/implicit-declarations-nov6.patch"
# Fix CVE2008-4392 (no ipv6)
"${FILESDIR}/CVE2008-4392_0001-dnscache-merge-similar-outgoing-queries-r1.patch"
"${FILESDIR}/CVE2008-4392_0002-dnscache-cache-soa-records.patch"

View File

@@ -1,22 +1,8 @@
From: Jaco Kroon <jaco@uls.co.za>
Date: Tue, 24 Oct 2023 06:36:10 +0200
Subject: [PATCH] dnscache: Enable larger truncation
This variation conflicts with the IPv6 patch.
This is a workaround for https://forum.mikrotik.com/viewtopic.php?t=200627
where Mikrotik doesn't fall back if the UDP response is truncated.
This is done by enabling larger (configurable) than 512 byte responses on UDP
such that Mikrotik doesn't have a need to revert to TCP. Since it's impossible
to truly know the maximum size of a DNS response trivially this is made
configurable and the upper limit is arbitrarily capped to 16KB.
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
diff -bru djbdns-1.05.o/dnscache.c djbdns-1.05/dnscache.c
--- djbdns-1.05.o/dnscache.c 2024-02-23 08:05:00.037623680 +0200
+++ djbdns-1.05/dnscache.c 2024-02-23 08:18:26.320580927 +0200
@@ -52,6 +52,7 @@
diff --git a/dnscache.c b/dnscache.c
index 8c899a3..8b10571 100644
--- a/dnscache.c
+++ b/dnscache.c
@@ -51,6 +51,7 @@ static char myipincoming[4];
static char buf[1024];
uint64 numqueries = 0;
@@ -24,7 +10,7 @@ diff -bru djbdns-1.05.o/dnscache.c djbdns-1.05/dnscache.c
static int udp53;
@@ -77,7 +78,7 @@
@@ -77,7 +78,7 @@ void u_respond(int j)
{
if (!u[j].active) return;
response_id(u[j].id);
@@ -33,7 +19,7 @@ diff -bru djbdns-1.05.o/dnscache.c djbdns-1.05/dnscache.c
socket_send4(udp53,response,response_len,u[j].ip,u[j].port);
log_querydone(&u[j].active,response_len);
u[j].active = 0; --uactive;
@@ -430,6 +431,15 @@
@@ -431,6 +432,15 @@ int main()
if (!cache_init(cachesize))
strerr_die3x(111,FATAL,"not enough memory for cache of size ",x);
@@ -49,10 +35,19 @@ diff -bru djbdns-1.05.o/dnscache.c djbdns-1.05/dnscache.c
if (env_get("HIDETTL"))
response_hidettl();
if (env_get("FORWARDONLY"))
diff -Nbrau djbdns-1.05.o/server.c djbdns-1.05/server.c
--- djbdns-1.05.o/server.c 2001-02-11 23:11:45.000000000 +0200
+++ djbdns-1.05/server.c 2024-02-23 08:19:40.020855813 +0200
@@ -83,6 +83,7 @@
diff --git a/server.c b/server.c
index e486fe1..63ad11c 100644
--- a/server.c
+++ b/server.c
@@ -2,6 +2,7 @@
#include "case.h"
#include "env.h"
#include "buffer.h"
+#include "scan.h"
#include "strerr.h"
#include "ip4.h"
#include "uint16.h"
@@ -83,6 +84,7 @@ int main()
{
char *x;
int udp53;
@@ -60,7 +55,7 @@ diff -Nbrau djbdns-1.05.o/server.c djbdns-1.05/server.c
x = env_get("IP");
if (!x)
@@ -105,11 +106,19 @@
@@ -105,11 +107,19 @@ int main()
buffer_putsflush(buffer_2,starting);

View File

@@ -53,6 +53,14 @@ Only in djbdns-1.05/: .dnscache.c.swp
diff -bru djbdns-1.05.o/server.c djbdns-1.05/server.c
--- djbdns-1.05.o/server.c 2023-10-20 00:34:15.778688116 +0200
+++ djbdns-1.05/server.c 2023-10-20 00:43:31.519954643 +0200
@@ -2,6 +2,7 @@
#include "case.h"
#include "env.h"
#include "buffer.h"
+#include "scan.h"
#include "strerr.h"
#include "ip4.h"
#include "uint16.h"
@@ -94,6 +94,7 @@
int *udp53;
unsigned int off;

View File

@@ -0,0 +1,79 @@
Fix the build with -Werror=implicit-function-declarations
diff --git a/chkshsgr.c b/chkshsgr.c
index 2b942d8..2d4e5f4 100644
--- a/chkshsgr.c
+++ b/chkshsgr.c
@@ -1,3 +1,5 @@
+#include <grp.h>
+#include <unistd.h>
#include "exit.h"
int main()
diff --git a/dnsq.c b/dnsq.c
index 533e6af..fd9fe78 100644
--- a/dnsq.c
+++ b/dnsq.c
@@ -1,3 +1,5 @@
+#include <unistd.h>
+
#include "uint16.h"
#include "strerr.h"
#include "buffer.h"
diff --git a/dnsqr.c b/dnsqr.c
index ff8ea6e..01bfe65 100644
--- a/dnsqr.c
+++ b/dnsqr.c
@@ -1,3 +1,5 @@
+#include <unistd.h>
+
#include "uint16.h"
#include "strerr.h"
#include "buffer.h"
diff --git a/hier.c b/hier.c
index 4aef75b..c7c8766 100644
--- a/hier.c
+++ b/hier.c
@@ -1,5 +1,11 @@
#include "auto_home.h"
+/* implemented in install.c and/or instcheck.c */
+void c(char*, char*, char*, int, int, int);
+void h(char*, int, int, int);
+void d(char*, char*, int, int, int);
+
+
void hier()
{
c("/","etc","dnsroots.global",-1,-1,0644);
diff --git a/prot.c b/prot.c
index 0a8a373..1c56e9c 100644
--- a/prot.c
+++ b/prot.c
@@ -1,3 +1,5 @@
+#include <grp.h>
+#include <unistd.h>
#include "hasshsgr.h"
#include "prot.h"
diff --git a/seek_set.c b/seek_set.c
index d08d4f3..47c61e4 100644
--- a/seek_set.c
+++ b/seek_set.c
@@ -1,4 +1,5 @@
#include <sys/types.h>
+#include <unistd.h>
#include "seek.h"
#define SET 0 /* sigh */
diff --git a/utime.c b/utime.c
index 4b7984f..be6c936 100644
--- a/utime.c
+++ b/utime.c
@@ -1,5 +1,6 @@
#include <sys/types.h>
#include <sys/time.h>
+#include <utime.h>
#include "scan.h"
#include "exit.h"