Skip to content

Commit b6f03a2

Browse files
committed
[PR #1368] os: move AllowByteSwappedClients setting into DIX
PR: #1368
1 parent ce9da23 commit b6f03a2

File tree

8 files changed

+49
-8
lines changed

8 files changed

+49
-8
lines changed

dix/dispatch.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ Equipment Corporation.
117117
#include "dix/screensaver_priv.h"
118118
#include "dix/selection_priv.h"
119119
#include "dix/server_priv.h"
120+
#include "dix/settings_priv.h"
120121
#include "dix/window_priv.h"
121122
#include "include/resource.h"
122123
#include "miext/extinit_priv.h"
@@ -3907,7 +3908,7 @@ ProcEstablishConnection(ClientPtr client)
39073908

39083909
prefix = (xConnClientPrefix *) ((char *) stuff + sz_xReq);
39093910

3910-
if (client->swapped && !AllowByteSwappedClients) {
3911+
if (client->swapped && !dixSettingAllowByteSwappedClients) {
39113912
reason = "Prohibited client endianess, see the Xserver man page ";
39123913
} else if ((client->req_len << 2) != sz_xReq + sz_xConnClientPrefix +
39133914
pad_to_int32(prefix->nbytesAuthProto) +

dix/globals.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ SOFTWARE.
5151

5252
#include "dix/cursor_priv.h"
5353
#include "dix/dix_priv.h"
54+
#include "dix/settings_priv.h"
5455

5556
#include "misc.h"
5657
#include "windowstr.h"

dix/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ srcs_dix = [
3333
'screen_hooks.c',
3434
'selection.c',
3535
'screen.c',
36+
'settings.c',
3637
'swaprep.c',
3738
'swapreq.c',
3839
'tables.c',

dix/settings.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/* SPDX-License-Identifier: MIT OR X11
2+
*
3+
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
4+
*
5+
* This file holds global DIX *settings*, which might be needed by other
6+
* parts, e.g. OS layer or DDX'es.
7+
*
8+
* Some of them might be influenced by command line args, some by xf86's
9+
* config files.
10+
*/
11+
#include <dix-config.h>
12+
13+
#include <stdbool.h>
14+
15+
#include "dix/settings_priv.h"
16+
17+
bool dixSettingAllowByteSwappedClients = false;

dix/settings_priv.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* SPDX-License-Identifier: MIT OR X11
2+
*
3+
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
4+
*/
5+
#ifndef _XSERVER_DIX_SETTINGS_H
6+
#define _XSERVER_DIX_SETTINGS_H
7+
8+
#include <stdbool.h>
9+
10+
/* This file holds global DIX *settings*, which might be needed by other
11+
* parts, e.g. OS layer or DDX'es.
12+
*
13+
* Some of them might be influenced by command line args, some by xf86's
14+
* config files.
15+
*/
16+
17+
extern bool dixSettingAllowByteSwappedClients;
18+
19+
#endif

hw/xfree86/common/xf86Config.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
#include <grp.h>
5252

5353
#include "dix/resource_priv.h"
54+
#include "dix/settings_priv.h"
5455
#include "dix/screensaver_priv.h"
5556
#include "include/extinit.h"
5657
#include "os/log_priv.h"
@@ -752,8 +753,11 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
752753
LogMessageVerb(X_CONFIG, 1, "Ignoring ABI Version\n");
753754
}
754755

755-
xf86GetOptValBool(FlagOptions, FLAG_ALLOW_BYTE_SWAPPED_CLIENTS, &AllowByteSwappedClients);
756-
if (AllowByteSwappedClients) {
756+
Bool bv = FALSE;
757+
if (xf86GetOptValBool(FlagOptions, FLAG_ALLOW_BYTE_SWAPPED_CLIENTS, &bv)) {
758+
dixSettingAllowByteSwappedClients = bv;
759+
}
760+
if (dixSettingAllowByteSwappedClients) {
757761
LogMessageVerb(X_CONFIG, 1, "Allowing byte-swapped clients\n");
758762
}
759763

os/osdep.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ extern Bool PartialNetwork;
199199

200200
extern Bool CoreDump;
201201
extern Bool NoListenAll;
202-
extern Bool AllowByteSwappedClients;
203202

204203
/*
205204
* This function reallocarray(3)s passed buffer, terminating the server if

os/utils.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ OR PERFORMANCE OF THIS SOFTWARE.
9696

9797
#include "dix/dix_priv.h"
9898
#include "dix/input_priv.h"
99+
#include "dix/settings_priv.h"
99100
#include "dix/screensaver_priv.h"
100101
#include "miext/extinit_priv.h"
101102
#include "os/audit_priv.h"
@@ -127,8 +128,6 @@ Bool CoreDump;
127128

128129
Bool enableIndirectGLX = FALSE;
129130

130-
Bool AllowByteSwappedClients = FALSE;
131-
132131
#ifdef XINERAMA
133132
Bool PanoramiXExtensionDisabledHack = FALSE;
134133
#endif /* XINERAMA */
@@ -473,9 +472,9 @@ ProcessCommandLine(int argc, char *argv[])
473472
UseMsg();
474473
}
475474
else if (strcmp(argv[i], "-byteswappedclients") == 0) {
476-
AllowByteSwappedClients = FALSE;
475+
dixSettingAllowByteSwappedClients = FALSE;
477476
} else if (strcmp(argv[i], "+byteswappedclients") == 0) {
478-
AllowByteSwappedClients = TRUE;
477+
dixSettingAllowByteSwappedClients = TRUE;
479478
}
480479
else if (strcmp(argv[i], "-br") == 0); /* default */
481480
else if (strcmp(argv[i], "+bs") == 0)

0 commit comments

Comments
 (0)