summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKaleb Keithley <kaleb@freedesktop.org>2003-11-26 22:48:35 +0000
committerKaleb Keithley <kaleb@freedesktop.org>2003-11-26 22:48:35 +0000
commit09ca1da2938f5086eddad61f589cd7d4a865f80f (patch)
tree72dbcfd6f23c0e9d8da49633b82d839f60256c14 /src
parente3943e9c5eda00bce99d3a96cb68a1542c6c9a6e (diff)
merge latest (4.3.99.16) from XFree86 (vendor) branchXEVIE-BASE
Diffstat (limited to 'src')
-rw-r--r--src/sm_auth.c5
-rw-r--r--src/sm_genid.c47
-rw-r--r--src/sm_process.c13
3 files changed, 59 insertions, 6 deletions
diff --git a/src/sm_auth.c b/src/sm_auth.c
index a709cda..7057fd6 100644
--- a/src/sm_auth.c
+++ b/src/sm_auth.c
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/SM/sm_auth.c,v 1.4 2003/10/23 21:38:22 tsi Exp $ */
/*
* Author: Ralph Mor, X Consortium
@@ -33,6 +34,10 @@ in this Software without prior written authorization from The Open Group.
#include <X11/SM/SMlib.h>
#include "SMlibint.h"
+#ifdef __UNIXOS2__
+static char dummy;
+#endif
+
/*
* For now, SMlib just supports MIT-MAGIC-COOKIE-1 (defined in ICElib).
*/
diff --git a/src/sm_genid.c b/src/sm_genid.c
index bc79d7e..8771d07 100644
--- a/src/sm_genid.c
+++ b/src/sm_genid.c
@@ -1,8 +1,8 @@
/* $Xorg: sm_genid.c,v 1.4 2001/02/09 02:03:30 xorgcvs Exp $ */
-
/*
Copyright 1993, 1998 The Open Group
+Copyright 2002 Sun Microsystems, Inc.
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
@@ -25,7 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
-/* $XFree86: xc/lib/SM/sm_genid.c,v 3.15 2001/12/14 19:53:55 dawes Exp $ */
+/* $XFree86: xc/lib/SM/sm_genid.c,v 3.17 2003/07/09 15:27:28 tsi Exp $ */
/*
* Author: Ralph Mor, X Consortium
@@ -120,7 +120,7 @@ SmsGenerateClientID (smsConn)
{
#if defined(TCPCONN) || defined(STREAMSCONN)
char hostname[256];
- char address[14];
+ char address[64];
char temp[256];
char *id;
static int sequence = 0;
@@ -133,15 +133,46 @@ SmsGenerateClientID (smsConn)
char temp[4], *ptr1, *ptr2;
unsigned char decimal[4];
int i, len;
+ struct in_addr *haddr = NULL;
+#if defined(IPv6) && defined(AF_INET6)
+ struct addrinfo *ai, *first_ai;
+ if (getaddrinfo(hostname,NULL,NULL,&ai) == 0)
+ return NULL;
+
+ for (first_ai = ai; ai != NULL; ai = ai->ai_next) {
+ if ( (ai->ai_family == AF_INET) || (ai->ai_family == AF_INET6) )
+ break;
+ }
+ if (ai == NULL) {
+ freeaddrinfo(first_ai);
+ return NULL;
+ }
+
+ if (ai->ai_family == AF_INET6) {
+ unsigned char *cp = (unsigned char *) &((struct sockaddr_in6 *)ai->ai_addr)->sin6_addr.s6_addr;
+
+ address[0] = '6'; /* IPv6 address code */
+ address[1] = '\0';
+
+ for (i = 0 ; i < 16 ; i++) {
+ strcat(address, hex_table[cp[i]]);
+ }
+
+ } else { /* Fall through to IPv4 address handling */
+ haddr = &((struct sockaddr_in *)ai->ai_addr)->sin_addr;
+#else
#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
_Xgethostbynameparams hparams;
#endif
struct hostent *hostp;
if ((hostp = _XGethostbyname (hostname,hparams)) != NULL)
- inet_addr = inet_ntoa (*(struct in_addr *)(hostp->h_addr));
+ haddr = (struct in_addr *)(hostp->h_addr);
else
return NULL;
+#endif
+
+ inet_addr = inet_ntoa (*haddr);
for (i = 0, ptr1 = inet_addr; i < 3; i++)
{
ptr2 = strchr (ptr1, '.');
@@ -160,10 +191,14 @@ SmsGenerateClientID (smsConn)
address[1] = '\0';
for (i = 0; i < 4; i++)
strcat (address, hex_table[decimal[i]]);
+#if defined(IPv6) && defined(AF_INET6)
+ }
+ freeaddrinfo(first_ai);
+#endif
}
- sprintf (temp, "1%s%.13ld%.10ld%.4d", address, time((Time_t*)0),
- (long)getpid(), sequence);
+ sprintf (temp, "1%s%.13ld%.10ld%.4d", address, (long)time((Time_t*)0),
+ (long)getpid(), sequence);
if (++sequence > 9999)
sequence = 0;
diff --git a/src/sm_process.c b/src/sm_process.c
index cb15ebc..44f088b 100644
--- a/src/sm_process.c
+++ b/src/sm_process.c
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/SM/sm_process.c,v 1.3 2003/05/27 22:26:25 tsi Exp $ */
/*
* Author: Ralph Mor, X Consortium
@@ -162,8 +163,10 @@ Bool *replyReadyRet;
_SmcRegisterClientReply *reply =
(_SmcRegisterClientReply *) (replyWait->reply);
+#if 0 /* No-op */
CHECK_AT_LEAST_SIZE (iceConn, _SmcOpcode, opcode,
length, SIZEOF (smRegisterClientReplyMsg), IceFatalToProtocol);
+#endif
IceReadCompleteMessage (iceConn, SIZEOF (smRegisterClientReplyMsg),
smRegisterClientReplyMsg, pMsg, pStart);
@@ -367,8 +370,10 @@ Bool *replyReadyRet;
SmProp **props = NULL;
_SmcPropReplyWait *next;
+#if 0 /* No-op */
CHECK_AT_LEAST_SIZE (iceConn, _SmcOpcode, opcode,
length, SIZEOF (smPropertiesReplyMsg), IceFatalToProtocol);
+#endif
IceReadCompleteMessage (iceConn, SIZEOF (smPropertiesReplyMsg),
smPropertiesReplyMsg, pMsg, pStart);
@@ -477,8 +482,10 @@ Bool swap;
char *pData, *pStart;
char *previousId;
+#if 0 /* No-op */
CHECK_AT_LEAST_SIZE (iceConn, _SmsOpcode, opcode,
length, SIZEOF (smRegisterClientMsg), IceFatalToProtocol);
+#endif
IceReadCompleteMessage (iceConn, SIZEOF (smRegisterClientMsg),
smRegisterClientMsg, pMsg, pStart);
@@ -733,8 +740,10 @@ Bool swap;
int count, i;
char **reasonMsgs = NULL;
+#if 0 /* No-op */
CHECK_AT_LEAST_SIZE (iceConn, _SmsOpcode, opcode,
length, SIZEOF (smCloseConnectionMsg), IceFatalToProtocol);
+#endif
IceReadCompleteMessage (iceConn, SIZEOF (smCloseConnectionMsg),
smCloseConnectionMsg, pMsg, pStart);
@@ -778,8 +787,10 @@ Bool swap;
SmProp **props = NULL;
int numProps;
+#if 0 /* No-op */
CHECK_AT_LEAST_SIZE (iceConn, _SmsOpcode, opcode,
length, SIZEOF (smSetPropertiesMsg), IceFatalToProtocol);
+#endif
IceReadCompleteMessage (iceConn, SIZEOF (smSetPropertiesMsg),
smSetPropertiesMsg, pMsg, pStart);
@@ -816,8 +827,10 @@ Bool swap;
int count, i;
char **propNames = NULL;
+#if 0 /* No-op */
CHECK_AT_LEAST_SIZE (iceConn, _SmsOpcode, opcode,
length, SIZEOF (smDeletePropertiesMsg), IceFatalToProtocol);
+#endif
IceReadCompleteMessage (iceConn, SIZEOF (smDeletePropertiesMsg),
smDeletePropertiesMsg, pMsg, pStart);