/* if the function 'ioctlsocket' is available */
#undef HAVE_IOCTLSOCKET
+/* Define to 1 if you have the <iphlpapi.h> header file. */
+#undef HAVE_IPHLPAPI_H
+
/* Define to 1 if you have the `kill' function. */
#undef HAVE_KILL
-for ac_header in stdarg.h stdbool.h netinet/in.h sys/param.h sys/socket.h sys/uio.h sys/resource.h arpa/inet.h syslog.h netdb.h sys/wait.h pwd.h glob.h grp.h login_cap.h winsock2.h ws2tcpip.h
+
+for ac_header in stdarg.h stdbool.h netinet/in.h sys/param.h sys/socket.h sys/uio.h sys/resource.h arpa/inet.h syslog.h netdb.h sys/wait.h pwd.h glob.h grp.h login_cap.h winsock2.h ws2tcpip.h iphlpapi.h
do
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
WINDRES="$ac_cv_prog_WINDRES"
fi
+ LIBS="$LIBS -liphlpapi"
fi
if test $ac_cv_func_getaddrinfo = no; then
case " $LIBOBJS " in
ACX_LIBTOOL_C_ONLY
# Checks for header files.
-AC_CHECK_HEADERS([stdarg.h stdbool.h netinet/in.h sys/param.h sys/socket.h sys/uio.h sys/resource.h arpa/inet.h syslog.h netdb.h sys/wait.h pwd.h glob.h grp.h login_cap.h winsock2.h ws2tcpip.h],,, [AC_INCLUDES_DEFAULT])
+AC_CHECK_HEADERS([stdarg.h stdbool.h netinet/in.h sys/param.h sys/socket.h sys/uio.h sys/resource.h arpa/inet.h syslog.h netdb.h sys/wait.h pwd.h glob.h grp.h login_cap.h winsock2.h ws2tcpip.h iphlpapi.h ],,, [AC_INCLUDES_DEFAULT])
# check for types.
# Using own tests for int64* because autoconf builtin only give 32bit.
UB_ON_WINDOWS=yes
AC_SUBST(UB_ON_WINDOWS)
AC_CHECK_TOOL(WINDRES, windres)
+ LIBS="$LIBS -liphlpapi"
fi
if test $ac_cv_func_getaddrinfo = no; then
AC_LIBOBJ([fake-rfc2553])
Zdenek Vasicek and Marek Vavrusa - python module.
cz.nic - sponsoring 'summer of code' development by Zdenek and Marek.
Brett Carr - windows beta testing.
+Luca Bruno - patch for windows support in libunbound hosts and resolvconf().
+3 September 2009: Wouter
+ - Got a patch from Luca Bruno for libunbound support on windows to
+ pick up the system resolvconf nameservers and hosts there.
+
2 September 2009: Wouter
- TRAFFIC keyword for testbound. Simplifies test generation.
${range lower val upper} to check probe timeout values.
If they do not support DNSSEC, validation may fail.
Only nameservers are picked up, the searchdomain, ndots and other
settings from \fIresolv.conf\fR(5) are ignored.
-If fname NULL is passed, "/etc/resolv.conf" is used.
+If fname NULL is passed, "/etc/resolv.conf" is used (if on Windows,
+the system\-wide configured nameserver is picked instead).
At this time it is only possible to set configuration before the
first resolve is done.
.TP
.B ub_ctx_hosts
Read list of hosts from the filename given.
Usually "/etc/hosts". When queried for, these addresses are not marked
-DNSSEC secure. If fname NULL is passed, "/etc/hosts" is used.
+DNSSEC secure. If fname NULL is passed, "/etc/hosts" is used
+(if on Windows, etc/hosts from WINDIR is picked instead).
At this time it is only possible to set configuration before the
first resolve is done.
.TP
#include "services/cache/infra.h"
#include "services/cache/rrset.h"
+#if defined(UB_ON_WINDOWS) && defined (HAVE_WINDOWS_H)
+#include <windows.h>
+#include <iphlpapi.h>
+#endif /* UB_ON_WINDOWS */
+
struct ub_ctx*
ub_ctx_create()
{
char buf[1024];
char* parse, *addr;
int r;
- if(fname == NULL)
+
+ if(fname == NULL) {
+#if !defined(UB_ON_WINDOWS) || !defined(HAVE_WINDOWS_H)
fname = "/etc/resolv.conf";
+#else
+ FIXED_INFO *info;
+ ULONG buflen = sizeof(*info);
+ IP_ADDR_STRING *ptr;
+
+ info = (FIXED_INFO *) malloc(sizeof (FIXED_INFO));
+ if (info == NULL)
+ return UB_READFILE;
+
+ if (GetNetworkParams(info, &buflen) == ERROR_BUFFER_OVERFLOW) {
+ free(info);
+ info = (FIXED_INFO *) malloc(buflen);
+ if (info == NULL)
+ return UB_READFILE;
+ }
+
+ if (GetNetworkParams(info, &buflen) == NO_ERROR) {
+ int retval=0;
+ ptr = &(info->DnsServerList);
+ while (ptr) {
+ numserv++;
+ if((retval=ub_ctx_set_fwd(ctx,
+ ptr->IpAddress.String)!=0)) {
+ free(info);
+ return retval;
+ }
+ ptr = ptr->Next;
+ }
+ free(info);
+ if (numserv==0)
+ return UB_READFILE;
+ return UB_NOERROR;
+ }
+ free(info);
+ return UB_READFILE;
+#endif /* WINDOWS */
+ }
in = fopen(fname, "r");
if(!in) {
/* error in errno! perror(fname) */
return UB_AFTERFINAL;
}
lock_basic_unlock(&ctx->cfglock);
- if(fname == NULL)
+ if(fname == NULL) {
+#if defined(UB_ON_WINDOWS) && defined(HAVE_WINDOWS_H)
+ /*
+ * If this is Windows NT/XP/2K it's in
+ * %WINDIR%\system32\drivers\etc\hosts.
+ * If this is Windows 95/98/Me it's in %WINDIR%\hosts.
+ */
+ name = getenv("WINDIR");
+ if (name != NULL) {
+ int retval=0;
+ snprintf(buf, sizeof(buf), "%s%s", name,
+ "\\system32\\drivers\\etc\\hosts");
+ if((retval=ub_ctx_hosts(ctx, buf)) !=0 ) {
+ snprintf(buf, sizeof(buf), "%s%s", name,
+ "\\hosts");
+ retval=ub_ctx_hosts(ctx, buf);
+ }
+ free(name);
+ return retval;
+ }
+ return UB_READFILE;
+#else
fname = "/etc/hosts";
+#endif /* WIN32 */
+ }
in = fopen(fname, "r");
if(!in) {
/* error in errno! perror(fname) */