- if (reverse_resolve &&
- inet_aton((const char *) rep->r_client, &addr) &&
- (he = gethostbyaddr(&addr, sizeof(addr), AF_INET)))
- m->ml_hostname = strdup(he->h_name);
- else
+ if (reverse_resolve) {
+ struct addrinfo *ai;
+ ai = host_pton(rep->r_client);
+ if (ai != NULL) {
+ m->ml_hostname = host_canonname(ai->ai_addr);
+ freeaddrinfo(ai);
+ }
+ }
+ if (m->ml_hostname == NULL)