From a968ef24dfc9ddd1322f91acb4a6a1898fc15490 Mon Sep 17 00:00:00 2001 From: Kaleb Keithley Date: Tue, 25 Nov 2003 19:28:07 +0000 Subject: XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks --- include/X11/SM/SMlib.h | 114 ------------------------------------------------- src/sm_auth.c | 5 +++ src/sm_genid.c | 47 +++++++++++++++++--- src/sm_process.c | 13 ++++++ 4 files changed, 59 insertions(+), 120 deletions(-) diff --git a/include/X11/SM/SMlib.h b/include/X11/SM/SMlib.h index 8ec7ea2..92418c1 100644 --- a/include/X11/SM/SMlib.h +++ b/include/X11/SM/SMlib.h @@ -87,58 +87,44 @@ typedef enum { */ typedef void (*SmcSaveYourselfProc) ( -#if NeedFunctionPrototypes SmcConn /* smcConn */, SmPointer /* clientData */, int /* saveType */, Bool /* shutdown */, int /* interactStyle */, Bool /* fast */ -#endif ); typedef void (*SmcSaveYourselfPhase2Proc) ( -#if NeedFunctionPrototypes SmcConn /* smcConn */, SmPointer /* clientData */ -#endif ); typedef void (*SmcInteractProc) ( -#if NeedFunctionPrototypes SmcConn /* smcConn */, SmPointer /* clientData */ -#endif ); typedef void (*SmcDieProc) ( -#if NeedFunctionPrototypes SmcConn /* smcConn */, SmPointer /* clientData */ -#endif ); typedef void (*SmcShutdownCancelledProc) ( -#if NeedFunctionPrototypes SmcConn /* smcConn */, SmPointer /* clientData */ -#endif ); typedef void (*SmcSaveCompleteProc) ( -#if NeedFunctionPrototypes SmcConn /* smcConn */, SmPointer /* clientData */ -#endif ); typedef void (*SmcPropReplyProc) ( -#if NeedFunctionPrototypes SmcConn /* smcConn */, SmPointer /* clientData */, int /* numProps */, SmProp ** /* props */ -#endif ); @@ -182,31 +168,24 @@ typedef struct { */ typedef Status (*SmsRegisterClientProc) ( -#if NeedFunctionPrototypes SmsConn /* smsConn */, SmPointer /* managerData */, char * /* previousId */ -#endif ); typedef void (*SmsInteractRequestProc) ( -#if NeedFunctionPrototypes SmsConn /* smsConn */, SmPointer /* managerData */, int /* dialogType */ -#endif ); typedef void (*SmsInteractDoneProc) ( -#if NeedFunctionPrototypes SmsConn /* smsConn */, SmPointer /* managerData */, Bool /* cancelShutdown */ -#endif ); typedef void (*SmsSaveYourselfRequestProc) ( -#if NeedFunctionPrototypes SmsConn /* smsConn */, SmPointer /* managerData */, int /* saveType */, @@ -214,56 +193,43 @@ typedef void (*SmsSaveYourselfRequestProc) ( int /* interactStyle */, Bool /* fast */, Bool /* global */ -#endif ); typedef void (*SmsSaveYourselfPhase2RequestProc) ( -#if NeedFunctionPrototypes SmsConn /* smsConn */, SmPointer /* managerData */ -#endif ); typedef void (*SmsSaveYourselfDoneProc) ( -#if NeedFunctionPrototypes SmsConn /* smsConn */, SmPointer /* managerData */, Bool /* success */ -#endif ); typedef void (*SmsCloseConnectionProc) ( -#if NeedFunctionPrototypes SmsConn /* smsConn */, SmPointer /* managerData */, int /* count */, char ** /* reasonMsgs */ -#endif ); typedef void (*SmsSetPropertiesProc) ( -#if NeedFunctionPrototypes SmsConn /* smsConn */, SmPointer /* managerData */, int /* numProps */, SmProp ** /* props */ -#endif ); typedef void (*SmsDeletePropertiesProc) ( -#if NeedFunctionPrototypes SmsConn /* smsConn */, SmPointer /* managerData */, int /* numProps */, char ** /* propNames */ -#endif ); typedef void (*SmsGetPropertiesProc) ( -#if NeedFunctionPrototypes SmsConn /* smsConn */, SmPointer /* managerData */ -#endif ); @@ -340,13 +306,11 @@ typedef struct { typedef Status (*SmsNewClientProc) ( -#if NeedFunctionPrototypes SmsConn /* smsConn */, SmPointer /* managerData */, unsigned long * /* maskRet */, SmsCallbacks * /* callbacksRet */, char ** /* failureReasonRet */ -#endif ); @@ -356,7 +320,6 @@ typedef Status (*SmsNewClientProc) ( */ typedef void (*SmcErrorHandler) ( -#if NeedFunctionPrototypes SmcConn /* smcConn */, Bool /* swap */, int /* offendingMinorOpcode */, @@ -364,11 +327,9 @@ typedef void (*SmcErrorHandler) ( int /* errorClass */, int /* severity */, SmPointer /* values */ -#endif ); typedef void (*SmsErrorHandler) ( -#if NeedFunctionPrototypes SmsConn /* smsConn */, Bool /* swap */, int /* offendingMinorOpcode */, @@ -376,7 +337,6 @@ typedef void (*SmsErrorHandler) ( int /* errorClass */, int /* severity */, SmPointer /* values */ -#endif ); @@ -388,7 +348,6 @@ typedef void (*SmsErrorHandler) ( _XFUNCPROTOBEGIN extern SmcConn SmcOpenConnection ( -#if NeedFunctionPrototypes char * /* networkIdsList */, SmPointer /* context */, int /* xsmpMajorRev */, @@ -399,129 +358,95 @@ extern SmcConn SmcOpenConnection ( char ** /* clientIdRet */, int /* errorLength */, char * /* errorStringRet */ -#endif ); extern SmcCloseStatus SmcCloseConnection ( -#if NeedFunctionPrototypes SmcConn /* smcConn */, int /* count */, char ** /* reasonMsgs */ -#endif ); extern void SmcModifyCallbacks ( -#if NeedFunctionPrototypes SmcConn /* smcConn */, unsigned long /* mask */, SmcCallbacks * /* callbacks */ -#endif ); extern void SmcSetProperties ( -#if NeedFunctionPrototypes SmcConn /* smcConn */, int /* numProps */, SmProp ** /* props */ -#endif ); extern void SmcDeleteProperties ( -#if NeedFunctionPrototypes SmcConn /* smcConn */, int /* numProps */, char ** /* propNames */ -#endif ); extern Status SmcGetProperties ( -#if NeedFunctionPrototypes SmcConn /* smcConn */, SmcPropReplyProc /* propReplyProc */, SmPointer /* clientData */ -#endif ); extern Status SmcInteractRequest ( -#if NeedFunctionPrototypes SmcConn /* smcConn */, int /* dialogType */, SmcInteractProc /* interactProc */, SmPointer /* clientData */ -#endif ); extern void SmcInteractDone ( -#if NeedFunctionPrototypes SmcConn /* smcConn */, Bool /* cancelShutdown */ -#endif ); extern void SmcRequestSaveYourself ( -#if NeedFunctionPrototypes SmcConn /* smcConn */, int /* saveType */, Bool /* shutdown */, int /* interactStyle */, Bool /* fast */, Bool /* global */ -#endif ); extern Status SmcRequestSaveYourselfPhase2 ( -#if NeedFunctionPrototypes SmcConn /* smcConn */, SmcSaveYourselfPhase2Proc /* saveYourselfPhase2Proc */, SmPointer /* clientData */ -#endif ); extern void SmcSaveYourselfDone ( -#if NeedFunctionPrototypes SmcConn /* smcConn */, Bool /* success */ -#endif ); extern int SmcProtocolVersion ( -#if NeedFunctionPrototypes SmcConn /* smcConn */ -#endif ); extern int SmcProtocolRevision ( -#if NeedFunctionPrototypes SmcConn /* smcConn */ -#endif ); extern char *SmcVendor ( -#if NeedFunctionPrototypes SmcConn /* smcConn */ -#endif ); extern char *SmcRelease ( -#if NeedFunctionPrototypes SmcConn /* smcConn */ -#endif ); extern char *SmcClientID ( -#if NeedFunctionPrototypes SmcConn /* smcConn */ -#endif ); extern IceConn SmcGetIceConnection ( -#if NeedFunctionPrototypes SmcConn /* smcConn */ -#endif ); extern Status SmsInitialize ( -#if NeedFunctionPrototypes char * /* vendor */, char * /* release */, SmsNewClientProc /* newClientProc */, @@ -529,129 +454,90 @@ extern Status SmsInitialize ( IceHostBasedAuthProc /* hostBasedAuthProc */, int /* errorLength */, char * /* errorStringRet */ -#endif ); extern char *SmsClientHostName ( -#if NeedFunctionPrototypes SmsConn /* smsConn */ -#endif ); extern char *SmsGenerateClientID ( -#if NeedFunctionPrototypes SmsConn /* smsConn */ -#endif ); extern Status SmsRegisterClientReply ( -#if NeedFunctionPrototypes SmsConn /* smsConn */, char * /* clientId */ -#endif ); extern void SmsSaveYourself ( -#if NeedFunctionPrototypes SmsConn /* smsConn */, int /* saveType */, Bool /* shutdown */, int /* interactStyle */, Bool /* fast */ -#endif ); extern void SmsSaveYourselfPhase2 ( -#if NeedFunctionPrototypes SmsConn /* smsConn */ -#endif ); extern void SmsInteract ( -#if NeedFunctionPrototypes SmsConn /* smsConn */ -#endif ); extern void SmsDie ( -#if NeedFunctionPrototypes SmsConn /* smsConn */ -#endif ); extern void SmsSaveComplete ( -#if NeedFunctionPrototypes SmsConn /* smsConn */ -#endif ); extern void SmsShutdownCancelled ( -#if NeedFunctionPrototypes SmsConn /* smsConn */ -#endif ); extern void SmsReturnProperties ( -#if NeedFunctionPrototypes SmsConn /* smsConn */, int /* numProps */, SmProp ** /* props */ -#endif ); extern void SmsCleanUp ( -#if NeedFunctionPrototypes SmsConn /* smsConn */ -#endif ); extern int SmsProtocolVersion ( -#if NeedFunctionPrototypes SmsConn /* smsConn */ -#endif ); extern int SmsProtocolRevision ( -#if NeedFunctionPrototypes SmsConn /* smsConn */ -#endif ); extern char *SmsClientID ( -#if NeedFunctionPrototypes SmsConn /* smsConn */ -#endif ); extern IceConn SmsGetIceConnection ( -#if NeedFunctionPrototypes SmsConn /* smsConn */ -#endif ); extern SmcErrorHandler SmcSetErrorHandler ( -#if NeedFunctionPrototypes SmcErrorHandler /* handler */ -#endif ); extern SmsErrorHandler SmsSetErrorHandler ( -#if NeedFunctionPrototypes SmsErrorHandler /* handler */ -#endif ); extern void SmFreeProperty ( -#if NeedFunctionPrototypes SmProp * /* prop */ -#endif ); extern void SmFreeReasons ( -#if NeedFunctionPrototypes int /* count */, char ** /* reasonMsgs */ -#endif ); _XFUNCPROTOEND 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 #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); -- cgit v1.2.1