[PATCH] os: Don't listen to 'tcp' or 'unix' by default. Add '-listen' option.
Hans de Goede
hdegoede at redhat.com
Sat Sep 13 03:41:59 PDT 2014
Hi,
On 09/12/2014 08:35 PM, Keith Packard wrote:
> This disables tcp and unix listen ports by default (the unix port is
> the non-abstract /tmp/.X11-unix port that xcb doesn't use). Then, it
> uses a new xtrans interface, TRANS(Listen), to provide a command line
> option to re-enable those if desired.
>
> Signed-off-by: Keith Packard <keithp at keithp.com>
We should probably put a #ifdef __linux__ around the
"unix" in the defaultNoListenList, other then that this
looks good:
Reviewed-by: Hans de Goede <hdegoede at redhat.com>
Regards,
Hans
> ---
> os/utils.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/os/utils.c b/os/utils.c
> index c83f77d..ff1806b 100644
> --- a/os/utils.c
> +++ b/os/utils.c
> @@ -646,6 +646,12 @@ VerifyDisplayName(const char *d)
> return 1;
> }
>
> +static const char *defaultNoListenList[] = {
> + "tcp",
> + "unix",
> + NULL
> +};
> +
> /*
> * This function parses the command line. Handles device-independent fields
> * and allows ddx to handle additional fields. It is not allowed to modify
> @@ -664,6 +670,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))) {
> @@ -849,6 +861,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;
> }
>
More information about the xorg-devel
mailing list