summaryrefslogtreecommitdiff
path: root/ares_parse_ptr_reply.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-10-06 07:50:18 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-10-06 07:50:18 +0000
commit3e748f4b50224e43b916dda5de438c785bdcd49d (patch)
tree53bbfe3dae88be1fd482d3fc392cd1465214f4f3 /ares_parse_ptr_reply.c
parent47bd7d7548103c44b466fceb1dbda425ce8774bc (diff)
downloadc-ares-3e748f4b50224e43b916dda5de438c785bdcd49d.tar.gz
c-ares-3e748f4b50224e43b916dda5de438c785bdcd49d.tar.bz2
c-ares-3e748f4b50224e43b916dda5de438c785bdcd49d.zip
removed tabs and trailing whitespace from source
Diffstat (limited to 'ares_parse_ptr_reply.c')
-rw-r--r--ares_parse_ptr_reply.c110
1 files changed, 55 insertions, 55 deletions
diff --git a/ares_parse_ptr_reply.c b/ares_parse_ptr_reply.c
index 888b029..20df411 100644
--- a/ares_parse_ptr_reply.c
+++ b/ares_parse_ptr_reply.c
@@ -32,7 +32,7 @@
#include "ares_private.h"
int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
- int addrlen, int family, struct hostent **host)
+ int addrlen, int family, struct hostent **host)
{
unsigned int qdcount, ancount;
int status, i, rr_type, rr_class, rr_len;
@@ -73,47 +73,47 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
/* Decode the RR up to the data field. */
status = ares_expand_name(aptr, abuf, alen, &rr_name, &len);
if (status != ARES_SUCCESS)
- break;
+ break;
aptr += len;
if (aptr + RRFIXEDSZ > abuf + alen)
- {
- status = ARES_EBADRESP;
- break;
- }
+ {
+ status = ARES_EBADRESP;
+ break;
+ }
rr_type = DNS_RR_TYPE(aptr);
rr_class = DNS_RR_CLASS(aptr);
rr_len = DNS_RR_LEN(aptr);
aptr += RRFIXEDSZ;
if (rr_class == C_IN && rr_type == T_PTR
- && strcasecmp(rr_name, ptrname) == 0)
- {
- /* Decode the RR data and set hostname to it. */
- status = ares_expand_name(aptr, abuf, alen, &rr_data, &len);
- if (status != ARES_SUCCESS)
- break;
- if (hostname)
- free(hostname);
- hostname = rr_data;
- }
+ && strcasecmp(rr_name, ptrname) == 0)
+ {
+ /* Decode the RR data and set hostname to it. */
+ status = ares_expand_name(aptr, abuf, alen, &rr_data, &len);
+ if (status != ARES_SUCCESS)
+ break;
+ if (hostname)
+ free(hostname);
+ hostname = rr_data;
+ }
if (rr_class == C_IN && rr_type == T_CNAME)
- {
- /* Decode the RR data and replace ptrname with it. */
- status = ares_expand_name(aptr, abuf, alen, &rr_data, &len);
- if (status != ARES_SUCCESS)
- break;
- free(ptrname);
- ptrname = rr_data;
- }
+ {
+ /* Decode the RR data and replace ptrname with it. */
+ status = ares_expand_name(aptr, abuf, alen, &rr_data, &len);
+ if (status != ARES_SUCCESS)
+ break;
+ free(ptrname);
+ ptrname = rr_data;
+ }
free(rr_name);
aptr += rr_len;
if (aptr > abuf + alen)
- {
- status = ARES_EBADRESP;
- break;
- }
+ {
+ status = ARES_EBADRESP;
+ break;
+ }
}
if (status == ARES_SUCCESS && !hostname)
@@ -123,33 +123,33 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
/* We got our answer. Allocate memory to build the host entry. */
hostent = malloc(sizeof(struct hostent));
if (hostent)
- {
- hostent->h_addr_list = malloc(2 * sizeof(char *));
- if (hostent->h_addr_list)
- {
- hostent->h_addr_list[0] = malloc(addrlen);
- if (hostent->h_addr_list[0])
- {
- hostent->h_aliases = malloc(sizeof (char *));
- if (hostent->h_aliases)
- {
- /* Fill in the hostent and return successfully. */
- hostent->h_name = hostname;
- hostent->h_aliases[0] = NULL;
- hostent->h_addrtype = family;
- hostent->h_length = addrlen;
- memcpy(hostent->h_addr_list[0], addr, addrlen);
- hostent->h_addr_list[1] = NULL;
- *host = hostent;
- free(ptrname);
- return ARES_SUCCESS;
- }
- free(hostent->h_addr_list[0]);
- }
- free(hostent->h_addr_list);
- }
- free(hostent);
- }
+ {
+ hostent->h_addr_list = malloc(2 * sizeof(char *));
+ if (hostent->h_addr_list)
+ {
+ hostent->h_addr_list[0] = malloc(addrlen);
+ if (hostent->h_addr_list[0])
+ {
+ hostent->h_aliases = malloc(sizeof (char *));
+ if (hostent->h_aliases)
+ {
+ /* Fill in the hostent and return successfully. */
+ hostent->h_name = hostname;
+ hostent->h_aliases[0] = NULL;
+ hostent->h_addrtype = family;
+ hostent->h_length = addrlen;
+ memcpy(hostent->h_addr_list[0], addr, addrlen);
+ hostent->h_addr_list[1] = NULL;
+ *host = hostent;
+ free(ptrname);
+ return ARES_SUCCESS;
+ }
+ free(hostent->h_addr_list[0]);
+ }
+ free(hostent->h_addr_list);
+ }
+ free(hostent);
+ }
status = ARES_ENOMEM;
}
if (hostname)