[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rsh, getaddrinfo problems on AIX 5.1



On Sat, 8 May 2004, Niklas Edmundsson wrote:

> Anyhow, has anyone made a fix for it? I suspect the right way is to
> add an additional check in cf/broken-getaddrinfo.m4, I could try to
> whip up a patch if noone else is up to it.

I interpret no response as noone has cared to fix it, so here's a
patch that detects the broken feature in getaddrinfo on AIX 4.3.3 and
AIX 5.1 at least. It doesn't think Solaris 8 and modern Linuxes is
broken, so I guess it really works :)

Applying this patch and doing an autoreconf on AIX 5.1 I got a working
rsh binary, so please apply this or something equivalent to heimdal.

---------------------8<----------------------------
diff -wru ../dist/cf/broken-getaddrinfo.m4 cf/broken-getaddrinfo.m4
--- ../dist/cf/broken-getaddrinfo.m4	2004-04-01 09:27:32.000000000 +0200
+++ cf/broken-getaddrinfo.m4	2004-05-12 20:36:57.000000000 +0200
@@ -21,4 +21,24 @@
 		return 1;
 	return 0;
 }
-]], ac_cv_func_getaddrinfo_numserv=yes, ac_cv_func_getaddrinfo_numserv=no))])
+]], ac_cv_func_getaddrinfo_numserv=yes, ac_cv_func_getaddrinfo_numserv=no))
+
+AC_CACHE_CHECK([if getaddrinfo handles 0 as numeric service correctly], ac_cv_func_getaddrinfo_numzero,
+AC_TRY_RUN([[#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+
+int
+main(int argc, char **argv)
+{
+	struct addrinfo hints, *ai;
+	memset(&hints, 0, sizeof(hints));
+	hints.ai_flags = AI_PASSIVE;
+	hints.ai_socktype = SOCK_STREAM;
+	hints.ai_family = PF_UNSPEC;
+	if(getaddrinfo(NULL, "0", &hints, &ai) != 0)
+		return 1;
+	return 0;
+}
+]], ac_cv_func_getaddrinfo_numzero=yes, ac_cv_func_getaddrinfo_numzero=no))])
diff -wru ../dist/cf/roken-frag.m4 cf/roken-frag.m4
--- ../dist/cf/roken-frag.m4	2004-04-01 09:27:35.000000000 +0200
+++ cf/roken-frag.m4	2004-05-12 20:49:33.000000000 +0200
@@ -433,7 +433,7 @@

 if test "$ac_cv_func_getaddrinfo" = "yes"; then
   rk_BROKEN_GETADDRINFO
-  if test "$ac_cv_func_getaddrinfo_numserv" = no; then
+  if test "$ac_cv_func_getaddrinfo_numserv" = no || test "$ac_cv_func_getaddrinfo_numzero" = no; then
 	AC_LIBOBJ(getaddrinfo)
 	AC_LIBOBJ(freeaddrinfo)
   fi
---------------------8<----------------------------


/Nikke
-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 Niklas Edmundsson, Admin @ {acc,hpc2n,ing}.umu.se    |   nikke@acc.umu.se
---------------------------------------------------------------------------
 "You do have your moments.  Not many, but you have them." - Leia
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=