mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 05:32:55 +00:00
Add the ability to specify DNS servers and make adns work right in case they
are specified. svn path=/trunk/; revision=23626
This commit is contained in:
parent
43d5f7e90d
commit
9cb66d7953
3 changed files with 49 additions and 30 deletions
|
@ -49,7 +49,7 @@ DNS_STATUS WINAPI DnsQuery_A
|
||||||
PDNS_RECORD *QueryResultSet,
|
PDNS_RECORD *QueryResultSet,
|
||||||
PVOID *Reserved ) {
|
PVOID *Reserved ) {
|
||||||
adns_state astate;
|
adns_state astate;
|
||||||
int quflags = 0;
|
int quflags = 0, i;
|
||||||
int adns_error;
|
int adns_error;
|
||||||
adns_answer *answer;
|
adns_answer *answer;
|
||||||
LPSTR CurrentName;
|
LPSTR CurrentName;
|
||||||
|
@ -62,12 +62,20 @@ DNS_STATUS WINAPI DnsQuery_A
|
||||||
adns_error = adns_init( &astate,
|
adns_error = adns_init( &astate,
|
||||||
adns_if_noenv |
|
adns_if_noenv |
|
||||||
adns_if_noerrprint |
|
adns_if_noerrprint |
|
||||||
adns_if_noserverwarn,
|
adns_if_noserverwarn |
|
||||||
|
(Servers ? adns_if_noserver : 0),
|
||||||
0 );
|
0 );
|
||||||
|
|
||||||
if( adns_error != adns_s_ok ) {
|
if( adns_error != adns_s_ok ) {
|
||||||
return DnsIntTranslateAdnsToDNS_STATUS( adns_error );
|
return DnsIntTranslateAdnsToDNS_STATUS( adns_error );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Servers) {
|
||||||
|
for( i = 0; i < Servers->AddrCount; i++ ) {
|
||||||
|
adns_addserver( astate, *((struct in_addr *)&Servers->AddrArray[i]) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* adns doesn't resolve chained CNAME records (a CNAME which points to
|
* adns doesn't resolve chained CNAME records (a CNAME which points to
|
||||||
* another CNAME pointing to another... pointing to an A record), according
|
* another CNAME pointing to another... pointing to an A record), according
|
||||||
|
|
6
reactos/lib/3rdparty/adns/src/adns.h
vendored
6
reactos/lib/3rdparty/adns/src/adns.h
vendored
|
@ -95,7 +95,8 @@ typedef enum {
|
||||||
adns_if_eintr= 0x0020, /* allow _wait and _synchronous to return EINTR */
|
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_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_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;
|
} adns_initflags;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -367,6 +368,9 @@ typedef struct {
|
||||||
ADNS_API int adns_init(adns_state *newstate_r, adns_initflags flags,
|
ADNS_API int adns_init(adns_state *newstate_r, adns_initflags flags,
|
||||||
FILE *diagfile /*0=>stderr*/);
|
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,
|
ADNS_API int adns_init_strcfg(adns_state *newstate_r, adns_initflags flags,
|
||||||
FILE *diagfile /*0=>discard*/, const char *configtext);
|
FILE *diagfile /*0=>discard*/, const char *configtext);
|
||||||
|
|
||||||
|
|
9
reactos/lib/3rdparty/adns/src/setup.c
vendored
9
reactos/lib/3rdparty/adns/src/setup.c
vendored
|
@ -525,7 +525,7 @@ static int init_finish(adns_state ads) {
|
||||||
struct protoent *proto;
|
struct protoent *proto;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (!ads->nservers) {
|
if (!ads->nservers && !(ads->iflags & adns_if_noserver)) {
|
||||||
if (ads->diagfile && ads->iflags & adns_if_debug)
|
if (ads->diagfile && ads->iflags & adns_if_debug)
|
||||||
fprintf(ads->diagfile,"adns: no nameservers, using localhost\n");
|
fprintf(ads->diagfile,"adns: no nameservers, using localhost\n");
|
||||||
ia.s_addr= htonl(INADDR_LOOPBACK);
|
ia.s_addr= htonl(INADDR_LOOPBACK);
|
||||||
|
@ -589,6 +589,7 @@ int adns_init(adns_state *ads_r, adns_initflags flags, FILE *diagfile) {
|
||||||
ccf_options(ads,"ADNS_RES_OPTIONS",-1,adns_res_options);
|
ccf_options(ads,"ADNS_RES_OPTIONS",-1,adns_res_options);
|
||||||
|
|
||||||
#ifdef ADNS_JGAA_WIN32
|
#ifdef ADNS_JGAA_WIN32
|
||||||
|
if (!(flags & adns_if_noserver)) {
|
||||||
GetWindowsDirectory(PathBuf, SECURE_PATH_LEN);
|
GetWindowsDirectory(PathBuf, SECURE_PATH_LEN);
|
||||||
strcat(PathBuf,"\\resolv.conf");
|
strcat(PathBuf,"\\resolv.conf");
|
||||||
readconfig(ads,PathBuf,1);
|
readconfig(ads,PathBuf,1);
|
||||||
|
@ -618,6 +619,7 @@ int adns_init(adns_state *ads_r, adns_initflags flags, FILE *diagfile) {
|
||||||
addserver(ads, addr);
|
addserver(ads, addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
readconfig(ads,"/etc/resolv.conf",1);
|
readconfig(ads,"/etc/resolv.conf",1);
|
||||||
readconfig(ads,"/etc/resolv-adns.conf",0);
|
readconfig(ads,"/etc/resolv-adns.conf",0);
|
||||||
|
@ -730,3 +732,8 @@ adns_query adns_forallqueries_next(adns_state ads, void **context_r) {
|
||||||
if (context_r) *context_r= qu->ctx.ext;
|
if (context_r) *context_r= qu->ctx.ext;
|
||||||
return qu;
|
return qu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ReactOS addition */
|
||||||
|
void adns_addserver(adns_state ads, struct in_addr addr) {
|
||||||
|
addserver(ads, addr);
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue