tcp_wrappers/tcp_wrappers-7.6-fixgethost...

29 lines
874 B
Diff

diff -up tcp_wrappers_7.6/socket.c.patch7 tcp_wrappers_7.6/socket.c
--- tcp_wrappers_7.6/socket.c.patch7 1997-03-21 19:27:25.000000000 +0100
+++ tcp_wrappers_7.6/socket.c 2008-08-29 09:45:12.000000000 +0200
@@ -52,7 +52,8 @@ static struct hostent *gethostbyname_dot
char *name;
{
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.
@@ -61,8 +62,12 @@ char *name;
if (strchr(name, '.') == 0 || strlen(name) >= MAXHOSTNAMELEN - 1) {
return (gethostbyname(name));
} else {
- sprintf(dot_name, "%s.", name);
- return (gethostbyname(dot_name));
+ sprintf(dot_name, "%s.", name);
+ hp = gethostbyname(dot_name);
+ if (hp)
+ return hp;
+ else
+ return (gethostbyname(name));
}
}