[PATCH xinit] startx: Pass "-nolisten tcp" by default

Hans de Goede hdegoede at redhat.com
Fri Sep 12 00:25:18 PDT 2014


Having servers started by startx listen on tcp by default is not a good idea
in this time and age. Pass "-nolisten tcp" by default, and add a special
-listen server option which can be used to disable this new default behavior.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 man/startx.man | 7 +++++++
 startx.cpp     | 5 +++++
 2 files changed, 12 insertions(+)

diff --git a/man/startx.man b/man/startx.man
index 0405be0..fc2cbc3 100644
--- a/man/startx.man
+++ b/man/startx.man
@@ -39,6 +39,8 @@ startx \- initialize an X session
 .I server
 ] [
 .I display
+] [
+.I -listen
 ]
 .I options
 \&.\|.\|. ]
@@ -56,6 +58,11 @@ command are used to start a client in the same manner as
 The special argument
 .RB '--'
 marks the end of client arguments and the beginning of server options.
+By default startx passes
+.RB '-nolisten\ tcp'
+to the server, the special server option
+.RB '-listen'
+can be used to stop startx from doing this.
 It may be convenient to specify server options with startx to change on a
 per-session basis the
 default color depth, the server's notion of the number of dots-per-inch the
diff --git a/startx.cpp b/startx.cpp
index 1c6fce0..8612fa6 100644
--- a/startx.cpp
+++ b/startx.cpp
@@ -60,6 +60,7 @@ defaultdisplay=":0"
 clientargs=""
 serverargs=""
 vtarg=""
+listenarg="-nolisten tcp"
 
 #ifdef __APPLE__
 
@@ -156,6 +157,8 @@ while [ x"$1" != x ]; do
 	    if [ x"$serverargs" = x ] && @@
 		 expr "$1" : ':[0-9][0-9]*$' > /dev/null 2>&1; then
 		display="$1"
+	    elif [ "$1" = "-listen" ]; then
+		listenarg=""
 	    else
 		serverargs="$serverargs $1"
 	    fi
@@ -225,6 +228,8 @@ if [ "$have_vtarg" = "no" ]; then
     serverargs="$serverargs $vtarg"
 fi
 
+serverargs="$serverargs $listenarg"
+
 XCOMM if no display, use default
 if [ x"$display" = x ]; then
     display=$defaultdisplay
-- 
2.1.0



More information about the xorg-devel mailing list