summaryrefslogtreecommitdiffstats
path: root/x11vnc/ssltools.h
diff options
context:
space:
mode:
Diffstat (limited to 'x11vnc/ssltools.h')
-rw-r--r--x11vnc/ssltools.h43
1 files changed, 32 insertions, 11 deletions
diff --git a/x11vnc/ssltools.h b/x11vnc/ssltools.h
index 57b3806..c6ff87b 100644
--- a/x11vnc/ssltools.h
+++ b/x11vnc/ssltools.h
@@ -798,6 +798,9 @@ char find_display[] =
" exit 1\n"
"fi\n"
"\n"
+"LC_ALL=C\n"
+"export LC_ALL\n"
+"\n"
"# util to try to match a display with a Linux VT and print\n"
"# disp,VT=... etc. Otherwise just print out display.\n"
"#\n"
@@ -980,19 +983,21 @@ char find_display[] =
"list=\"$list \"`who 2>/dev/null | grep \"^${user}[ ]\" | awk '{print $NF}' | grep '(:[0-9]' | sed -e 's/[()]//g'`\n"
"host=`hostname 2>/dev/null | sed -e 's/\\..*$//'`\n"
"\n"
+"got_local_dm_file=\"\"\n"
+"\n"
"if [ \"X$X11VNC_FINDDISPLAY_SKIP_XAUTH\" = \"X\" ]; then\n"
" # do a normal xauth list:\n"
" list=\"$list \"`xauth list | awk '{print $1}' | grep /unix | grep \"^${host}\" | sed -e 's/^.*:/:/' | sort -n | uniq`\n"
"\n"
-" # check for gdm and kdm non-NFS cookies in /tmp:\n"
-" for xa in /tmp/.gdm* /tmp/.Xauth*\n"
+" # check for gdm and kdm non-NFS cookies in /tmp: (and now /var/run/gdm)\n"
+" for xa in /tmp/.gdm* /tmp/.Xauth* /var/run/gdm/auth-for-*/database /var/run/gdm/auth-cookie-*-for-*\n"
" do\n"
" # try to be somewhat careful about the real owner of the file:\n"
" if id | sed -e 's/ gid.*$//' | grep -w root > /dev/null; then\n"
" break\n"
" fi\n"
" if [ -f $xa -a -r $xa ]; then\n"
-" if ls -l \"$xa\" | sed -e 's,/tmp.*$,,' | grep -w \"$user\" > /dev/null; then\n"
+" if ls -l \"$xa\" | sed -e 's,/tmp.*$,,' -e 's,/var.*$,,' | grep -w \"$user\" > /dev/null; then\n"
" # append these too:\n"
" if find \"$xa\" -user \"$user\" -perm 600 > /dev/null; then\n"
" :\n"
@@ -1000,7 +1005,12 @@ char find_display[] =
" continue\n"
" fi\n"
" # it passes the ownership tests, add it:\n"
-" list=\"$list \"`xauth -f \"$xa\" list | awk '{print $1}' | grep /unix | grep \"^${host}\" | sed -e 's/^.*:/:/' | sort -n | uniq | sed -e \"s,\\$,\\,$xa,\"`\n"
+" # since the directory is (evidently) local, \"localhost\" is good too. (but beware XAUTHLOCALHOSTNAME in libxcb)\n"
+" sav0=\"$list \"\n"
+" list=\"$list \"`xauth -f \"$xa\" list | awk '{print $1}' | grep /unix | egrep -i \"^${host}|^localhost\" | sed -e 's/^.*:/:/' | sort -n | uniq | sed -e \"s,\\$,\\,$xa,\"`\n"
+" if [ \"X$sav0\" != \"X$list\" ]; then\n"
+" got_local_dm_file=1\n"
+" fi\n"
" fi\n"
" fi\n"
" done\n"
@@ -1073,10 +1083,6 @@ char find_display[] =
" if [ \"X$ok\" = \"X1\" ]; then\n"
" # ok, put it on the list\n"
" poss=\"$poss $p\"\n"
-" if [ \"X$xa\" != \"X\" ]; then\n"
-" # xauth file too, if applicable\n"
-" poss=\"$poss,$xa\"\n"
-" fi\n"
" fi\n"
"done\n"
"\n"
@@ -1148,12 +1154,24 @@ char find_display[] =
"\n"
" # check xauth for it:\n"
" if [ \"X$xa\" != \"X\" ]; then\n"
-" XAUTHORITY=\"$xa\" xdpyinfo -display \"$p\" >/dev/null 2>&1\n"
+" myenv=\"XAUTHORITY=$xa\"\n"
" else\n"
-" xdpyinfo -display \"$p\" >/dev/null 2>&1\n"
+" myenv=\"FOO_BAR_=baz\"\n"
+" fi\n"
+" env \"$myenv\" xdpyinfo -display \"$p\" >/dev/null 2>&1\n"
+" rc=$?\n"
+" if [ $rc != 0 -a \"X$XAUTHLOCALHOSTNAME\" = \"X\" ]; then\n"
+" # guard against libxcb/desktop silliness: \n"
+" env \"$myenv\" XAUTHLOCALHOSTNAME=localhost xdpyinfo -display \"$p\" >/dev/null 2>&1\n"
+" rc=$?\n"
+" if [ $rc = 0 ]; then\n"
+" # better export it for cmds below...\n"
+" XAUTHLOCALHOSTNAME=localhost\n"
+" export XAUTHLOCALHOSTNAME\n"
+" fi\n"
" fi\n"
"\n"
-" if [ $? = 0 ]; then\n"
+" if [ $rc = 0 ]; then\n"
" if [ \"X$FD_TAG\" != \"X\" ]; then\n"
" # look for x11vnc special FD_TAG property:\n"
" if [ \"X$xa\" = \"X\" ]; then\n"
@@ -1286,6 +1304,9 @@ char create_display[] =
"COLUMNS=256\n"
"export COLUMNS\n"
"\n"
+"LC_ALL=C\n"
+"export LC_ALL\n"
+"\n"
"findfree() {\n"
" try=20\n"
" sry=99\n"