Author: arty
Date: Mon Aug 21 00:51:54 2006
New Revision: 23626
URL:
http://svn.reactos.org/svn/reactos?rev=23626&view=rev
Log:
Add the ability to specify DNS servers and make adns work right in case they
are specified.
Modified:
trunk/reactos/dll/win32/dnsapi/dnsapi/query.c
trunk/reactos/lib/3rdparty/adns/src/adns.h
trunk/reactos/lib/3rdparty/adns/src/setup.c
Modified: trunk/reactos/dll/win32/dnsapi/dnsapi/query.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/dnsapi/dnsapi/qu…
==============================================================================
--- trunk/reactos/dll/win32/dnsapi/dnsapi/query.c (original)
+++ trunk/reactos/dll/win32/dnsapi/dnsapi/query.c Mon Aug 21 00:51:54 2006
@@ -49,7 +49,7 @@
PDNS_RECORD *QueryResultSet,
PVOID *Reserved ) {
adns_state astate;
- int quflags = 0;
+ int quflags = 0, i;
int adns_error;
adns_answer *answer;
LPSTR CurrentName;
@@ -62,10 +62,18 @@
adns_error = adns_init( &astate,
adns_if_noenv |
adns_if_noerrprint |
- adns_if_noserverwarn,
+ adns_if_noserverwarn |
+ (Servers ? adns_if_noserver : 0),
0 );
+
if( adns_error != adns_s_ok ) {
return DnsIntTranslateAdnsToDNS_STATUS( adns_error );
+ }
+
+ if (Servers) {
+ for( i = 0; i < Servers->AddrCount; i++ ) {
+ adns_addserver( astate, *((struct in_addr *)&Servers->AddrArray[i]) );
+ }
}
/*
Modified: trunk/reactos/lib/3rdparty/adns/src/adns.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/adns/src/adns…
==============================================================================
--- trunk/reactos/lib/3rdparty/adns/src/adns.h (original)
+++ trunk/reactos/lib/3rdparty/adns/src/adns.h Mon Aug 21 00:51:54 2006
@@ -95,7 +95,8 @@
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_checkc_freq= 0x0300, /* do consistency checks very frequently (slow!) */
+ adns_if_noserver= 0x0800, /* do not get dns servers from the environment */
} adns_initflags;
typedef enum {
@@ -367,6 +368,9 @@
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: trunk/reactos/lib/3rdparty/adns/src/setup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/adns/src/setu…
==============================================================================
--- trunk/reactos/lib/3rdparty/adns/src/setup.c (original)
+++ trunk/reactos/lib/3rdparty/adns/src/setup.c Mon Aug 21 00:51:54 2006
@@ -525,7 +525,7 @@
struct protoent *proto;
int r;
- if (!ads->nservers) {
+ if (!ads->nservers && !(ads->iflags & adns_if_noserver)) {
if (ads->diagfile && ads->iflags & adns_if_debug)
fprintf(ads->diagfile,"adns: no nameservers, using localhost\n");
ia.s_addr= htonl(INADDR_LOOPBACK);
@@ -589,33 +589,35 @@
ccf_options(ads,"ADNS_RES_OPTIONS",-1,adns_res_options);
#ifdef ADNS_JGAA_WIN32
- 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);
+ 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);
+ }
}
}
#else
@@ -730,3 +732,8 @@
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);
+}