diff options
Diffstat (limited to 'xorg-server/os/access.c')
-rw-r--r-- | xorg-server/os/access.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/xorg-server/os/access.c b/xorg-server/os/access.c index 125f35f5f..5c510ded2 100644 --- a/xorg-server/os/access.c +++ b/xorg-server/os/access.c @@ -35,13 +35,13 @@ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -201,7 +201,7 @@ static Bool NewHost(int /*family */ , /etc/X<display>.hosts, we've added a requested field to the HOST struct, and a LocalHostRequested variable. These default to FALSE, but are set to TRUE in ResetHosts when reading in /etc/X<display>.hosts. They are - checked in DisableLocalHost(), which is called to disable the default + checked in DisableLocalHost(), which is called to disable the default local host entries when stronger authentication is turned on. */ typedef struct _host { @@ -309,7 +309,7 @@ ifioctl(int fd, int cmd, char *arg) /* * DefineSelf (fd): * - * Define this host for access control. Find all the hosts the OS knows about + * Define this host for access control. Find all the hosts the OS knows about * for this fd and add them to the selfhosts list. */ @@ -712,7 +712,7 @@ DefineSelf(int fd) ) continue; - /* + /* * ignore 'localhost' entries as they're not useful * on the other end of the wire */ @@ -835,7 +835,7 @@ ResetHosts(const char *display) } saddr; #endif int family = 0; - void *addr; + void *addr = NULL; int len; siTypesInitialize(); @@ -928,8 +928,8 @@ ResetHosts(const char *display) len = a->ai_addrlen; f = ConvertAddr(a->ai_addr, &len, (void **) &addr); - if ((family == f) || - ((family == FamilyWild) && (f != -1))) { + if (addr && ((family == f) || + ((family == FamilyWild) && (f != -1)))) { NewHost(f, addr, len, FALSE); } } @@ -1010,7 +1010,7 @@ ComputeLocalClient(ClientPtr client) /* * Return the uid and all gids of a connected local client * Allocates a LocalClientCredRec - caller must call FreeLocalClientCreds - * + * * Used by localuser & localgroup ServerInterpreted access control forms below * Used by AuthAudit to log who local connections came from */ @@ -1037,8 +1037,8 @@ GetLocalClientCreds(ClientPtr client, LocalClientCredRec ** lccp) return -1; ci = ((OsCommPtr) client->osPrivate)->trans_conn; #if !(defined(sun) && defined(HAVE_GETPEERUCRED)) - /* Most implementations can only determine peer credentials for Unix - * domain sockets - Solaris getpeerucred can work with a bit more, so + /* 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)) { @@ -1203,7 +1203,7 @@ ForEachHostInFamily(int family, Bool (*func) (unsigned char *addr, return FALSE; } -/* Add a host to the access control list. This is the internal interface +/* Add a host to the access control list. This is the internal interface * called when starting or resetting the server */ static Bool NewHost(int family, const void *addr, int len, int addingLocalHosts) @@ -1352,14 +1352,14 @@ CheckAddr(int family, const void *pAddr, unsigned length) return len; } -/* Check if a host is not in the access control list. +/* Check if a host is not in the access control list. * Returns 1 if host is invalid, 0 if we've found it. */ int InvalidHost(register struct sockaddr *saddr, int len, ClientPtr client) { int family; - void *addr; + void *addr = NULL; register HOST *selfhost, *host; if (!AccessEnabled) /* just let them in */ @@ -1370,7 +1370,7 @@ InvalidHost(register struct sockaddr *saddr, int len, ClientPtr client) if (family == FamilyLocal) { if (!LocalHostEnabled) { /* - * check to see if any local address is enabled. This + * check to see if any local address is enabled. This * implicitly enables local connections. */ for (selfhost = selfhosts; selfhost; selfhost = selfhost->next) { @@ -1386,12 +1386,12 @@ InvalidHost(register struct sockaddr *saddr, int len, ClientPtr client) } for (host = validhosts; host; host = host->next) { if (host->family == FamilyServerInterpreted) { - if (siAddrMatch(family, addr, len, host, client)) { + if (addr && siAddrMatch(family, addr, len, host, client)) { return 0; } } else { - if (addrEqual(family, addr, len, host)) + if (addr && addrEqual(family, addr, len, host)) return 0; } @@ -1474,7 +1474,7 @@ GetAccessControl(void) * See xc/doc/specs/SIAddresses for formal definitions of each type. */ -/* These definitions and the siTypeAdd function could be exported in the +/* 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. */ @@ -1571,7 +1571,7 @@ siCheckAddr(const char *addrString, int length) 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. + * and the second string is a valid address of that type. */ typelen = strlen(addrString) + 1; addrlen = length - typelen; @@ -1638,8 +1638,8 @@ siHostnameAddrMatch(int family, void *addr, int len, { Bool res = FALSE; -/* Currently only supports checking against IPv4 & IPv6 connections, but - * support for other address families, such as DECnet, could be added if +/* 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) @@ -1648,7 +1648,7 @@ siHostnameAddrMatch(int family, void *addr, int len, struct addrinfo *addresses; struct addrinfo *a; int f, hostaddrlen; - void *hostaddr; + void *hostaddr = NULL; if (siAddrLen >= sizeof(hostname)) return FALSE; @@ -1659,7 +1659,7 @@ siHostnameAddrMatch(int family, void *addr, int len, 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) && + if ((f == family) && (len == hostaddrlen) && hostaddr && (memcmp(addr, hostaddr, len) == 0)) { res = TRUE; break; @@ -1717,7 +1717,7 @@ 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. + * character sets. Hostnames must be pure ASCII. */ int len = length; int i; @@ -1771,12 +1771,12 @@ siHostnameCheckAddr(const char *valueString, int length, void *typePriv) * * 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 + * 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. +/* 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 |