-
-int is_ip_alias(const char *name1,const char *name2)
-/* Given two hostnames as arguments, returns TRUE if they
+#include "getaddrinfo.h"
+
+#define MX_RETRIES 3
+
+typedef unsigned char address_t[sizeof (struct in_addr)];
+
+#ifdef HAVE_RES_SEARCH
+static int getaddresses(struct addrinfo **result, const char *name)
+{
+ struct addrinfo hints;
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_socktype=SOCK_STREAM;
+ hints.ai_protocol=PF_UNSPEC;
+ hints.ai_family=AF_UNSPEC;
+ return fm_getaddrinfo(name, NULL, &hints, result);
+}
+
+/* XXX FIXME: doesn't detect if an IPv6-mapped IPv4 address
+ * matches a real IPv4 address */
+static int compareaddr(const struct addrinfo *a1, const struct addrinfo *a2)
+{
+ if (a1->ai_family != a2->ai_family) return FALSE;
+ if (a1->ai_addrlen != a2->ai_addrlen) return FALSE;
+ return (!memcmp(a1->ai_addr, a2->ai_addr, a1->ai_addrlen));
+}
+
+static int is_ip_alias(const char *name1,const char *name2)
+/*
+ * Given two hostnames as arguments, returns TRUE if they