diff options
author | joe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845> | 2014-09-20 19:20:33 +0000 |
---|---|---|
committer | joe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845> | 2014-09-20 19:20:33 +0000 |
commit | 5a75eb422d3da6209d746d7cbe95afebe08ae55e (patch) | |
tree | 6115a780e22371133daf2f33760883af67b35bb0 | |
parent | 5985e0922b6ec719426d7d81aeeb7e8a822865e1 (diff) | |
download | neon-5a75eb422d3da6209d746d7cbe95afebe08ae55e.tar.gz |
* test/socket.c (addr_reverse): Succeed if returned name uses hostname as
prefix, and only warn for non-empty strings which don't match.
git-svn-id: http://svn.webdav.org/repos/projects/neon/trunk@1944 61a7d7f5-40b7-0310-9c16-bb0ea8cb1845
-rw-r--r-- | test/socket.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/test/socket.c b/test/socket.c index 94b67eb..76d26b6 100644 --- a/test/socket.c +++ b/test/socket.c @@ -374,6 +374,7 @@ static int addr_reverse(void) { ne_inet_addr *ia = ne_iaddr_make(ne_iaddr_ipv4, raw_127); char buf[128], *syshost = NULL; + int match; #ifdef HAVE_GETHOSTNAME char host[128]; @@ -388,10 +389,20 @@ static int addr_reverse(void) ONN("reverse lookup for 127.0.0.1 failed", ne_iaddr_reverse(ia, buf, sizeof buf) != 0); - ONV(!(strcmp(buf, "localhost.localdomain") == 0 - || strcmp(buf, "localhost") == 0 - || (syshost && strcmp(buf, syshost) == 0)), - ("reverse lookup for 127.0.0.1 got %s", buf)); + NE_DEBUG(NE_DBG_SOCKET, "Reverse lookup for 127.0.0.1 => %s\n", buf); + + match = strcmp(buf, "localhost.localdomain") == 0 + || strcmp(buf, "localhost") == 0; + + if (!match && syshost) + /* If the returned name has the system hostname as a prefix, that's + * good enough. */ + match = strncmp(buf, syshost, strlen(syshost)) == 0; + + if (!match) + t_warning("reverse lookup for 127.0.0.1 got '%s'", buf); + + ONN("reverse lookup for 127.0.0.1 got empty string", strlen(buf) == 0); ne_iaddr_free(ia); |