- strlcpy( hostname, h->h_name, sizeof( hostname ));
-
- h = gethostbyname( hostname );
- if ( h ) {
- if (memcmp(h->h_addr, &Addr->sin_addr, sizeof (struct in_addr))) {
- addr = (struct in_addr*) h->h_addr;
- strlcpy(ipstr, inet_ntoa(*addr), sizeof ipstr);
- Log(LOG_WARNING,"Possible forgery: %s resolved to %s (which is at ip %s!)",
- inet_ntoa( Addr->sin_addr), hostname, ipstr);
- strlcpy( hostname, inet_ntoa( Addr->sin_addr ), sizeof( hostname ));
- }
- } else {
- Log(LOG_WARNING, "Possible forgery: %s resolved to %s (which has no ip address)",
- inet_ntoa( Addr->sin_addr ), hostname);
- strlcpy( hostname, inet_ntoa( Addr->sin_addr ), sizeof( hostname ));
- }
- }
- Log_Resolver( LOG_DEBUG, "Ok, translated %s to \"%s\".", inet_ntoa( Addr->sin_addr ), hostname );
-
- /* Write resolver result into pipe to parent */
- len = strlen( hostname );
- hostname[len] = '\n'; len++;
- if( (size_t)write( w_fd, hostname, len ) != (size_t)len )
- {
- Log_Resolver( LOG_CRIT, "Resolver: Can't write to parent: %s!", strerror( errno ));
- close( w_fd );
- return;