summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/exim_monitor/em_hdr.h9
-rw-r--r--src/src/dns.c6
-rw-r--r--src/src/exim.h12
-rw-r--r--src/src/structs.h5
4 files changed, 13 insertions, 19 deletions
diff --git a/src/exim_monitor/em_hdr.h b/src/exim_monitor/em_hdr.h
index 67294368a..ada9f36b4 100644
--- a/src/exim_monitor/em_hdr.h
+++ b/src/exim_monitor/em_hdr.h
@@ -87,11 +87,12 @@ anything. */
#include <pcre.h>
-/* Includes from the main source of Exim. We need to have MAXPACKET defined for
-the benefit of structs.h. One of these days I should tidy up this interface so
-that this kind of kludge isn't needed. */
+/* Includes from the main source of Exim. One of these days I should tidy up
+this interface so that this kind of kludge isn't needed. */
-#define MAXPACKET 1024
+#ifndef NS_MAXMSG
+# define NS_MAXMSG 65535
+#endif
typedef void hctx;
#include "config.h"
diff --git a/src/src/dns.c b/src/src/dns.c
index 297b8b88d..0f0b435de 100644
--- a/src/src/dns.c
+++ b/src/src/dns.c
@@ -639,6 +639,10 @@ up nameservers that produce this error continually, so there is the option of
providing a list of domains for which this is treated as a non-existent
host.
+The dns_answer structure is pretty big; enough to hold a max-sized DNS message
+- so best allocated from fast-release memory. As of writing, all our callers
+use a stack-auto variable.
+
Arguments:
dnsa pointer to dns_answer structure
name name to look up
@@ -1101,7 +1105,7 @@ switch (type)
&& (h->rcode == NOERROR || h->rcode == NXDOMAIN)
&& ntohs(h->qdcount) == 1 && ntohs(h->ancount) == 0
&& ntohs(h->nscount) >= 1)
- dnsa->answerlen = MAXPACKET;
+ dnsa->answerlen = sizeof(dnsa->answer);
for (rr = dns_next_rr(dnsa, &dnss, RESET_AUTHORITY);
rr; rr = dns_next_rr(dnsa, &dnss, RESET_NEXT)
diff --git a/src/src/exim.h b/src/src/exim.h
index 0de0595b1..ca6221ffd 100644
--- a/src/src/exim.h
+++ b/src/src/exim.h
@@ -284,18 +284,6 @@ disabused of the notion. Luckily, since EX_OK is not used, it didn't matter.] */
#include <arpa/nameser.h>
-/* If arpa/nameser.h defines a maximum name server packet size, use it,
-provided it is greater than 2048. Otherwise go for a default. PACKETSZ was used
-for this, but it seems that NS_PACKETSZ is coming into use. */
-
-#if defined(NS_PACKETSZ) && NS_PACKETSZ >= 2048
- #define MAXPACKET NS_PACKETSZ
-#elif defined(PACKETSZ) && PACKETSZ >= 2048
- #define MAXPACKET PACKETSZ
-#else
- #define MAXPACKET 2048
-#endif
-
/* While IPv6 is still young the definitions of T_AAAA and T_A6 may not be
included in arpa/nameser.h. Fudge them here. */
diff --git a/src/src/structs.h b/src/src/structs.h
index 1ac455ca5..48f475a89 100644
--- a/src/src/structs.h
+++ b/src/src/structs.h
@@ -743,11 +743,12 @@ typedef struct {
const uschar *data; /* pointer to data */
} dns_record;
-/* Structure for holding the result of a DNS query. */
+/* Structure for holding the result of a DNS query. A touch over
+64k big, so take care to release as soon as possible. */
typedef struct {
int answerlen; /* length of the answer */
- uschar answer[MAXPACKET]; /* the answer itself */
+ uschar answer[NS_MAXMSG]; /* the answer itself */
} dns_answer;
/* Structure for holding the intermediate data while scanning a DNS answer