[PATCH] os: Treat ssh as a non-local client
Adam Jackson
ajax at redhat.com
Tue Dec 8 10:55:02 PST 2015
By the time we get to ComputeLocalClient, we've already done
NextAvailableClient → ReserveClientIds → DetermineClientCmd (assuming
we're built with #define CLIENTIDS), so we can look up the name of the
client process and refuse to treat ssh's X forwarding as if it were
local.
Signed-off-by: Adam Jackson <ajax at redhat.com>
---
os/access.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/os/access.c b/os/access.c
index 10a48c3..f9619ae 100644
--- a/os/access.c
+++ b/os/access.c
@@ -1081,9 +1081,8 @@ ResetHosts(const char *display)
}
}
-/* Is client on the local host */
-Bool
-ComputeLocalClient(ClientPtr client)
+static Bool
+xtransLocalClient(ClientPtr client)
{
int alen, family, notused;
Xtransaddr *from = NULL;
@@ -1116,6 +1115,20 @@ ComputeLocalClient(ClientPtr client)
return FALSE;
}
+/* Is client on the local host */
+Bool
+ComputeLocalClient(ClientPtr client)
+{
+ if (!xtransLocalClient(client))
+ return FALSE;
+
+ if (client->clientIds)
+ if (!strncmp(client->clientIds->cmdname, "ssh", 3))
+ return FALSE;
+
+ return TRUE;
+}
+
/*
* Return the uid and all gids of a connected local client
* Allocates a LocalClientCredRec - caller must call FreeLocalClientCreds
--
2.5.0
More information about the xorg-devel
mailing list