summaryrefslogtreecommitdiff
path: root/xserver/os
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2015-06-20 10:03:58 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2015-06-20 10:03:58 +0000
commitecb42d928335a3e6b083cdae174b326793079d69 (patch)
treebd5343198d15999d7395bf39d0099fa295a69a5a /xserver/os
parent70ce255848dcb87fd04c970a1707a1966136912b (diff)
Merge from upstream: Don't listen to 'tcp' by default. Add '-listen' option.
commit cc59be38b7eff52a1d003b390f2994c73ee0b3e9 Author: Keith Packard <keithp@keithp.com> Date: Fri Sep 12 11:33:48 2014 -0700 os: Don't listen to 'tcp' by default. Add '-listen' option. [v2] This disables the tcp listen socket by default. Then, it uses a new xtrans interface, TRANS(Listen), to provide a command line option to re-enable those if desired. v2: Leave unix socket enabled by default. Add configure options. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'xserver/os')
-rw-r--r--xserver/os/utils.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/xserver/os/utils.c b/xserver/os/utils.c
index 0c1d4b7a9..c1b13d10c 100644
--- a/xserver/os/utils.c
+++ b/xserver/os/utils.c
@@ -569,6 +569,7 @@ UseMsg(void)
ErrorF("-nolock disable the locking mechanism\n");
#endif
ErrorF("-nolisten string don't listen on protocol\n");
+ ErrorF("-listen string listen on protocol\n");
ErrorF("-noreset don't reset after last client exists\n");
ErrorF("-background [none] create root window with no background\n");
ErrorF("-reset reset after last client exists\n");
@@ -662,6 +663,19 @@ VerifyDisplayName(const char *d)
return 1;
}
+static const char *defaultNoListenList[] = {
+#ifndef LISTEN_TCP
+ "tcp",
+#endif
+#ifndef LISTEN_UNIX
+ "unix",
+#endif
+#ifndef LISTEN_LOCAL
+ "local",
+#endif
+ NULL
+};
+
/*
* This function parses the command line. Handles device-independent fields
* and allows ddx to handle additional fields. It is not allowed to modify
@@ -680,6 +694,12 @@ ProcessCommandLine(int argc, char *argv[])
PartialNetwork = TRUE;
#endif
+ for (i = 0; defaultNoListenList[i] != NULL; i++) {
+ if (_XSERVTransNoListen(defaultNoListenList[i]))
+ ErrorF("Failed to disable listen for %s transport",
+ defaultNoListenList[i]);
+ }
+
for (i = 1; i < argc; i++) {
/* call ddx first, so it can peek/override if it wants */
if ((skip = ddxProcessArgument(argc, argv, i))) {
@@ -865,6 +885,15 @@ ProcessCommandLine(int argc, char *argv[])
else
UseMsg();
}
+ else if (strcmp(argv[i], "-listen") == 0) {
+ if (++i < argc) {
+ if (_XSERVTransListen(argv[i]))
+ ErrorF("Failed to enable listen for %s transport",
+ argv[i]);
+ }
+ else
+ UseMsg();
+ }
else if (strcmp(argv[i], "-noreset") == 0) {
dispatchExceptionAtReset = 0;
}