summarylogtreecommitdiffstats
path: root/arch-fglrx-authatieventsd_new.patch
blob: 80467cf3ced51161e945b80c3577c83b23b442de (plain)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
--- 14.1/common/etc/ati/authatieventsd.sh	2014-01-30 15:36:26.000000000 +0100
+++ 14.1/common/etc/ati/authatieventsd.sh	2014-02-02 14:10:19.529653688 +0100
@@ -32,7 +32,7 @@
     # vary depending upon whether X was started via xdm/kdm, gdm or startx, so
     # check each one in turn.
 
-    # Check xdm/kdm
+    # Check xdm
 
     XDM_AUTH_MASK=/var/lib/xdm/authdir/authfiles/A$1*
     XDM_AUTH_FILE=`ls -t $XDM_AUTH_MASK 2>/dev/null | head -n 1`   # Choose the newest file
@@ -42,12 +42,32 @@
         return 0
     fi
 
-    # Check gdm
+    # Check kdm
 
-    GDM_AUTH_FILE=/var/lib/gdm/$1.Xauth
+    KDM_AUTH_MASK=/var/run/xauth/A$1*
+    KDM_AUTH_FILE=`ls -t $KDM_AUTH_MASK 2>/dev/null | head -n 1`   # Choose the newest file
+    if [ -n "$KDM_AUTH_FILE" ]; then
+        SERVER_AUTH_FILE=$KDM_AUTH_FILE
+        DISP_SEARCH_STRING="#ffff#"
+        return 0
+    fi
+
+    # Check gdm 3
+
+    GDM_AUTH_FILE=/var/run/gdm/auth-for-gdm-*/database
     if [ -e $GDM_AUTH_FILE ]; then
         SERVER_AUTH_FILE=$GDM_AUTH_FILE
-        DISP_SEARCH_STRING="$1"
+        DISP_SEARCH_STRING="unix$1"
+        return 0
+    fi
+
+    # Check lightdm
+    # Not sure if this will work
+    LIGHTDM_AUTH_FILE=/var/run/lightdm/root/$1
+    if [ -e $LIGHTDM_AUTH_FILE ]; then
+        SERVER_AUTH_FILE=$LIGHTDM_AUTH_FILE
+        # Not sure if this is correct
+        DISP_SEARCH_STRING="unix$1"
         return 0
     fi
 
@@ -65,7 +85,7 @@
 
     # Couldn't find the key
 
-    return -1
+    return 255
 }
 
 # Main part of script
@@ -78,25 +98,25 @@
 #
 
 PATH=$PATH:/usr/bin:/usr/X11R6/bin
-which xauth > /dev/null || exit -1
+which xauth > /dev/null || exit 255
 
 case "$1" in
     grant)
-        GetServerAuthFile $2 || exit -1
+        GetServerAuthFile $2 || exit 255
         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
+            xauth -f $3 add $2 . $DISP_AUTH_KEY || exit 255
         else
-            exit -1
+            exit 255
         fi
         ;;
 
     revoke)
-        xauth -f $3 remove $2 || exit -1
+        xauth -f $3 remove $2 || exit 255
         ;;
 
     *)
-        exit -1
+        exit 255
         ;;
 esac
 exit 0