Bug 7332

Summary: IPv6 problem: xdm rejects all chooser connections
Product: xorg Reporter: Peter Breitenlohner <peb>
Component: Server/GeneralAssignee: Alan Coopersmith <alan.coopersmith>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: high Keywords: patch
Version: 6.9.0   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
patch for IPv6 problem none

Description Peter Breitenlohner 2006-06-26 04:48:20 UTC
When xdm is compiled with IPv6 support, all chooser connections are rejected.
This problem is present since IPv6 support was first introduces and after more
that 2 years I finally found the reason: in_addr/sockaddr_in resp.
in6_addr/sockaddr_in6 confusion.

A patch is attached.

In order to prevent any possibility for memory leaks and/or segmentation faults
the patch also ensures a one-to-one correspondence between successful
getaddrinfo() calls and freeaddrinfo() calls.
Comment 1 Peter Breitenlohner 2006-06-26 04:49:43 UTC
Created attachment 6046 [details] [review]
patch for IPv6 problem
Comment 2 Alan Coopersmith 2006-06-26 13:11:15 UTC
Committed the trivial fixes to the current modular git/cvs head branches:

Log message:
  2006-06-26  Alan Coopersmith  <alan.coopersmith@sun.com>
  
  	* src/sm_genid.c:
  	From Patch #6046 <https://bugs.freedesktop.org/attachment.cgi?id=6046>
  	freeaddrinfo() in error handling return (Peter Breitenlohner)

Modified files:
      lib/SM/:
        ChangeLog 
      lib/SM/src/:
        sm_genid.c 
  
  Revision      Changes    Path
  1.11          +6 -0      lib/SM/ChangeLog
  http://webcvs.freedesktop.org/xorg/lib/SM/ChangeLog
  1.5           +5 -1      lib/SM/src/sm_genid.c
  http://webcvs.freedesktop.org/xorg/lib/SM/src/sm_genid.c

--------

diff-tree b3c869304cd85af034aa9debaa874e29d14fcbe6 (from
91dcac5295486cc55a34ad91704bfa483bd31eeb)
Author: Peter Breitenlohner <peb@mppmu.mpg.de>
Date:   Mon Jun 26 10:48:44 2006 -0700

    Free small, one-time memory leak in xdmcp -from handling
    
    Part of Patch #6046 <https://bugs.freedesktop.org/attachment.cgi?id=6046>

os/xdmcp.c |    4 ++++
 1 files changed, 4 insertions(+)

--------

Log message:
  2006-06-26  Alan Coopersmith  <alan.coopersmith@sun.com>
  
          * di/pm.c:
          From Patch #6046 <https://bugs.freedesktop.org/attachment.cgi?id=6046>
          Remove redundant setting of ai to NULL. (Peter Breitenlohner)

Modified files:
      app/proxymngr/:
        ChangeLog main.c 
  
  Revision      Changes    Path
  1.7           +6 -0      app/proxymngr/ChangeLog
  http://webcvs.freedesktop.org/xorg/app/proxymngr/ChangeLog
  1.3           +0 -2      app/proxymngr/main.c
  http://webcvs.freedesktop.org/xorg/app/proxymngr/main.c

-------

Will do xdm ones soon.
Comment 3 Alan Coopersmith 2006-06-26 16:59:06 UTC
Committed xdm fixes too, with one small typo change - the second AF_INET changed
to AF_INET6 in this code:
+                       if ((af_type == nai->ai_family) && (
+                         ((nai->ai_family == AF_INET) &&
+                           (connectionAddress->length == sizeof(struct in_addr)) &&
+                           (memcmp(connectionAddress->data,
+                                   &((struct sockaddr_in *)nai->ai_addr)->sin_addr,
+                                   connectionAddress->length) == 0)) ||
+                         ((nai->ai_family == AF_INET6) &&
+                           (connectionAddress->length == sizeof(struct
in6_addr)) &&
+                           (memcmp(connectionAddress->data,
+                                   &((struct sockaddr_in6
*)nai->ai_addr)->sin6_addr,
+                                   connectionAddress->length) == 0))))

Thanks for the patches!


CVSROOT:	/cvs/xorg
Module name:	app
Changes by:	alanc@kemper.freedesktop.org	06/06/26 23:56:06

Log message:
  2006-06-26  Alan Coopersmith  <alan.coopersmith@sun.com>
  
  	* access.c:
  	* chooser.c:
  	* xdmcp.c:
  	Bugzilla #7332 <https://bugs.freedesktop.org/show_bug.cgi?id=7332>
  	Patch #6046 <https://bugs.freedesktop.org/attachment.cgi?id=6046>
  	(1) Xdm compiled with IPv6 support failed to accept any
  	chooser connections (even when only using IPv4).
  	(2) There should be a one-to-one correspondence between
  	successful getaddrinfo calls and freeaddrinfo calls.
  	(Peter Breitenlohner)

Modified files:
      app/xdm/:
        ChangeLog access.c chooser.c xdmcp.c 
  
  Revision      Changes    Path
  1.53          +13 -0     app/xdm/ChangeLog
  http://webcvs.freedesktop.org/xorg/app/xdm/ChangeLog
  1.3           +25 -4     app/xdm/access.c
  http://webcvs.freedesktop.org/xorg/app/xdm/access.c
  1.6           +2 -1      app/xdm/chooser.c
  http://webcvs.freedesktop.org/xorg/app/xdm/chooser.c
  1.7           +35 -16    app/xdm/xdmcp.c
  http://webcvs.freedesktop.org/xorg/app/xdm/xdmcp.c

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.