+4888. [test] Initialize sockets correctly in sample-update so
+ that nsupdate system test will will run on Windows.
+ [RT #47097]
+
4885. [security] update-policy rules that otherwise ignore the name
field now require that it be set to "." to ensure
that any type list present is properly interpreted.
exit(1);
}
+#ifdef _WIN32
+static void
+InitSockets(void) {
+ WORD wVersionRequested;
+ WSADATA wsaData;
+ int err;
+
+ wVersionRequested = MAKEWORD(2, 0);
+
+ err = WSAStartup(wVersionRequested, &wsaData);
+ if (err != 0) {
+ fprintf(stderr, "WSAStartup() failed: %d\n", err);
+ exit(1);
+ }
+}
+
+static void
+DestroySockets(void) {
+ WSACleanup();
+}
+#else
+#define InitSockets() ((void)0)
+#define DestroySockets() ((void)0)
+#endif
+
static isc_boolean_t
addserver(const char *server, isc_sockaddrlist_t *list,
isc_sockaddr_t *sockaddr)
#ifdef AI_NUMERICSERV
hints.ai_flags |= AI_NUMERICSERV;
#endif
+ InitSockets();
gaierror = getaddrinfo(server, port, &hints, &res);
if (gaierror != 0) {
fprintf(stderr, "getaddrinfo(%s) failed: %s\n",
server, gai_strerror(gaierror));
+ DestroySockets();
return (ISC_FALSE);
}
INSIST(res->ai_addrlen <= sizeof(sockaddr->type));
ISC_LINK_INIT(sockaddr, link);
ISC_LIST_APPEND(*list, sockaddr, link);
freeaddrinfo(res);
+ DestroySockets();
return (ISC_TRUE);
}
exit(1);
}
/*
- * The following APIs do not exist as functions in a library, but we must
- * ask winsock for them. They are "extensions" -- but why they cannot be
- * actual functions is beyond me. So, ask winsock for the pointers to the
- * functions we need.
+ * The following APIs do not exist as functions in a library, but
+ * we must ask winsock for them. They are "extensions" -- but why
+ * they cannot be actual functions is beyond me. So, ask winsock
+ * for the pointers to the functions we need.
*/
sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
INSIST(sock != INVALID_SOCKET);