os: move AllowByteSwappedClients setting into DIX

Adding new source and header that's going to host all DIX
settings (set via cmdline or xf86 config file) in the future.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-11-07 17:40:04 +01:00
committed by Enrico Weigelt
parent 5501c60f1b
commit 5532917d76
8 changed files with 49 additions and 8 deletions

View File

@@ -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) +

View File

@@ -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"

View File

@@ -33,6 +33,7 @@ srcs_dix = [
'screen_hooks.c',
'selection.c',
'screen.c',
'settings.c',
'swaprep.c',
'swapreq.c',
'tables.c',

17
dix/settings.c Normal file
View File

@@ -0,0 +1,17 @@
/* SPDX-License-Identifier: MIT OR X11
*
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
*
* 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 <dix-config.h>
#include <stdbool.h>
#include "dix/settings_priv.h"
bool dixSettingAllowByteSwappedClients = false;

19
dix/settings_priv.h Normal file
View File

@@ -0,0 +1,19 @@
/* SPDX-License-Identifier: MIT OR X11
*
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
*/
#ifndef _XSERVER_DIX_SETTINGS_H
#define _XSERVER_DIX_SETTINGS_H
#include <stdbool.h>
/* 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

View File

@@ -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");
}

View File

@@ -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

View File

@@ -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)