version 1.143, 2019/11/25 00:54:23 |
version 1.144, 2019/12/16 13:58:53 |
|
|
if (getpeername(ssh_packet_get_connection_in(ssh), |
if (getpeername(ssh_packet_get_connection_in(ssh), |
(struct sockaddr *)&from, &fromlen) == -1) { |
(struct sockaddr *)&from, &fromlen) == -1) { |
debug("getpeername failed: %.100s", strerror(errno)); |
debug("getpeername failed: %.100s", strerror(errno)); |
return strdup(ntop); |
return xstrdup(ntop); |
} |
} |
|
|
debug3("Trying to reverse map address %.100s.", ntop); |
debug3("Trying to reverse map address %.100s.", ntop); |
|
|
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. */ |
return strdup(ntop); |
return xstrdup(ntop); |
} |
} |
|
|
/* |
/* |
|
|
logit("Nasty PTR record \"%s\" is set up for %s, ignoring", |
logit("Nasty PTR record \"%s\" is set up for %s, ignoring", |
name, ntop); |
name, ntop); |
freeaddrinfo(ai); |
freeaddrinfo(ai); |
return strdup(ntop); |
return xstrdup(ntop); |
} |
} |
|
|
/* Names are stored in lowercase. */ |
/* Names are stored in lowercase. */ |
|
|
if (getaddrinfo(name, NULL, &hints, &aitop) != 0) { |
if (getaddrinfo(name, NULL, &hints, &aitop) != 0) { |
logit("reverse mapping checking getaddrinfo for %.700s " |
logit("reverse mapping checking getaddrinfo for %.700s " |
"[%s] failed.", name, ntop); |
"[%s] failed.", name, ntop); |
return strdup(ntop); |
return xstrdup(ntop); |
} |
} |
/* Look for the address from the list of addresses. */ |
/* Look for the address from the list of addresses. */ |
for (ai = aitop; ai; ai = ai->ai_next) { |
for (ai = aitop; ai; ai = ai->ai_next) { |
|
|
/* Address not found for the host name. */ |
/* Address not found for the host name. */ |
logit("Address %.100s maps to %.600s, but this does not " |
logit("Address %.100s maps to %.600s, but this does not " |
"map back to the address.", ntop, name); |
"map back to the address.", ntop, name); |
return strdup(ntop); |
return xstrdup(ntop); |
} |
} |
return strdup(name); |
return xstrdup(name); |
} |
} |
|
|
/* |
/* |