[gdm] Port fix for bug #494817 to the new GDM rewrite. This fixes the code so
- From: Brian Cameron <bcameron src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gdm] Port fix for bug #494817 to the new GDM rewrite. This fixes the code so
- Date: Wed, 28 Oct 2009 21:27:52 +0000 (UTC)
commit 2c204d6b96059c68eb426a1e01f2f8d4d9d1ef53
Author: Brian Cameron <Brian Cameron sun com>
Date: Wed Oct 28 16:25:17 2009 -0500
Port fix for bug #494817 to the new GDM rewrite. This fixes the code so
that the length of the sockaddr is set to the correct length for IPv4 or IPv6.
This problem affects Solaris and FreeBSD. Linux only require that the
length be greater or equal to the expected length, so you would not see this
problem on Linux.
common/gdm-address.h | 1 +
daemon/gdm-xdmcp-display-factory.c | 20 ++++++++++----------
gui/simple-chooser/gdm-host-chooser-widget.c | 5 +++--
3 files changed, 14 insertions(+), 12 deletions(-)
---
diff --git a/common/gdm-address.h b/common/gdm-address.h
index 5a01f8f..6cb26b1 100644
--- a/common/gdm-address.h
+++ b/common/gdm-address.h
@@ -35,6 +35,7 @@
G_BEGIN_DECLS
#define GDM_TYPE_ADDRESS (gdm_address_get_type ())
+#define gdm_sockaddr_len(sa) (((struct sockaddr *)sa)->sa_family == AF_INET6 ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in))
typedef struct _GdmAddress GdmAddress;
diff --git a/daemon/gdm-xdmcp-display-factory.c b/daemon/gdm-xdmcp-display-factory.c
index 2207cef..838854a 100644
--- a/daemon/gdm-xdmcp-display-factory.c
+++ b/daemon/gdm-xdmcp-display-factory.c
@@ -835,7 +835,7 @@ gdm_xdmcp_send_willing (GdmXdmcpDisplayFactory *factory,
XdmcpFlush (factory->priv->socket_fd,
&factory->priv->buf,
(XdmcpNetaddr)gdm_address_peek_sockaddr_storage (address),
- (int)sizeof (struct sockaddr_storage));
+ (int)gdm_sockaddr_len (gdm_address_peek_sockaddr_storage (address)));
g_free (status.data);
}
@@ -879,7 +879,7 @@ gdm_xdmcp_send_unwilling (GdmXdmcpDisplayFactory *factory,
XdmcpFlush (factory->priv->socket_fd,
&factory->priv->buf,
(XdmcpNetaddr)gdm_address_peek_sockaddr_storage (address),
- (int)sizeof (struct sockaddr_storage));
+ (int)gdm_sockaddr_len (gdm_address_peek_sockaddr_storage (address)));
last_time = time (NULL);
}
@@ -988,7 +988,7 @@ gdm_xdmcp_send_forward_query (GdmXdmcpDisplayFactory *factory,
XdmcpFlush (factory->priv->socket_fd,
&factory->priv->buf,
(XdmcpNetaddr)gdm_address_peek_sockaddr_storage (ic->chosen_address),
- (int)sizeof (struct sockaddr_storage));
+ (int)gdm_sockaddr_len (gdm_address_peek_sockaddr_storage (ic->chosen_address)));
g_free (port.data);
g_free (addr.data);
@@ -1691,7 +1691,7 @@ gdm_xdmcp_really_send_managed_forward (GdmXdmcpDisplayFactory *factory,
XdmcpFlush (factory->priv->socket_fd,
&factory->priv->buf,
(XdmcpNetaddr)gdm_address_peek_sockaddr_storage (address),
- (int)sizeof (struct sockaddr_storage));
+ (int)gdm_sockaddr_len (gdm_address_peek_sockaddr_storage (address)));
g_free (addr.data);
}
@@ -1772,7 +1772,7 @@ gdm_xdmcp_send_got_managed_forward (GdmXdmcpDisplayFactory *factory,
XdmcpFlush (factory->priv->socket_fd,
&factory->priv->buf,
(XdmcpNetaddr)gdm_address_peek_sockaddr_storage (address),
- (int)sizeof (struct sockaddr_storage));
+ (int)gdm_sockaddr_len (gdm_address_peek_sockaddr_storage (address)));
}
static gboolean
@@ -1945,7 +1945,7 @@ gdm_xdmcp_send_decline (GdmXdmcpDisplayFactory *factory,
XdmcpFlush (factory->priv->socket_fd,
&factory->priv->buf,
(XdmcpNetaddr)gdm_address_peek_sockaddr_storage (address),
- (int)sizeof (struct sockaddr_storage));
+ (int)gdm_sockaddr_len (gdm_address_peek_sockaddr_storage (address)));
/* Send MANAGED_FORWARD to indicate that the connection
* reached some sort of resolution */
@@ -2093,7 +2093,7 @@ gdm_xdmcp_send_accept (GdmXdmcpDisplayFactory *factory,
XdmcpFlush (factory->priv->socket_fd,
&factory->priv->buf,
(XdmcpNetaddr)gdm_address_peek_sockaddr_storage (address),
- (int)sizeof (struct sockaddr_storage));
+ (int)gdm_sockaddr_len (gdm_address_peek_sockaddr_storage (address)));
host = NULL;
gdm_address_get_numeric_info (address, &host, NULL);
@@ -2424,7 +2424,7 @@ gdm_xdmcp_send_failed (GdmXdmcpDisplayFactory *factory,
XdmcpFlush (factory->priv->socket_fd,
&factory->priv->buf,
(XdmcpNetaddr)gdm_address_peek_sockaddr_storage (address),
- (int)sizeof (struct sockaddr_storage));
+ (int)gdm_sockaddr_len (gdm_address_peek_sockaddr_storage (address)));
}
static void
@@ -2448,7 +2448,7 @@ gdm_xdmcp_send_refuse (GdmXdmcpDisplayFactory *factory,
XdmcpFlush (factory->priv->socket_fd,
&factory->priv->buf,
(XdmcpNetaddr)gdm_address_peek_sockaddr_storage (address),
- (int)sizeof (struct sockaddr_storage));
+ (int)gdm_sockaddr_len (gdm_address_peek_sockaddr_storage (address)));
/*
* This was from a forwarded query quite apparently so
@@ -2719,7 +2719,7 @@ gdm_xdmcp_send_alive (GdmXdmcpDisplayFactory *factory,
XdmcpFlush (factory->priv->socket_fd,
&factory->priv->buf,
(XdmcpNetaddr)gdm_address_peek_sockaddr_storage (address),
- (int)sizeof (struct sockaddr_storage));
+ (int)gdm_sockaddr_len (gdm_address_peek_sockaddr_storage (address)));
}
static void
diff --git a/gui/simple-chooser/gdm-host-chooser-widget.c b/gui/simple-chooser/gdm-host-chooser-widget.c
index 6ea9196..085cf5d 100644
--- a/gui/simple-chooser/gdm-host-chooser-widget.c
+++ b/gui/simple-chooser/gdm-host-chooser-widget.c
@@ -311,7 +311,8 @@ do_ping (GdmHostChooserWidget *widget,
res = XdmcpFlush (widget->priv->socket_fd,
&widget->priv->broadcast_buf,
(XdmcpNetaddr)gdm_address_peek_sockaddr_storage (address),
- (int)sizeof (struct sockaddr_storage));
+ (int)gdm_sockaddr_len (gdm_address_peek_sockaddr_storage (address)));
+
if (! res) {
g_warning ("Unable to flush the XDMCP broadcast packet: %s", g_strerror (errno));
}
@@ -328,7 +329,7 @@ do_ping (GdmHostChooserWidget *widget,
res = XdmcpFlush (widget->priv->socket_fd,
&widget->priv->query_buf,
(XdmcpNetaddr)gdm_address_peek_sockaddr_storage (address),
- (int)sizeof (struct sockaddr_storage));
+ (int)gdm_sockaddr_len (gdm_address_peek_sockaddr_storage (address)));
if (! res) {
g_warning ("Unable to flush the XDMCP query packet");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]