File: 02-authatieventsd.sh.patch

package info (click to toggle)
fglrx-driver 1:15.9-4~deb8u1~bpo70+1
  • links: PTS, VCS
  • area: non-free
  • in suites: wheezy-backports
  • size: 505,568 kB
  • sloc: ansic: 15,231; xml: 4,141; sh: 2,401; makefile: 425
file content (68 lines) | stat: -rw-r--r-- 2,566 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
description: compatiblility for authatieventsd.sh on Debian
author: Patrick Matthäi <pmatthaei@debian.org>

Index: fglrx-driver/common/etc/ati/authatieventsd.sh
===================================================================
--- fglrx-driver.orig/common/etc/ati/authatieventsd.sh	2011-07-18 19:32:39.000000000 -0400
+++ fglrx-driver/common/etc/ati/authatieventsd.sh	2011-07-18 20:25:31.000000000 -0400
@@ -42,6 +42,16 @@
         return 0
     fi
 
+    # Check for xauth
+    XAUTH_AUTH_MASK=/var/run/xauth/A$1*
+    XAUTH_AUTH_FILE=`ls -t $XAUTH_AUTH_MASK 2>/dev/null | head -n 1`   # Choose the newest file
+    if [ -n "$XAUTH_AUTH_FILE" ]; then
+        SERVER_AUTH_FILE=$XAUTH_AUTH_FILE
+        DISP_SEARCH_STRING="#ffff#"
+        return 0
+    fi
+
+
     # Check gdm
 
     GDM_AUTH_FILE=/var/lib/gdm/$1.Xauth
@@ -55,12 +65,14 @@
 
     for XPID in `pidof X`; do
         TRIAL_XAUTH_FILE=`tr '\0' '\n' < /proc/$XPID/environ | grep -e "^XAUTHORITY=" | cut -d= -f2`
+        if [ -n "$TRIAL_XAUTH_FILE" ]; then
         TRIAL_XAUTH_KEY=`xauth -f $TRIAL_XAUTH_FILE list | grep "unix$1"`
         if [ -n "$TRIAL_XAUTH_KEY" ]; then
             SERVER_AUTH_FILE=$TRIAL_XAUTH_FILE
             DISP_SEARCH_STRING="unix$1"
             return 0
         fi
+	fi
     done
 
     # Couldn't find the key
@@ -83,16 +95,22 @@
 case "$1" in
     grant)
         GetServerAuthFile $2 || exit -1
-        DISP_AUTH_KEY=`xauth -f $SERVER_AUTH_FILE list | grep $DISP_SEARCH_STRING | awk '{ print $3 }'`
-        if [ -n "$DISP_AUTH_KEY" ]; then
-            xauth -f $3 add $2 . $DISP_AUTH_KEY || exit -1
-        else
-            exit -1
+	xauth -f $SERVER_AUTH_FILE list | grep $DISP_SEARCH_STRING || exit -1
+	if [ `pinky -fs | awk '{ if ($3 == "'$2'" || $(NF) == "'$2'" ) { print $1; exit; } }'` ]; then
+		user=`pinky -fs | awk '{ if ($3 == "'$2'" || $(NF) == "'$2'" ) { print $1; exit; } }'`
+		su $user -c "echo "$2 . `xauth -f $SERVER_AUTH_FILE list | grep $DISP_SEARCH_STRING | awk '{print $3}'`" | xauth -f $3 merge -" || exit -1
+	else
+		echo "$2 . `xauth -f $SERVER_AUTH_FILE list | grep $DISP_SEARCH_STRING | awk '{print $3}'`" | xauth -f $3 merge - || exit -1
         fi
         ;;
 
     revoke)
-        xauth -f $3 remove $2 || exit -1
+	if [ `pinky -fs | awk '{ if ($3 == "'$2'" || $(NF) == "'$2'" ) { print $1; exit; } }'` ]; then
+		user=`pinky -fs | awk '{ if ($3 == "'$2'" || $(NF) == "'$2'" ) { print $1; exit; } }'`
+		su $user -c "xauth -f $3 remove $2" || exit -1
+	else
+		xauth -f $3 remove $2 || exit -1
+	fi
         ;;
 
     *)