summaryrefslogtreecommitdiff
path: root/lib/libSM/src
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2009-08-23 14:08:01 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2009-08-23 14:08:01 +0000
commitc6236d9adc97b5c746dac67e8ec6c6d52fe2ae23 (patch)
treeb79d0243f220d65bb14e9a5ab8548532fd9fb606 /lib/libSM/src
parent09cd387c51d91ee81c5e4bcbc4aa4acfe6ff2016 (diff)
update to libSM 1.1.1
Diffstat (limited to 'lib/libSM/src')
-rw-r--r--lib/libSM/src/Makefile.am11
-rw-r--r--lib/libSM/src/Makefile.in36
-rw-r--r--lib/libSM/src/SMlibint.h46
-rw-r--r--lib/libSM/src/globals.h68
-rw-r--r--lib/libSM/src/sm_client.c150
-rw-r--r--lib/libSM/src/sm_error.c44
-rw-r--r--lib/libSM/src/sm_genid.c106
-rw-r--r--lib/libSM/src/sm_manager.c85
-rw-r--r--lib/libSM/src/sm_misc.c61
-rw-r--r--lib/libSM/src/sm_process.c24
10 files changed, 226 insertions, 405 deletions
diff --git a/lib/libSM/src/Makefile.am b/lib/libSM/src/Makefile.am
index b44e623f8..41d074b2d 100644
--- a/lib/libSM/src/Makefile.am
+++ b/lib/libSM/src/Makefile.am
@@ -2,13 +2,20 @@ lib_LTLIBRARIES=libSM.la
AM_CFLAGS= -I${top_srcdir}/include $(SM_CFLAGS) $(XTRANS_CFLAGS)
-libSM_la_LDFLAGS = -version-number 6:0:0 -no-undefined
+if WITH_LIBUUID
+AM_CFLAGS += $(LIBUUID_CFLAGS) -DHAVE_LIBUUID
+endif
+
+libSM_la_LDFLAGS = -version-number 6:0:1 -no-undefined
libSM_la_LIBADD = $(SM_LIBS) $(XTRANS_LIBS)
+if WITH_LIBUUID
+libSM_la_LIBADD += $(LIBUUID_LIBS)
+endif
+
libSM_la_SOURCES = \
SMlibint.h \
- globals.h \
sm_auth.c \
sm_client.c \
sm_error.c \
diff --git a/lib/libSM/src/Makefile.in b/lib/libSM/src/Makefile.in
index 1d9eff61f..b839ed1c3 100644
--- a/lib/libSM/src/Makefile.in
+++ b/lib/libSM/src/Makefile.in
@@ -37,6 +37,8 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
+@WITH_LIBUUID_TRUE@am__append_1 = $(LIBUUID_CFLAGS) -DHAVE_LIBUUID
+@WITH_LIBUUID_TRUE@am__append_2 = $(LIBUUID_LIBS)
subdir = src
DIST_COMMON = $(sminclude_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
@@ -57,7 +59,9 @@ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(smincludedir)"
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
am__DEPENDENCIES_1 =
-libSM_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+@WITH_LIBUUID_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
+libSM_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_2)
am_libSM_la_OBJECTS = sm_auth.lo sm_client.lo sm_error.lo sm_genid.lo \
sm_manager.lo sm_misc.lo sm_process.lo
libSM_la_OBJECTS = $(am_libSM_la_OBJECTS)
@@ -91,8 +95,10 @@ AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
+CHANGELOG_CMD = @CHANGELOG_CMD@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CWARNFLAGS = @CWARNFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
@@ -100,6 +106,7 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
@@ -108,6 +115,7 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
+GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -116,12 +124,15 @@ LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
+LIBUUID_CFLAGS = @LIBUUID_CFLAGS@
+LIBUUID_LIBS = @LIBUUID_LIBS@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
+NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -132,21 +143,20 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
+SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SM_CFLAGS = @SM_CFLAGS@
SM_LIBS = @SM_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
+WITH_LIBUUID_FALSE = @WITH_LIBUUID_FALSE@
+WITH_LIBUUID_TRUE = @WITH_LIBUUID_TRUE@
XTRANS_CFLAGS = @XTRANS_CFLAGS@
XTRANS_LIBS = @XTRANS_LIBS@
-ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
-ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
@@ -163,34 +173,42 @@ build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
+datarootdir = @datarootdir@
+distcleancheck_listfiles = @distcleancheck_listfiles@
+docdir = @docdir@
+dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
+htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
+localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
+psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
lib_LTLIBRARIES = libSM.la
-AM_CFLAGS = -I${top_srcdir}/include $(SM_CFLAGS) $(XTRANS_CFLAGS)
-libSM_la_LDFLAGS = -version-number 6:0:0 -no-undefined
-libSM_la_LIBADD = $(SM_LIBS) $(XTRANS_LIBS)
+AM_CFLAGS = -I${top_srcdir}/include $(SM_CFLAGS) $(XTRANS_CFLAGS) \
+ $(am__append_1)
+libSM_la_LDFLAGS = -version-number 6:0:1 -no-undefined
+libSM_la_LIBADD = $(SM_LIBS) $(XTRANS_LIBS) $(am__append_2)
libSM_la_SOURCES = \
SMlibint.h \
- globals.h \
sm_auth.c \
sm_client.c \
sm_error.c \
diff --git a/lib/libSM/src/SMlibint.h b/lib/libSM/src/SMlibint.h
index e9fa9cd96..350b9707e 100644
--- a/lib/libSM/src/SMlibint.h
+++ b/lib/libSM/src/SMlibint.h
@@ -207,10 +207,9 @@ in this Software without prior written authorization from The Open Group.
#define STORE_ARRAY8(_pBuf, _len, _array8) \
{ \
STORE_CARD32 (_pBuf, _len); \
- memcpy (_pBuf, _array8, _len); \
- _pBuf += _len; \
- if (PAD64 (4 + _len)) \
- _pBuf += PAD64 (4 + _len); \
+ if (_len) \
+ memcpy (_pBuf, _array8, _len); \
+ _pBuf += _len + PAD64 (4 + _len); \
}
#define STORE_LISTOF_PROPERTY(_pBuf, _count, _props) \
@@ -243,9 +242,7 @@ in this Software without prior written authorization from The Open Group.
_array8 = (char *) malloc (_len + 1); \
memcpy (_array8, _pBuf, _len); \
_array8[_len] = '\0'; \
- _pBuf += _len; \
- if (PAD64 (4 + _len)) \
- _pBuf += PAD64 (4 + _len); \
+ _pBuf += _len + PAD64 (4 + _len); \
}
#define EXTRACT_ARRAY8_AS_STRING(_pBuf, _swap, _string) \
@@ -255,9 +252,7 @@ in this Software without prior written authorization from The Open Group.
_string = (char *) malloc (_len + 1); \
memcpy (_string, _pBuf, _len); \
_string[_len] = '\0'; \
- _pBuf += _len; \
- if (PAD64 (4 + _len)) \
- _pBuf += PAD64 (4 + _len); \
+ _pBuf += _len + PAD64 (4 + _len); \
}
#define EXTRACT_LISTOF_PROPERTY(_pBuf, _swap, _count, _props) \
@@ -289,9 +284,7 @@ in this Software without prior written authorization from The Open Group.
{ \
CARD32 _len; \
EXTRACT_CARD32 (_pBuf, _swap, _len); \
- _pBuf += _len; \
- if (PAD64 (4 + _len)) \
- _pBuf += PAD64 (4 + _len); \
+ _pBuf += _len + PAD64 (4 + _len); \
}
#define SKIP_LISTOF_PROPERTY(_pBuf, _swap) \
@@ -495,18 +488,27 @@ struct _SmsConn {
/*
* Extern declarations
*/
+extern void
+_SmcProcessMessage(IceConn iceConn, IcePointer clientData, int opcode,
+ unsigned long length, Bool swap,
+ IceReplyWaitInfo *replyWait, Bool *replyReadyRet);
-extern int _SmcOpcode;
-extern int _SmsOpcode;
+extern void
+_SmsProcessMessage(IceConn iceConn, IcePointer clientData, int opcode,
+ unsigned long length, Bool swap);
+
+extern void
+_SmcDefaultErrorHandler(SmcConn smcConn, Bool swap, int offendingMinorOpcode,
+ unsigned long offendingSequence, int errorClass,
+ int severity, SmPointer values);
-extern int _SmVersionCount;
-extern IcePoVersionRec _SmcVersions[];
-extern IcePaVersionRec _SmsVersions[];
+extern void
+_SmsDefaultErrorHandler(SmsConn smsConn, Bool swap, int offendingMinorOpcode,
+ unsigned long offendingSequence, int errorClass,
+ int severity, SmPointer values);
-extern int _SmAuthCount;
-extern char *_SmAuthNames[];
-extern IcePoAuthProc _SmcAuthProcs[];
-extern IcePaAuthProc _SmsAuthProcs[];
+extern int _SmcOpcode;
+extern int _SmsOpcode;
extern SmsNewClientProc _SmsNewClientProc;
extern SmPointer _SmsNewClientData;
diff --git a/lib/libSM/src/globals.h b/lib/libSM/src/globals.h
deleted file mode 100644
index 2f26a78e9..000000000
--- a/lib/libSM/src/globals.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* $Xorg: globals.h,v 1.4 2001/02/09 02:03:30 xorgcvs Exp $ */
-
-/*
-
-Copyright 1993, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-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/globals.h,v 1.4 2001/12/14 19:53:55 dawes Exp $ */
-
-/*
- * Author: Ralph Mor, X Consortium
- */
-
-extern void _SmcDefaultErrorHandler ();
-extern void _SmsDefaultErrorHandler ();
-
-extern IcePoAuthStatus _IcePoMagicCookie1Proc ();
-extern IcePaAuthStatus _IcePaMagicCookie1Proc ();
-
-extern void _SmcProcessMessage ();
-extern void _SmsProcessMessage ();
-
-int _SmcOpcode = 0;
-int _SmsOpcode = 0;
-
-int _SmVersionCount = 1;
-
-IcePoVersionRec _SmcVersions[] = {
- {SmProtoMajor, SmProtoMinor, _SmcProcessMessage}};
-
-IcePaVersionRec _SmsVersions[] = {
- {SmProtoMajor, SmProtoMinor, _SmsProcessMessage}};
-
-int _SmAuthCount = 1;
-char *_SmAuthNames[] = {"MIT-MAGIC-COOKIE-1"};
-IcePoAuthProc _SmcAuthProcs[] = {_IcePoMagicCookie1Proc};
-IcePaAuthProc _SmsAuthProcs[] = {_IcePaMagicCookie1Proc};
-
-#ifndef __UNIXOS2__
-SmsNewClientProc _SmsNewClientProc;
-SmPointer _SmsNewClientData;
-#else
-SmsNewClientProc _SmsNewClientProc = 0;
-SmPointer _SmsNewClientData = 0;
-#endif
-
-SmcErrorHandler _SmcErrorHandler = _SmcDefaultErrorHandler;
-SmsErrorHandler _SmsErrorHandler = _SmsDefaultErrorHandler;
diff --git a/lib/libSM/src/sm_client.c b/lib/libSM/src/sm_client.c
index 047924b12..a5c714fe9 100644
--- a/lib/libSM/src/sm_client.c
+++ b/lib/libSM/src/sm_client.c
@@ -1,6 +1,3 @@
-/* $XdotOrg: $ */
-/* $Xorg: sm_client.c,v 1.4 2001/02/09 02:03:30 xorgcvs Exp $ */
-
/*
Copyright 1993, 1998 The Open Group
@@ -36,27 +33,32 @@ in this Software without prior written authorization from The Open Group.
#endif
#include <X11/SM/SMlib.h>
#include "SMlibint.h"
-#include "globals.h"
-static void set_callbacks();
+int _SmcOpcode = 0;
+int _SmsOpcode = 0;
+
+#ifndef __UNIXOS2__
+SmsNewClientProc _SmsNewClientProc;
+SmPointer _SmsNewClientData;
+#else
+SmsNewClientProc _SmsNewClientProc = 0;
+SmPointer _SmsNewClientData = 0;
+#endif
+
+SmcErrorHandler _SmcErrorHandler = _SmcDefaultErrorHandler;
+SmsErrorHandler _SmsErrorHandler = _SmsDefaultErrorHandler;
+
+
+static void
+set_callbacks(SmcConn smcConn, unsigned long mask, SmcCallbacks *callbacks);
SmcConn
-SmcOpenConnection (networkIdsList, context,
- xsmpMajorRev, xsmpMinorRev, mask, callbacks,
- previousId, clientIdRet, errorLength, errorStringRet)
-
-char *networkIdsList;
-SmPointer context;
-int xsmpMajorRev;
-int xsmpMinorRev;
-unsigned long mask;
-SmcCallbacks *callbacks;
-char *previousId;
-char **clientIdRet;
-int errorLength;
-char *errorStringRet;
-
+SmcOpenConnection(char *networkIdsList, SmPointer context,
+ int xsmpMajorRev, int xsmpMinorRev,
+ unsigned long mask, SmcCallbacks *callbacks,
+ char *previousId, char **clientIdRet,
+ int errorLength, char *errorStringRet)
{
SmcConn smcConn;
IceConn iceConn;
@@ -73,6 +75,16 @@ char *errorStringRet;
_SmcRegisterClientReply reply;
Bool gotReply, ioErrorOccured;
+ const char *auth_names[] = {"MIT-MAGIC-COOKIE-1"};
+ IcePoAuthProc auth_procs[] = {_IcePoMagicCookie1Proc};
+ int auth_count = 1;
+
+ IcePoVersionRec versions[] = {
+ {SmProtoMajor, SmProtoMinor, _SmcProcessMessage}
+ };
+ int version_count = 1;
+
+
*clientIdRet = NULL;
if (errorStringRet && errorLength > 0)
@@ -83,13 +95,13 @@ char *errorStringRet;
/*
* For now, there is only one version of XSMP, so we don't
* have to check {xsmpMajorRev, xsmpMinorRev}. In the future,
- * we will check against _SmcVersions and generate the list
+ * we will check against versions and generate the list
* of versions the application actually supports.
*/
if ((_SmcOpcode = IceRegisterForProtocolSetup ("XSMP",
- SmVendorString, SmReleaseString, _SmVersionCount, _SmcVersions,
- _SmAuthCount, _SmAuthNames, _SmcAuthProcs, NULL)) < 0)
+ SmVendorString, SmReleaseString, version_count, versions,
+ auth_count, auth_names, auth_procs, NULL)) < 0)
{
if (errorStringRet && errorLength > 0) {
strncpy (errorStringRet,
@@ -188,7 +200,9 @@ char *errorStringRet;
* Now register the client
*/
- len = previousId ? strlen (previousId) : 0;
+ if (!previousId)
+ previousId = "";
+ len = strlen (previousId);
extra = ARRAY8_BYTES (len);
IceGetHeaderExtra (iceConn, _SmcOpcode, SM_RegisterClient,
@@ -254,7 +268,7 @@ char *errorStringRet;
SIZEOF (smRegisterClientMsg), WORD64COUNT (extra),
smRegisterClientMsg, pMsg, pData);
- STORE_ARRAY8 (pData, 0, NULL);
+ STORE_ARRAY8 (pData, 0, "");
IceFlush (iceConn);
@@ -272,12 +286,7 @@ char *errorStringRet;
SmcCloseStatus
-SmcCloseConnection (smcConn, count, reasonMsgs)
-
-SmcConn smcConn;
-int count;
-char **reasonMsgs;
-
+SmcCloseConnection(SmcConn smcConn, int count, char **reasonMsgs)
{
IceConn iceConn = smcConn->iceConn;
smCloseConnectionMsg *pMsg;
@@ -345,12 +354,7 @@ char **reasonMsgs;
void
-SmcModifyCallbacks (smcConn, mask, callbacks)
-
-SmcConn smcConn;
-unsigned long mask;
-SmcCallbacks *callbacks;
-
+SmcModifyCallbacks(SmcConn smcConn, unsigned long mask, SmcCallbacks *callbacks)
{
set_callbacks (smcConn, mask, callbacks);
}
@@ -358,12 +362,7 @@ SmcCallbacks *callbacks;
void
-SmcSetProperties (smcConn, numProps, props)
-
-SmcConn smcConn;
-int numProps;
-SmProp **props;
-
+SmcSetProperties(SmcConn smcConn, int numProps, SmProp **props)
{
IceConn iceConn = smcConn->iceConn;
smSetPropertiesMsg *pMsg;
@@ -378,6 +377,7 @@ SmProp **props;
pMsg->length += WORD64COUNT (bytes);
pBuf = pStart = IceAllocScratch (iceConn, bytes);
+ memset(pStart, 0, bytes);
STORE_LISTOF_PROPERTY (pBuf, numProps, props);
@@ -388,12 +388,7 @@ SmProp **props;
void
-SmcDeleteProperties (smcConn, numProps, propNames)
-
-SmcConn smcConn;
-int numProps;
-char **propNames;
-
+SmcDeleteProperties(SmcConn smcConn, int numProps, char **propNames)
{
IceConn iceConn = smcConn->iceConn;
smDeletePropertiesMsg *pMsg;
@@ -421,12 +416,8 @@ char **propNames;
Status
-SmcGetProperties (smcConn, propReplyProc, clientData)
-
-SmcConn smcConn;
-SmcPropReplyProc propReplyProc;
-SmPointer clientData;
-
+SmcGetProperties(SmcConn smcConn, SmcPropReplyProc propReplyProc,
+ SmPointer clientData)
{
IceConn iceConn = smcConn->iceConn;
_SmcPropReplyWait *wait, *ptr;
@@ -459,13 +450,8 @@ SmPointer clientData;
Status
-SmcInteractRequest (smcConn, dialogType, interactProc, clientData)
-
-SmcConn smcConn;
-int dialogType;
-SmcInteractProc interactProc;
-SmPointer clientData;
-
+SmcInteractRequest(SmcConn smcConn, int dialogType,
+ SmcInteractProc interactProc, SmPointer clientData)
{
IceConn iceConn = smcConn->iceConn;
smInteractRequestMsg *pMsg;
@@ -503,11 +489,7 @@ SmPointer clientData;
void
-SmcInteractDone (smcConn, cancelShutdown)
-
-SmcConn smcConn;
-Bool cancelShutdown;
-
+SmcInteractDone(SmcConn smcConn, Bool cancelShutdown)
{
IceConn iceConn = smcConn->iceConn;
smInteractDoneMsg *pMsg;
@@ -523,16 +505,8 @@ Bool cancelShutdown;
void
-SmcRequestSaveYourself (smcConn, saveType, shutdown, interactStyle,
- fast, global)
-
-SmcConn smcConn;
-int saveType;
-Bool shutdown;
-int interactStyle;
-Bool fast;
-Bool global;
-
+SmcRequestSaveYourself(SmcConn smcConn, int saveType, Bool shutdown,
+ int interactStyle, Bool fast, Bool global)
{
IceConn iceConn = smcConn->iceConn;
smSaveYourselfRequestMsg *pMsg;
@@ -552,12 +526,9 @@ Bool global;
Status
-SmcRequestSaveYourselfPhase2 (smcConn, saveYourselfPhase2Proc, clientData)
-
-SmcConn smcConn;
-SmcSaveYourselfPhase2Proc saveYourselfPhase2Proc;
-SmPointer clientData;
-
+SmcRequestSaveYourselfPhase2(SmcConn smcConn,
+ SmcSaveYourselfPhase2Proc saveYourselfPhase2Proc,
+ SmPointer clientData)
{
IceConn iceConn = smcConn->iceConn;
_SmcPhase2Wait *wait;
@@ -587,11 +558,7 @@ SmPointer clientData;
void
-SmcSaveYourselfDone (smcConn, success)
-
-SmcConn smcConn;
-Bool success;
-
+SmcSaveYourselfDone(SmcConn smcConn, Bool success)
{
IceConn iceConn = smcConn->iceConn;
smSaveYourselfDoneMsg *pMsg;
@@ -607,12 +574,7 @@ Bool success;
static void
-set_callbacks (smcConn, mask, callbacks)
-
-SmcConn smcConn;
-unsigned long mask;
-SmcCallbacks *callbacks;
-
+set_callbacks(SmcConn smcConn, unsigned long mask, SmcCallbacks *callbacks)
{
if (mask & SmcSaveYourselfProcMask)
{
diff --git a/lib/libSM/src/sm_error.c b/lib/libSM/src/sm_error.c
index 50a476e59..d5c15fc8b 100644
--- a/lib/libSM/src/sm_error.c
+++ b/lib/libSM/src/sm_error.c
@@ -45,21 +45,12 @@ in this Software without prior written authorization from The Open Group.
*/
void
-_SmcDefaultErrorHandler (smcConn, swap,
- offendingMinorOpcode, offendingSequence,
- errorClass, severity, values)
-
-SmcConn smcConn;
-Bool swap;
-int offendingMinorOpcode;
-unsigned long offendingSequence;
-int errorClass;
-int severity;
-SmPointer values;
-
+_SmcDefaultErrorHandler(SmcConn smcConn, Bool swap, int offendingMinorOpcode,
+ unsigned long offendingSequence, int errorClass,
+ int severity, SmPointer values)
{
char *pData = (char *) values;
- char *str;
+ const char *str;
switch (offendingMinorOpcode)
{
@@ -177,21 +168,12 @@ SmPointer values;
*/
void
-_SmsDefaultErrorHandler (smsConn, swap,
- offendingMinorOpcode, offendingSequence,
- errorClass, severity, values)
-
-SmsConn smsConn;
-Bool swap;
-int offendingMinorOpcode;
-unsigned long offendingSequence;
-int errorClass;
-int severity;
-SmPointer values;
-
+_SmsDefaultErrorHandler(SmsConn smsConn, Bool swap, int offendingMinorOpcode,
+ unsigned long offendingSequence, int errorClass,
+ int severity, SmPointer values)
{
char *pData = (char *) values;
- char *str;
+ const char *str;
switch (offendingMinorOpcode)
{
@@ -301,10 +283,7 @@ SmPointer values;
*/
SmcErrorHandler
-SmcSetErrorHandler (handler)
-
-SmcErrorHandler handler;
-
+SmcSetErrorHandler(SmcErrorHandler handler)
{
SmcErrorHandler oldHandler = _SmcErrorHandler;
@@ -325,10 +304,7 @@ SmcErrorHandler handler;
*/
SmsErrorHandler
-SmsSetErrorHandler (handler)
-
-SmsErrorHandler handler;
-
+SmsSetErrorHandler(SmsErrorHandler handler)
{
SmsErrorHandler oldHandler = _SmsErrorHandler;
diff --git a/lib/libSM/src/sm_genid.c b/lib/libSM/src/sm_genid.c
index bf066448e..f6adda395 100644
--- a/lib/libSM/src/sm_genid.c
+++ b/lib/libSM/src/sm_genid.c
@@ -1,4 +1,3 @@
-/* $Xorg: sm_genid.c,v 1.4 2001/02/09 02:03:30 xorgcvs Exp $ */
/*
Copyright 1993, 1998 The Open Group
@@ -25,7 +24,6 @@ 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.17 2003/07/09 15:27:28 tsi Exp $ */
/*
* Author: Ralph Mor, X Consortium
@@ -78,51 +76,55 @@ in this Software without prior written authorization from The Open Group.
#define TCPCONN
#endif
-
-static char *hex_table[] = { /* for generating client IDs */
- "00", "01", "02", "03", "04", "05", "06", "07",
- "08", "09", "0a", "0b", "0c", "0d", "0e", "0f",
- "10", "11", "12", "13", "14", "15", "16", "17",
- "18", "19", "1a", "1b", "1c", "1d", "1e", "1f",
- "20", "21", "22", "23", "24", "25", "26", "27",
- "28", "29", "2a", "2b", "2c", "2d", "2e", "2f",
- "30", "31", "32", "33", "34", "35", "36", "37",
- "38", "39", "3a", "3b", "3c", "3d", "3e", "3f",
- "40", "41", "42", "43", "44", "45", "46", "47",
- "48", "49", "4a", "4b", "4c", "4d", "4e", "4f",
- "50", "51", "52", "53", "54", "55", "56", "57",
- "58", "59", "5a", "5b", "5c", "5d", "5e", "5f",
- "60", "61", "62", "63", "64", "65", "66", "67",
- "68", "69", "6a", "6b", "6c", "6d", "6e", "6f",
- "70", "71", "72", "73", "74", "75", "76", "77",
- "78", "79", "7a", "7b", "7c", "7d", "7e", "7f",
- "80", "81", "82", "83", "84", "85", "86", "87",
- "88", "89", "8a", "8b", "8c", "8d", "8e", "8f",
- "90", "91", "92", "93", "94", "95", "96", "97",
- "98", "99", "9a", "9b", "9c", "9d", "9e", "9f",
- "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7",
- "a8", "a9", "aa", "ab", "ac", "ad", "ae", "af",
- "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7",
- "b8", "b9", "ba", "bb", "bc", "bd", "be", "bf",
- "c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7",
- "c8", "c9", "ca", "cb", "cc", "cd", "ce", "cf",
- "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
- "d8", "d9", "da", "db", "dc", "dd", "de", "df",
- "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7",
- "e8", "e9", "ea", "eb", "ec", "ed", "ee", "ef",
- "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
- "f8", "f9", "fa", "fb", "fc", "fd", "fe", "ff",
-};
-
+#if defined(HAVE_UUID_CREATE)
+#include <uuid.h>
+#elif defined(HAVE_LIBUUID)
+#include <uuid/uuid.h>
+#endif
char *
-SmsGenerateClientID (smsConn)
- SmsConn smsConn;
+SmsGenerateClientID(SmsConn smsConn)
{
+#if defined(HAVE_UUID_CREATE)
+ char *id;
+ char **temp;
+ uuid_t uuid;
+ uint32_t status;
+
+ uuid_create(&uuid, &status);
+
+ uuid_to_string(&uuid, &temp, &status);
+
+ if ((id = malloc (strlen (temp) + 2)) != NULL)
+ {
+ id[1] = '2';
+ strcpy (id+1, temp);
+ }
+
+ free(temp);
+
+ return id;
+#elif defined(HAVE_LIBUUID)
+ char *id;
+ char temp[256];
+ uuid_t uuid;
+
+ uuid_generate(uuid);
+
+ temp[0] = '2';
+ temp[1] = '\0';
+ uuid_unparse_lower(uuid, &temp[1]);
+
+ if ((id = malloc (strlen (temp) + 1)) != NULL)
+ strcpy (id, temp);
+
+ return id;
+#else
#if defined(TCPCONN) || defined(STREAMSCONN)
+ static const char hex[] = "0123456789abcdef";
char hostname[256];
- char address[64];
+ char address[64], *addr_ptr = address;
char temp[256];
char *id;
static int sequence = 0;
@@ -153,13 +155,15 @@ SmsGenerateClientID (smsConn)
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';
+ *addr_ptr++ = '6'; /* IPv6 address code */
for (i = 0 ; i < 16 ; i++) {
- strcat(address, hex_table[cp[i]]);
+ *addr_ptr++ = hex[cp[i] >> 4];
+ *addr_ptr++ = hex[cp[i] & 0x0f];
}
+ *addr_ptr++ = '\0';
+
} else { /* Fall through to IPv4 address handling */
haddr = &((struct sockaddr_in *)ai->ai_addr)->sin_addr;
#else
@@ -193,10 +197,15 @@ SmsGenerateClientID (smsConn)
decimal[3] = atoi (ptr1);
- address[0] = '1';
- address[1] = '\0';
- for (i = 0; i < 4; i++)
- strcat (address, hex_table[decimal[i]]);
+ *addr_ptr++ = '1';
+
+ for (i = 0; i < 4; i++) {
+ *addr_ptr++ = hex[decimal[i] >> 4];
+ *addr_ptr++ = hex[decimal[i] & 0x0f];
+ }
+
+ *addr_ptr++ = '\0';
+
#if defined(IPv6) && defined(AF_INET6)
}
freeaddrinfo(first_ai);
@@ -216,4 +225,5 @@ SmsGenerateClientID (smsConn)
#else
return (NULL);
#endif
+#endif
}
diff --git a/lib/libSM/src/sm_manager.c b/lib/libSM/src/sm_manager.c
index df9c221d3..688214595 100644
--- a/lib/libSM/src/sm_manager.c
+++ b/lib/libSM/src/sm_manager.c
@@ -73,7 +73,7 @@ _SmsProtocolSetupProc (IceConn iceConn,
if ((smsConn = (SmsConn) malloc (sizeof (struct _SmsConn))) == NULL)
{
- char *str = "Memory allocation failed";
+ const char *str = "Memory allocation failed";
if ((*failureReasonRet = (char *) malloc (strlen (str) + 1)) != NULL)
strcpy (*failureReasonRet, str);
@@ -114,18 +114,19 @@ _SmsProtocolSetupProc (IceConn iceConn,
Status
-SmsInitialize (vendor, release, newClientProc, managerData,
- hostBasedAuthProc, errorLength, errorStringRet)
+SmsInitialize(char *vendor, char *release, SmsNewClientProc newClientProc,
+ SmPointer managerData, IceHostBasedAuthProc hostBasedAuthProc,
+ int errorLength, char *errorStringRet)
+{
+ const char *auth_names[] = {"MIT-MAGIC-COOKIE-1"};
+ IcePaAuthProc auth_procs[] = {_IcePaMagicCookie1Proc};
+ int auth_count = 1;
-char *vendor;
-char *release;
-SmsNewClientProc newClientProc;
-SmPointer managerData;
-IceHostBasedAuthProc hostBasedAuthProc;
-int errorLength;
-char *errorStringRet;
+ IcePaVersionRec versions[] = {
+ {SmProtoMajor, SmProtoMinor, _SmsProcessMessage}
+ };
+ int version_count = 1;
-{
if (errorStringRet && errorLength > 0)
*errorStringRet = '\0';
@@ -145,8 +146,8 @@ char *errorStringRet;
{
if ((_SmsOpcode = IceRegisterForProtocolReply ("XSMP",
- vendor, release, _SmVersionCount, _SmsVersions,
- _SmAuthCount, _SmAuthNames, _SmsAuthProcs, hostBasedAuthProc,
+ vendor, release, version_count, versions,
+ auth_count, auth_names, auth_procs, hostBasedAuthProc,
_SmsProtocolSetupProc,
NULL, /* IceProtocolActivateProc - we don't care about
when the Protocol Reply is sent, because the
@@ -174,10 +175,7 @@ char *errorStringRet;
char *
-SmsClientHostName (smsConn)
-
-SmsConn smsConn;
-
+SmsClientHostName(SmsConn smsConn)
{
return (IceGetPeerName (smsConn->iceConn));
}
@@ -185,11 +183,7 @@ SmsConn smsConn;
Status
-SmsRegisterClientReply (smsConn, clientId)
-
-SmsConn smsConn;
-char *clientId;
-
+SmsRegisterClientReply(SmsConn smsConn, char *clientId)
{
IceConn iceConn = smsConn->iceConn;
int extra;
@@ -219,14 +213,8 @@ char *clientId;
void
-SmsSaveYourself (smsConn, saveType, shutdown, interactStyle, fast)
-
-SmsConn smsConn;
-int saveType;
-Bool shutdown;
-int interactStyle;
-Bool fast;
-
+SmsSaveYourself(SmsConn smsConn, int saveType, Bool shutdown,
+ int interactStyle, Bool fast)
{
IceConn iceConn = smsConn->iceConn;
smSaveYourselfMsg *pMsg;
@@ -262,10 +250,7 @@ Bool fast;
void
-SmsSaveYourselfPhase2 (smsConn)
-
-SmsConn smsConn;
-
+SmsSaveYourselfPhase2(SmsConn smsConn)
{
IceConn iceConn = smsConn->iceConn;
@@ -276,10 +261,7 @@ SmsConn smsConn;
void
-SmsInteract (smsConn)
-
-SmsConn smsConn;
-
+SmsInteract(SmsConn smsConn)
{
IceConn iceConn = smsConn->iceConn;
@@ -292,10 +274,7 @@ SmsConn smsConn;
void
-SmsDie (smsConn)
-
-SmsConn smsConn;
-
+SmsDie(SmsConn smsConn)
{
IceConn iceConn = smsConn->iceConn;
@@ -306,10 +285,7 @@ SmsConn smsConn;
void
-SmsSaveComplete (smsConn)
-
-SmsConn smsConn;
-
+SmsSaveComplete(SmsConn smsConn)
{
IceConn iceConn = smsConn->iceConn;
@@ -320,10 +296,7 @@ SmsConn smsConn;
void
-SmsShutdownCancelled (smsConn)
-
-SmsConn smsConn;
-
+SmsShutdownCancelled(SmsConn smsConn)
{
IceConn iceConn = smsConn->iceConn;
@@ -336,12 +309,7 @@ SmsConn smsConn;
void
-SmsReturnProperties (smsConn, numProps, props)
-
-SmsConn smsConn;
-int numProps;
-SmProp **props;
-
+SmsReturnProperties(SmsConn smsConn, int numProps, SmProp **props)
{
IceConn iceConn = smsConn->iceConn;
int bytes;
@@ -366,10 +334,7 @@ SmProp **props;
void
-SmsCleanUp (smsConn)
-
-SmsConn smsConn;
-
+SmsCleanUp(SmsConn smsConn)
{
IceProtocolShutdown (smsConn->iceConn, _SmsOpcode);
diff --git a/lib/libSM/src/sm_misc.c b/lib/libSM/src/sm_misc.c
index 30c2c2d18..a08b19866 100644
--- a/lib/libSM/src/sm_misc.c
+++ b/lib/libSM/src/sm_misc.c
@@ -42,10 +42,7 @@ in this Software without prior written authorization from The Open Group.
*/
void
-SmFreeProperty (prop)
-
-SmProp *prop;
-
+SmFreeProperty(SmProp *prop)
{
if (prop)
{
@@ -73,11 +70,7 @@ SmProp *prop;
*/
void
-SmFreeReasons (count, reasonMsgs)
-
-int count;
-char **reasonMsgs;
-
+SmFreeReasons(int count, char **reasonMsgs)
{
if (reasonMsgs)
{
@@ -97,30 +90,21 @@ char **reasonMsgs;
*/
int
-SmcProtocolVersion (smcConn)
-
-SmcConn smcConn;
-
+SmcProtocolVersion(SmcConn smcConn)
{
return (smcConn->proto_major_version);
}
int
-SmcProtocolRevision (smcConn)
-
-SmcConn smcConn;
-
+SmcProtocolRevision(SmcConn smcConn)
{
return (smcConn->proto_minor_version);
}
char *
-SmcVendor (smcConn)
-
-SmcConn smcConn;
-
+SmcVendor(SmcConn smcConn)
{
char *string = (char *) malloc (strlen (smcConn->vendor) + 1);
@@ -131,10 +115,7 @@ SmcConn smcConn;
char *
-SmcRelease (smcConn)
-
-SmcConn smcConn;
-
+SmcRelease(SmcConn smcConn)
{
char *string = (char *) malloc (strlen (smcConn->release) + 1);
@@ -145,10 +126,7 @@ SmcConn smcConn;
char *
-SmcClientID (smcConn)
-
-SmcConn smcConn;
-
+SmcClientID(SmcConn smcConn)
{
char *clientId = (char *) malloc (strlen (smcConn->client_id) + 1);
@@ -159,10 +137,7 @@ SmcConn smcConn;
IceConn
-SmcGetIceConnection (smcConn)
-
-SmcConn smcConn;
-
+SmcGetIceConnection(SmcConn smcConn)
{
return (smcConn->iceConn);
}
@@ -174,30 +149,21 @@ SmcConn smcConn;
*/
int
-SmsProtocolVersion (smsConn)
-
-SmsConn smsConn;
-
+SmsProtocolVersion(SmsConn smsConn)
{
return (smsConn->proto_major_version);
}
int
-SmsProtocolRevision (smsConn)
-
-SmsConn smsConn;
-
+SmsProtocolRevision(SmsConn smsConn)
{
return (smsConn->proto_minor_version);
}
char *
-SmsClientID (smsConn)
-
-SmsConn smsConn;
-
+SmsClientID(SmsConn smsConn)
{
char *clientId = (char *) malloc (strlen (smsConn->client_id) + 1);
@@ -208,10 +174,7 @@ SmsConn smsConn;
IceConn
-SmsGetIceConnection (smsConn)
-
-SmsConn smsConn;
-
+SmsGetIceConnection(SmsConn smsConn)
{
return (smsConn->iceConn);
}
diff --git a/lib/libSM/src/sm_process.c b/lib/libSM/src/sm_process.c
index ab3ec0ba4..1c8102097 100644
--- a/lib/libSM/src/sm_process.c
+++ b/lib/libSM/src/sm_process.c
@@ -68,17 +68,9 @@ in this Software without prior written authorization from The Open Group.
void
-_SmcProcessMessage (iceConn, clientData, opcode,
- length, swap, replyWait, replyReadyRet)
-
-IceConn iceConn;
-IcePointer clientData;
-int opcode;
-unsigned long length;
-Bool swap;
-IceReplyWaitInfo *replyWait;
-Bool *replyReadyRet;
-
+_SmcProcessMessage(IceConn iceConn, IcePointer clientData, int opcode,
+ unsigned long length, Bool swap,
+ IceReplyWaitInfo *replyWait, Bool *replyReadyRet)
{
SmcConn smcConn = (SmcConn) clientData;
@@ -423,14 +415,8 @@ Bool *replyReadyRet;
void
-_SmsProcessMessage (iceConn, clientData, opcode, length, swap)
-
-IceConn iceConn;
-IcePointer clientData;
-int opcode;
-unsigned long length;
-Bool swap;
-
+_SmsProcessMessage(IceConn iceConn, IcePointer clientData, int opcode,
+ unsigned long length, Bool swap)
{
SmsConn smsConn = (SmsConn) clientData;