SHA256
3
0
forked from pool/tcpd
tcpd/tcp_wrappers_7.6-fedora-fixgethostbyname.diff

26 lines
658 B
Diff
Raw Normal View History

--- socket.c.orig
+++ socket.c
@@ -54,6 +54,7 @@ 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
@@ -63,8 +64,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));
}
}