diff options
author | Nathaniel Roach <nroach44@gmail.com> | 2015-11-10 09:11:08 -0500 |
---|---|---|
committer | Tim Lunn <tim@feathertop.org> | 2016-04-14 15:29:22 +1000 |
commit | 0831a7f11e06b28fc0f64c75a35f20e15ab19c9f (patch) | |
tree | dab1a32557e2545b7e310d929da301dad0d373bc | |
parent | ca1bcb93852e937e80af439f7c5b0a5a38d53b55 (diff) | |
download | gdm-0831a7f11e06b28fc0f64c75a35f20e15ab19c9f.tar.gz |
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: Nathaniel Roach <nroach44@gmail.com>
https://bugzilla.gnome.org/show_bug.cgi?id=750026
-rw-r--r-- | configure.ac | 8 | ||||
-rw-r--r-- | daemon/gdm-server.c | 13 | ||||
-rw-r--r-- | daemon/gdm-x-session.c | 12 |
3 files changed, 33 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index bedac99a..7b6346cc 100644 --- a/configure.ac +++ b/configure.ac @@ -1232,6 +1232,14 @@ else 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 --------------------------------------------------------------------------- diff --git a/daemon/gdm-server.c b/daemon/gdm-server.c index eb7db0e2..6357d344 100644 --- a/daemon/gdm-server.c +++ b/daemon/gdm-server.c @@ -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); } diff --git a/daemon/gdm-x-session.c b/daemon/gdm-x-session.c index 58646fa3..624f67ca 100644 --- a/daemon/gdm-x-session.c +++ b/daemon/gdm-x-session.c @@ -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"); |