X-Git-Url: https://git.saurik.com/apple/libinfo.git/blobdiff_plain/3e81ae21a7e2c2e07f2acbb16c9e9d1fd4a15b62..84e6ee29846bd48cc36d74aeb5c13c52a59c5a55:/dns.subproj/res_send.c?ds=sidebyside diff --git a/dns.subproj/res_send.c b/dns.subproj/res_send.c index 7be2204..d6cf0f5 100644 --- a/dns.subproj/res_send.c +++ b/dns.subproj/res_send.c @@ -78,7 +78,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93"; -static char rcsid[] = "$Id: res_send.c,v 1.2.202.1 2002/11/06 17:30:17 majka Exp $"; +static char rcsid[] = "$Id: res_send.c,v 1.6 2003/02/18 17:29:25 majka Exp $"; #endif /* LIBC_SCCS and not lint */ /* change this to "0" @@ -97,7 +97,7 @@ static char rcsid[] = "$Id: res_send.c,v 1.2.202.1 2002/11/06 17:30:17 majka Exp #include #include #include -#include +#include #include #include #include @@ -105,7 +105,7 @@ static char rcsid[] = "$Id: res_send.c,v 1.2.202.1 2002/11/06 17:30:17 majka Exp #include #include #include -#include +#include #if defined(BSD) && (BSD >= 199306) # include # include @@ -186,8 +186,6 @@ static int vc = 0; /* is the socket a virtual ciruit? */ } #endif -extern struct __res_state _res_shadow; - static res_send_qhook Qhook = NULL; static res_send_rhook Rhook = NULL; @@ -313,26 +311,6 @@ res_queriesmatch(buf1, eom1, buf2, eom2) return (1); } -static int res_using_defaults() -{ - int i; - - if (_res.nscount != _res_shadow.nscount) - return 0; - - for (i = 0; i < _res.nscount; i++) { - /* Check that the address and port have not changed */ - if ((_res.nsaddr_list[i].sin_addr.s_addr != - _res_shadow.nsaddr_list[i].sin_addr.s_addr) || - (_res.nsaddr_list[i].sin_port != - _res_shadow.nsaddr_list[i].sin_port)) { - return 0; - } - } - - return 1; -} - /* Returns whether a dns encoded name should be sent to multicast or not */ static int dns_is_local_name(const u_int8_t *name) { @@ -340,7 +318,9 @@ static int dns_is_local_name(const u_int8_t *name) const u_int8_t *d1 = NULL; // Second-Level Domain const u_int8_t *d2 = NULL; // etc. const u_int8_t *d3 = NULL; - + + if (name == NULL) return 0; + while (*name) { d3 = d2; @@ -418,8 +398,7 @@ res_send(buf, buflen, ans, anssiz) terrno = ETIMEDOUT; badns = 0; - if (res_using_defaults() && - dns_is_local_name((u_int8_t*)(buf + DNS_HEADER_SIZE))) { + if (dns_is_local_name((u_int8_t*)(buf + DNS_HEADER_SIZE))) { multicast = 1; v_circuit = 0; } else { @@ -605,7 +584,7 @@ res_send(buf, buflen, ans, anssiz) struct timeval timeout; fd_set dsmask; struct sockaddr_in from; - int fromlen; + unsigned int fromlen; if ((s < 0) || vc) { if (vc)