* respect DO_HOST_LOOKUP config option

--HG--
extra : convert_revision : ab193dd162b03bdd935759fa667ff394a5e29734
This commit is contained in:
Matt Johnston 2005-02-28 10:15:16 +00:00
parent 6013d993b9
commit 03d78bbb31
2 changed files with 8 additions and 4 deletions

View File

@ -397,6 +397,11 @@ char* getaddrhostname(struct sockaddr_storage * addr) {
char sbuf[NI_MAXSERV]; char sbuf[NI_MAXSERV];
int ret; int ret;
unsigned int len; 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); len = sizeof(struct sockaddr_storage);
/* Some platforms such as Solaris 8 require that len is the length /* Some platforms such as Solaris 8 require that len is the length
@ -410,8 +415,9 @@ char* getaddrhostname(struct sockaddr_storage * addr) {
} }
#endif #endif
ret = getnameinfo((struct sockaddr*)addr, len, hbuf, sizeof(hbuf), ret = getnameinfo((struct sockaddr*)addr, len, hbuf, sizeof(hbuf),
sbuf, sizeof(sbuf), NI_NUMERICSERV); sbuf, sizeof(sbuf), flags);
if (ret != 0) { if (ret != 0) {
/* On some systems (Darwin does it) we get EINTR from getnameinfo /* On some systems (Darwin does it) we get EINTR from getnameinfo

View File

@ -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 */ * if the random number source isn't good. In general this isn't required */
/* #define DSS_PROTOK */ /* #define DSS_PROTOK */
/* Whether to do reverse DNS lookups. This is advisable, though will add /* Whether to do reverse DNS lookups. */
* code size with gethostbyname() etc, so for very small environments where
* you are statically linking, you might want to undefine this */
#define DO_HOST_LOOKUP #define DO_HOST_LOOKUP
/* Whether to print the message of the day (MOTD). This doesn't add much code /* Whether to print the message of the day (MOTD). This doesn't add much code