summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan Osgood <iano@quirkster.com>2006-11-21 09:04:37 -0800
committerIan Osgood <iano@quirkster.com>2006-11-21 09:04:37 -0800
commit7fbfebaa3fb3a5ca2d2a307a0a5c40c015e18115 (patch)
treef7fa520e31ec727d7ebbc6a32ecfd8649ef2fab4 /src
parent684b8271a4539527daa15da82ad0cc302fb44727 (diff)
Fix IP6 work for FreeBSD/Mac.
Diffstat (limited to 'src')
-rw-r--r--src/xcb_auth.c12
1 files changed, 7 insertions, 5 deletions
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_protos kind, char *name, int namelen)
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 sockaddr *sockname, unsigned int socknamelen,
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 *info, Xauth *authptr, struct sockaddr *
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);