summaryrefslogtreecommitdiffstats
path: root/libntp/ntp_rfc2553.c
diff options
context:
space:
mode:
authorroberto <roberto@FreeBSD.org>2013-12-04 21:33:17 +0000
committerroberto <roberto@FreeBSD.org>2013-12-04 21:33:17 +0000
commitd54cfbdce4a9878ef65216dea36b62cf6646b84b (patch)
treea618007bb41d13153794a598e3d904ace2976324 /libntp/ntp_rfc2553.c
parentfd23eea016bd30c806a3ee90eb6f397470c2fa46 (diff)
downloadFreeBSD-src-d54cfbdce4a9878ef65216dea36b62cf6646b84b.zip
FreeBSD-src-d54cfbdce4a9878ef65216dea36b62cf6646b84b.tar.gz
Virgin import of ntpd 4.2.6p5.
When the series of commits is complete, things like https://cert.litnet.lt/en/docs/ntp-distributed-reflection-dos-attacks should be fixed. PR: bin/148836 (except that we import a newer version) Asked by: Too many MFC after: 2 weeks
Diffstat (limited to 'libntp/ntp_rfc2553.c')
-rw-r--r--libntp/ntp_rfc2553.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/libntp/ntp_rfc2553.c b/libntp/ntp_rfc2553.c
index 017ef83..03af593 100644
--- a/libntp/ntp_rfc2553.c
+++ b/libntp/ntp_rfc2553.c
@@ -69,7 +69,9 @@
#include <sys/types.h>
#include <ctype.h>
+#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
+#endif
#include <isc/net.h>
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
@@ -127,8 +129,8 @@ DNSlookup_name(
}
#endif
-static int do_nodename P((const char *nodename, struct addrinfo *ai,
- const struct addrinfo *hints));
+static int do_nodename (const char *nodename, struct addrinfo *ai,
+ const struct addrinfo *hints);
int
getaddrinfo (const char *nodename, const char *servname,
@@ -362,7 +364,7 @@ do_nodename(
sockin6->sin6_addr = in6addr_any;
*/
}
-#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR
+#ifdef ISC_PLATFORM_HAVESALEN
ai->ai_addr->sa_len = SOCKLEN(ai->ai_addr);
#endif
@@ -428,15 +430,11 @@ do_nodename(
sockin = (struct sockaddr_in *)ai->ai_addr;
memcpy(&sockin->sin_addr, hp->h_addr, hp->h_length);
ai->ai_addr->sa_family = hp->h_addrtype;
-#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR
+#ifdef ISC_PLATFORM_HAVESALEN
ai->ai_addr->sa_len = sizeof(struct sockaddr);
#endif
- if (hints != NULL && hints->ai_flags & AI_CANONNAME) {
- ai->ai_canonname = malloc(strlen(hp->h_name) + 1);
- if (ai->ai_canonname == NULL)
- return (EAI_MEMORY);
- strcpy(ai->ai_canonname, hp->h_name);
- }
+ if (hints != NULL && hints->ai_flags & AI_CANONNAME)
+ ai->ai_canonname = estrdup(hp->h_name);
return (0);
}
OpenPOWER on IntegriCloud