diff options
Diffstat (limited to 'x11vnc/ssltools.h')
-rw-r--r-- | x11vnc/ssltools.h | 97 |
1 files changed, 71 insertions, 26 deletions
diff --git a/x11vnc/ssltools.h b/x11vnc/ssltools.h index a93dfe6..1b1a96b 100644 --- a/x11vnc/ssltools.h +++ b/x11vnc/ssltools.h @@ -869,6 +869,8 @@ char create_display[] = "#!/bin/sh\n" "\n" "#CREATE_DISPLAY_OUTPUT=/tmp/cdo.txt\n" +"\n" +"CREATE_DISPLAY_OUTPUT=/tmp/cdo.$USER.txt\n" "if [ \"X$CREATE_DISPLAY_OUTPUT\" != \"X\" ]; then\n" " if [ \"X$CREATE_DISPLAY_EXEC\" = \"X\" ]; then\n" " CREATE_DISPLAY_EXEC=1\n" @@ -1033,29 +1035,56 @@ char create_display[] = " $have_xauth -f $authfile nextract - `hostname`:$N | $have_xauth nmerge -\n" " fi\n" "\n" +" result=0\n" +" ns=4\n" " if [ \"X$use_xdmcp_query\" = \"X1\" ]; then\n" " # we cannot use -nolisten tcp\n" -" #echo \"$* -from localhost -once -query localhost\"\n" -" #nohup $* -from localhost -once -query localhost 1>&2 &\n" " echo \"$* -once -query localhost\" 1>&2\n" -" nohup $* -once -query localhost 1>&2 &\n" -" pid=$!\n" -" elif [ \"X$have_startx\" != \"X\" ]; then\n" -" echo \"$have_startx $sess -- $* -nolisten tcp -auth $authfile\" 1>&2\n" -" $have_startx $sess -- $* -nolisten tcp -auth $authfile 1>&2 &\n" +" if [ \"X$have_root\" != \"X\" ]; then\n" +" nohup $* -once -query localhost 1>&2 &\n" +" else\n" +" nohup sh -c \"(sleep $ns; $* -once -query localhost -auth $authfile)\" 1>&2 &\n" +" ns=0\n" +" result=1\n" +" fi\n" " pid=$!\n" -" elif [ \"X$have_xinit\" != \"X\" ]; then\n" -" echo \"$have_xinit $sess -- $* -nolisten tcp -auth $authfile\" 1>&2\n" -" $have_xinit $sess -- $* -nolisten tcp -auth $authfile 1>&2 &\n" +" elif [ \"X$have_startx\" != \"X\" -o \"X$have_xinit\" != \"X\" ]; then\n" +" if [ \"X$have_startx\" != \"X\" ]; then\n" +" sxcmd=$have_startx\n" +" else\n" +" sxcmd=$have_xinit\n" +" fi\n" +" echo \"$sxcmd $sess -- $* -nolisten tcp -auth $authfile\" 1>&2\n" +" if [ \"X$have_root\" != \"X\" ]; then\n" +" $sxcmd $sess -- $* -nolisten tcp -auth $authfile 1>&2 &\n" +" else\n" +" nohup sh -c \"(sleep $ns; $sxcmd $sess -- $* -nolisten tcp -auth $authfile)\" 1>&2 &\n" +" ns=0\n" +" result=1\n" +" fi\n" " pid=$!\n" " else\n" " echo \"$* -nolisten tcp -auth $authfile\" 1>&2\n" -" nohup $* -nolisten tcp -auth $authfile 1>&2 &\n" -" pid=$!\n" -" nohup $sess 1>&2 &\n" +" if [ \"X$have_root\" != \"X\" ]; then\n" +" nohup $* -nolisten tcp -auth $authfile 1>&2 &\n" +" pid=$!\n" +" sleep 2\n" +" nohup $sess 1>&2 &\n" +" else\n" +" nohup sh -c \"(sleep $ns; $* -nolisten tcp -auth $authfile)\" 1>&2 &\n" +" pid=$!\n" +" sleep 2\n" +" nohup sh -c \"(sleep $ns; $sess)\" 1>&2 &\n" +" ns=0\n" +" result=1\n" +" fi\n" " fi\n" -" sleep 4\n" -" if kill -0 $pid; then\n" +" sleep $ns\n" +" if [ \"X$result\" = \"X1\" ]; then\n" +" :\n" +" elif [ -d /proc/$pid ]; then\n" +" result=1\n" +" elif kill -0 $pid; then\n" " result=1\n" " else\n" " result=0\n" @@ -1123,17 +1152,33 @@ char create_display[] = " #have_startx=$save_have_startx\n" "\n" " if [ \"X$result\" = \"X1\" -a \"X$have_xmodmap\" != \"X\" ]; then\n" -" (\n" -" sleep 1; $have_xmodmap -display :$N -e \"keycode any = Shift_R\" \n" -" sleep 1; $have_xmodmap -display :$N -e \"add Shift = Shift_L Shift_R\" \n" -" sleep 1; $have_xmodmap -display :$N -e \"keycode any = Control_R\" \n" -" sleep 1; $have_xmodmap -display :$N -e \"add Control = Control_L Control_R\" \n" -" sleep 1; $have_xmodmap -display :$N -e \"keycode any = Alt_L\" \n" -" sleep 1; $have_xmodmap -display :$N -e \"keycode any = Alt_R\" \n" -" sleep 1; $have_xmodmap -display :$N -e \"keycode any = Meta_L\" \n" -" sleep 1; $have_xmodmap -display :$N -e \"clear Mod1\" \n" -" sleep 1; $have_xmodmap -display :$N -e \"add Mod1 = Alt_L Alt_R Meta_L\" \n" -" ) 1>&2 &\n" +" if [ \"X$have_root\" = \"X\" ]; then\n" +" nohup sh -c \"(\n" +" sleep 6;\n" +" $have_xmodmap -display :$N -e 'keycode any = Shift_R' \\\n" +" -e 'add Shift = Shift_L Shift_R' \\\n" +" -e 'keycode any = Control_R' \\\n" +" -e 'add Control = Control_L Control_R' \\\n" +" -e 'keycode any = Alt_L' \\\n" +" -e 'keycode any = Alt_R' \\\n" +" -e 'keycode any = Meta_L' \\\n" +" -e 'clear Mod1' \\\n" +" -e 'add Mod1 = Alt_L Alt_R Meta_L' \\\n" +" )\" 1>&2 &\n" +" else\n" +" (\n" +" sleep 1;\n" +" $have_xmodmap -display :$N -e 'keycode any = Shift_R' \\\n" +" -e 'add Shift = Shift_L Shift_R' \\\n" +" -e 'keycode any = Control_R' \\\n" +" -e 'add Control = Control_L Control_R' \\\n" +" -e 'keycode any = Alt_L' \\\n" +" -e 'keycode any = Alt_R' \\\n" +" -e 'keycode any = Meta_L' \\\n" +" -e 'clear Mod1' \\\n" +" -e 'add Mod1 = Alt_L Alt_R Meta_L' \\\n" +" ) 1>&2 &\n" +" fi\n" " fi\n" "}\n" "\n" |