mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-04-01 21:00:40 +02:00
Merge branch 'listen-path' into 'main'
Allow display names to be arbitrary paths See merge request xorg/xserver!546
This commit is contained in:
commit
7fb3f3db46
3 changed files with 19 additions and 10 deletions
|
|
@ -212,12 +212,8 @@ NotifyParentProcess(void)
|
|||
}
|
||||
|
||||
static Bool
|
||||
TryCreateSocket(int num, int *partial)
|
||||
TryCreateSocket(const char *port, int *partial)
|
||||
{
|
||||
char port[20];
|
||||
|
||||
snprintf(port, sizeof(port), "%d", num);
|
||||
|
||||
return (_XSERVTransMakeAllCOTSServerListeners(port, partial,
|
||||
&ListenTransCount,
|
||||
&ListenTransConns) >= 0);
|
||||
|
|
@ -241,7 +237,7 @@ CreateWellKnownSockets(void)
|
|||
ListenTransCount = 0;
|
||||
}
|
||||
else if ((displayfd < 0) || explicit_display) {
|
||||
if (TryCreateSocket(atoi(display), &partial) &&
|
||||
if (TryCreateSocket(display, &partial) &&
|
||||
ListenTransCount >= 1)
|
||||
if (!PartialNetwork && partial)
|
||||
FatalError ("Failed to establish all listening sockets");
|
||||
|
|
@ -249,7 +245,10 @@ CreateWellKnownSockets(void)
|
|||
else { /* -displayfd and no explicit display number */
|
||||
Bool found = 0;
|
||||
for (i = 0; i < 65536 - X_TCP_PORT; i++) {
|
||||
if (TryCreateSocket(i, &partial) && !partial) {
|
||||
char port[20];
|
||||
|
||||
snprintf(port, sizeof(port), "%d", i);
|
||||
if (TryCreateSocket(port, &partial) && !partial) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
12
os/utils.c
12
os/utils.c
|
|
@ -594,8 +594,12 @@ UseMsg(void)
|
|||
/* This function performs a rudimentary sanity check
|
||||
* on the display name passed in on the command-line,
|
||||
* since this string is used to generate filenames.
|
||||
* It is especially important that the display name
|
||||
* not contain a "/" and not start with a "-".
|
||||
* The string must either be a filename starting with "/",
|
||||
* or a sequence of 1-3 numbers separated by ".".
|
||||
*
|
||||
* It is especially important that the display name not
|
||||
* start with "-", and if the display name does not start
|
||||
* with "/", then it must not contain a "/"
|
||||
* --kvajk
|
||||
*/
|
||||
static int
|
||||
|
|
@ -613,6 +617,8 @@ VerifyDisplayName(const char *d)
|
|||
return 0; /* could be confused for an option */
|
||||
if (*d == '.')
|
||||
return 0; /* must not equal "." or ".." */
|
||||
if (*d == '/')
|
||||
return 1;
|
||||
if (strchr(d, '/') != (char *) 0)
|
||||
return 0; /* very important!!! */
|
||||
|
||||
|
|
@ -850,7 +856,7 @@ ProcessCommandLine(int argc, char *argv[])
|
|||
#ifdef LOCK_SERVER
|
||||
else if (strcmp(argv[i], "-nolock") == 0) {
|
||||
#if !defined(WIN32) && !defined(__CYGWIN__)
|
||||
if (getuid() != 0)
|
||||
if (getuid() != 0 && PrivsElevated())
|
||||
ErrorF
|
||||
("Warning: the -nolock option can only be used by root\n");
|
||||
else
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ RunXkbComp(xkbcomp_buffer_callback callback, void *userdata)
|
|||
char *xkbbasedirflag = NULL;
|
||||
const char *xkbbindir = emptystring;
|
||||
const char *xkbbindirsep = emptystring;
|
||||
int i;
|
||||
|
||||
#ifdef WIN32
|
||||
/* WIN32 has no popen. The input must be stored in a file which is
|
||||
|
|
@ -123,6 +124,9 @@ RunXkbComp(xkbcomp_buffer_callback callback, void *userdata)
|
|||
#endif
|
||||
|
||||
snprintf(keymap, sizeof(keymap), "server-%s", display);
|
||||
for (i = 0; keymap[i] != '\0'; i++)
|
||||
if (keymap[i] == '/')
|
||||
keymap[i] = '_';
|
||||
|
||||
OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue