aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/os
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2015-06-15 21:36:28 +0200
committermarha <marha@users.sourceforge.net>2015-06-15 21:36:28 +0200
commit008a8d8051786badb83e455bd9281103ba9a6470 (patch)
treef99ea672d105271cb60a726fac8022ce47ea2866 /xorg-server/os
parent912e881bec8b16f2331225960645c3bdf5a8ba2d (diff)
parente8d5e7c4bb11f7fcb0a4ba5c13f43e7929849a2f (diff)
downloadvcxsrv-008a8d8051786badb83e455bd9281103ba9a6470.tar.gz
vcxsrv-008a8d8051786badb83e455bd9281103ba9a6470.tar.bz2
vcxsrv-008a8d8051786badb83e455bd9281103ba9a6470.zip
Merge remote-tracking branch 'origin/released'
Conflicts: freetype/src/base/ftfntfmt.c freetype/src/cache/ftcimage.c freetype/src/cid/cidriver.c freetype/src/truetype/ttdriver.c mesalib/src/mesa/drivers/dri/common/dri_util.c mesalib/src/mesa/drivers/dri/swrast/swrast.c openssl/Makefile
Diffstat (limited to 'xorg-server/os')
-rw-r--r--xorg-server/os/access.c109
-rw-r--r--xorg-server/os/auth.c8
-rw-r--r--xorg-server/os/backtrace.c4
-rw-r--r--xorg-server/os/makefile1
4 files changed, 116 insertions, 6 deletions
diff --git a/xorg-server/os/access.c b/xorg-server/os/access.c
index 23eb404ed..0b49ef703 100644
--- a/xorg-server/os/access.c
+++ b/xorg-server/os/access.c
@@ -102,6 +102,10 @@ SOFTWARE.
#include <sys/ioctl.h>
#include <ctype.h>
+#ifndef NO_LOCAL_CLIENT_CRED
+#include <pwd.h>
+#endif
+
#if defined(TCPCONN) || defined(STREAMSCONN)
#include <netinet/in.h>
#endif /* TCPCONN || STREAMSCONN */
@@ -229,6 +233,13 @@ static int ActiveInterfaces = 0;
void match_interface(u_long u_lQuery);
+static enum {
+ LOCAL_ACCESS_SCOPE_HOST = 0,
+#ifndef NO_LOCAL_CLIENT_CRED
+ LOCAL_ACCESS_SCOPE_USER,
+#endif
+} LocalAccessScope;
+
/* FamilyServerInterpreted implementation */
static Bool siAddrMatch(int family, void *addr, int len, HOST * host,
ClientPtr client);
@@ -319,6 +330,21 @@ int inet_pton(int af, const char *src, void *dst)
*/
void
+EnableLocalAccess(void)
+{
+ switch (LocalAccessScope) {
+ case LOCAL_ACCESS_SCOPE_HOST:
+ EnableLocalHost();
+ break;
+#ifndef NO_LOCAL_CLIENT_CRED
+ case LOCAL_ACCESS_SCOPE_USER:
+ EnableLocalUser();
+ break;
+#endif
+ }
+}
+
+void
EnableLocalHost(void)
{
if (!UsingXdmcp) {
@@ -331,6 +357,21 @@ EnableLocalHost(void)
* called when authorization is enabled to keep us secure
*/
void
+DisableLocalAccess(void)
+{
+ switch (LocalAccessScope) {
+ case LOCAL_ACCESS_SCOPE_HOST:
+ DisableLocalHost();
+ break;
+#ifndef NO_LOCAL_CLIENT_CRED
+ case LOCAL_ACCESS_SCOPE_USER:
+ DisableLocalUser();
+ break;
+#endif
+ }
+}
+
+void
DisableLocalHost(void)
{
HOST *self;
@@ -344,6 +385,74 @@ DisableLocalHost(void)
}
}
+#ifndef NO_LOCAL_CLIENT_CRED
+static int GetLocalUserAddr(char **addr)
+{
+ static const char *type = "localuser";
+ static const char delimiter = '\0';
+ static const char *value;
+ struct passwd *pw;
+ int length = -1;
+
+ pw = getpwuid(getuid());
+
+ if (pw == NULL || pw->pw_name == NULL)
+ goto out;
+
+ value = pw->pw_name;
+
+ length = asprintf(addr, "%s%c%s", type, delimiter, value);
+
+ if (length == -1) {
+ goto out;
+ }
+
+ /* Trailing NUL */
+ length++;
+
+out:
+ return length;
+}
+
+void
+EnableLocalUser(void)
+{
+ char *addr = NULL;
+ int length = -1;
+
+ length = GetLocalUserAddr(&addr);
+
+ if (length == -1)
+ return;
+
+ NewHost(FamilyServerInterpreted, addr, length, TRUE);
+
+ free(addr);
+}
+
+void
+DisableLocalUser(void)
+{
+ char *addr = NULL;
+ int length = -1;
+
+ length = GetLocalUserAddr(&addr);
+
+ if (length == -1)
+ return;
+
+ RemoveHost(NULL, FamilyServerInterpreted, length, addr);
+
+ free(addr);
+}
+
+void
+LocalAccessScopeUser(void)
+{
+ LocalAccessScope = LOCAL_ACCESS_SCOPE_USER;
+}
+#endif
+
/*
* called at init time when XDMCP will be used; xdmcp always
* adds local hosts manually when needed
diff --git a/xorg-server/os/auth.c b/xorg-server/os/auth.c
index df05a5717..b5ae2540c 100644
--- a/xorg-server/os/auth.c
+++ b/xorg-server/os/auth.c
@@ -181,11 +181,11 @@ CheckAuthorization(unsigned int name_length,
/*
* If the authorization file has at least one entry for this server,
- * disable local host access. (loadauth > 0)
+ * disable local access. (loadauth > 0)
*
* If there are zero entries (either initially or when the
* authorization file is later reloaded), or if a valid
- * authorization file was never loaded, enable local host access.
+ * authorization file was never loaded, enable local access.
* (loadauth == 0 || !loaded)
*
* If the authorization file was loaded initially (with valid
@@ -194,11 +194,11 @@ CheckAuthorization(unsigned int name_length,
*/
if (loadauth > 0) {
- DisableLocalHost(); /* got at least one */
+ DisableLocalAccess(); /* got at least one */
loaded = TRUE;
}
else if (loadauth == 0 || !loaded)
- EnableLocalHost();
+ EnableLocalAccess();
}
if (name_length) {
for (i = 0; i < NUM_AUTHORIZATION; i++) {
diff --git a/xorg-server/os/backtrace.c b/xorg-server/os/backtrace.c
index 3d1195b86..fd129ef21 100644
--- a/xorg-server/os/backtrace.c
+++ b/xorg-server/os/backtrace.c
@@ -87,7 +87,7 @@ xorg_backtrace(void)
procname[1] = 0;
}
- if (dladdr((void *)(pip.start_ip + off), &dlinfo) && dlinfo.dli_fname &&
+ if (dladdr((void *)(uintptr_t)(pip.start_ip + off), &dlinfo) && dlinfo.dli_fname &&
*dlinfo.dli_fname)
filename = dlinfo.dli_fname;
else
@@ -95,7 +95,7 @@ xorg_backtrace(void)
ErrorFSigSafe("%u: %s (%s%s+0x%x) [%p]\n", i++, filename, procname,
ret == -UNW_ENOMEM ? "..." : "", (int)off,
- (void *)(pip.start_ip + off));
+ (void *)(uintptr_t)(pip.start_ip + off));
ret = unw_step(&cursor);
if (ret < 0)
diff --git a/xorg-server/os/makefile b/xorg-server/os/makefile
index ba7720a25..b129301e9 100644
--- a/xorg-server/os/makefile
+++ b/xorg-server/os/makefile
@@ -3,6 +3,7 @@ LIBRARY=libos
ifeq ($(DEBUG),1)
DEFINES += XSERVER_DTRACE
endif
+DEFINES += NO_LOCAL_CLIENT_CRED
SECURE_RPC=1
XDMCP=1
NEED_STRLCAT=1