|
@@ -80,6 +80,7 @@
char *remote_ip = getenv("TCPREMOTEIP");
char *action = getenv("HELO_DNS_CHECK");
struct hostent* result;
+ int fIPv4 = 0;
if (!action) {
action = "";
@@ -101,11 +102,15 @@
return 0;
}
+ fIPv4 = (NULL == strchr(remote_ip, ':'));
/* init DNS library */
res_init();
/* check A record */
+ if (!fIPv4) {
+ _res.options |= RES_USE_INET6;
+ }
result = gethostbyname(helo_domain);
/* check if there is any result */
@@ -175,7 +180,11 @@
count=0;
while (result->h_addr_list[count] && (found==0)) {
addr=result->h_addr_list[count];
- inet_ntop(AF_INET, addr, print_address, 1000);
+ if (!fIPv4) {
+ inet_ntop(AF_INET6, addr, print_address, 1000);
+ } else {
+ inet_ntop(AF_INET, addr, print_address, 1000);
+ }
if (strcmp(print_address, remote_ip) == 0) {
found = 1;
};
|