]> git.ipfire.org Git - people/stevee/ipfire-3.x.git/blob - xorg-x11-server/patches/xserver-1.4.99-ssh-isnt-local.patch
kernel: Drop ld.so placeholder files
[people/stevee/ipfire-3.x.git] / xorg-x11-server / patches / xserver-1.4.99-ssh-isnt-local.patch
1 From 66a3b14e118e90db80f96fcab52af4df35bc2377 Mon Sep 17 00:00:00 2001
2 From: Adam Jackson <ajax@redhat.com>
3 Date: Mon, 10 Dec 2007 11:26:57 -0500
4 Subject: [PATCH] Hack for proper MIT-SHM rejection for ssh-forwarded clients.
5
6 ---
7 Xext/shm.c | 16 ++++++++++++++++
8 1 file changed, 16 insertions(+)
9
10 diff --git a/Xext/shm.c b/Xext/shm.c
11 index de48020..c011210 100644
12 --- a/Xext/shm.c
13 +++ b/Xext/shm.c
14 @@ -321,8 +321,21 @@ shm_access(ClientPtr client, SHMPERM_TYPE * perm, int readonly)
15 mode_t mask;
16 int uidset = 0, gidset = 0;
17 LocalClientCredRec *lcc;
18 + Bool is_ssh = FALSE;
19
20 if (GetLocalClientCreds(client, &lcc) != -1) {
21 +#ifdef linux
22 + if (lcc->fieldsSet & LCC_PID_SET) {
23 + /* ssh isn't actually a local client */
24 + char exe[64], buf[64];
25 +
26 + memset(buf, 0, 64);
27 + snprintf(exe, 64, "/proc/%d/exe", lcc->pid);
28 + readlink(exe, buf, 63);
29 + if (strstr(buf, "/ssh"))
30 + is_ssh = TRUE;
31 + }
32 +#endif
33
34 if (lcc->fieldsSet & LCC_UID_SET) {
35 uid = lcc->euid;
36 @@ -342,6 +355,9 @@ shm_access(ClientPtr client, SHMPERM_TYPE * perm, int readonly)
37 #endif
38 FreeLocalClientCreds(lcc);
39
40 + if (is_ssh)
41 + return -1;
42 +
43 if (uidset) {
44 /* User id 0 always gets access */
45 if (uid == 0) {
46 --
47 1.7.10.1
48