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>
This commit is contained in:
parent
8ada3fb32c
commit
cc59be38b7
20
configure.ac
20
configure.ac
|
@ -461,6 +461,16 @@ AC_ARG_WITH(os-vendor, AS_HELP_STRING([--with-os-vendor=OSVENDOR], [Name o
|
||||||
AC_ARG_WITH(builderstring, AS_HELP_STRING([--with-builderstring=BUILDERSTRING], [Additional builder string]),
|
AC_ARG_WITH(builderstring, AS_HELP_STRING([--with-builderstring=BUILDERSTRING], [Additional builder string]),
|
||||||
[ BUILDERSTRING="$withval" ]
|
[ BUILDERSTRING="$withval" ]
|
||||||
[ ])
|
[ ])
|
||||||
|
AC_ARG_ENABLE(listen-tcp, AS_HELP_STRING([--enable-listen-tcp],
|
||||||
|
[Listen on TCP by default (default:disabled)]),
|
||||||
|
[LISTEN_TCP=$enableval], [LISTEN_TCP=no])
|
||||||
|
AC_ARG_ENABLE(listen-unix, AS_HELP_STRING([--disable-listen-unix],
|
||||||
|
[Listen on Unix by default (default:enabled)]),
|
||||||
|
[LISTEN_UNIX=$enableval], [LISTEN_UNIX=yes])
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(listen-local, AS_HELP_STRING([--disable-listen-local],
|
||||||
|
[Listen on local by default (default:enabled)]),
|
||||||
|
[LISTEN_LOCAL=$enableval], [LISTEN_LOCAL=yes])
|
||||||
|
|
||||||
dnl Determine font path
|
dnl Determine font path
|
||||||
XORG_FONTROOTDIR
|
XORG_FONTROOTDIR
|
||||||
|
@ -1053,6 +1063,16 @@ if test "x$RES" = xyes; then
|
||||||
SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $RESOURCEPROTO"
|
SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $RESOURCEPROTO"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test "x$LISTEN_TCP" = xyes; then
|
||||||
|
AC_DEFINE(LISTEN_TCP, 1, [Listen on TCP socket])
|
||||||
|
fi
|
||||||
|
if test "x$LISTEN_UNIX" = xyes; then
|
||||||
|
AC_DEFINE(LISTEN_UNIX, 1, [Listen on Unix socket])
|
||||||
|
fi
|
||||||
|
if test "x$LISTEN_LOCAL" = xyes; then
|
||||||
|
AC_DEFINE(LISTEN_LOCAL, 1, [Listen on local socket])
|
||||||
|
fi
|
||||||
|
|
||||||
# The XRes extension may support client ID tracking only if it has
|
# The XRes extension may support client ID tracking only if it has
|
||||||
# been specifically enabled. Client ID tracking is implicitly not
|
# been specifically enabled. Client ID tracking is implicitly not
|
||||||
# supported if XRes extension is disabled.
|
# supported if XRes extension is disabled.
|
||||||
|
|
|
@ -493,4 +493,13 @@
|
||||||
/* byte order */
|
/* byte order */
|
||||||
#undef X_BYTE_ORDER
|
#undef X_BYTE_ORDER
|
||||||
|
|
||||||
|
/* Listen on TCP socket */
|
||||||
|
#undef LISTEN_TCP
|
||||||
|
|
||||||
|
/* Listen on Unix socket */
|
||||||
|
#undef LISTEN_UNIX
|
||||||
|
|
||||||
|
/* Listen on local socket */
|
||||||
|
#undef LISTEN_LOCAL
|
||||||
|
|
||||||
#endif /* _DIX_CONFIG_H_ */
|
#endif /* _DIX_CONFIG_H_ */
|
||||||
|
|
|
@ -196,6 +196,13 @@ with
|
||||||
This option may be issued multiple times to disable listening to different
|
This option may be issued multiple times to disable listening to different
|
||||||
transport types.
|
transport types.
|
||||||
.TP 8
|
.TP 8
|
||||||
|
.B \-listen \fItrans-type\fP
|
||||||
|
enables a transport type. For example, TCP/IP connections can be enabled
|
||||||
|
with
|
||||||
|
.BR "\-listen tcp" .
|
||||||
|
This option may be issued multiple times to enable listening to different
|
||||||
|
transport types.
|
||||||
|
.TP 8
|
||||||
.B \-noreset
|
.B \-noreset
|
||||||
prevents a server reset when the last client connection is closed. This
|
prevents a server reset when the last client connection is closed. This
|
||||||
overrides a previous
|
overrides a previous
|
||||||
|
|
29
os/utils.c
29
os/utils.c
|
@ -557,6 +557,7 @@ UseMsg(void)
|
||||||
ErrorF("-nolock disable the locking mechanism\n");
|
ErrorF("-nolock disable the locking mechanism\n");
|
||||||
#endif
|
#endif
|
||||||
ErrorF("-nolisten string don't listen on protocol\n");
|
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("-noreset don't reset after last client exists\n");
|
||||||
ErrorF("-background [none] create root window with no background\n");
|
ErrorF("-background [none] create root window with no background\n");
|
||||||
ErrorF("-reset reset after last client exists\n");
|
ErrorF("-reset reset after last client exists\n");
|
||||||
|
@ -646,6 +647,19 @@ VerifyDisplayName(const char *d)
|
||||||
return 1;
|
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
|
* This function parses the command line. Handles device-independent fields
|
||||||
* and allows ddx to handle additional fields. It is not allowed to modify
|
* and allows ddx to handle additional fields. It is not allowed to modify
|
||||||
|
@ -664,6 +678,12 @@ ProcessCommandLine(int argc, char *argv[])
|
||||||
PartialNetwork = TRUE;
|
PartialNetwork = TRUE;
|
||||||
#endif
|
#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++) {
|
for (i = 1; i < argc; i++) {
|
||||||
/* call ddx first, so it can peek/override if it wants */
|
/* call ddx first, so it can peek/override if it wants */
|
||||||
if ((skip = ddxProcessArgument(argc, argv, i))) {
|
if ((skip = ddxProcessArgument(argc, argv, i))) {
|
||||||
|
@ -849,6 +869,15 @@ ProcessCommandLine(int argc, char *argv[])
|
||||||
else
|
else
|
||||||
UseMsg();
|
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) {
|
else if (strcmp(argv[i], "-noreset") == 0) {
|
||||||
dispatchExceptionAtReset = 0;
|
dispatchExceptionAtReset = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue