diff --git a/dix/dispatch.c b/dix/dispatch.c index 0f776678e1..508fe7085f 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" @@ -3907,7 +3908,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 4eb6bbec36..edc54a9c9c 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 e98db459b4..2d200f5eb0 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -51,6 +51,7 @@ #include #include "dix/resource_priv.h" +#include "dix/settings_priv.h" #include "dix/screensaver_priv.h" #include "include/extinit.h" #include "os/log_priv.h" @@ -752,8 +753,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 5ea06c547a..c82378c4cf 100644 --- a/os/osdep.h +++ b/os/osdep.h @@ -199,7 +199,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 52f9bf9c16..05d60af548 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 */ @@ -473,9 +472,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)