ares_init.c (c-ares-1.17.1) | : | ares_init.c (c-ares-1.17.2) | ||
---|---|---|---|---|
skipping to change at line 36 | skipping to change at line 36 | |||
#endif | #endif | |||
#ifdef HAVE_NETDB_H | #ifdef HAVE_NETDB_H | |||
#include <netdb.h> | #include <netdb.h> | |||
#endif | #endif | |||
#ifdef HAVE_ARPA_INET_H | #ifdef HAVE_ARPA_INET_H | |||
#include <arpa/inet.h> | #include <arpa/inet.h> | |||
#endif | #endif | |||
#ifdef HAVE_ARPA_NAMESER_H | #include "ares_nameser.h" | |||
# include <arpa/nameser.h> | ||||
#else | ||||
# include "nameser.h" | ||||
#endif | ||||
#ifdef HAVE_ARPA_NAMESER_COMPAT_H | ||||
# include <arpa/nameser_compat.h> | ||||
#endif | ||||
#if defined(ANDROID) || defined(__ANDROID__) | #if defined(ANDROID) || defined(__ANDROID__) | |||
#include <sys/system_properties.h> | #include <sys/system_properties.h> | |||
#include "ares_android.h" | #include "ares_android.h" | |||
/* From the Bionic sources */ | /* From the Bionic sources */ | |||
#define DNS_PROP_NAME_PREFIX "net.dns" | #define DNS_PROP_NAME_PREFIX "net.dns" | |||
#define MAX_DNS_PROPERTIES 8 | #define MAX_DNS_PROPERTIES 8 | |||
#endif | #endif | |||
#if defined(CARES_USE_LIBRESOLV) | #if defined(CARES_USE_LIBRESOLV) | |||
skipping to change at line 1475 | skipping to change at line 1468 | |||
status = set_search(channel, line); | status = set_search(channel, line); | |||
ares_free(line); | ares_free(line); | |||
} | } | |||
if (status == ARES_SUCCESS) | if (status == ARES_SUCCESS) | |||
status = ARES_EOF; | status = ARES_EOF; | |||
else | else | |||
/* Catch the case when all the above checks fail (which happens when there | /* Catch the case when all the above checks fail (which happens when there | |||
is no network card or the cable is unplugged) */ | is no network card or the cable is unplugged) */ | |||
status = ARES_EFILE; | status = ARES_EFILE; | |||
#elif defined(__MVS__) | ||||
struct __res_state *res = 0; | ||||
int count4, count6; | ||||
__STATEEXTIPV6 *v6; | ||||
struct server_state *pserver | ||||
if (0 == res) { | ||||
int rc = res_init(); | ||||
while (rc == -1 && h_errno == TRY_AGAIN) { | ||||
rc = res_init(); | ||||
} | ||||
if (rc == -1) { | ||||
return ARES_ENOMEM; | ||||
} | ||||
res = __res(); | ||||
} | ||||
v6 = res->__res_extIPv6; | ||||
count4 = res->nscount; | ||||
if (v6) { | ||||
count6 = v6->__stat_nscount; | ||||
} else { | ||||
count6 = 0; | ||||
} | ||||
nservers = count4 + count6; | ||||
servers = ares_malloc(nservers * sizeof(struct server_state)); | ||||
if (!servers) | ||||
return ARES_ENOMEM; | ||||
memset(servers, 0, nservers * sizeof(struct server_state)); | ||||
pserver = servers; | ||||
for (int i = 0; i < count4; ++i, ++pserver) { | ||||
struct sockaddr_in *addr_in = &(res->nsaddr_list[i]); | ||||
pserver->addr.addrV4.s_addr = addr_in->sin_addr.s_addr; | ||||
pserver->addr.family = AF_INET; | ||||
pserver->addr.udp_port = addr_in->sin_port; | ||||
pserver->addr.tcp_port = addr_in->sin_port; | ||||
} | ||||
for (int j = 0; j < count6; ++j, ++pserver) { | ||||
struct sockaddr_in6 *addr_in = &(v6->__stat_nsaddr_list[j]); | ||||
memcpy(&(pserver->addr.addr.addr6), &(addr_in->sin6_addr), | ||||
sizeof(addr_in->sin6_addr)); | ||||
pserver->addr.family = AF_INET6; | ||||
pserver->addr.udp_port = addr_in->sin6_port; | ||||
pserver->addr.tcp_port = addr_in->sin6_port; | ||||
} | ||||
status = ARES_EOF; | ||||
#elif defined(__riscos__) | #elif defined(__riscos__) | |||
/* Under RISC OS, name servers are listed in the | /* Under RISC OS, name servers are listed in the | |||
system variable Inet$Resolvers, space separated. */ | system variable Inet$Resolvers, space separated. */ | |||
line = getenv("Inet$Resolvers"); | line = getenv("Inet$Resolvers"); | |||
status = ARES_EOF; | status = ARES_EOF; | |||
if (line) { | if (line) { | |||
char *resolvers = ares_strdup(line), *pos, *space; | char *resolvers = ares_strdup(line), *pos, *space; | |||
skipping to change at line 1624 | skipping to change at line 1668 | |||
if (config_status != ARES_SUCCESS) { | if (config_status != ARES_SUCCESS) { | |||
status = config_status; | status = config_status; | |||
break; | break; | |||
} | } | |||
} | } | |||
} | } | |||
if (channel->ndomains == -1) { | if (channel->ndomains == -1) { | |||
int entries = 0; | int entries = 0; | |||
while ((entries < MAXDNSRCH) && res.dnsrch[entries]) | while ((entries < MAXDNSRCH) && res.dnsrch[entries]) | |||
entries++; | entries++; | |||
if(entries) { | ||||
channel->domains = ares_malloc(entries * sizeof(char *)); | channel->domains = ares_malloc(entries * sizeof(char *)); | |||
if (!channel->domains) { | if (!channel->domains) { | |||
status = ARES_ENOMEM; | status = ARES_ENOMEM; | |||
} else { | } else { | |||
int i; | int i; | |||
channel->ndomains = entries; | channel->ndomains = entries; | |||
for (i = 0; i < channel->ndomains; ++i) { | for (i = 0; i < channel->ndomains; ++i) { | |||
channel->domains[i] = ares_strdup(res.dnsrch[i]); | channel->domains[i] = ares_strdup(res.dnsrch[i]); | |||
if (!channel->domains[i]) | if (!channel->domains[i]) | |||
status = ARES_ENOMEM; | status = ARES_ENOMEM; | |||
} | ||||
} | } | |||
} | } | |||
} | } | |||
if (channel->ndots == -1) | if (channel->ndots == -1) | |||
channel->ndots = res.ndots; | channel->ndots = res.ndots; | |||
if (channel->tries == -1) | if (channel->tries == -1) | |||
channel->tries = res.retry; | channel->tries = res.retry; | |||
if (channel->rotate == -1) | if (channel->rotate == -1) | |||
channel->rotate = res.options & RES_ROTATE; | channel->rotate = res.options & RES_ROTATE; | |||
if (channel->timeout == -1) | if (channel->timeout == -1) | |||
skipping to change at line 2473 | skipping to change at line 2518 | |||
int counter=0; | int counter=0; | |||
#ifdef WIN32 | #ifdef WIN32 | |||
BOOLEAN res; | BOOLEAN res; | |||
if (ares_fpSystemFunction036) | if (ares_fpSystemFunction036) | |||
{ | { | |||
res = (*ares_fpSystemFunction036) (key, key_data_len); | res = (*ares_fpSystemFunction036) (key, key_data_len); | |||
if (res) | if (res) | |||
randomized = 1; | randomized = 1; | |||
} | } | |||
#else /* !WIN32 */ | #else /* !WIN32 */ | |||
#ifdef RANDOM_FILE | #ifdef CARES_RANDOM_FILE | |||
FILE *f = fopen(RANDOM_FILE, "rb"); | FILE *f = fopen(CARES_RANDOM_FILE, "rb"); | |||
if(f) { | if(f) { | |||
setvbuf(f, NULL, _IONBF, 0); | ||||
counter = aresx_uztosi(fread(key, 1, key_data_len, f)); | counter = aresx_uztosi(fread(key, 1, key_data_len, f)); | |||
fclose(f); | fclose(f); | |||
} | } | |||
#endif | #endif | |||
#endif /* WIN32 */ | #endif /* WIN32 */ | |||
if (!randomized) { | if (!randomized) { | |||
for (;counter<key_data_len;counter++) | for (;counter<key_data_len;counter++) | |||
key[counter]=(unsigned char)(rand() % 256); /* LCOV_EXCL_LINE */ | key[counter]=(unsigned char)(rand() % 256); /* LCOV_EXCL_LINE */ | |||
} | } | |||
End of changes. 5 change blocks. | ||||
21 lines changed or deleted | 67 lines changed or added |