"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/lib/ares_parse_ns_reply.c" between
c-ares-1.17.1.tar.gz and c-ares-1.17.2.tar.gz

About: c-ares is a C library for asynchronous DNS requests (including name resolves).

ares_parse_ns_reply.c  (c-ares-1.17.1):ares_parse_ns_reply.c  (c-ares-1.17.2)
skipping to change at line 32 skipping to change at line 32
#ifdef HAVE_NETINET_IN_H #ifdef HAVE_NETINET_IN_H
# include <netinet/in.h> # include <netinet/in.h>
#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 <arpa/nameser.h> #include "ares_nameser.h"
#else
# include "nameser.h"
#endif
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
# include <arpa/nameser_compat.h>
#endif
#include "ares.h" #include "ares.h"
#include "ares_dns.h" #include "ares_dns.h"
#include "ares_private.h" #include "ares_private.h"
int ares_parse_ns_reply( const unsigned char* abuf, int alen, int ares_parse_ns_reply( const unsigned char* abuf, int alen,
struct hostent** host ) struct hostent** host )
{ {
unsigned int qdcount, ancount; unsigned int qdcount, ancount;
int status, i, rr_type, rr_class, rr_len; int status, i, rr_type, rr_class, rr_len;
skipping to change at line 71 skipping to change at line 65
return ARES_EBADRESP; return ARES_EBADRESP;
/* Fetch the question and answer count from the header. */ /* Fetch the question and answer count from the header. */
qdcount = DNS_HEADER_QDCOUNT( abuf ); qdcount = DNS_HEADER_QDCOUNT( abuf );
ancount = DNS_HEADER_ANCOUNT( abuf ); ancount = DNS_HEADER_ANCOUNT( abuf );
if ( qdcount != 1 ) if ( qdcount != 1 )
return ARES_EBADRESP; return ARES_EBADRESP;
/* Expand the name from the question, and skip past the question. */ /* Expand the name from the question, and skip past the question. */
aptr = abuf + HFIXEDSZ; aptr = abuf + HFIXEDSZ;
status = ares__expand_name_for_response( aptr, abuf, alen, &hostname, &len); status = ares__expand_name_for_response( aptr, abuf, alen, &hostname, &len, 0) ;
if ( status != ARES_SUCCESS ) if ( status != ARES_SUCCESS )
return status; return status;
if ( aptr + len + QFIXEDSZ > abuf + alen ) if ( aptr + len + QFIXEDSZ > abuf + alen )
{ {
ares_free( hostname ); ares_free( hostname );
return ARES_EBADRESP; return ARES_EBADRESP;
} }
aptr += len + QFIXEDSZ; aptr += len + QFIXEDSZ;
/* Allocate nameservers array; ancount gives an upper bound */ /* Allocate nameservers array; ancount gives an upper bound */
skipping to change at line 94 skipping to change at line 88
{ {
ares_free( hostname ); ares_free( hostname );
return ARES_ENOMEM; return ARES_ENOMEM;
} }
nameservers_num = 0; nameservers_num = 0;
/* Examine each answer resource record (RR) in turn. */ /* Examine each answer resource record (RR) in turn. */
for ( i = 0; i < ( int ) ancount; i++ ) for ( i = 0; i < ( int ) ancount; i++ )
{ {
/* Decode the RR up to the data field. */ /* Decode the RR up to the data field. */
status = ares__expand_name_for_response( aptr, abuf, alen, &rr_name, &len ); status = ares__expand_name_for_response( aptr, abuf, alen, &rr_name, &len, 0 );
if ( status != ARES_SUCCESS ) if ( status != ARES_SUCCESS )
break; break;
aptr += len; aptr += len;
if ( aptr + RRFIXEDSZ > abuf + alen ) if ( aptr + RRFIXEDSZ > abuf + alen )
{ {
status = ARES_EBADRESP; status = ARES_EBADRESP;
ares_free(rr_name); ares_free(rr_name);
break; break;
} }
rr_type = DNS_RR_TYPE( aptr ); rr_type = DNS_RR_TYPE( aptr );
skipping to change at line 119 skipping to change at line 113
{ {
ares_free(rr_name); ares_free(rr_name);
status = ARES_EBADRESP; status = ARES_EBADRESP;
break; break;
} }
if ( rr_class == C_IN && rr_type == T_NS ) if ( rr_class == C_IN && rr_type == T_NS )
{ {
/* Decode the RR data and add it to the nameservers list */ /* Decode the RR data and add it to the nameservers list */
status = ares__expand_name_for_response( aptr, abuf, alen, &rr_data, status = ares__expand_name_for_response( aptr, abuf, alen, &rr_data,
&len); &len, 1);
if ( status != ARES_SUCCESS ) if ( status != ARES_SUCCESS )
{ {
ares_free(rr_name); ares_free(rr_name);
break; break;
} }
nameservers[nameservers_num] = ares_malloc(strlen(rr_data)+1); nameservers[nameservers_num] = ares_malloc(strlen(rr_data)+1);
if (nameservers[nameservers_num]==NULL) if (nameservers[nameservers_num]==NULL)
{ {
 End of changes. 4 change blocks. 
11 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)