Commit 3f59fa0d authored by Nathaniel Roach's avatar Nathaniel Roach Committed by Ray Strode

Use -listen instead of -nolisten for new Xorg

Newer Xorg versions don't listen to tcp sockets
by default, so instead of explicitly passing
-nolisten to disable tcp sockets by default,
we need to explicitly pass -listen to enable
tcp sockets when DisallowTCP=false.

Older versions don't support the -listen flag,
so we check the version and if it's >= 1.17 then
we specify -listen tcp
Signed-off-by: 's avatarNathaniel Roach <nroach44@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=750026
parent a6e31668
......@@ -1227,6 +1227,14 @@ else
X_SERVER="/usr/bin/X"
fi
dnl ---------------------------------------------------------------------------
dnl - Check if Xorg is new enough to require '-listen tcp' (1.17)
dnl ---------------------------------------------------------------------------
if $PKG_CONFIG --atleast-version=1.17 xorg-server; then
AC_DEFINE([HAVE_XSERVER_THAT_DEFAULTS_TO_LOCAL_ONLY], [], [XServer disables tcp access by default])
fi
dnl ---------------------------------------------------------------------------
dnl - Check for Xnest / Xephyr support
dnl ---------------------------------------------------------------------------
......
......@@ -320,11 +320,24 @@ gdm_server_resolve_command_line (GdmServer *server,
argv[len++] = g_strdup (server->priv->display_seat_id);
}
/* If we were compiled with Xserver >= 1.17 we need to specify
* '-listen tcp' as the X server dosen't listen on tcp sockets
* by default anymore. In older versions we need to pass
* -nolisten tcp to disable listening on tcp sockets.
*/
#ifdef HAVE_XSERVER_THAT_DEFAULTS_TO_LOCAL_ONLY
if (!server->priv->disable_tcp && ! query_in_arglist) {
argv[len++] = g_strdup ("-listen");
argv[len++] = g_strdup ("tcp");
}
#else
if (server->priv->disable_tcp && ! query_in_arglist) {
argv[len++] = g_strdup ("-nolisten");
argv[len++] = g_strdup ("tcp");
}
#endif
if (vtarg != NULL && ! gotvtarg) {
argv[len++] = g_strdup (vtarg);
}
......
......@@ -249,10 +249,22 @@ spawn_x_server (State *state,
g_ptr_array_add (arguments, "-auth");
g_ptr_array_add (arguments, auth_file);
/* If we were compiled with Xserver >= 1.17 we need to specify
* '-listen tcp' as the X server dosen't listen on tcp sockets
* by default anymore. In older versions we need to pass
* -nolisten tcp to disable listening on tcp sockets.
*/
#ifdef HAVE_XSERVER_THAT_DEFAULTS_TO_LOCAL_ONLY
if (allow_remote_connections) {
g_ptr_array_add (arguments, "-listen");
g_ptr_array_add (arguments, "tcp");
}
#else
if (!allow_remote_connections) {
g_ptr_array_add (arguments, "-nolisten");
g_ptr_array_add (arguments, "tcp");
}
#endif
g_ptr_array_add (arguments, "-background");
g_ptr_array_add (arguments, "none");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment