diff --git a/dix/dispatch.c b/dix/dispatch.c index 4f57eac6e7..8cbfdff597 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -117,6 +117,7 @@ Equipment Corporation. #include "dix/screensaver_priv.h" #include "dix/selection_priv.h" #include "dix/server_priv.h" +#include "dix/settings_priv.h" #include "dix/window_priv.h" #include "include/resource.h" #include "miext/extinit_priv.h" @@ -3906,7 +3907,7 @@ ProcEstablishConnection(ClientPtr client) prefix = (xConnClientPrefix *) ((char *) stuff + sz_xReq); - if (client->swapped && !AllowByteSwappedClients) { + if (client->swapped && !dixSettingAllowByteSwappedClients) { reason = "Prohibited client endianess, see the Xserver man page "; } else if ((client->req_len << 2) != sz_xReq + sz_xConnClientPrefix + pad_to_int32(prefix->nbytesAuthProto) + diff --git a/dix/globals.c b/dix/globals.c index 1ff8d26178..f234e29fe2 100644 --- a/dix/globals.c +++ b/dix/globals.c @@ -51,6 +51,7 @@ SOFTWARE. #include "dix/cursor_priv.h" #include "dix/dix_priv.h" +#include "dix/settings_priv.h" #include "misc.h" #include "windowstr.h" diff --git a/dix/meson.build b/dix/meson.build index 0c3c662b9d..c5e7114cae 100644 --- a/dix/meson.build +++ b/dix/meson.build @@ -33,6 +33,7 @@ srcs_dix = [ 'screen_hooks.c', 'selection.c', 'screen.c', + 'settings.c', 'swaprep.c', 'swapreq.c', 'tables.c', diff --git a/dix/settings.c b/dix/settings.c new file mode 100644 index 0000000000..4c36e8e3bf --- /dev/null +++ b/dix/settings.c @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: MIT OR X11 + * + * Copyright © 2024 Enrico Weigelt, metux IT consult + * + * This file holds global DIX *settings*, which might be needed by other + * parts, e.g. OS layer or DDX'es. + * + * Some of them might be influenced by command line args, some by xf86's + * config files. + */ +#include + +#include + +#include "dix/settings_priv.h" + +bool dixSettingAllowByteSwappedClients = false; diff --git a/dix/settings_priv.h b/dix/settings_priv.h new file mode 100644 index 0000000000..4fe49bce23 --- /dev/null +++ b/dix/settings_priv.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: MIT OR X11 + * + * Copyright © 2024 Enrico Weigelt, metux IT consult + */ +#ifndef _XSERVER_DIX_SETTINGS_H +#define _XSERVER_DIX_SETTINGS_H + +#include + +/* This file holds global DIX *settings*, which might be needed by other + * parts, e.g. OS layer or DDX'es. + * + * Some of them might be influenced by command line args, some by xf86's + * config files. + */ + +extern bool dixSettingAllowByteSwappedClients; + +#endif diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index d5dea0edeb..21d41c2e36 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -52,6 +52,7 @@ #include "dix/dix_priv.h" #include "dix/resource_priv.h" +#include "dix/settings_priv.h" #include "dix/screensaver_priv.h" #include "include/extinit.h" #include "os/log_priv.h" @@ -753,8 +754,11 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) LogMessageVerb(X_CONFIG, 1, "Ignoring ABI Version\n"); } - xf86GetOptValBool(FlagOptions, FLAG_ALLOW_BYTE_SWAPPED_CLIENTS, &AllowByteSwappedClients); - if (AllowByteSwappedClients) { + Bool bv = FALSE; + if (xf86GetOptValBool(FlagOptions, FLAG_ALLOW_BYTE_SWAPPED_CLIENTS, &bv)) { + dixSettingAllowByteSwappedClients = bv; + } + if (dixSettingAllowByteSwappedClients) { LogMessageVerb(X_CONFIG, 1, "Allowing byte-swapped clients\n"); } diff --git a/os/osdep.h b/os/osdep.h index 9d2a001bbd..013d8cdb28 100644 --- a/os/osdep.h +++ b/os/osdep.h @@ -188,7 +188,6 @@ extern Bool PartialNetwork; extern Bool CoreDump; extern Bool NoListenAll; -extern Bool AllowByteSwappedClients; /* * This function reallocarray(3)s passed buffer, terminating the server if diff --git a/os/utils.c b/os/utils.c index 4e3422ea2b..7461ef9f87 100644 --- a/os/utils.c +++ b/os/utils.c @@ -96,6 +96,7 @@ OR PERFORMANCE OF THIS SOFTWARE. #include "dix/dix_priv.h" #include "dix/input_priv.h" +#include "dix/settings_priv.h" #include "dix/screensaver_priv.h" #include "miext/extinit_priv.h" #include "os/audit_priv.h" @@ -127,8 +128,6 @@ Bool CoreDump; Bool enableIndirectGLX = FALSE; -Bool AllowByteSwappedClients = FALSE; - #ifdef XINERAMA Bool PanoramiXExtensionDisabledHack = FALSE; #endif /* XINERAMA */ @@ -459,9 +458,9 @@ ProcessCommandLine(int argc, char *argv[]) UseMsg(); } else if (strcmp(argv[i], "-byteswappedclients") == 0) { - AllowByteSwappedClients = FALSE; + dixSettingAllowByteSwappedClients = FALSE; } else if (strcmp(argv[i], "+byteswappedclients") == 0) { - AllowByteSwappedClients = TRUE; + dixSettingAllowByteSwappedClients = TRUE; } else if (strcmp(argv[i], "-br") == 0); /* default */ else if (strcmp(argv[i], "+bs") == 0)