version 1.28, 2001/12/05 03:56:39 |
version 1.29, 2001/12/19 07:18:56 |
|
|
check_ip_options(socket, ntop); |
check_ip_options(socket, ntop); |
|
|
if (getnameinfo((struct sockaddr *)&from, fromlen, ntop, sizeof(ntop), |
if (getnameinfo((struct sockaddr *)&from, fromlen, ntop, sizeof(ntop), |
NULL, 0, NI_NUMERICHOST) != 0) |
NULL, 0, NI_NUMERICHOST) != 0) |
fatal("get_remote_hostname: getnameinfo NI_NUMERICHOST failed"); |
fatal("get_remote_hostname: getnameinfo NI_NUMERICHOST failed"); |
|
|
debug3("Trying to reverse map address %.100s.", ntop); |
debug3("Trying to reverse map address %.100s.", ntop); |
/* Map the IP address to a host name. */ |
/* Map the IP address to a host name. */ |
if (getnameinfo((struct sockaddr *)&from, fromlen, name, sizeof(name), |
if (getnameinfo((struct sockaddr *)&from, fromlen, name, sizeof(name), |
NULL, 0, NI_NAMEREQD) != 0) { |
NULL, 0, NI_NAMEREQD) != 0) { |
/* Host name not found. Use ip address. */ |
/* Host name not found. Use ip address. */ |
log("Could not reverse map address %.100s.", ntop); |
log("Could not reverse map address %.100s.", ntop); |
return xstrdup(ntop); |
return xstrdup(ntop); |
|
|
} |
} |
/* Get the address in ascii. */ |
/* Get the address in ascii. */ |
if (getnameinfo((struct sockaddr *)&addr, addrlen, ntop, sizeof(ntop), |
if (getnameinfo((struct sockaddr *)&addr, addrlen, ntop, sizeof(ntop), |
NULL, 0, flags) != 0) { |
NULL, 0, flags) != 0) { |
error("get_socket_ipaddr: getnameinfo %d failed", flags); |
error("get_socket_ipaddr: getnameinfo %d failed", flags); |
return NULL; |
return NULL; |
} |
} |
|
|
} |
} |
/* Return port number. */ |
/* Return port number. */ |
if (getnameinfo((struct sockaddr *)&from, fromlen, NULL, 0, |
if (getnameinfo((struct sockaddr *)&from, fromlen, NULL, 0, |
strport, sizeof(strport), NI_NUMERICSERV) != 0) |
strport, sizeof(strport), NI_NUMERICSERV) != 0) |
fatal("get_sock_port: getnameinfo NI_NUMERICSERV failed"); |
fatal("get_sock_port: getnameinfo NI_NUMERICSERV failed"); |
return atoi(strport); |
return atoi(strport); |
} |
} |