aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2017-03-15 14:56:17 +0000
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-03-21 10:58:08 +0100
commite8bc4c7e2f42d21e41328b68d5dc2a15db73d47a (patch)
treed767bfc45dda8a67c83d1d11ca243d1c901ea596 /nx-X11/programs/Xserver
parent89496d987dc6a21250c9fdda2cd3668516061f5c (diff)
downloadnx-libs-e8bc4c7e2f42d21e41328b68d5dc2a15db73d47a.tar.gz
nx-libs-e8bc4c7e2f42d21e41328b68d5dc2a15db73d47a.tar.bz2
nx-libs-e8bc4c7e2f42d21e41328b68d5dc2a15db73d47a.zip
os: Add a mechanism to prevent creating any listen sockets
commit 44fe1b8ea284df6bbaef67e246016d104665b2fe Author: Kristian Høgsberg <krh@bitplanet.net> Date: Wed Mar 19 14:03:13 2014 -0700 os: Add a mechanism to prevent creating any listen sockets A socket-activated server will receive its listening sockets from the parent process and should not create its own sockets. This patch introduces a NoListen flag that can be set by a DDX to prevent the server from creating the sockets. When NoListen is enabled, we also disable the server lock checking, since the parent process is responsible for checking the lock before picking the display name and creating the sockets. Signed-off-by: Kristian Høgsberg <krh@bitplanet.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
Diffstat (limited to 'nx-X11/programs/Xserver')
-rw-r--r--nx-X11/programs/Xserver/include/opaque.h2
-rw-r--r--nx-X11/programs/Xserver/os/connection.c8
-rw-r--r--nx-X11/programs/Xserver/os/utils.c4
3 files changed, 9 insertions, 5 deletions
diff --git a/nx-X11/programs/Xserver/include/opaque.h b/nx-X11/programs/Xserver/include/opaque.h
index 8f98bf1be..1b84b9f5b 100644
--- a/nx-X11/programs/Xserver/include/opaque.h
+++ b/nx-X11/programs/Xserver/include/opaque.h
@@ -77,6 +77,6 @@ extern long maxBigRequestSize;
extern Bool blackRoot;
extern Bool CoreDump;
-
+extern Bool NoListenAll;
#endif /* OPAQUE_H */
diff --git a/nx-X11/programs/Xserver/os/connection.c b/nx-X11/programs/Xserver/os/connection.c
index 6dc0ff64d..8958c47b5 100644
--- a/nx-X11/programs/Xserver/os/connection.c
+++ b/nx-X11/programs/Xserver/os/connection.c
@@ -137,6 +137,7 @@ int MaxClients = 0;
int NumNotifyWriteFd; /* Number of NotifyFd members with write set */
Bool NewOutputPending; /* not yet attempted to write some new output */
Bool AnyWritesPending; /* true if some client blocked on write or NotifyFd with write */
+Bool NoListenAll; /* Don't establish any listening sockets */
Bool RunFromSmartParent; /* send SIGUSR1 to parent process */
static char dynamic_display[7]; /* display name */
Bool PartialNetwork; /* continue even if unable to bind all addrs */
@@ -411,7 +412,10 @@ CreateWellKnownSockets(void)
/* display is initialized to "0" by main(). It is then set to the display
* number if specified on the command line, or to NULL when the -displayfd
* option is used. */
- if (display) {
+ if (NoListenAll) {
+ ListenTransCount = 0;
+ }
+ else if (display) {
if (TryCreateSocket(atoi(display), &partial) &&
ListenTransCount >= 1)
if (!PartialNetwork && partial)
@@ -445,7 +449,7 @@ CreateWellKnownSockets(void)
DefineSelf (fd);
}
- if (!XFD_ANYSET (&WellKnownConnections))
+ if (!XFD_ANYSET (&WellKnownConnections) && !NoListenAll)
FatalError ("Cannot establish any listening sockets - Make sure an X server isn't already running");
#if !defined(WIN32)
OsSignal (SIGPIPE, SIG_IGN);
diff --git a/nx-X11/programs/Xserver/os/utils.c b/nx-X11/programs/Xserver/os/utils.c
index 929549168..74acb53ef 100644
--- a/nx-X11/programs/Xserver/os/utils.c
+++ b/nx-X11/programs/Xserver/os/utils.c
@@ -338,7 +338,7 @@ LockServer(void)
int len;
char port[20];
- if (nolock) return;
+ if (nolock || NoListenAll) return;
/*
* Path names
*/
@@ -464,7 +464,7 @@ LockServer(void)
void
UnlockServer(void)
{
- if (nolock) return;
+ if (nolock || NoListenAll) return;
if (!StillLocking){