retired su function that was unused
[feisty_meow.git] / scripts / security / get_x_auth.sh
1 #!/bin/bash
2 # This script finds the X window system authorization info that's already
3 # been established for this display.  The information can then be used to
4 # set the authorization for a new su session, which keeps X secure as
5 # well as allowing the user to run X programs on the original display.
6
7 # make sure we have some information to return in the first place.
8 if [ ! -z "$DISPLAY" ]; then 
9   disp_search=$(echo $DISPLAY | sed -e 's/.*:\([0-9]*\).*/:\1/')
10 #echo disp search is $disp_search
11   temp_auth=$(xauth list | grep -i $HOSTNAME | grep $disp_search)
12 #echo temp auth is $temp_auth
13   temp_auth2=$(echo $temp_auth | sed -e "s/$HOSTNAME/; xauth add $HOSTNAME/g" )
14 #echo temp auth2 is $temp_auth2
15   export X_auth_info="echo setting X permissions $temp_auth2"
16 #echo $X_auth_info
17
18 fi
19