|
|
@@ -246,61 +246,3 @@ void call_ipbyhost(char *hostn, in_addr_t ip, int ok)
|
|
|
de = nde;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-/*
|
|
|
- * Async DNS emulation functions
|
|
|
- */
|
|
|
-
|
|
|
-void block_dns_hostbyip(in_addr_t ip)
|
|
|
-{
|
|
|
- struct hostent *hp = NULL;
|
|
|
- in_addr_t addr = htonl(ip);
|
|
|
- static char s[UHOSTLEN] = "";
|
|
|
-
|
|
|
- if (!setjmp(alarmret)) {
|
|
|
- alarm(resolve_timeout);
|
|
|
- hp = gethostbyaddr((char *) &addr, sizeof(addr), AF_INET);
|
|
|
- alarm(0);
|
|
|
- if (hp) {
|
|
|
- strncpyz(s, hp->h_name, sizeof s);
|
|
|
- } else
|
|
|
- strcpy(s, iptostr(addr));
|
|
|
- } else {
|
|
|
- hp = NULL;
|
|
|
- strcpy(s, iptostr(addr));
|
|
|
- }
|
|
|
- /* Call hooks. */
|
|
|
- call_hostbyip(ip, s, hp ? 1 : 0);
|
|
|
-}
|
|
|
-
|
|
|
-void block_dns_ipbyhost(char *host)
|
|
|
-{
|
|
|
- struct in_addr inaddr;
|
|
|
-
|
|
|
- /* Check if someone passed us an IP address as hostname
|
|
|
- * and return it straight away */
|
|
|
- if (egg_inet_aton(host, &inaddr)) {
|
|
|
- call_ipbyhost(host, ntohl(inaddr.s_addr), 1);
|
|
|
- return;
|
|
|
- }
|
|
|
- if (!setjmp(alarmret)) {
|
|
|
- struct hostent *hp = NULL;
|
|
|
- struct in_addr *in = NULL;
|
|
|
- in_addr_t ip = 0;
|
|
|
-
|
|
|
- alarm(resolve_timeout);
|
|
|
- hp = gethostbyname(host);
|
|
|
- alarm(0);
|
|
|
-
|
|
|
- if (hp) {
|
|
|
- in = (struct in_addr *) (hp->h_addr_list[0]);
|
|
|
- ip = (in_addr_t) (in->s_addr);
|
|
|
- call_ipbyhost(host, ntohl(ip), 1);
|
|
|
- return;
|
|
|
- }
|
|
|
- /* Fall through. */
|
|
|
- }
|
|
|
- call_ipbyhost(host, 0, 0);
|
|
|
-}
|
|
|
-
|