summaryrefslogtreecommitdiff
path: root/debian/patches/ntpd-ni-maxhost.patch
blob: 03a6e5abf335fbd30396fe4bf8e99f62be797999 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Compilation fix for systems without MAXHOSTNAMELEN (e.g., Hurd); but the
use of MAXHOSTNAMELEN is incorrect here anyway.  (bug #387665,
http://bugs.ntp.org/978)

Index: ntp-4.2.6.p3+dfsg/ntpd/ntp_intres.c
===================================================================
--- ntp-4.2.6.p3+dfsg.orig/ntpd/ntp_intres.c	2011-06-03 15:26:01.000000000 +0000
+++ ntp-4.2.6.p3+dfsg/ntpd/ntp_intres.c	2011-06-03 15:27:15.000000000 +0000
@@ -186,11 +186,11 @@
 struct ntp_res_t_pkt {		/* Tagged packet: */
 	void *tag;		/* For the caller */
 	u_int32 paddr;		/* IP to look up, or 0 */
-	char name[MAXHOSTNAMELEN]; /* Name to look up (if 1st byte is not 0) */
+        char *name;             /* Name to look up (if 1st byte is not 0) */
 };
 
 struct ntp_res_c_pkt {		/* Control packet: */
-	char name[MAXHOSTNAMELEN];
+	char *name;
 	u_int32 paddr;
 	int mode;
 	int version;
@@ -583,10 +583,10 @@
 		DPRINTF(2, ("findhostaddr: Resolving <%s>\n",
 			stoa(&entry->peer_store)));
 
-		entry->ce_name = emalloc(MAXHOSTNAMELEN);
+		entry->ce_name = emalloc(NI_MAXHOST);
 		error = getnameinfo((const struct sockaddr *)&entry->peer_store,
 				   SOCKLEN(&entry->peer_store),
-				   (char *)&entry->ce_name, MAXHOSTNAMELEN,
+				   (char *)&entry->ce_name, NI_MAXHOST,
 				   NULL, 0, 0);
 	}