tcp_wrappers/tcp_wrappers-7.6-fixgethost...

28 lines
826 B
Diff

--- tcp_wrappers_7.6-ipv6.4/socket.c.patch7 1999-10-27 15:23:14.000000000 +0200
+++ tcp_wrappers_7.6-ipv6.4/socket.c 2013-01-23 11:41:48.776857327 +0100
@@ -54,6 +54,8 @@ int af;
{
char dot_name[MAXHOSTNAMELEN + 1];
+ struct hostent *hp;
+
/*
* Don't append dots to unqualified names. Such names are likely to come
* from local hosts files or from NIS.
@@ -62,8 +64,13 @@ int af;
if (strchr(name, '.') == 0 || strlen(name) >= MAXHOSTNAMELEN - 1) {
return (tcpd_gethostbyname(name, af));
} else {
- sprintf(dot_name, "%s.", name);
- return (tcpd_gethostbyname(dot_name, af));
+ sprintf(dot_name, "%s.", name);
+ hp = tcpd_gethostbyname(dot_name, af);
+ if (hp)
+ return hp;
+
+ else
+ return tcpd_gethostbyname(name, af);
}
}