diff options
author | Egbert Eich <eich@suse.de> | 2004-04-23 19:54:30 +0000 |
---|---|---|
committer | Egbert Eich <eich@suse.de> | 2004-04-23 19:54:30 +0000 |
commit | 2fb588620030ad393f8500d60e16144d59e4effe (patch) | |
tree | 07262cbe15a40e5aeae54f62751260f83243ab79 /os | |
parent | 0664db19bf37f9dd69cca6adff4e238e310c3092 (diff) |
Merging XORG-CURRENT into trunk
Diffstat (limited to 'os')
-rw-r--r-- | os/WaitFor.c | 2 | ||||
-rw-r--r-- | os/access.c | 503 | ||||
-rw-r--r-- | os/auth.c | 2 | ||||
-rw-r--r-- | os/connection.c | 4 | ||||
-rw-r--r-- | os/io.c | 2 | ||||
-rw-r--r-- | os/k5auth.c | 2 | ||||
-rw-r--r-- | os/lbxio.c | 2 | ||||
-rw-r--r-- | os/mitauth.c | 2 | ||||
-rw-r--r-- | os/oscolor.c | 2 | ||||
-rw-r--r-- | os/osdep.h | 2 | ||||
-rw-r--r-- | os/osinit.c | 2 | ||||
-rw-r--r-- | os/rpcauth.c | 2 | ||||
-rw-r--r-- | os/secauth.c | 2 | ||||
-rw-r--r-- | os/utils.c | 24 | ||||
-rw-r--r-- | os/xalloc.c | 4 | ||||
-rw-r--r-- | os/xdmauth.c | 2 | ||||
-rw-r--r-- | os/xdmcp.c | 51 |
17 files changed, 525 insertions, 85 deletions
diff --git a/os/WaitFor.c b/os/WaitFor.c index 615392d64..3283dd5cf 100644 --- a/os/WaitFor.c +++ b/os/WaitFor.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/os/WaitFor.c,v 3.44 2004/02/17 15:30:26 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/os/WaitFor.c,v 3.42 2003/10/16 01:33:35 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group diff --git a/os/access.c b/os/access.c index 14b61839c..2877373c7 100644 --- a/os/access.c +++ b/os/access.c @@ -1,28 +1,38 @@ /* $Xorg: access.c,v 1.5 2001/02/09 02:05:23 xorgcvs Exp $ */ +/* $XdotOrg: xc/programs/Xserver/os/access.c,v 1.1.4.3.2.3 2004/03/22 11:57:11 ago Exp $ */ /*********************************************************** Copyright 1987, 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. - +Copyright 2004 Sun Microsystems, Inc. + +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, and/or sell copies of the Software, and to permit persons +to whom the Software is furnished to do so, provided that the above +copyright notice(s) and this permission notice appear in all copies of +the Software and that both the above copyright notice(s) and this +permission notice appear in supporting documentation. + +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 +OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL +INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING +FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, +NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION +WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, use +or other dealings in this Software without prior written authorization +of the copyright holder. + +X Window System is a trademark of The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -45,7 +55,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/os/access.c,v 3.54 2004/01/03 17:38:39 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/os/access.c,v 3.53 2004/01/02 18:23:19 tsi Exp $ */ #ifdef WIN32 #include <X11/Xwinsock.h> @@ -78,6 +88,9 @@ SOFTWARE. #include <netdnet/dnetdb.h> #endif +#ifdef HAS_GETPEERUCRED +# include <ucred.h> +#endif #if defined(DGUX) #include <sys/ioctl.h> @@ -242,6 +255,11 @@ static int LocalHostEnabled = FALSE; static int LocalHostRequested = FALSE; static int UsingXdmcp = FALSE; +/* FamilyServerInterpreted implementation */ +static Bool siAddrMatch(int family, pointer addr, int len, HOST *host, + ClientPtr client); +static int siCheckAddr(const char *addrString, int length); +static void siTypesInitialize(void); /* * called when authorization is not enabled to add the @@ -641,7 +659,7 @@ DefineLocalHost: #endif #endif -#ifdef DEF_SELF_DEBUG +#if defined(DEF_SELF_DEBUG) || (defined(IPv6) && defined(AF_INET6)) #include <arpa/inet.h> #endif @@ -1100,6 +1118,7 @@ ResetHosts (char *display) pointer addr; int len; + siTypesInitialize(); AccessEnabled = defeatAccessControl ? FALSE : DEFAULT_ACCESS_CONTROL; LocalHostEnabled = FALSE; while ((host = validhosts) != 0) @@ -1107,6 +1126,7 @@ ResetHosts (char *display) validhosts = host->next; FreeHost (host); } + #define ETC_HOST_PREFIX "/etc/X" #define ETC_HOST_SUFFIX ".hosts" fnamelen = strlen(ETC_HOST_PREFIX) + strlen(ETC_HOST_SUFFIX) + @@ -1176,10 +1196,26 @@ ResetHosts (char *display) hostname = ohostname + 4; } #endif + else if (!strncmp("si:", lhostname, 3)) + { + family = FamilyServerInterpreted; + hostname = ohostname + 3; + hostlen -= 3; + } + + + if (family == FamilyServerInterpreted) + { + len = siCheckAddr(hostname, hostlen); + if (len >= 0) { + NewHost(family, hostname, len, FALSE); + } + } + else #ifdef DNETCONN - if ((family == FamilyDECnet) || + if ((family == FamilyDECnet) || ((family == FamilyWild) && (ptr = strchr(hostname, ':')) && (*(ptr + 1) == ':') && - !(*ptr = '\0')) /* bash trailing colons if necessary */ + !(*ptr = '\0'))) /* bash trailing colons if necessary */ { /* node name (DECnet names end in "::") */ dnaddrp = dnet_addr(hostname); @@ -1332,12 +1368,14 @@ Bool LocalClient(ClientPtr client) int LocalClientCred(ClientPtr client, int *pUid, int *pGid) { -#if defined(HAS_GETPEEREID) || defined(SO_PEERCRED) +#if defined(HAS_GETPEEREID) || defined(HAS_GETPEERUCRED) || defined(SO_PEERCRED) int fd; XtransConnInfo ci; #ifdef HAS_GETPEEREID uid_t uid; gid_t gid; +#elif defined(HAS_GETPEERUCRED) + ucred_t *peercred = NULL; #elif defined(SO_PEERCRED) struct ucred peercred; socklen_t so_len = sizeof(peercred); @@ -1346,10 +1384,15 @@ LocalClientCred(ClientPtr client, int *pUid, int *pGid) if (client == NULL) return -1; ci = ((OsCommPtr)client->osPrivate)->trans_conn; - /* We can only determine peer credentials for Unix domain sockets */ +#if !(defined(sun) && defined(HAS_GETPEERUCRED)) + /* Most implementations can only determine peer credentials for Unix + * domain sockets - Solaris getpeerucred can work with a bit more, so + * we just let it tell us if the connection type is supported or not + */ if (!_XSERVTransIsLocal(ci)) { return -1; } +#endif fd = _XSERVTransGetConnectionNumber(ci); #ifdef HAS_GETPEEREID if (getpeereid(fd, &uid, &gid) == -1) @@ -1359,6 +1402,15 @@ LocalClientCred(ClientPtr client, int *pUid, int *pGid) if (pGid != NULL) *pGid = gid; return 0; +#elif defined(HAS_GETPEERUCRED) + if (getpeerucred(fd, &peercred) < 0) + return -1; + if (pUid != NULL) + *pUid = ucred_geteuid(peercred); + if (pGid != NULL) + *pGid = ucred_getegid(peercred); + ucred_free(peercred); + return 0; #elif defined(SO_PEERCRED) if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &peercred, &so_len) == -1) return -1; @@ -1417,6 +1469,7 @@ AddHost (ClientPtr client, #endif case FamilyDECnet: case FamilyChaos: + case FamilyServerInterpreted: if ((len = CheckAddr (family, pAddr, length)) < 0) { client->errorValue = length; @@ -1518,6 +1571,7 @@ RemoveHost ( #endif case FamilyDECnet: case FamilyChaos: + case FamilyServerInterpreted: if ((len = CheckAddr (family, pAddr, length)) < 0) { client->errorValue = length; @@ -1629,6 +1683,9 @@ CheckAddr ( } break; #endif + case FamilyServerInterpreted: + len = siCheckAddr(pAddr, length); + break; default: len = -1; } @@ -1641,7 +1698,8 @@ CheckAddr ( int InvalidHost ( register struct sockaddr *saddr, - int len) + int len, + ClientPtr client) { int family; pointer addr; @@ -1675,8 +1733,15 @@ InvalidHost ( } for (host = validhosts; host; host = host->next) { - if (addrEqual (family, addr, len, host)) - return (0); + if ((host->family == FamilyServerInterpreted)) { + if (siAddrMatch (family, addr, len, host, client)) { + return (0); + } + } else { + if (addrEqual (family, addr, len, host)) + return (0); + } + } return (1); } @@ -1755,3 +1820,381 @@ GetAccessControl(void) { return AccessEnabled; } + +/***************************************************************************** + * FamilyServerInterpreted host entry implementation + * + * Supports an extensible system of host types which the server can interpret + * See the IPv6 extensions to the X11 protocol spec for the definition. + * + * Currently supported schemes: + * + * hostname - hostname as defined in IETF RFC 2396 + * ipv6 - IPv6 literal address as defined in IETF RFC's 3513 and <TBD> + * + * See xc/doc/specs/SIAddresses for formal definitions of each type. + */ + +/* These definitions and the siTypeAdd function could be exported in the + * future to enable loading additional host types, but that was not done for + * the initial implementation. + */ +typedef Bool (*siAddrMatchFunc)(int family, pointer addr, int len, + const char *siAddr, int siAddrlen, ClientPtr client, void *siTypePriv); +typedef int (*siCheckAddrFunc)(const char *addrString, int length, + void *siTypePriv); + +struct siType { + struct siType * next; + const char * typeName; + siAddrMatchFunc addrMatch; + siCheckAddrFunc checkAddr; + void * typePriv; /* Private data for type routines */ +}; + +static struct siType *siTypeList; + +static int +siTypeAdd(const char *typeName, siAddrMatchFunc addrMatch, + siCheckAddrFunc checkAddr, void *typePriv) +{ + struct siType *s, *p; + + if ((typeName == NULL) || (addrMatch == NULL) || (checkAddr == NULL)) + return BadValue; + + for (s = siTypeList, p = NULL; s != NULL ; p = s, s = s->next) { + if (strcmp(typeName, s->typeName) == 0) { + s->addrMatch = addrMatch; + s->checkAddr = checkAddr; + s->typePriv = typePriv; + return Success; + } + } + + s = (struct siType *) xalloc(sizeof(struct siType)); + if (s == NULL) + return BadAlloc; + + if (p == NULL) + siTypeList = s; + else + p->next = s; + + s->next = NULL; + s->typeName = typeName; + s->addrMatch = addrMatch; + s->checkAddr = checkAddr; + s->typePriv = typePriv; + return Success; +} + +/* Checks to see if a host matches a server-interpreted host entry */ +static Bool +siAddrMatch(int family, pointer addr, int len, HOST *host, ClientPtr client) +{ + Bool matches = FALSE; + struct siType *s; + const char *valueString; + int addrlen; + + valueString = (const char *) memchr(host->addr, '\0', host->len); + if (valueString != NULL) { + for (s = siTypeList; s != NULL ; s = s->next) { + if (strcmp((char *) host->addr, s->typeName) == 0) { + addrlen = host->len - (strlen((char *)host->addr) + 1); + matches = s->addrMatch(family, addr, len, + valueString + 1, addrlen, client, s->typePriv); + break; + } + } +#ifdef FAMILY_SI_DEBUG + ErrorF( + "Xserver: siAddrMatch(): type = %s, value = %*.*s -- %s\n", + host->addr, addrlen, addrlen, valueString + 1, + (matches) ? "accepted" : "rejected"); +#endif + } + return matches; +} + +static int +siCheckAddr(const char *addrString, int length) +{ + const char *valueString; + int addrlen, typelen; + int len = -1; + struct siType *s; + + /* Make sure there is a \0 byte inside the specified length + to separate the address type from the address value. */ + valueString = (const char *) memchr(addrString, '\0', length); + if (valueString != NULL) { + /* Make sure the first string is a recognized address type, + * and the second string is a valid address of that type. + */ + typelen = strlen(addrString) + 1; + addrlen = length - typelen; + + for (s = siTypeList; s != NULL ; s = s->next) { + if (strcmp(addrString, s->typeName) == 0) { + len = s->checkAddr(valueString + 1, addrlen, s->typePriv); + if (len >= 0) { + len += typelen; + } + break; + } + } +#ifdef FAMILY_SI_DEBUG + { + const char *resultMsg; + + if (s == NULL) { + resultMsg = "type not registered"; + } else { + if (len == -1) + resultMsg = "rejected"; + else + resultMsg = "accepted"; + } + + ErrorF("Xserver: siCheckAddr(): type = %s, value = %*.*s, len = %d -- %s\n", + addrString, addrlen, addrlen, valueString + 1, len, resultMsg); + } +#endif + } + return len; +} + + +/*** + * Hostname server-interpreted host type + * + * Stored as hostname string, explicitly defined to be resolved ONLY + * at access check time, to allow for hosts with dynamic addresses + * but static hostnames, such as found in some DHCP & mobile setups. + * + * Hostname must conform to IETF RFC 2396 sec. 3.2.2, which defines it as: + * hostname = *( domainlabel "." ) toplabel [ "." ] + * domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum + * toplabel = alpha | alpha *( alphanum | "-" ) alphanum + */ + +#ifdef NI_MAXHOST +# define SI_HOSTNAME_MAXLEN NI_MAXHOST +#else +# ifdef MAXHOSTNAMELEN +# define SI_HOSTNAME_MAXLEN MAXHOSTNAMELEN +# else +# define SI_HOSTNAME_MAXLEN 256 +# endif +#endif + +static Bool +siHostnameAddrMatch(int family, pointer addr, int len, + const char *siAddr, int siAddrLen, ClientPtr client, void *typePriv) +{ + Bool res = FALSE; + +/* Currently only supports checking against IPv4 & IPv6 connections, but + * support for other address families, such as DECnet, could be added if + * desired. + */ +#if defined(IPv6) && defined(AF_INET6) + if ((family == FamilyInternet) || (family == FamilyInternet6)) { + char hostname[SI_HOSTNAME_MAXLEN]; + struct addrinfo *addresses; + struct addrinfo *a; + int f, hostaddrlen; + pointer hostaddr; + + if (siAddrLen >= sizeof(hostname)) + return FALSE; + + strncpy(hostname, siAddr, siAddrLen); + hostname[siAddrLen] = '\0'; + + if (getaddrinfo(hostname, NULL, NULL, &addresses) == 0) { + for (a = addresses ; a != NULL ; a = a->ai_next) { + hostaddrlen = a->ai_addrlen; + f = ConvertAddr(a->ai_addr,&hostaddrlen,&hostaddr); + if ((f == family) && (len == hostaddrlen) && + (acmp (addr, hostaddr, len) == 0) ) { + res = TRUE; + break; + } + } + freeaddrinfo(addresses); + } + } +#else /* IPv6 not supported, use gethostbyname instead for IPv4 */ + if (family == FamilyInternet) { + register struct hostent *hp; +#ifdef XTHREADS_NEEDS_BYNAMEPARAMS + _Xgethostbynameparams hparams; +#endif + char hostname[SI_HOSTNAME_MAXLEN]; + int f, hostaddrlen; + pointer hostaddr; + const char **addrlist; + + if (siAddrLen >= sizeof(hostname)) + return FALSE; + + strncpy(hostname, siAddr, siAddrLen); + hostname[siAddrLen] = '\0'; + + if ((hp = _XGethostbyname(hostname, hparams)) != NULL) { +#ifdef h_addr /* new 4.3bsd version of gethostent */ + /* iterate over the addresses */ + for (addrlist = hp->h_addr_list; *addrlist; addrlist++) +#else + addrlist = &hp->h_addr; +#endif + { + struct sockaddr_in sin; + + sin.sin_family = hp->h_addrtype; + acopy ( *addrlist, &(sin.sin_addr), hp->h_length); + hostaddrlen = sizeof(sin); + f = ConvertAddr ((struct sockaddr *)&sin, + &hostaddrlen, &hostaddr); + if ((f == family) && (len == hostaddrlen) && + (acmp (addr, hostaddr, len) == 0) ) { + res = TRUE; + break; + } + } + } + } +#endif + return res; +} + + +static int +siHostnameCheckAddr(const char *valueString, int length, void *typePriv) +{ + /* Check conformance of hostname to RFC 2396 sec. 3.2.2 definition. + * We do not use ctype functions here to avoid locale-specific + * character sets. Hostnames must be pure ASCII. + */ + int len = length; + int i; + Bool dotAllowed = FALSE; + Bool dashAllowed = FALSE; + + if ((length <= 0) || (length >= SI_HOSTNAME_MAXLEN)) { + len = -1; + } else { + for (i = 0; i < length; i++) { + char c = valueString[i]; + + if (c == 0x2E) { /* '.' */ + if (dotAllowed == FALSE) { + len = -1; + break; + } else { + dotAllowed = FALSE; + dashAllowed = FALSE; + } + } else if (c == 0x2D) { /* '-' */ + if (dashAllowed == FALSE) { + len = -1; + break; + } else { + dotAllowed = FALSE; + } + } else if (((c >= 0x30) && (c <= 0x3A)) /* 0-9 */ || + ((c >= 0x61) && (c <= 0x7A)) /* a-z */ || + ((c >= 0x41) && (c <= 0x5A)) /* A-Z */) { + dotAllowed = TRUE; + dashAllowed = TRUE; + } else { /* Invalid character */ + len = -1; + break; + } + } + } + return len; +} + +#if defined(IPv6) && defined(AF_INET6) +/*** + * "ipv6" server interpreted type + * + * Currently supports only IPv6 literal address as specified in IETF RFC 3513 + * + * Once draft-ietf-ipv6-scoping-arch-00.txt becomes an RFC, support will be + * added for the scoped address format it specifies. + */ + +/* Maximum length of an IPv6 address string - increase when adding support + * for scoped address qualifiers. Includes room for trailing NUL byte. + */ +#define SI_IPv6_MAXLEN INET6_ADDRSTRLEN + +static Bool +siIPv6AddrMatch(int family, pointer addr, int len, + const char *siAddr, int siAddrlen, ClientPtr client, void *typePriv) +{ + struct in6_addr addr6; + char addrbuf[SI_IPv6_MAXLEN]; + + if ((family != FamilyInternet6) || (len != sizeof(addr6))) + return FALSE; + + memcpy(addrbuf, siAddr, siAddrlen); + addrbuf[siAddrlen] = '\0'; + + if (inet_pton(AF_INET6, addrbuf, &addr6) != 1) { + perror("inet_pton"); + return FALSE; + } + + if (memcmp(addr, &addr6, len) == 0) { + return TRUE; + } else { + return FALSE; + } +} + +static int +siIPv6CheckAddr(const char *addrString, int length, void *typePriv) +{ + int len; + + /* Minimum length is 3 (smallest legal address is "::1") */ + if (length < 3) { + /* Address is too short! */ + len = -1; + } else if (length >= SI_IPv6_MAXLEN) { + /* Address is too long! */ + len = -1; + } else { + /* Assume inet_pton is sufficient validation */ + struct in6_addr addr6; + char addrbuf[SI_IPv6_MAXLEN]; + + memcpy(addrbuf, addrString, length); + addrbuf[length] = '\0'; + + if (inet_pton(AF_INET6, addrbuf, &addr6) != 1) { + perror("inet_pton"); + len = -1; + } else { + len = length; + } + } + return len; +} +#endif /* IPv6 */ + +static void +siTypesInitialize(void) +{ + siTypeAdd("hostname", siHostnameAddrMatch, siHostnameCheckAddr, NULL); +#if defined(IPv6) && defined(AF_INET6) + siTypeAdd("ipv6", siIPv6AddrMatch, siIPv6CheckAddr, NULL); +#endif +} @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/os/auth.c,v 1.14 2003/08/27 19:57:21 herrb Exp $ */ +/* $XFree86: auth.c,v 1.13 2003/04/27 21:31:08 herrb Exp $ */ /* * authorization hooks for the server diff --git a/os/connection.c b/os/connection.c index 7465e7eff..930d38528 100644 --- a/os/connection.c +++ b/os/connection.c @@ -45,7 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/os/connection.c,v 3.65 2003/10/30 21:21:10 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/os/connection.c,v 3.64 2003/10/07 22:50:42 herrb Exp $ */ /***************************************************************** * Stuff to create connections --- OS dependent * @@ -661,7 +661,7 @@ ClientAuthorized(ClientPtr client, #ifdef LBX !trans_conn || #endif - InvalidHost ((struct sockaddr *) from, fromlen)) + InvalidHost ((struct sockaddr *) from, fromlen, client)) AuthAudit(client, FALSE, (struct sockaddr *) from, fromlen, proto_n, auth_proto, auth_id); else @@ -53,7 +53,7 @@ SOFTWARE. * InsertFakeRequest, ResetCurrentRequest * *****************************************************************/ -/* $XFree86: xc/programs/Xserver/os/io.c,v 3.35 2003/04/27 21:31:08 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/os/io.c,v 3.34 2002/05/31 18:46:05 dawes Exp $ */ #if 0 #define DEBUG_COMMUNICATION diff --git a/os/k5auth.c b/os/k5auth.c index 8c59fe8ab..3726df6ba 100644 --- a/os/k5auth.c +++ b/os/k5auth.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/os/k5auth.c,v 3.5 2001/12/14 20:00:34 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/k5auth.c,v 3.4 2001/01/17 22:37:10 dawes Exp $ */ /* * Kerberos V5 authentication scheme diff --git a/os/lbxio.c b/os/lbxio.c index ae4d4355f..ba79040b5 100644 --- a/os/lbxio.c +++ b/os/lbxio.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/os/lbxio.c,v 3.18 2003/04/27 21:31:09 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/os/lbxio.c,v 3.17 2002/05/31 18:46:06 dawes Exp $ */ /* Copyright 1996, 1998 The Open Group diff --git a/os/mitauth.c b/os/mitauth.c index bddbdf1d6..97f88b232 100644 --- a/os/mitauth.c +++ b/os/mitauth.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/os/mitauth.c,v 1.5 2001/12/14 20:00:34 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/mitauth.c,v 1.4 2001/01/17 22:37:11 dawes Exp $ */ /* * MIT-MAGIC-COOKIE-1 authorization scheme diff --git a/os/oscolor.c b/os/oscolor.c index f6e941fb8..557d539bb 100644 --- a/os/oscolor.c +++ b/os/oscolor.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/os/oscolor.c,v 3.11 2003/09/24 02:43:36 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/oscolor.c,v 3.10 2003/07/16 01:39:03 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group diff --git a/os/osdep.h b/os/osdep.h index a5392ffc3..2b9eb5674 100644 --- a/os/osdep.h +++ b/os/osdep.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/os/osdep.h,v 3.18 2003/04/27 21:31:09 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/os/osdep.h,v 3.17 2002/05/31 18:46:06 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group diff --git a/os/osinit.c b/os/osinit.c index 1c56d0af7..1a5ff0501 100644 --- a/os/osinit.c +++ b/os/osinit.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/os/osinit.c,v 3.30 2003/10/29 04:17:22 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/osinit.c,v 3.29 2003/09/09 03:20:41 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group diff --git a/os/rpcauth.c b/os/rpcauth.c index 512b3ecb5..f0693f599 100644 --- a/os/rpcauth.c +++ b/os/rpcauth.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/os/rpcauth.c,v 3.8 2003/04/27 21:31:09 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/os/rpcauth.c,v 3.7 2001/12/14 20:00:35 dawes Exp $ */ /* * SUN-DES-1 authentication mechanism diff --git a/os/secauth.c b/os/secauth.c index 4f90fe9a9..8c30eaafb 100644 --- a/os/secauth.c +++ b/os/secauth.c @@ -24,7 +24,7 @@ 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/programs/Xserver/os/secauth.c,v 1.11 2001/12/14 20:00:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/secauth.c,v 1.10 2001/08/01 00:44:59 tsi Exp $ */ #include "X.h" #include "os.h" diff --git a/os/utils.c b/os/utils.c index 924d97471..51931ae4c 100644 --- a/os/utils.c +++ b/os/utils.c @@ -1,3 +1,4 @@ +/* $XdotOrg: xc/programs/Xserver/os/utils.c,v 1.1.4.6.2.4.6.3 2004/04/20 03:27:09 gisburn Exp $ */ /* $Xorg: utils.c,v 1.5 2001/02/09 02:05:24 xorgcvs Exp $ */ /* @@ -49,7 +50,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/os/utils.c,v 3.97 2004/01/09 00:35:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/utils.c,v 3.96 2004/01/07 04:16:37 dawes Exp $ */ #ifdef __CYGWIN__ #include <stdlib.h> @@ -167,7 +168,7 @@ int userdefinedfontpath = 0; char *dev_tty_from_init = NULL; /* since we need to parse it anyway */ -extern int dispatchExceptionAtReset; +extern char dispatchExceptionAtReset; OsSigHandlerPtr OsSignal(sig, handler) @@ -575,6 +576,17 @@ VerifyDisplayName(const char *d) } /* + * This function is responsible for doing initalisation of any global + * variables at an very early point of server startup (even before + * |ProcessCommandLine()|. + */ +void InitGlobals(void) +{ + ddxInitGlobals(); +} + + +/* * This function parses the command line. Handles device-independent fields * and allows ddx to handle additional fields. It is not allowed to modify * argc or any of the strings pointed to by argv. @@ -607,7 +619,7 @@ ProcessCommandLine(int argc, char *argv[]) if( ! VerifyDisplayName( display ) ) { ErrorF("Bad display name: %s\n", display); UseMsg(); - exit(1); + FatalError("Bad display name, exiting: %s\n", display); } } else if ( strcmp( argv[i], "-a") == 0) @@ -985,7 +997,7 @@ ProcessCommandLine(int argc, char *argv[]) { ErrorF("Unrecognized option: %s\n", argv[i]); UseMsg(); - exit (1); + FatalError("Unrecognized option: %s\n", argv[i]); } } } @@ -1848,13 +1860,13 @@ enum BadCode { #define ARGMSG \ "\nIf the arguments used are valid, and have been rejected incorrectly\n" \ "please send details of the arguments and why they are valid to\n" \ - "XFree86@XFree86.org. In the meantime, you can start the Xserver as\n" \ + "&&&&&@X.org. In the meantime, you can start the Xserver as\n" \ "the \"super user\" (root).\n" #define ENVMSG \ "\nIf the environment is valid, and have been rejected incorrectly\n" \ "please send details of the environment and why it is valid to\n" \ - "XFree86@XFree86.org. In the meantime, you can start the Xserver as\n" \ + "&&&&&@X.org. In the meantime, you can start the Xserver as\n" \ "the \"super user\" (root).\n" void diff --git a/os/xalloc.c b/os/xalloc.c index 8bb46e2c9..5677896dc 100644 --- a/os/xalloc.c +++ b/os/xalloc.c @@ -26,7 +26,7 @@ dealings in this Software without prior written authorization from Pascal Haible. */ -/* $XFree86: xc/programs/Xserver/os/xalloc.c,v 3.36 2003/11/03 05:12:00 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/os/xalloc.c,v 3.35tsi Exp $ */ /* Only used if INTERNAL_MALLOC is defined * - otherwise xalloc() in utils.c is used @@ -184,7 +184,7 @@ extern Bool Must_have_memory; defined(__ia64__) || defined(ia64) || \ defined(__sparc64__) || \ defined(__s390x__) || \ - defined(__AMD64__) || defined(AMD64) || \ + defined(__amd64__) || defined(amd64) || \ (defined(sgi) && _MIPS_SZLONG == 64)) #define MAGIC 0x1404196414071968 #define MAGIC_FREE 0x1506196615061966 diff --git a/os/xdmauth.c b/os/xdmauth.c index 13695c13c..4ec7265dd 100644 --- a/os/xdmauth.c +++ b/os/xdmauth.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/os/xdmauth.c,v 1.9 2003/06/24 15:44:48 eich Exp $ */ +/* $XFree86: xdmauth.c,v 1.7 2002/11/05 05:50:34 keithp Exp $ */ /* * XDM-AUTHENTICATION-1 (XDMCP authentication) and diff --git a/os/xdmcp.c b/os/xdmcp.c index cbd43f45b..9489afc44 100644 --- a/os/xdmcp.c +++ b/os/xdmcp.c @@ -1,3 +1,4 @@ +/* $XdotOrg: xc/programs/Xserver/os/xdmcp.c,v 1.1.4.5 2004/02/23 21:37:27 kaleb Exp $ */ /* $Xorg: xdmcp.c,v 1.4 2001/01/31 13:37:19 pookie Exp $ */ /* * Copyright 1989 Network Computing Devices, Inc., Mountain View, California. @@ -13,7 +14,7 @@ * without express or implied warranty. * */ -/* $XFree86: xc/programs/Xserver/os/xdmcp.c,v 3.32 2004/01/01 17:09:29 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/os/xdmcp.c,v 3.31 2003/12/30 21:24:32 herrb Exp $ */ #ifdef WIN32 /* avoid conflicting definitions */ @@ -279,8 +280,7 @@ XdmcpOptions(int argc, char **argv, int i) } if (strcmp(argv[i], "-port") == 0) { if (++i == argc) { - ErrorF("Xserver: missing port number in command line\n"); - exit(1); + FatalError("Xserver: missing port number in command line\n"); } xdm_udp_port = (unsigned short) atoi(argv[i]); return (i + 1); @@ -295,8 +295,7 @@ XdmcpOptions(int argc, char **argv, int i) } if (strcmp(argv[i], "-class") == 0) { if (++i == argc) { - ErrorF("Xserver: missing class name in command line\n"); - exit(1); + FatalError("Xserver: missing class name in command line\n"); } defaultDisplayClass = argv[i]; return (i + 1); @@ -304,8 +303,7 @@ XdmcpOptions(int argc, char **argv, int i) #ifdef HASXDMAUTH if (strcmp(argv[i], "-cookie") == 0) { if (++i == argc) { - ErrorF("Xserver: missing cookie data in command line\n"); - exit(1); + FatalError("Xserver: missing cookie data in command line\n"); } xdmAuthCookie = argv[i]; return (i + 1); @@ -313,8 +311,7 @@ XdmcpOptions(int argc, char **argv, int i) #endif if (strcmp(argv[i], "-displayID") == 0) { if (++i == argc) { - ErrorF("Xserver: missing displayID in command line\n"); - exit(1); + FatalError("Xserver: missing displayID in command line\n"); } XdmcpRegisterManufacturerDisplayID (argv[i], strlen (argv[i])); return (i + 1); @@ -1061,8 +1058,7 @@ get_xdmcp_sock(void) if (xdmcpSocket >= 0 && xdm_from != NULL) { if (bind(xdmcpSocket, (struct sockaddr *)&FromAddress, FromAddressLen) < 0) { - ErrorF("Xserver: failed to bind to -from address: %s\n", xdm_from); - exit(1); + FatalError("Xserver: failed to bind to -from address: %s\n", xdm_from); } } #endif /* STREAMSCONN */ @@ -1523,8 +1519,7 @@ get_addr_by_name( } else if (port > 0 && port < 65535) { sprintf(portstr, "%d", port); } else { - ErrorF("Xserver: port out of range: %d\n", port); - exit(1); + FatalError("Xserver: port out of range: %d\n", port); } if (*aifirstp != NULL) { @@ -1538,17 +1533,15 @@ get_addr_by_name( break; } if ((ai == NULL) || (ai->ai_addrlen > sizeof(SOCKADDR_TYPE))) { - ErrorF ("Xserver: %s host %s not on supported network type\n", + FatalError ("Xserver: %s host %s not on supported network type\n", argtype, namestr); - exit (1); } else { *aip = ai; *addrlen = ai->ai_addrlen; memcpy(addr, ai->ai_addr, ai->ai_addrlen); } } else { - ErrorF("Xserver: %s: %s %s\n", gai_strerror(gaierr), argtype, namestr); - exit(1); + FatalError("Xserver: %s: %s %s\n", gai_strerror(gaierr), argtype, namestr); } #else struct hostent *hep; @@ -1558,8 +1551,7 @@ get_addr_by_name( if (!(hep = _XGethostbyname(namestr, hparams))) { - ErrorF("Xserver: %s unknown host: %s\n", argtype, namestr); - exit(1); + FatalError("Xserver: %s unknown host: %s\n", argtype, namestr); } if (hep->h_length == sizeof (struct in_addr)) { @@ -1570,8 +1562,7 @@ get_addr_by_name( } else { - ErrorF ("Xserver: %s host on strange network %s\n", argtype, namestr); - exit (1); + FatalError("Xserver: %s host on strange network %s\n", argtype, namestr); } #endif } @@ -1585,8 +1576,7 @@ get_manager_by_name( if ((i + 1) == argc) { - ErrorF("Xserver: missing %s host name in command line\n", argv[i]); - exit(1); + FatalError("Xserver: missing %s host name in command line\n", argv[i]); } get_addr_by_name(argv[i], argv[i+1], xdm_udp_port, SOCK_DGRAM, @@ -1610,8 +1600,7 @@ get_fromaddr_by_name( #endif if (i == argc) { - ErrorF("Xserver: missing -from host name in command line\n"); - exit(1); + FatalError("Xserver: missing -from host name in command line\n"); } get_addr_by_name("-from", argv[i], 0, 0, &FromAddress, &FromAddressLen #if defined(IPv6) && defined(AF_INET6) @@ -1640,9 +1629,8 @@ get_mcast_options(argc, argv, i) if ((i < argc) && (argv[i][0] != '-') && (argv[i][0] != '+')) { hopcount = strtol(argv[i++], NULL, 10); if ((hopcount < 1) || (hopcount > 255)) { - ErrorF("Xserver: multicast hop count out of range: %d\n", + FatalError("Xserver: multicast hop count out of range: %d\n", hopcount); - exit(1); } } } @@ -1650,8 +1638,7 @@ get_mcast_options(argc, argv, i) if (xdm_udp_port > 0 && xdm_udp_port < 65535) { sprintf(portstr, "%d", xdm_udp_port); } else { - ErrorF("Xserver: port out of range: %d\n", xdm_udp_port); - exit(1); + FatalError("Xserver: port out of range: %d\n", xdm_udp_port); } bzero(&hints, sizeof(hints)); hints.ai_socktype = SOCK_DGRAM; @@ -1667,9 +1654,8 @@ get_mcast_options(argc, argv, i) break; } if (ai == NULL) { - ErrorF ("Xserver: address not supported multicast type %s\n", + FatalError ("Xserver: address not supported multicast type %s\n", address); - exit (1); } else { struct multicastinfo *mcastinfo, *mcl; @@ -1688,8 +1674,7 @@ get_mcast_options(argc, argv, i) } } } else { - ErrorF("Xserver: %s: %s\n", gai_strerror(gaierr), address); - exit(1); + FatalError("Xserver: %s: %s\n", gai_strerror(gaierr), address); } return i; } |