[Xcb-commit] src

Ian Osgood iano at kemper.freedesktop.org
Tue Nov 21 09:04:48 PST 2006


 src/xcb_auth.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

New commits:
diff-tree 7fbfebaa3fb3a5ca2d2a307a0a5c40c015e18115 (from 684b8271a4539527daa15da82ad0cc302fb44727)
Author: Ian Osgood <iano at quirkster.com>
Date:   Tue Nov 21 09:04:37 2006 -0800

    Fix IP6 work for FreeBSD/Mac.

diff --git a/src/xcb_auth.c b/src/xcb_auth.c
index afab318..4842d1d 100644
--- a/src/xcb_auth.c
+++ b/src/xcb_auth.c
@@ -77,6 +77,8 @@ static int authname_match(enum auth_prot
     return 1;
 }
 
+#define SIN6_ADDR(s) (&((struct sockaddr_in6 *)s)->sin6_addr)
+
 static Xauth *get_authptr(struct sockaddr *sockname, unsigned int socknamelen,
                           int display)
 {
@@ -92,11 +94,11 @@ static Xauth *get_authptr(struct sockadd
     switch(sockname->sa_family)
     {
     case AF_INET6:
-        addr = (char *) &((struct sockaddr_in6 *)sockname)->sin6_addr;
-        addrlen = sizeof(((struct sockaddr_in6 *)sockname)->sin6_addr);
-        if(!IN6_IS_ADDR_V4MAPPED(addr))
+        addr = (char *) SIN6_ADDR(sockname);
+        addrlen = sizeof(*SIN6_ADDR(sockname));
+        if(!IN6_IS_ADDR_V4MAPPED(SIN6_ADDR(sockname)))
         {
-            if(!IN6_IS_ADDR_LOOPBACK(addr))
+            if(!IN6_IS_ADDR_LOOPBACK(SIN6_ADDR(sockname)))
                 family = XCB_FAMILY_INTERNET_6;
             break;
         }
@@ -180,7 +182,7 @@ static int compute_auth(xcb_auth_info_t 
         case AF_INET6:
             /*block*/ {
             struct sockaddr_in6 *si6 = (struct sockaddr_in6 *) sockname;
-            if(IN6_IS_ADDR_V4MAPPED(si6->sin6_addr.s6_addr))
+            if(IN6_IS_ADDR_V4MAPPED(SIN6_ADDR(sockname)))
             {
                 APPEND(info->data, j, si6->sin6_addr.s6_addr[12]);
                 APPEND(info->data, j, si6->sin6_port);


More information about the xcb-commit mailing list