diff --git a/dbutil.c b/dbutil.c index 3ead97909b68a6444bee552bd8cce637cbc6cba3..fbe170d532684bac835d62fbd9d2e0220de1ee0e 100644 --- a/dbutil.c +++ b/dbutil.c @@ -397,6 +397,11 @@ char* getaddrhostname(struct sockaddr_storage * addr) { char sbuf[NI_MAXSERV]; int ret; unsigned int len; +#ifdef DO_HOST_LOOKUP + const int flags = NI_NUMERICSERV; +#else + const int flags = NI_NUMERICHOST | NI_NUMERICSERV; +#endif len = sizeof(struct sockaddr_storage); /* Some platforms such as Solaris 8 require that len is the length @@ -410,8 +415,9 @@ char* getaddrhostname(struct sockaddr_storage * addr) { } #endif + ret = getnameinfo((struct sockaddr*)addr, len, hbuf, sizeof(hbuf), - sbuf, sizeof(sbuf), NI_NUMERICSERV); + sbuf, sizeof(sbuf), flags); if (ret != 0) { /* On some systems (Darwin does it) we get EINTR from getnameinfo diff --git a/options.h b/options.h index 11e7db1faee6f3067c8cc419c7b3b62ef8b65dd5..1dfb73878d0552cb9d6dd5294e1e70f674681e16 100644 --- a/options.h +++ b/options.h @@ -96,9 +96,7 @@ etc) slower (perhaps by 50%). Recommended for most small systems. */ * if the random number source isn't good. In general this isn't required */ /* #define DSS_PROTOK */ -/* Whether to do reverse DNS lookups. This is advisable, though will add - * code size with gethostbyname() etc, so for very small environments where - * you are statically linking, you might want to undefine this */ +/* Whether to do reverse DNS lookups. */ #define DO_HOST_LOOKUP /* Whether to print the message of the day (MOTD). This doesn't add much code