Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 x11vnc (0.9.12-1build2) unstable; urgency=low
 .
   * add another user check
Author: root <root@console1-ub.ub.aau.at>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- x11vnc-0.9.12.orig/x11vnc/ssltools.h
+++ x11vnc-0.9.12/x11vnc/ssltools.h
@@ -1143,7 +1143,9 @@ char find_display[] =
 "list=\"$list \"`w -h \"$user\" 2>/dev/null | grep \"^${user}[ 	][ 	]*:[0-9]\" | awk '{print $2}' | sed -e 's,/.*$,,'`\n"
 "list=\"$list \"`who 2>/dev/null | grep \"^${user}[ 	]\" | awk '{print $NF}' | grep '(:[0-9]' | sed -e 's/[()]//g'`\n"
 "# ALGE: fix\n"
-"for i in `ps axuwww| grep \"$user\"| grep xinit`; do list=\"$list \"`echo $i | awk '/^:[0-9][0-9]/ {print $0}'`; done\n"
+"xinitlist=\"\"\n"
+"for i in `ps axuwww| grep \"$user\"| grep xinit`; do xinitlist=\"$xinitlist \"`echo $i | awk '/^:[0-9][0-9]/ {print $0}'`; done\n"
+"list=\"$list $xinitlist\"\n"
 "host=`hostname 2>/dev/null | sed -e 's/\\..*$//'`\n"
 "\n"
 "got_local_dm_file=\"\"\n"
@@ -1266,6 +1268,14 @@ char find_display[] =
 "	if [ \"X$FIND_DISPLAY_ALL\" != \"X\" ]; then\n"
 "		for p in $poss\n"
 "		do\n"
+"                       # ALGE, try only dpys in xinitlist\n"
+"                       xifound=0\n"
+"                       for xi in $xinitlist; do\n"
+"                         if [ \"X$p\" = \"X$xi\"]; then\n"
+"                           xifound=1\n"
+"                         fi\n"
+"                       done\n"  
+"                       if [ \"$xifound\" = "0" ]; then continue; fi\n"
 "			if [ \"X$p\" = \"X\" ]; then\n"
 "				continue\n"
 "			fi\n"
@@ -1289,6 +1299,14 @@ char find_display[] =
 "		if [ \"X$p\" = \"X\" ]; then\n"
 "			continue\n"
 "		fi\n"
+"               xifound=0\n"
+"               # ALGE, try only dpys in xinitlist\n"
+"               for xi in $xinitlist; do\n"
+"                 if [ \"X$p\" = \"X$xi\"]; then\n"
+"                   xifound=1\n"
+"                 fi\n"
+"               done\n"  
+"               if [ \"$xifound\" = "0" ]; then continue; fi\n"
 "		seen \"$p\"\n"
 "		if [ \"X$seenret\" = \"X1\" ]; then\n"
 "			continue\n"
