diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2022-08-31 11:25:20 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2022-08-31 11:25:20 +0000 |
commit | be9f365c075c78cfa670e2ee7d939cfc20807ed5 (patch) | |
tree | b1197eb17d32e65b1c667ef70b529c73719f7971 /xserver/os | |
parent | 63ff66483d961ba4416764b5fd61c5500c2070ea (diff) |
Update xserver to version 21.1.4.
The security patches were already committed as part of july 24 errata.
This brings a few other bug fixes.
Tested by Walter Alejandro Iglesias.
Diffstat (limited to 'xserver/os')
-rw-r--r-- | xserver/os/connection.c | 31 | ||||
-rw-r--r-- | xserver/os/utils.c | 1 |
2 files changed, 26 insertions, 6 deletions
diff --git a/xserver/os/connection.c b/xserver/os/connection.c index 3b1947957..691b2d5ce 100644 --- a/xserver/os/connection.c +++ b/xserver/os/connection.c @@ -79,6 +79,8 @@ SOFTWARE. #include <stdio.h> #include <stdlib.h> +#include <sys/stat.h> + #ifndef WIN32 #include <sys/socket.h> @@ -1006,15 +1008,34 @@ MakeClientGrabPervious(ClientPtr client) void ListenOnOpenFD(int fd, int noxauth) { - char port[256]; + char port[PATH_MAX]; XtransConnInfo ciptr; const char *display_env = getenv("DISPLAY"); - if (display_env && (strncmp(display_env, "/tmp/launch", 11) == 0)) { - /* Make the path the launchd socket if our DISPLAY is set right */ - strcpy(port, display_env); + /* First check if display_env matches a <absolute path to unix socket>[.<screen number>] scheme (eg: launchd) */ + if (display_env && display_env[0] == '/') { + struct stat sbuf; + + strlcpy(port, display_env, sizeof(port)); + + /* If the path exists, we don't have do do anything else. + * If it doesn't, we need to check for a .<screen number> to strip off and recheck. + */ + if (0 != stat(port, &sbuf)) { + char *dot = strrchr(port, '.'); + if (dot) { + *dot = '\0'; + + if (0 != stat(port, &sbuf)) { + display_env = NULL; + } + } else { + display_env = NULL; + } + } } - else { + + if (!display_env) { /* Just some default so things don't break and die. */ snprintf(port, sizeof(port), ":%d", atoi(display)); } diff --git a/xserver/os/utils.c b/xserver/os/utils.c index 673f56308..1934aeeef 100644 --- a/xserver/os/utils.c +++ b/xserver/os/utils.c @@ -693,7 +693,6 @@ ProcessCommandLine(int argc, char *argv[]) ErrorF("Failed to disable listen for %s transport", defaultNoListenList[i]); } - SeatId = getenv("XDG_SEAT"); for (i = 1; i < argc; i++) { /* call ddx first, so it can peek/override if it wants */ |