Author: cgutman Date: Wed Nov 12 16:06:44 2008 New Revision: 37321
URL: http://svn.reactos.org/svn/reactos?rev=37321&view=rev Log: - Update adns to the latest version
Modified: branches/aicom-network-fixes/lib/3rdparty/adns/adns_win32/README.TXT branches/aicom-network-fixes/lib/3rdparty/adns/adns_win32/adns_unix_calls.c branches/aicom-network-fixes/lib/3rdparty/adns/adns_win32/adns_win32.h branches/aicom-network-fixes/lib/3rdparty/adns/client/adh-main.c branches/aicom-network-fixes/lib/3rdparty/adns/client/adnslogres.c branches/aicom-network-fixes/lib/3rdparty/adns/client/fanftest.c branches/aicom-network-fixes/lib/3rdparty/adns/src/adns.h branches/aicom-network-fixes/lib/3rdparty/adns/src/check.c branches/aicom-network-fixes/lib/3rdparty/adns/src/event.c branches/aicom-network-fixes/lib/3rdparty/adns/src/general.c branches/aicom-network-fixes/lib/3rdparty/adns/src/internal.h branches/aicom-network-fixes/lib/3rdparty/adns/src/parse.c branches/aicom-network-fixes/lib/3rdparty/adns/src/setup.c branches/aicom-network-fixes/lib/3rdparty/adns/src/transmit.c
Modified: branches/aicom-network-fixes/lib/3rdparty/adns/adns_win32/README.TXT URL: http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/lib/3rdparty... ============================================================================== --- branches/aicom-network-fixes/lib/3rdparty/adns/adns_win32/README.TXT [iso-8859-1] (original) +++ branches/aicom-network-fixes/lib/3rdparty/adns/adns_win32/README.TXT [iso-8859-1] Wed Nov 12 16:06:44 2008 @@ -5,9 +5,9 @@ port provides a 100% native Windows DLL and linker library for the DLL - suitable for traditional compilers and linkers under Windows. The library itself is ported to -Microsot Visual C++ 6.0 SP 2. +Microsot Visual C++ 6.0.
-The library is tested under Windows 2000, but should work +The library is tested under Windows 2000 and XP, but should work with all versions from Windows NT 4 and up, and Windows98 and up. Windows95 is not supported.
@@ -37,3 +37,32 @@ For more information about this port, see http://adns.jgaa.com
+/////////////////////////////////////////////////////// + +October 13th 2005 jgaa: adns-1.0-win32-05 + - Fixed a problem with the return-value from adns_inet_aton() + Thanks to Gerald Combs for reporting the problem. + +October 7th 2004 jgaa: adns-1.0-win32-03 + + - Fixed a problem with error-messages when the program + works off-line. + Thanks to Ulf Lamping for pointing ourt and solving the problem. + + +April 4th 2004 jgaa: adns-1.0-win32-03 + + - Fixed broken gettimeofday() function. + + - Fixed problem with TCP connections, where the librarry + failed to connect to DNS servers with TCP, and flooded + the servers with TCP connection attempts. + + - Made sure that errno was handled corrcetly after all network + (winsock) calls. + + - Fixed a few places where noblocking calls were not handled + EAGAIN and EWOULDBLOCK is not the same under Windows. + + +
Modified: branches/aicom-network-fixes/lib/3rdparty/adns/adns_win32/adns_unix_calls.c URL: http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/lib/3rdparty... ============================================================================== --- branches/aicom-network-fixes/lib/3rdparty/adns/adns_win32/adns_unix_calls.c [iso-8859-1] (original) +++ branches/aicom-network-fixes/lib/3rdparty/adns/adns_win32/adns_unix_calls.c [iso-8859-1] Wed Nov 12 16:06:44 2008 @@ -1,3 +1,4 @@ + /* * adns_unix_calls.c * - Simple implementation of requiered UNIX system calls and @@ -29,20 +30,20 @@
#include "adns.h"
-int adns_writev(SOCKET FileDescriptor, const struct iovec * iov, int iovCount) +int adns_writev(int FileDescriptor, const struct iovec * iov, int iovCount) { - int total_len = 0; + size_t total_len = 0; int i = 0, r = 0; char *buf = NULL, *p = NULL;
for(; i < iovCount; i++) total_len += iov[i].iov_len;
- p = buf = (char *)alloca( (size_t) total_len); + p = buf = (char *)alloca(total_len);
for(; i < iovCount; i++) { - memcpy(p, iov[i].iov_base, (size_t) iov[i].iov_len); + memcpy(p, iov[i].iov_base, iov[i].iov_len); p += iov[i].iov_len; }
@@ -54,8 +55,21 @@
int adns_inet_aton(const char *cp, struct in_addr *inp) { + if (!cp || !*cp || !inp) + { + errno = EINVAL; + return -1; + } + + if (!strcmp(cp, "255.255.255.255")) + { + // Special case + inp->s_addr = INADDR_NONE; + return 0; + } + inp->s_addr = inet_addr(cp); - return inp->s_addr != INADDR_ANY; + return (inp->s_addr == INADDR_NONE) ? -1 : 0; }
int adns_getpid() @@ -63,35 +77,30 @@ return GetCurrentProcessId(); }
-/* ReactOS: Fixed gettimeofday implementation. Was wrong by a factor of - * 10 */ int gettimeofday(struct timeval *tv, struct timezone *tz) { - static __int64 Adjustment; - __int64 Now = 0; + static __int64 Adjustment; + __int64 now = 0; + + if (!Adjustment) + { + SYSTEMTIME st = {1970,1,0,1,0,0,0}; + SystemTimeToFileTime(&st, (LPFILETIME)&Adjustment); + } + + if (tz) + { + errno = EINVAL; + return -1; + } + + GetSystemTimeAsFileTime((LPFILETIME)&now); + now -= Adjustment; + + tv->tv_sec = (long)(now / 10000000); + tv->tv_usec = (long)((now % 10000000) / 10);
- - if (!Adjustment) - { - SYSTEMTIME st = {1970,1,3,0,0,0,0}; - - SystemTimeToFileTime(&st, ((LPFILETIME)(VOID *)&Adjustment)); - } - - if (tz) - { - return -1; - } - - GetSystemTimeAsFileTime(((LPFILETIME)(VOID *)&Now)); - Now -= Adjustment; - - /* 100 ns - .1 us - 10 * 1000000 */ - tv->tv_sec = (long)(Now / 10000000); - tv->tv_usec = (long)((Now / 10) % 1000000); - return 0; + return 0; }
/* Memory allocated in the DLL must be freed in the dll, so
Modified: branches/aicom-network-fixes/lib/3rdparty/adns/adns_win32/adns_win32.h URL: http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/lib/3rdparty... ============================================================================== --- branches/aicom-network-fixes/lib/3rdparty/adns/adns_win32/adns_win32.h [iso-8859-1] (original) +++ branches/aicom-network-fixes/lib/3rdparty/adns/adns_win32/adns_win32.h [iso-8859-1] Wed Nov 12 16:06:44 2008 @@ -105,6 +105,8 @@ #define EINPROGRESS WSAEINPROGRESS #define EMSGSIZE WSAEMSGSIZE #define ENOPROTOOPT WSAENOPROTOOPT +#define ECONNRESET WSAECONNRESET + //#define NONRETURNING //#define NONRETURNPRINTFFORMAT(si,tc)
@@ -129,9 +131,9 @@ * Undef ADNS_MAP_UNIXAPI in the calling code to use natve calls */ ADNS_API int adns_gettimeofday(struct timeval *tv, struct timezone *tz); -ADNS_API int adns_writev (SOCKET FileDescriptor, const struct iovec * iov, int iovCount); +ADNS_API int adns_writev (int FileDescriptor, const struct iovec * iov, int iovCount); ADNS_API int adns_inet_aton(const char *cp, struct in_addr *inp); -ADNS_API int adns_getpid(void); +ADNS_API int adns_getpid();
#ifdef ADNS_DLL ADNS_API void *adns_malloc(const size_t bytes); @@ -155,7 +157,5 @@ } #endif /* __cplusplus */
-#include "timercmp.h" /* arty added: mingw headers don't seem to have it */ - #endif /* ADNS_WIN32_H_INCLUDED */
Modified: branches/aicom-network-fixes/lib/3rdparty/adns/client/adh-main.c URL: http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/lib/3rdparty... ============================================================================== --- branches/aicom-network-fixes/lib/3rdparty/adns/client/adh-main.c [iso-8859-1] (original) +++ branches/aicom-network-fixes/lib/3rdparty/adns/client/adh-main.c [iso-8859-1] Wed Nov 12 16:06:44 2008 @@ -240,7 +240,7 @@ for (;;) { qu= ov_asynch ? 0 : outstanding.head ? outstanding.head->qu : 0; r= adns_check(ads,&qu,&answer,&qun_v); - if (r == EAGAIN) break; + if ((r == EAGAIN) || (r == EWOULDBLOCK)) break; if (r == ESRCH) { if (!ov_pipe) goto x_quit; else break; } assert(!r); query_done(qun_v,answer); @@ -259,7 +259,6 @@ r= select(maxfd, &readfds,&writefds,&exceptfds, tv); ADNS_CAPTURE_ERRNO; if (r == -1) { - ADNS_CAPTURE_ERRNO; if (errno == EINTR) continue; sysfail("select",errno); }
Modified: branches/aicom-network-fixes/lib/3rdparty/adns/client/adnslogres.c URL: http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/lib/3rdparty... ============================================================================== --- branches/aicom-network-fixes/lib/3rdparty/adns/client/adnslogres.c [iso-8859-1] (original) +++ branches/aicom-network-fixes/lib/3rdparty/adns/client/adnslogres.c [iso-8859-1] Wed Nov 12 16:06:44 2008 @@ -29,9 +29,6 @@ * modified by Ian Jackson as it was incorporated into adns and * subsequently. */ - -static const char * const cvsid = - "$Id$";
#ifdef ADNS_JGAA_WIN32 # include "adns_win32.h" @@ -202,7 +199,7 @@ } else { err= adns_check(adns, &head->query, &answer, NULL); } - if (err == EAGAIN) break; + if ((err == EAGAIN) || (EWOULDBLOCK == err)) break; if (err) { fprintf(stderr, "%s: adns_wait/check: %s", progname, strerror(err)); exit(1);
Modified: branches/aicom-network-fixes/lib/3rdparty/adns/client/fanftest.c URL: http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/lib/3rdparty... ============================================================================== --- branches/aicom-network-fixes/lib/3rdparty/adns/client/fanftest.c [iso-8859-1] (original) +++ branches/aicom-network-fixes/lib/3rdparty/adns/client/fanftest.c [iso-8859-1] Wed Nov 12 16:06:44 2008 @@ -28,9 +28,6 @@ * This version was originally supplied by Tony Finch, but has been * modified by Ian Jackson as it was incorporated into adns. */ - -static const char * const cvsid = - "$Id$";
#ifdef ADNS_JGAA_WIN32 # include "adns_win32.h"
Modified: branches/aicom-network-fixes/lib/3rdparty/adns/src/adns.h URL: http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/lib/3rdparty... ============================================================================== --- branches/aicom-network-fixes/lib/3rdparty/adns/src/adns.h [iso-8859-1] (original) +++ branches/aicom-network-fixes/lib/3rdparty/adns/src/adns.h [iso-8859-1] Wed Nov 12 16:06:44 2008 @@ -51,7 +51,6 @@ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * - * $Id$ */
#ifndef ADNS_H_INCLUDED @@ -95,8 +94,7 @@ adns_if_eintr= 0x0020, /* allow _wait and _synchronous to return EINTR */ adns_if_nosigpipe= 0x0040, /* applic has SIGPIPE set to SIG_IGN, do not protect */ adns_if_checkc_entex= 0x0100, /* do consistency checks on entry/exit to adns funcs */ - adns_if_checkc_freq= 0x0300, /* do consistency checks very frequently (slow!) */ - adns_if_noserver= 0x0800, /* do not get dns servers from the environment */ + adns_if_checkc_freq= 0x0300 /* do consistency checks very frequently (slow!) */ } adns_initflags;
typedef enum { @@ -368,9 +366,6 @@ ADNS_API int adns_init(adns_state *newstate_r, adns_initflags flags, FILE *diagfile /*0=>stderr*/);
-/* ReactOS addition */ -ADNS_API void adns_addserver(adns_state state, struct in_addr server); - ADNS_API int adns_init_strcfg(adns_state *newstate_r, adns_initflags flags, FILE *diagfile /*0=>discard*/, const char *configtext);
Modified: branches/aicom-network-fixes/lib/3rdparty/adns/src/check.c URL: http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/lib/3rdparty... ============================================================================== --- branches/aicom-network-fixes/lib/3rdparty/adns/src/check.c [iso-8859-1] (original) +++ branches/aicom-network-fixes/lib/3rdparty/adns/src/check.c [iso-8859-1] Wed Nov 12 16:06:44 2008 @@ -101,8 +101,8 @@
static void checkc_global(adns_state ads) { int i; - - assert(ads->udpsocket != INVALID_SOCKET); + + assert(ads->udpsocket >= 0);
for (i=0; i<ads->nsortlist; i++) assert(!(ads->sortlist[i].base.s_addr & ~ads->sortlist[i].mask.s_addr)); @@ -111,16 +111,16 @@
switch (ads->tcpstate) { case server_connecting: - assert(ads->tcpsocket != INVALID_SOCKET); + assert(ads->tcpsocket >= 0); checkc_notcpbuf(ads); break; case server_disconnected: case server_broken: - assert(ads->tcpsocket == INVALID_SOCKET); + assert(ads->tcpsocket == -1); checkc_notcpbuf(ads); break; case server_ok: - assert(ads->tcpsocket != INVALID_SOCKET); + assert(ads->tcpsocket >= 0); assert(ads->tcprecv_skip <= ads->tcprecv.used); break; default:
Modified: branches/aicom-network-fixes/lib/3rdparty/adns/src/event.c URL: http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/lib/3rdparty... ============================================================================== --- branches/aicom-network-fixes/lib/3rdparty/adns/src/event.c [iso-8859-1] (original) +++ branches/aicom-network-fixes/lib/3rdparty/adns/src/event.c [iso-8859-1] Wed Nov 12 16:06:44 2008 @@ -28,10 +28,10 @@ */
#include <errno.h> +#include <stdlib.h> + +#ifdef ADNS_JGAA_WIN32 # include "adns_win32.h" -#include <stdlib.h> - -#ifdef ADNS_JGAA_WIN32 #else # include <unistd.h> # include <sys/types.h> @@ -52,7 +52,7 @@
serv= ads->tcpserver; adns_socket_close(ads->tcpsocket); - ads->tcpsocket= INVALID_SOCKET; + ads->tcpsocket= -1; ads->tcprecv.used= ads->tcprecv_skip= ads->tcpsend.used= 0; }
@@ -114,7 +114,7 @@ ADNS_CLEAR_ERRNO fd= socket(AF_INET,SOCK_STREAM,proto->p_proto); ADNS_CAPTURE_ERRNO; - if (fd == INVALID_SOCKET) { + if (fd<0) { adns__diag(ads,-1,0,"cannot create TCP socket: %s",strerror(errno)); return; } @@ -128,7 +128,9 @@ addr.sin_family= AF_INET; addr.sin_port= htons(DNS_PORT); addr.sin_addr= ads->servers[ads->tcpserver].addr; + ADNS_CLEAR_ERRNO; r= connect(fd,(const struct sockaddr*)&addr,sizeof(addr)); + ADNS_CAPTURE_ERRNO; ads->tcpsocket= fd; ads->tcpstate= server_connecting; if (r==0) { tcp_connected(ads,now); return; } @@ -398,10 +400,10 @@ (struct sockaddr*)&udpaddr,&udpaddrlen); ADNS_CAPTURE_ERRNO; if (r<0) { - if (errno == EAGAIN || errno == EWOULDBLOCK) { r= 0; goto xit; } + if (errno == EAGAIN || errno == EWOULDBLOCK || errno == ECONNRESET) { r= 0; goto xit; } if (errno == EINTR) continue; if (errno_resources(errno)) { r= errno; goto xit; } - adns__warn(ads,-1,0,"datagram receive error: %s",strerror(errno)); + adns__warn(ads,-1,0,"datagram receive error: %s (%d)",strerror(errno), errno); r= 0; goto xit; } if (udpaddrlen != sizeof(udpaddr)) {
Modified: branches/aicom-network-fixes/lib/3rdparty/adns/src/general.c URL: http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/lib/3rdparty... ============================================================================== --- branches/aicom-network-fixes/lib/3rdparty/adns/src/general.c [iso-8859-1] (original) +++ branches/aicom-network-fixes/lib/3rdparty/adns/src/general.c [iso-8859-1] Wed Nov 12 16:06:44 2008 @@ -254,7 +254,7 @@ SINFO( nodata, "No such data" ) };
-static int __cdecl si_compar(const void *key, const void *elem) { +static int si_compar(const void *key, const void *elem) { const adns_status *st= key; const struct sinfo *si= elem;
@@ -295,7 +295,7 @@ STINFO( permfail ) };
-static int __cdecl sti_compar(const void *key, const void *elem) { +static int sti_compar(const void *key, const void *elem) { const adns_status *st= key; const struct stinfo *sti= elem;
Modified: branches/aicom-network-fixes/lib/3rdparty/adns/src/internal.h URL: http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/lib/3rdparty... ============================================================================== --- branches/aicom-network-fixes/lib/3rdparty/adns/src/internal.h [iso-8859-1] (original) +++ branches/aicom-network-fixes/lib/3rdparty/adns/src/internal.h [iso-8859-1] Wed Nov 12 16:06:44 2008 @@ -31,7 +31,7 @@ #define ADNS_INTERNAL_H_INCLUDED
#include "config.h" -/*typedef unsigned char byte;*/ /* FIXME: horrible kludge to avoid conflicts with an SDK type */ +typedef unsigned char byte;
#include <stdarg.h> #include <assert.h> @@ -575,7 +575,7 @@ } parsedomain_flags;
adns_status adns__parse_domain(adns_state ads, int serv, adns_query qu, - vbuf *vb, parsedomain_flags flags, + vbuf *vb, adns_queryflags flags, const byte *dgram, int dglen, int *cbyte_io, int max); /* vb must already have been initialised; it will be reset if necessary. * If there is truncation, vb->used will be set to 0; otherwise @@ -690,17 +690,17 @@
/* Useful static inline functions: */
-static __inline int ctype_whitespace(int c) { return c==' ' || c=='\n' || c=='\t'; } -static __inline int ctype_digit(int c) { return c>='0' && c<='9'; } -static __inline int ctype_alpha(int c) { +static inline int ctype_whitespace(int c) { return c==' ' || c=='\n' || c=='\t'; } +static inline int ctype_digit(int c) { return c>='0' && c<='9'; } +static inline int ctype_alpha(int c) { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); } -static __inline int ctype_822special(int c) { return strchr("()<>@,;:\".[]",c) != 0; } -static __inline int ctype_domainunquoted(int c) { +static inline int ctype_822special(int c) { return strchr("()<>@,;:\".[]",c) != 0; } +static inline int ctype_domainunquoted(int c) { return ctype_alpha(c) || ctype_digit(c) || (strchr("-_/+",c) != 0); }
-static __inline int errno_resources(int e) { return e==ENOMEM || e==ENOBUFS; } +static inline int errno_resources(int e) { return e==ENOMEM || e==ENOBUFS; }
/* Useful macros */
Modified: branches/aicom-network-fixes/lib/3rdparty/adns/src/parse.c URL: http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/lib/3rdparty... ============================================================================== --- branches/aicom-network-fixes/lib/3rdparty/adns/src/parse.c [iso-8859-1] (original) +++ branches/aicom-network-fixes/lib/3rdparty/adns/src/parse.c [iso-8859-1] Wed Nov 12 16:06:44 2008 @@ -115,7 +115,7 @@ }
adns_status adns__parse_domain(adns_state ads, int serv, adns_query qu, - vbuf *vb, parsedomain_flags flags, + vbuf *vb, adns_queryflags flags, const byte *dgram, int dglen, int *cbyte_io, int max) { findlabel_state fls;
Modified: branches/aicom-network-fixes/lib/3rdparty/adns/src/setup.c URL: http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/lib/3rdparty... ============================================================================== --- branches/aicom-network-fixes/lib/3rdparty/adns/src/setup.c [iso-8859-1] (original) +++ branches/aicom-network-fixes/lib/3rdparty/adns/src/setup.c [iso-8859-1] Wed Nov 12 16:06:44 2008 @@ -131,13 +131,13 @@ while (nextword(&bufp,&word,&l)) { count++; tl += l+1; }
newptrs= malloc(sizeof(char*)*count); if (!newptrs) { saveerr(ads,errno); return; } - newchars= malloc((size_t) tl); if (!newchars) { saveerr(ads,errno); free(newptrs); return; } + newchars= malloc(tl); if (!newchars) { saveerr(ads,errno); free(newptrs); return; }
bufp= buf; pp= newptrs; while (nextword(&bufp,&word,&l)) { *pp++= newchars; - memcpy(newchars,word,(size_t) l); + memcpy(newchars,word,l); newchars += l; *newchars++ = 0; } @@ -163,12 +163,12 @@ return; }
- if (l >= (int)sizeof(tbuf)) { + if (l >= sizeof(tbuf)) { configparseerr(ads,fn,lno,"sortlist entry `%.*s' too long",l,word); continue; }
- memcpy(tbuf,word, (size_t) l); tbuf[l]= 0; + memcpy(tbuf,word,l); tbuf[l]= 0; slash= strchr(tbuf,'/'); if (slash) *slash++= 0;
@@ -351,7 +351,7 @@ return -2; }
- memcpy(buf,cp, (size_t) l); + memcpy(buf,cp,l); buf[l]= 0; return l; } @@ -382,7 +382,7 @@ while (*q && !ctype_whitespace(*q)) q++; dirl= q-p; for (ccip=configcommandinfos; - ccip->name && !((int)strlen(ccip->name)==dirl && !memcmp(ccip->name,p,(size_t) (q-p))); + ccip->name && !((int)strlen(ccip->name)==dirl && !memcmp(ccip->name,p,q-p)); ccip++); if (!ccip->name) { adns__diag(ads,-1,0,"%s:%d: unknown configuration directive `%.*s'", @@ -457,7 +457,7 @@ int adns__setnonblock(adns_state ads, ADNS_SOCKET fd) { #ifdef ADNS_JGAA_WIN32 unsigned long Val = 1; - return (ioctlsocket (fd, (long) FIONBIO, &Val) == 0) ? 0 : -1; + return (ioctlsocket (fd, FIONBIO, &Val) == 0) ? 0 : -1; #else int r;
@@ -488,7 +488,7 @@ LIST_INIT(ads->output); ads->forallnext= 0; ads->nextid= 0x311f; - ads->udpsocket= ads->tcpsocket= ((unsigned) -1); + ads->udpsocket= ads->tcpsocket= -1; adns__vbuf_init(&ads->tcpsend); adns__vbuf_init(&ads->tcprecv); ads->tcprecv_skip= 0; @@ -525,7 +525,7 @@ struct protoent *proto; int r;
- if (!ads->nservers && !(ads->iflags & adns_if_noserver)) { + if (!ads->nservers) { if (ads->diagfile && ads->iflags & adns_if_debug) fprintf(ads->diagfile,"adns: no nameservers, using localhost\n"); ia.s_addr= htonl(INADDR_LOOPBACK); @@ -536,7 +536,7 @@ ADNS_CLEAR_ERRNO; ads->udpsocket= socket(AF_INET,SOCK_DGRAM,proto->p_proto); ADNS_CAPTURE_ERRNO; - if (ads->udpsocket == INVALID_SOCKET) { r= errno; goto x_free; } + if (ads->udpsocket<0) { r= errno; goto x_free; }
r= adns__setnonblock(ads,ads->udpsocket); if (r) { r= errno; goto x_closeudp; } @@ -589,35 +589,33 @@ ccf_options(ads,"ADNS_RES_OPTIONS",-1,adns_res_options);
#ifdef ADNS_JGAA_WIN32 - if (!(flags & adns_if_noserver)) { - GetWindowsDirectory(PathBuf, SECURE_PATH_LEN); - strcat(PathBuf,"\resolv.conf"); - readconfig(ads,PathBuf,1); - GetWindowsDirectory(PathBuf, SECURE_PATH_LEN); - strcat(PathBuf,"\resolv-adns.conf"); - readconfig(ads,PathBuf,0); - GetWindowsDirectory(PathBuf, SECURE_PATH_LEN); - strcat(PathBuf,"\System32\Drivers\etc\resolv.conf"); - readconfig(ads,PathBuf,1); - GetWindowsDirectory(PathBuf, SECURE_PATH_LEN); - strcat(PathBuf,"\System32\Drivers\etc\resolv-adns.conf"); - readconfig(ads,PathBuf,0); - network_info_result = GetNetworkParams(network_info, &network_info_blen); - if (network_info_result != ERROR_SUCCESS){ - switch(network_info_result) { - case ERROR_BUFFER_OVERFLOW: network_err_str = "ERROR_BUFFER_OVERFLOW"; break; - case ERROR_INVALID_PARAMETER: network_err_str = "ERROR_INVALID_PARAMETER"; break; - case ERROR_NO_DATA: network_err_str = "ERROR_NO_DATA"; break; - case ERROR_NOT_SUPPORTED: network_err_str = "ERROR_NOT_SUPPORTED"; break;} - adns__diag(ads,-1,0,"GetNetworkParams() failed with error [%d] %s", - network_info_result,network_err_str); - } - else { - for(pip = &(network_info->DnsServerList); pip; pip = pip->Next) { - addr.s_addr = inet_addr(pip->IpAddress.String); - if ((addr.s_addr != INADDR_ANY) && (addr.s_addr != INADDR_NONE)) - addserver(ads, addr); - } + GetWindowsDirectory(PathBuf, SECURE_PATH_LEN); + strcat(PathBuf,"\resolv.conf"); + readconfig(ads,PathBuf,1); + GetWindowsDirectory(PathBuf, SECURE_PATH_LEN); + strcat(PathBuf,"\resolv-adns.conf"); + readconfig(ads,PathBuf,0); + GetWindowsDirectory(PathBuf, SECURE_PATH_LEN); + strcat(PathBuf,"\System32\Drivers\etc\resolv.conf"); + readconfig(ads,PathBuf,1); + GetWindowsDirectory(PathBuf, SECURE_PATH_LEN); + strcat(PathBuf,"\System32\Drivers\etc\resolv-adns.conf"); + readconfig(ads,PathBuf,0); + network_info_result = GetNetworkParams(network_info, &network_info_blen); + if (network_info_result != ERROR_SUCCESS){ + switch(network_info_result) { + case ERROR_BUFFER_OVERFLOW: network_err_str = "ERROR_BUFFER_OVERFLOW"; break; + case ERROR_INVALID_PARAMETER: network_err_str = "ERROR_INVALID_PARAMETER"; break; + case ERROR_NO_DATA: network_err_str = "ERROR_NO_DATA"; break; + case ERROR_NOT_SUPPORTED: network_err_str = "ERROR_NOT_SUPPORTED"; break;} + adns__diag(ads,-1,0,"GetNetworkParams() failed with error [%d] %s", + network_info_result,network_err_str); + } + else { + for(pip = &(network_info->DnsServerList); pip; pip = pip->Next) { + addr.s_addr = inet_addr(pip->IpAddress.String); + if ((addr.s_addr != INADDR_ANY) && (addr.s_addr != INADDR_NONE)) + addserver(ads, addr); } } #else @@ -682,7 +680,7 @@ else break; } adns_socket_close(ads->udpsocket); - if (ads->tcpsocket != INVALID_SOCKET) adns_socket_close(ads->tcpsocket); + if (ads->tcpsocket >= 0) adns_socket_close(ads->tcpsocket); adns__vbuf_free(&ads->tcpsend); adns__vbuf_free(&ads->tcprecv); freesearchlist(ads); @@ -732,8 +730,3 @@ if (context_r) *context_r= qu->ctx.ext; return qu; } - -/* ReactOS addition */ -void adns_addserver(adns_state ads, struct in_addr addr) { - addserver(ads, addr); -}
Modified: branches/aicom-network-fixes/lib/3rdparty/adns/src/transmit.c URL: http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/lib/3rdparty... ============================================================================== --- branches/aicom-network-fixes/lib/3rdparty/adns/src/transmit.c [iso-8859-1] (original) +++ branches/aicom-network-fixes/lib/3rdparty/adns/src/transmit.c [iso-8859-1] Wed Nov 12 16:06:44 2008 @@ -194,10 +194,13 @@ iov[1].iov_base= (char*)qu->query_dgram; iov[1].iov_len= qu->query_dglen; adns__sigpipe_protect(qu->ads); + + ADNS_CLEAR_ERRNO; wr= writev(qu->ads->tcpsocket,iov,2); + ADNS_CAPTURE_ERRNO; adns__sigpipe_unprotect(qu->ads); if (wr < 0) { - if (!(errno == EAGAIN || errno == EINTR || errno == ENOSPC || + if (!(errno == EAGAIN || EWOULDBLOCK || errno == EINTR || errno == ENOSPC || errno == ENOBUFS || errno == ENOMEM)) { adns__tcp_broken(ads,"write",strerror(errno)); return; @@ -255,7 +258,7 @@ (const struct sockaddr*)&servaddr,sizeof(servaddr)); ADNS_CAPTURE_ERRNO; if (r<0 && errno == EMSGSIZE) { qu->retries= 0; query_usetcp(qu,now); return; } - if (r<0 && errno != EAGAIN) adns__warn(ads,serv,0,"sendto failed: %s (%d)",strerror(errno), errno); + if (r<0 && ((errno != EAGAIN) && (errno != EWOULDBLOCK))) adns__warn(ads,serv,0,"sendto failed: %s (%d)",strerror(errno), errno);
qu->timeout= now; timevaladd(&qu->timeout,UDPRETRYMS);