File u_xauth_Look-for-FamilyLocal-if-inet-or-inet6-addr.patch of Package xauth

--- gethost.c.orig	2010-09-04 01:04:27.000000000 +0200
+++ gethost.c	2012-01-10 17:57:22.072108000 +0100
@@ -318,16 +318,36 @@ struct addrlist *get_address_info (
 	for (ai = firstai; ai != NULL; ai = ai->ai_next) {
 	    struct addrlist *duplicate;
 
+	    len = 0;
 	    if (ai->ai_family == AF_INET) {
 		struct sockaddr_in *sin = (struct sockaddr_in *)ai->ai_addr;
 		src = &(sin->sin_addr);
-		len = sizeof(sin->sin_addr);
-		family = FamilyInternet;
+		if (*(in_addr_t *) src == htonl(INADDR_LOOPBACK)) {
+		    family = FamilyLocal;
+		    if(get_local_hostname (buf, sizeof buf, localhostname)) {
+			src = buf;
+			len = strlen (buf);
+		    } else
+			src = NULL;
+		} else {
+		    len = sizeof(sin->sin_addr);
+		    family = FamilyInternet;
+		}
 	    } else if (ai->ai_family == AF_INET6) {
 		struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)ai->ai_addr;
 		src = &(sin6->sin6_addr);
-		len = sizeof(sin6->sin6_addr);
-		family = FamilyInternet6;
+		if (IN6_IS_ADDR_V4MAPPED((struct sockaddr_in6 *)src)
+		    || IN6_IS_ADDR_LOOPBACK((struct sockaddr_in6 *)src)) {
+		    family = FamilyLocal;
+		    if (get_local_hostname (buf, sizeof buf, localhostname)) {
+			src = buf;
+			len = strlen (buf);
+		    } else
+			src = NULL;
+		} else {
+		    len = sizeof(sin6->sin6_addr);
+		    family = FamilyInternet6;
+		}
 	    }
 
 	    for(duplicate = retval; duplicate != NULL; duplicate = duplicate->next) {
@@ -366,7 +386,17 @@ struct addrlist *get_address_info (
 #else
 	if (!get_inet_address (host, &hostinetaddr)) return NULL;
 	src = (char *) &hostinetaddr;
-	len = 4; /* sizeof inaddr.sin_addr, would fail on Cray */
+	if (*(in_addr_t *) src == htonl(INADDR_LOOPBACK)) {
+	    family = FamilyLocal;
+	    if (get_local_hostname (buf, sizeof buf)) {
+		src = buf;
+		len = strlen (buf);
+	    } else {
+		len = 0;
+		src = NULL;
+	    }
+	} else
+	    len = 4; /* sizeof inaddr.sin_addr, would fail on Cray */
 	break;
 #endif /* IPv6 */
 #else