summaryrefslogtreecommitdiffstats
path: root/x11vnc/ssltools.h
diff options
context:
space:
mode:
authorrunge <runge>2006-06-18 23:59:45 +0000
committerrunge <runge>2006-06-18 23:59:45 +0000
commit64e731a9da82e3cc614e274d6fca6f855d0359b7 (patch)
tree540bca0a021f3e74b768a747bc3d75435848ca0d /x11vnc/ssltools.h
parent363ae71df0f25b018136d19eed20be954e1dd088 (diff)
downloadlibtdevnc-64e731a9da82e3cc614e274d6fca6f855d0359b7.tar.gz
libtdevnc-64e731a9da82e3cc614e274d6fca6f855d0359b7.zip
x11vnc: --grabkbd, -grabptr, -env, -allowedcmds, unixpw+WAIT user fred:options
Diffstat (limited to 'x11vnc/ssltools.h')
-rw-r--r--x11vnc/ssltools.h55
1 files changed, 41 insertions, 14 deletions
diff --git a/x11vnc/ssltools.h b/x11vnc/ssltools.h
index 98ee802..73b2686 100644
--- a/x11vnc/ssltools.h
+++ b/x11vnc/ssltools.h
@@ -697,9 +697,14 @@ char find_display[] =
"if [ \"X$1\" = \"X-n\" ]; then\n"
" showxauth=\"\"\n"
" shift\n"
-"elif [ \"X$1\" = \"X-f\" ]; then\n"
+"fi\n"
+"if [ \"X$1\" = \"X-f\" ]; then\n"
" shift\n"
-" showxauth=\"$1\"\n"
+" if [ ! -r $1 ]; then\n"
+" echo \"\"\n"
+" exit 1\n"
+" fi\n"
+" export XAUTHORITY=\"$1\"\n"
" shift\n"
"fi\n"
"\n"
@@ -724,24 +729,46 @@ char find_display[] =
"# Now try to match X DISPLAY to user:\n"
"\n"
"# who(1) output column 2:\n"
-"display=`who | grep \"^${user}[ ][ ]*:[0-9]\" | head -1 | awk '{print $2}'`\n"
+"display=`who | grep \"^${user}[ ][ ]*:[0-9]\" | head -1 \\\n"
+" | awk '{print $2}'`\n"
"\n"
"if [ \"X$display\" = \"X\" ]; then\n"
-" # who(1) output, last column:\n"
-" display=`who | grep \"^${user}[ ]\" | awk '{print $NF}' | grep '(:[0-9]' | sed -e 's/[()]//g' | head -1`\n"
-" if [ \"X$display\" = \"X\" ]; then\n"
-" echo \"\" # failure\n"
-" exit 1\n"
-" fi\n"
+" # who(1) output, last column:\n"
+" display=`who | grep \"^${user}[ ]\" | awk '{print $NF}' \\\n"
+" | grep '(:[0-9]' | sed -e 's/[()]//g' | head -1`\n"
+" if [ \"X$display\" = \"X\" ]; then\n"
+" if [ \"X$X11VNC_FINDDISPLAY_SKIP_XAUTH\" != \"X\" ]; then\n"
+" echo \"\" # failure\n"
+" exit 1\n"
+" fi\n"
+" # loop over xauth list items machine ^hostname/unix:N\n"
+" host=`hostname | sed -e 's/\\..*$//'`\n"
+" for d in `xauth list | awk '{print $1}' | grep /unix \\\n"
+" | grep \"^${host}\" | sed -e 's/^.*://' | sort -n | uniq`\n"
+" do\n"
+" xdpyinfo -display \":$d\" >/dev/null 2>&1\n"
+" if [ $? = 0 ]; then\n"
+" # try again with no authority:\n"
+" env XAUTHORITY=/dev/null xdpyinfo \\\n"
+" -display \":$d\" >/dev/null 2>&1\n"
+" # 0 means got in for free... skip it.\n"
+" if [ $? != 0 ]; then\n"
+" # keep it\n"
+" display=\":$d\"\n"
+" break\n"
+" fi\n"
+" fi\n"
+" done\n"
+" if [ \"X$display\" = \"X\" ]; then\n"
+" echo \"\" # failure\n"
+" exit 1\n"
+" fi\n"
+" fi\n"
"fi\n"
"\n"
"echo \"DISPLAY=$display\"\n"
"if [ \"X$showxauth\" != \"X\" ]; then\n"
-" if [ \"X$showxauth\" = \"X1\" ]; then\n"
-" xauth extract - \"$display\" 2>/dev/null\n"
-" else\n"
-" xauth -f \"$showxauth\" extract - \"$display\" 2>/dev/null\n"
-" fi\n"
+" xauth extract - \"$display\" 2>/dev/null\n"
"fi\n"
"\n"
"exit 0\n"