Lines 58-82
Link Here
|
58 |
|
58 |
|
59 |
int dns_query_rr_a(const res_state statp, char *fmt, ...) |
59 |
int dns_query_rr_a(const res_state statp, char *fmt, ...) |
60 |
{ va_list vl; |
60 |
{ va_list vl; |
61 |
int x,rc = 0; |
61 |
int x, haveRR = 0; |
62 |
char *hn = NULL; |
62 |
char *hostName = NULL; |
63 |
|
63 |
|
64 |
va_start(vl,fmt); |
64 |
va_start(vl,fmt); |
65 |
if(fmt != NULL && *fmt) |
65 |
if(fmt != NULL && *fmt) |
66 |
{ |
66 |
{ |
67 |
x = vasprintf(&hn,fmt,vl); |
67 |
x = vasprintf(&hostName,fmt,vl); |
68 |
if(hn != NULL && x > 0) |
68 |
if(hostName != NULL && x > 0) |
69 |
{ u_char packet[NS_PACKETSZ]; |
69 |
{ u_char ns_packet[NS_PACKETSZ]; |
70 |
|
70 |
|
71 |
rc = (res_nquery(statp, hn,ns_c_in,ns_t_a,packet,sizeof(packet)) == -1 ? 0 : 1); |
71 |
haveRR = (res_nquery(statp, hostName, ns_c_in, ns_t_a, ns_packet, sizeof(ns_packet)) == -1 ? 0 : 1); |
72 |
} |
72 |
} |
73 |
|
73 |
|
74 |
if(hn != NULL) |
74 |
if(hostName != NULL) |
75 |
free(hn); |
75 |
free(hostName); |
76 |
} |
76 |
} |
77 |
va_end(vl); |
77 |
va_end(vl); |
78 |
|
78 |
|
79 |
return(rc); |
79 |
return haveRR; |
|
|
80 |
} |
81 |
|
82 |
int dns_query_rr_aaaa(const res_state statp, char *fmt, ...) |
83 |
{ va_list vl; |
84 |
int x, haveRR = 0; |
85 |
char *hostName = NULL; |
86 |
|
87 |
va_start(vl,fmt); |
88 |
if(fmt != NULL && *fmt) |
89 |
{ |
90 |
x = vasprintf(&hostName,fmt,vl); |
91 |
if(hostName != NULL && x > 0) |
92 |
{ u_char ns_packet[NS_PACKETSZ]; |
93 |
|
94 |
haveRR = (res_nquery(statp, hostName, ns_c_in, ns_t_aaaa, ns_packet, sizeof(ns_packet)) == -1 ? 0 : 1); |
95 |
} |
96 |
|
97 |
if(hostName != NULL) |
98 |
free(hostName); |
99 |
} |
100 |
va_end(vl); |
101 |
|
102 |
return haveRR; |
80 |
} |
103 |
} |
81 |
|
104 |
|
82 |
int dns_rdnsbl_has_rr_a(const res_state statp, long ip, char *domain) |
105 |
int dns_rdnsbl_has_rr_a(const res_state statp, long ip, char *domain) |