* Fix building documentation in build directory.
Thanks Michael Tokarev
* Updated the configure script for split openssl directories.
+ * Fix for windows compile; asctime_r compat, search for inet_ntop
+ in ws2_32, avoid double decl of inet_ntop, check for symlink call,
+ include config.h in edns.c, have socket compare use correct
+ signedness, add -u repo option to makewin.sh, fix quoting in
+ makewin.sh and check return value of bind and connect in net.c
+ for failure instead of a socket type.
1.8.3 2022-08-15
* bugfix #183: Assertion failure with OPT record without rdata.
compat/fake-rfc2553.lo compat/fake-rfc2553.o: $(srcdir)/compat/fake-rfc2553.c ldns/config.h ldns/common.h \
$(srcdir)/compat/fake-rfc2553.h
compat/gmtime_r.lo compat/gmtime_r.o: $(srcdir)/compat/gmtime_r.c ldns/config.h
+compat/asctime_r.lo compat/asctime_r.o: $(srcdir)/compat/asctime_r.c ldns/config.h
compat/inet_aton.lo compat/inet_aton.o: $(srcdir)/compat/inet_aton.c ldns/config.h
compat/inet_ntop.lo compat/inet_ntop.o: $(srcdir)/compat/inet_ntop.c ldns/config.h
compat/inet_pton.lo compat/inet_pton.o: $(srcdir)/compat/inet_pton.c ldns/config.h
--- /dev/null
+#ifdef HAVE_CONFIG_H
+#include <ldns/config.h>
+#endif
+
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+
+char *asctime_r(const struct tm *tm, char *buf)
+{
+ /* no thread safety. */
+ char* result = asctime(tm);
+ if(buf && result)
+ strcpy(buf, result);
+ return result;
+}
# modern OS X provides inet_ntop in -lc.
# modern Solaris provides inet_ntop in -lsocket -lnsl.
# older Solaris provides inet_ntop in -lresolv.
+# Windows provides inet_ntop in -lws2_32.
AC_CHECK_FUNC([inet_ntop],
[],
- [AC_SEARCH_LIBS([inet_ntop], [socket c nsl resolv], [ac_cv_func_inet_ntop=yes])
+ [AC_SEARCH_LIBS([inet_ntop], [socket c nsl resolv ws2_32], [ac_cv_func_inet_ntop=yes])
])
# modern Linux provides inet_pton in -lsocket.
# modern OS X provides inet_pton in -lc.
# modern Solaris provides inet_pton in -lsocket -lnsl.
# older Solaris provides inet_pton in -lresolv.
+# Windows provides inet_pton in -lws2_32.
AC_CHECK_FUNC([inet_pton],
[],
- [AC_SEARCH_LIBS([inet_pton], [socket c nsl resolv], [ac_cv_func_inet_pton=yes])
+ [AC_SEARCH_LIBS([inet_pton], [socket c nsl resolv ws2_32], [ac_cv_func_inet_pton=yes])
])
-
AC_ARG_WITH(drill, AC_HELP_STRING([--with-drill],
[Also build drill.]),
[],[with_drill="no"])
;;
esac
-
+if echo "$tmp_LIBS" | grep "ws2_32" >/dev/null; then
+ if echo "$LIBSSL_LIBS" | grep "ws2_32" >/dev/null; then
+ # only need it once.
+ LIBSSL_LIBS=`echo "$LIBSSL_LIBS" | sed -e 's/ -lws2_32//' -e 's/^-lws2_32//'`
+ fi
+fi
AC_SUBST(LIBSSL_CPPFLAGS)
AC_SUBST(LIBSSL_LDFLAGS)
#endif])
ACX_CHECK_SS_FAMILY
+AC_CHECK_DECLS([inet_pton,inet_ntop], [], [], [
+AC_INCLUDES_DEFAULT
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#ifdef HAVE_NETINET_TCP_H
+#include <netinet/tcp.h>
+#endif
+
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
+#endif
+])
+
# AC_FUNC_MALLOC suffers false failures and causes Asan failures.
# AC_FUNC_MALLOC
# AC_FUNC_REALLOC
AC_REPLACE_FUNCS(calloc)
AC_REPLACE_FUNCS(timegm)
AC_REPLACE_FUNCS(gmtime_r)
+AC_REPLACE_FUNCS(asctime_r)
AC_REPLACE_FUNCS(ctime_r)
AC_REPLACE_FUNCS(localtime_r)
AC_REPLACE_FUNCS(isblank)
AC_DEFINE([HAVE_FORK_AVAILABLE], 1, [if fork is available for compile])
], [ AC_MSG_RESULT(no)
])
-AC_CHECK_FUNCS([endprotoent endservent sleep random fcntl strtoul bzero memset b32_ntop b32_pton])
+AC_CHECK_FUNCS([endprotoent endservent sleep random fcntl strtoul bzero memset b32_ntop b32_pton symlink])
if test "x$HAVE_B32_NTOP" = "xyes"; then
AC_SUBST(ldns_build_config_have_b32_ntop, 1)
else
#ifndef HAVE_GMTIME_R
struct tm *gmtime_r(const time_t *timep, struct tm *result);
#endif
+#ifndef HAVE_ASCTIME_R
+char *asctime_r(const struct tm *tm, char *buf);
+#endif
#ifndef HAVE_LOCALTIME_R
struct tm *localtime_r(const time_t *timep, struct tm *result);
#endif
int snprintf (char *str, size_t count, const char *fmt, ...);
int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);
#endif /* HAVE_SNPRINTF */
-#ifndef HAVE_INET_PTON
+#if !defined(HAVE_INET_PTON) && !HAVE_DECL_INET_PTON
int inet_pton(int af, const char* src, void* dst);
#endif /* HAVE_INET_PTON */
-#ifndef HAVE_INET_NTOP
+#if !defined(HAVE_INET_NTOP) && !HAVE_DECL_INET_NTOP
const char *inet_ntop(int af, const void *src, char *dst, size_t size);
#endif
#ifndef HAVE_INET_ATON
#endif
#ifdef USE_WINSOCK
-#define SOCK_INVALID INVALID_SOCKET
+#define SOCK_INVALID ((INT_PTR)INVALID_SOCKET)
#define close_socket(_s) do { if (_s != SOCK_INVALID) {closesocket(_s); _s = -1;} } while(0)
#else
#define SOCK_INVALID -1
* See the file LICENSE for the license
*/
+#include <ldns/config.h>
#include <ldns/ldns.h>
#define LDNS_OPTIONLIST_INIT 8
if (!symlink_name)
return result; /* no arg "-s" at all */
+#ifdef HAVE_SYMLINK
if ((result = symlink(symlink_destination, symlink_name)) == -1) {
fprintf(stderr, "Unable to create symlink %s -> %s: %s\n", symlink_name, symlink_destination, strerror(errno));
}
+#else
+ fprintf(stderr, "Unable to create symlink %s -> %s: no symlink()\n", symlink_name, symlink_destination);
+#endif
return result;
}
RC="no"
SNAPSHOT="no"
CHECKOUT=""
+GITREPO=""
# the destination is a zipfile in the start directory ldns-a.b.c.zip
# the start directory is a git repository, and it is copied to build from.
echo " -s snapshot, current date appended to version"
echo " -rc <nr> release candidate, the number is added to version"
echo " ldns-<version>rc<nr>."
+ echo " -u git_url Retrieve the source from the specified repository url."
+ echo " Detected from the working copy if not specified."
echo " -c <tag/br> Checkout this tag or branch, (defaults to current"
echo " branch)."
echo " -wssl <file> Pass openssl.tar.gz file, use absolute path."
RC="$2"
shift
;;
+ "-u")
+ GITREPO="$2"
+ shift
+ ;;
"-wssl")
WINSSL="$2"
shift
CHECKOUT=$( (git status | head -n 1 | awk '{print$3}') || echo develop)
fi
fi
+if [ -z "$GITREPO" ]
+then
+ GITREPO=`git config remote.origin.url`
+fi
# this script creates a temp directory $cdir.
# this directory contains subdirectories:
# sslinstall-nonstatic/ : install of nonstatic openssl compile
info "exporting source into $cdir/ldns"
-git clone git://git.nlnetlabs.nl/ldns/ ldns || error_cleanup "git command failed"
+git clone "$GITREPO" ldns || error_cleanup "git command failed"
(cd ldns; git checkout "$CHECKOUT") || error_cleanup "Could not checkout $CHECKOUT"
#svn export . $cdir/ldns
info "exporting source into $cdir/ldns-nonstatic"
-git clone git://git.nlnetlabs.nl/ldns/ ldns-nonstatic || error_cleanup "git command failed"
+git clone "$GITREPO" ldns-nonstatic || error_cleanup "git command failed"
(cd ldns-nonstatic; git checkout "$CHECKOUT") || error_cleanup "Could not checkout $CHECKOUT"
#svn export . $cdir/ldns-nonstatic
sslflags="no-shared no-asm -DOPENSSL_NO_CAPIENG mingw"
fi
info "winssl: Configure $sslflags"
-CC="${warch}-w64-mingw32-gcc" AR="${warch}-w64-mingw32-ar" RANLIB="${warch}-w64-mingw32-ranlib" WINDRES="${warch}-w64-mingw32-windres" ./Configure --prefix="$sslinstall" "$sslflags" || error_cleanup "OpenSSL Configure failed"
+CC="${warch}-w64-mingw32-gcc" AR="${warch}-w64-mingw32-ar" RANLIB="${warch}-w64-mingw32-ranlib" WINDRES="${warch}-w64-mingw32-windres" ./Configure --prefix="$sslinstall" $sslflags || error_cleanup "OpenSSL Configure failed"
info "winssl: make"
make || error_cleanup "make failed for $WINSSL"
info "winssl: make install_sw"
autoreconf -fi
ldns_flag="--with-examples --with-drill"
info "ldns: Configure $cross_flag $ldns_flag"
-$configure "$cross_flag" "$ldns_flag" || error_cleanup "ldns configure failed"
+$configure $cross_flag $ldns_flag || error_cleanup "ldns configure failed"
info "ldns: make"
make || error_cleanup "ldns make failed"
# do not strip debug symbols, could be useful for stack traces
autoreconf -fi
ldns_flag_nonstatic="--with-examples --with-drill"
info "ldnsnonstatic: Configure $cross_flag_nonstatic $ldns_flag_nonstatic"
-$configure "$cross_flag_nonstatic" "$ldns_flag_nonstatic" || error_cleanup "ldns configure failed"
+$configure $cross_flag_nonstatic $ldns_flag_nonstatic || error_cleanup "ldns configure failed"
info "ldnsnonstatic: make"
make || error_cleanup "ldns make failed"
# do not strip debug symbols, could be useful for stack traces
return -1;
}
#endif
- if (from && bind(sockfd, (const struct sockaddr*)from, fromlen) == SOCK_INVALID){
+ if (from && bind(sockfd, (const struct sockaddr*)from, fromlen) == -1){
close_socket(sockfd);
return -1;
}
/* perform nonblocking connect, to be able to wait with select() */
ldns_sock_nonblock(sockfd);
- if (connect(sockfd, (struct sockaddr*)to, tolen) == SOCK_INVALID) {
+ if (connect(sockfd, (struct sockaddr*)to, tolen) == -1) {
#ifndef USE_WINSOCK
#ifdef EINPROGRESS
if(errno != EINPROGRESS) {