[gdm] xdmcp: fix indirect queries



commit 398a1382bf439b21424ae9ad02f5362bf84465cb
Author: Olivier Fourdan <fourdan xfce org>
Date:   Mon Jun 25 16:13:34 2012 -0400

    xdmcp: fix indirect queries
    
    The XDMCP indirect query is supposed to be forwarded to the remote host
    by gdm_xdmcp_send_forward_query() from daemon/gdm-xdmcp-display-factory.c
    
    However, checking the return value of XdmcpFlush() we can see the call
    fails with "Invalid Argument".
    
    Looking at the gdm debug logs, the address (ic->chosen_address) used
    there is correct but the port is 0 instead of 177, so the indirect query is never
    forwarded to the selected host.
    
    The address is set in on_hostname_selected() from
    daemon/gdm-xdmcp-display-factory.c via getaddrinfo() but the service
    field passed to getaddrinfo() is NULL, while using the actual XDMCP port
    ("177") fixes the issue and the indirect connection is successful.
    
    committe://bugzilla.gnome.org/show_bug.cgi?id=665296

 daemon/gdm-xdmcp-display-factory.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/daemon/gdm-xdmcp-display-factory.c b/daemon/gdm-xdmcp-display-factory.c
index 7123536..a54a734 100644
--- a/daemon/gdm-xdmcp-display-factory.c
+++ b/daemon/gdm-xdmcp-display-factory.c
@@ -1991,7 +1991,8 @@ on_hostname_selected (GdmXdmcpChooserDisplay *display,
         int              gaierr;
         GdmAddress      *address;
         IndirectClient  *ic;
-
+        gchar           *xdmcp_port;
+        
         g_debug ("GdmXdmcpDisplayFactory: hostname selected: %s",
                 hostname ? hostname : "(null)");
 
@@ -2011,10 +2012,13 @@ on_hostname_selected (GdmXdmcpChooserDisplay *display,
         /* this should convert IPv4 address to IPv6 if needed */
         hints.ai_flags = AI_V4MAPPED;
 
-        if ((gaierr = getaddrinfo (hostname, NULL, &hints, &ai_list)) != 0) {
+        xdmcp_port = g_strdup_printf ("%d", XDM_UDP_PORT);
+        if ((gaierr = getaddrinfo (hostname, xdmcp_port, &hints, &ai_list)) != 0) {
                 g_warning ("Unable to get address: %s", gai_strerror (gaierr));
+                g_free (xdmcp_port);
                 return;
         }
+        g_free (xdmcp_port);
 
         /* just take the first one */
         ai = ai_list;



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