Blob Blame Raw
--- gdm-2.20.1-orig/common/gdm-common.c	2007-10-15 14:42:43.000000000 -0700
+++ gdm-2.20.1/common/gdm-common.c	2007-11-07 03:47:39.743191000 -0800
@@ -107,7 +107,7 @@
 	host [0] = '\0';
 	serv [0] = '\0';
 	getnameinfo ((const struct sockaddr *)ss,
-		     sizeof (struct sockaddr_storage),
+		     gdm_sockaddr_len(ss),
 		     host, sizeof (host),
 		     serv, sizeof (serv),
		     NI_NUMERICHOST | NI_NUMERICSERV);
--- gdm-2.20.1-orig/common/gdm-common.h	2007-10-15 14:42:43.000000000 -0700
+++ gdm-2.20.1/common/gdm-common.h	2007-11-07 03:39:21.170717000 -0800
@@ -38,6 +38,7 @@
 
 G_BEGIN_DECLS
 
+#define		gdm_sockaddr_len(sa)	(((struct sockaddr *)sa)->sa_family == AF_INET6 ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in))
 
 gboolean     gdm_address_equal        (struct sockaddr_storage *sa,
                                        struct sockaddr_storage *sb);
--- gdm-2.20.1-orig/daemon/gdm-xdmcp-manager.c	2007-10-15 14:43:04.000000000 -0700
+++ gdm-2.20.1/daemon/gdm-xdmcp-manager.c	2007-11-07 03:39:02.292252000 -0800
@@ -762,7 +762,7 @@
 	XdmcpFlush (manager->priv->socket_fd,
 		    &manager->priv->buf,
 		    (XdmcpNetaddr)clnt_sa,
-		    (int)sizeof (struct sockaddr_storage));
+		    (int)gdm_sockaddr_len(clnt_sa));
 
 	g_free (status.data);
 }
@@ -805,7 +805,7 @@
 	XdmcpFlush (manager->priv->socket_fd,
 		    &manager->priv->buf,
 		    (XdmcpNetaddr)clnt_sa,
-		    (int)sizeof (struct sockaddr_storage));
+		    (int)gdm_sockaddr_len(clnt_sa));
 
 	last_time = time (NULL);
 }
@@ -907,7 +907,7 @@
 	XdmcpFlush (manager->priv->socket_fd,
 		    &manager->priv->buf,
 		    (XdmcpNetaddr) sa,
-		    (int)sizeof (struct sockaddr_storage));
+		    (int)gdm_sockaddr_len(clnt_sa));
 
 	g_free (port.data);
 	g_free (address.data);
@@ -1435,7 +1435,7 @@
 	XdmcpFlush (manager->priv->socket_fd,
 		    &manager->priv->buf,
 		    (XdmcpNetaddr)clnt_sa,
-		    (int)sizeof (struct sockaddr_storage));
+		    (int)gdm_sockaddr_len(clnt_sa));
 
 	g_free (address.data);
 }
@@ -1507,7 +1507,7 @@
 	XdmcpFlush (manager->priv->socket_fd,
 		    &manager->priv->buf,
 		    (XdmcpNetaddr)clnt_sa,
-		    (int)sizeof (struct sockaddr_storage));
+		    (int)gdm_sockaddr_len(clnt_sa));
 }
 
 static void
@@ -1655,7 +1655,7 @@
 	XdmcpFlush (manager->priv->socket_fd,
 		    &manager->priv->buf,
 		    (XdmcpNetaddr)clnt_sa,
-		    (int)sizeof (struct sockaddr_storage));
+		    (int)gdm_sockaddr_len(clnt_sa));
 
 	/* Send MANAGED_FORWARD to indicate that the connection
 	 * reached some sort of resolution */
@@ -1805,7 +1805,7 @@
 	XdmcpFlush (manager->priv->socket_fd,
 		    &manager->priv->buf,
 		    (XdmcpNetaddr)clnt_sa,
-		    (int)sizeof (struct sockaddr_storage));
+		    (int)gdm_sockaddr_len(clnt_sa));
 
 	gdm_address_get_info (clnt_sa, &host, NULL);
 	g_debug ("XDMCP: Sending ACCEPT to %s with SessionID=%ld",
@@ -2107,7 +2107,7 @@
 	XdmcpFlush (manager->priv->socket_fd,
 		    &manager->priv->buf,
 		    (XdmcpNetaddr)clnt_sa,
-		    (int)sizeof (struct sockaddr_storage));
+		    (int)gdm_sockaddr_len(clnt_sa));
 }
 
 static void
@@ -2131,7 +2131,7 @@
 	XdmcpFlush (manager->priv->socket_fd,
 		    &manager->priv->buf,
 		    (XdmcpNetaddr)clnt_sa,
-		    (int)sizeof (struct sockaddr_storage));
+		    (int)gdm_sockaddr_len(clnt_sa));
 
 	/*
 	 * This was from a forwarded query quite apparently so
@@ -2384,7 +2384,7 @@
 	XdmcpFlush (manager->priv->socket_fd,
 		    &manager->priv->buf,
 		    (XdmcpNetaddr)clnt_sa,
-		    (int)sizeof (struct sockaddr_storage));
+		    (int)gdm_sockaddr_len(clnt_sa));
 }
 
 static void
--- gdm-2.20.1-orig/daemon/misc.c	2007-10-15 14:43:04.000000000 -0700
+++ gdm-2.20.1/daemon/misc.c	2007-11-07 05:43:51.117408000 -0800
@@ -899,7 +899,6 @@
 	static GList *the_list = NULL;
 	static time_t last_time = 0;
 	char hostbuf[BUFSIZ];
-	struct addrinfo hints;
 	struct addrinfo *result;
 	struct addrinfo *res;
 
@@ -920,13 +919,7 @@
 		snprintf (hostbuf, BUFSIZ-1, "localhost");
 	}
 
-	memset (&hints, 0, sizeof (hints));
-	hints.ai_family = AF_INET;
-#ifdef ENABLE_IPV6
-	hints.ai_family |= AF_INET6;
-#endif
-
-	if (getaddrinfo (hostbuf, NULL, &hints, &result) != 0) {
+	if (getaddrinfo (hostbuf, NULL, NULL, &result) != 0) {
 		gdm_debug ("%s: Could not get address from hostname!", "gdm_peek_local_address_list");
 
 		return NULL;