aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2017-02-16 10:54:19 +0000
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-03-21 10:58:07 +0100
commit4f76ed19b8a7b9448e29ac152f7f5ec1e611950e (patch)
tree05ce5afec9f6d3d74bf1d250d7b61d54a07bd37b
parented52cb2952bebf6b98e187ff1f8609690fae3d59 (diff)
downloadnx-libs-4f76ed19b8a7b9448e29ac152f7f5ec1e611950e.tar.gz
nx-libs-4f76ed19b8a7b9448e29ac152f7f5ec1e611950e.tar.bz2
nx-libs-4f76ed19b8a7b9448e29ac152f7f5ec1e611950e.zip
dix: Extend initial connection handshake for forwarding proxies
commit 78fa121f4097d29458e5453c13473595df06e26e Author: Adam Jackson <ajax@redhat.com> Date: Fri Jun 17 13:43:38 2011 -0400 dix: Extend initial connection handshake for forwarding proxies Forwarding proxies like sshd will appear to be local, even though they aren't really. This leads to weird behaviour for extensions that truly require running under the same OS services as the client, like MIT-SHM and DRI2. Add two new legal values for the initial connection's byteOrder field, 'r' and 'R'. These act like 'l' and 'B' respectively, but have the side effect of forcing the client to be treated as non-local. Forwarding proxies should attempt to munge the first packet of the connection accordingly; older servers will reject connections thusly munged, so the proxy should fall back to passthrough if the munged connection attempt fails. Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Adam Jackson <ajax@redhat.com> Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
-rw-r--r--nx-X11/programs/Xserver/dix/dispatch.c12
-rw-r--r--nx-X11/programs/Xserver/os/connection.c10
2 files changed, 14 insertions, 8 deletions
diff --git a/nx-X11/programs/Xserver/dix/dispatch.c b/nx-X11/programs/Xserver/dix/dispatch.c
index 16b94301f..438436526 100644
--- a/nx-X11/programs/Xserver/dix/dispatch.c
+++ b/nx-X11/programs/Xserver/dix/dispatch.c
@@ -3752,12 +3752,14 @@ ProcInitialConnection(register ClientPtr client)
REQUEST(xReq);
register xConnClientPrefix *prefix;
int whichbyte = 1;
+ char order;
prefix = (xConnClientPrefix *)((char *)stuff + sz_xReq);
- if ((prefix->byteOrder != 'l') && (prefix->byteOrder != 'B'))
+ order = prefix->byteOrder;
+ if (order != 'l' && order != 'B' && order != 'r' && order != 'R')
return (client->noClientException = -1);
- if (((*(char *) &whichbyte) && (prefix->byteOrder == 'B')) ||
- (!(*(char *) &whichbyte) && (prefix->byteOrder == 'l')))
+ if (((*(char *) &whichbyte) && (order == 'B' || order == 'R')) ||
+ (!(*(char *) &whichbyte) && (order == 'l' || order == 'r')))
{
client->swapped = TRUE;
SwapConnClientPrefix(prefix);
@@ -3769,6 +3771,10 @@ ProcInitialConnection(register ClientPtr client)
{
swaps(&stuff->length);
}
+ if (order == 'r' || order == 'R')
+ {
+ client->local = FALSE;
+ }
ResetCurrentRequest(client);
return (client->noClientException);
}
diff --git a/nx-X11/programs/Xserver/os/connection.c b/nx-X11/programs/Xserver/os/connection.c
index 917f79fa6..d4627e97c 100644
--- a/nx-X11/programs/Xserver/os/connection.c
+++ b/nx-X11/programs/Xserver/os/connection.c
@@ -886,7 +886,7 @@ ErrorConnMax(XtransConnInfo trans_conn)
xConnSetupPrefix csp;
char pad[3];
struct iovec iov[3];
- char byteOrder = 0;
+ char order = 0;
int whichbyte = 1;
struct timeval waittime;
fd_set mask;
@@ -899,16 +899,16 @@ ErrorConnMax(XtransConnInfo trans_conn)
FD_SET(fd, &mask);
(void)Select(fd + 1, &mask, NULL, NULL, &waittime);
/* try to read the byte-order of the connection */
- (void)_XSERVTransRead(trans_conn, &byteOrder, 1);
- if ((byteOrder == 'l') || (byteOrder == 'B'))
+ (void)_XSERVTransRead(trans_conn, &order, 1);
+ if (order == 'l' || order == 'B' || order == 'r' || order == 'R')
{
csp.success = xFalse;
csp.lengthReason = sizeof(NOROOM) - 1;
csp.length = (sizeof(NOROOM) + 2) >> 2;
csp.majorVersion = X_PROTOCOL;
csp.minorVersion = X_PROTOCOL_REVISION;
- if (((*(char *) &whichbyte) && (byteOrder == 'B')) ||
- (!(*(char *) &whichbyte) && (byteOrder == 'l')))
+ if (((*(char *) &whichbyte) && (order == 'B' || order == 'R')) ||
+ (!(*(char *) &whichbyte) && (order == 'l' || order == 'r')))
{
swaps(&csp.majorVersion);
swaps(&csp.minorVersion);