summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrunge <runge>2007-03-24 23:23:25 +0000
committerrunge <runge>2007-03-24 23:23:25 +0000
commitf1bfe53f4fab7996292846a68e075ebe76d107e7 (patch)
tree457ea6ea483d0c1d5fd7c0f8039cb071b8958e38
parentd013b8766ff947468b0f564a539bc17cd7c303b0 (diff)
downloadlibtdevnc-f1bfe53f.tar.gz
libtdevnc-f1bfe53f.zip
reverse (listening) VNC connections.
-rw-r--r--x11vnc/misc/enhanced_tightvnc_viewer/README8
-rwxr-xr-xx11vnc/misc/enhanced_tightvnc_viewer/bin/util/ss_vncviewer282
-rwxr-xr-xx11vnc/misc/enhanced_tightvnc_viewer/bin/util/ssvnc.tcl358
-rwxr-xr-xx11vnc/misc/enhanced_tightvnc_viewer/src/patches/_bundle2
-rw-r--r--x11vnc/misc/enhanced_tightvnc_viewer/src/patches/tight-vncviewer-full.patch330
5 files changed, 848 insertions, 132 deletions
diff --git a/x11vnc/misc/enhanced_tightvnc_viewer/README b/x11vnc/misc/enhanced_tightvnc_viewer/README
index 36b81a0..b121ee8 100644
--- a/x11vnc/misc/enhanced_tightvnc_viewer/README
+++ b/x11vnc/misc/enhanced_tightvnc_viewer/README
@@ -149,7 +149,7 @@ Unix and Mac OS X:
Unpack the archive:
- % gzip -dc ssvnc-1.0.11.tar.gz | tar xvf -
+ % gzip -dc ssvnc-1.0.14.tar.gz | tar xvf -
Run the GUI:
@@ -159,7 +159,7 @@ Unix and Mac OS X:
On MacOSX you could also click on the SSVNC app in the Finder.
- The smaller file "ssvnc_no_windows-1.0.11.tar.gz"
+ The smaller file "ssvnc_no_windows-1.0.14.tar.gz"
could have been used as well.
On MacOSX there is also a SSVNC.app directory icon you can click on
@@ -170,7 +170,7 @@ Windows:
Unzip, using WinZip or a similar utility, the zip file:
- ssvnc-1.0.11.zip
+ ssvnc-1.0.14.zip
Run the GUI, e.g.:
@@ -182,7 +182,7 @@ Windows:
select Open, and then OK to launch it.
- The smaller file "ssvnc_windows_only-1.0.11.zip"
+ The smaller file "ssvnc_windows_only-1.0.14.zip"
could have been used as well.
You can make a Windows shortcut to this program if you want to.
diff --git a/x11vnc/misc/enhanced_tightvnc_viewer/bin/util/ss_vncviewer b/x11vnc/misc/enhanced_tightvnc_viewer/bin/util/ss_vncviewer
index 458ce78..31a8bb6 100755
--- a/x11vnc/misc/enhanced_tightvnc_viewer/bin/util/ss_vncviewer
+++ b/x11vnc/misc/enhanced_tightvnc_viewer/bin/util/ss_vncviewer
@@ -3,7 +3,7 @@
# ss_vncviewer: wrapper for vncviewer to use an stunnel SSL tunnel
# or an SSH tunnel.
#
-# Copyright (c) 2006 by Karl J. Runge <runge@karlrunge.com>
+# Copyright (c) 2006-2007 by Karl J. Runge <runge@karlrunge.com>
#
# You must have stunnel(8) installed on the system and in your PATH
# (however, see the -ssh option below, in which case you will need ssh(1)
@@ -94,6 +94,7 @@
#
# ss_vncviewer -sshssl -proxy fred@mygate.com mymachine:0
#
+# -listen (or -reverse) set up a reverse connection.
#
# -alpha turn on cursor alphablending hack if you are using the
# enhanced tightvnc vncviewer.
@@ -111,6 +112,8 @@ VNCVIEWERCMD=${VNCVIEWERCMD:-vncviewer}
# Same for STUNNEL, e.g. set it to /path/to/stunnel or stunnel4, etc.
#
+#set -xv
+
PATH=$PATH:/usr/sbin:/usr/local/sbin:/dist/sbin; export PATH
if [ "X$STUNNEL" = "X" ]; then
@@ -131,12 +134,16 @@ use_ssh=""
use_sshssl=""
direct_connect=""
ssh_sleep=15
-ssh_cmd="sleep $ssh_sleep"
+if echo "$*" | grep '.*-listen' > /dev/null; then
+ ssh_sleep=1800
+fi
+ssh_cmd=""
if [ "X$SS_VNCVIEWER_SSH_CMD" != "X" ]; then
ssh_cmd="$SS_VNCVIEWER_SSH_CMD"
fi
ssh_args=""
showcert=""
+reverse=""
if [ "X$1" = "X-viewerflavor" ]; then
if echo "$VNCVIEWERCMD" | grep -i chicken.of > /dev/null; then
@@ -183,6 +190,10 @@ do
;;
"-showcert") showcert=1
;;
+ "-listen") reverse=1
+ ;;
+ "-reverse") reverse=1
+ ;;
"-grab") VNCVIEWER_GRAB_SERVER=1; export VNCVIEWER_GRAB_SERVER
;;
"-h"*) help; exit 0
@@ -202,6 +213,29 @@ else
NO_ALPHABLEND=1
export NO_ALPHABLEND
fi
+if [ "X$reverse" != "X" ]; then
+ ssh_sleep=1800
+ if [ "X$use_ssh" = "X1" ]; then
+ VNCVIEWER_LISTEN_LOCALHOST=1
+ export VNCVIEWER_LISTEN_LOCALHOST
+ fi
+ if [ "X$proxy" != "X" ]; then
+ if [ "X$use_ssh" = "X" -a "X$use_sshssl" = "X" ]; then
+ echo ""
+ echo "*Warning*: SSL -listen and a Web proxy does not make sense."
+ sleep 3
+ elif echo "$proxy" | grep "," > /dev/null; then
+ :
+ else
+ echo ""
+ echo "*Warning*: -listen and a single proxy/gateway does not make sense."
+ sleep 3
+ fi
+ fi
+fi
+if [ "X$ssh_cmd" = "X" ]; then
+ ssh_cmd="sleep $ssh_sleep"
+fi
orig="$1"
shift
@@ -228,7 +262,9 @@ fi
if echo "$orig" | grep ':' > /dev/null; then
:
else
- orig="$orig:0"
+ if [ "X$reverse" = "X" ]; then
+ orig="$orig:0"
+ fi
fi
host=`echo "$orig" | awk -F: '{print $1}'`
@@ -236,8 +272,14 @@ disp=`echo "$orig" | awk -F: '{print $2}'`
if [ "X$host" = "X" ]; then
host=localhost
fi
-if [ $disp -lt 200 ]; then
- port=`expr $disp + 5900`
+if [ $disp -lt 0 ]; then
+ port=`expr 0 - $disp`
+elif [ $disp -lt 200 ]; then
+ if [ "X$reverse" = "X" ]; then
+ port=`expr $disp + 5900`
+ else
+ port=`expr $disp + 5500`
+ fi
else
port=$disp
fi
@@ -278,12 +320,47 @@ findfree() {
echo $use0
}
-use=`findfree 5930`
+final() {
+ echo ""
+ if [ "X$SS_VNCVIEWER_RM" != "X" ]; then
+ rm -f $SS_VNCVIEWER_RM 2>/dev/null
+ fi
+ if [ "X$tcert" != "X" ]; then
+ rm -f $tcert
+ fi
+ if [ "X$pssh" != "X" ]; then
+ echo "Terminating background ssh process"
+ echo kill -TERM "$pssh"
+ kill -TERM "$pssh" 2>/dev/null
+ sleep 1
+ kill -KILL "$pssh" 2>/dev/null
+ pssh=""
+ fi
+ if [ "X$stunnel_pid" != "X" ]; then
+ echo "Terminating background stunnel process"
+ echo kill -TERM "$stunnel_pid"
+ kill -TERM "$stunnel_pid" 2>/dev/null
+ sleep 1
+ kill -KILL "$stunnel_pid" 2>/dev/null
+ stunnel_pid=""
+ fi
+}
-if [ $use -ge 5900 ]; then
- N=`expr $use - 5900`
+if [ "X$reverse" = "X" ]; then
+ use=`findfree 5930`
+ if [ $use -ge 5900 ]; then
+ N=`expr $use - 5900`
+ else
+ N=$use
+ fi
else
- N=$use
+ p2=`expr $port + 30`
+ use=`findfree $p2`
+ if [ $use -ge 5500 ]; then
+ N=`expr $use - 5500`
+ else
+ N=$use
+ fi
fi
if echo "$0" | grep vncip > /dev/null; then
@@ -295,6 +372,7 @@ if [ "X$use_ssh" = "X1" ]; then
ssh_host="$host"
vnc_host="localhost"
ssh=${SSH:-"ssh -x"}
+
if echo "$proxy" | grep "," > /dev/null; then
proxy1=`echo "$proxy" | awk -F, '{print $1}'`
proxy2=`echo "$proxy" | awk -F, '{print $2}'`
@@ -327,6 +405,7 @@ if [ "X$use_ssh" = "X1" ]; then
stty sane
proxy="${ssh_user2}localhost:$proxport"
fi
+
if [ "X$proxy" != "X" ]; then
ssh_port=`echo "$proxy" | awk -F: '{print $2}'`
if [ "X$ssh_port" = "X" ]; then
@@ -348,6 +427,12 @@ if [ "X$use_ssh" = "X1" ]; then
if [ "X$SS_VNCVIEWER_USE_C" != "X" ]; then
C="-C"
fi
+ if [ "X$reverse" = "X" ]; then
+ ssh_redir="-L ${use}:${vnc_host}:${port}"
+ else
+ ssh_redir="-R ${port}:${vnc_host}:${use}"
+ fi
+ pmark=`sh -c 'echo $$'`
# the -t option actually speeds up typing response via VNC!!
if [ "X$SS_VNCVIEWER_SSH_ONLY" != "X" ]; then
echo "$ssh -x -p $ssh_port -t $C $ssh_args $ssh_host \"$info\""
@@ -355,20 +440,32 @@ if [ "X$use_ssh" = "X1" ]; then
$ssh -x -p $ssh_port -t $C $ssh_args $ssh_host "$ssh_cmd"
exit $?
elif [ "X$SS_VNCVIEWER_NO_F" != "X" ]; then
- echo "$ssh -x -p $ssh_port -t $C -L ${use}:${vnc_host}:${port} $ssh_args $ssh_host \"$info\""
+ echo "$ssh -x -p $ssh_port -t $C $ssh_redir $ssh_args $ssh_host \"$info\""
echo ""
- $ssh -x -p $ssh_port -t $C -L ${use}:${vnc_host}:${port} $ssh_args $ssh_host "$ssh_cmd"
+ $ssh -x -p $ssh_port -t $C $ssh_redir $ssh_args $ssh_host "$ssh_cmd"
else
- echo "$ssh -x -f -p $ssh_port -t $C -L ${use}:${vnc_host}:${port} $ssh_args $ssh_host \"$info\""
+ echo "$ssh -x -f -p $ssh_port -t $C $ssh_redir $ssh_args $ssh_host \"$info\""
echo ""
- $ssh -x -f -p $ssh_port -t $C -L ${use}:${vnc_host}:${port} $ssh_args $ssh_host "$ssh_cmd"
+ $ssh -x -f -p $ssh_port -t $C $ssh_redir $ssh_args $ssh_host "$ssh_cmd"
fi
if [ "$?" != "0" ]; then
echo ""
echo "ssh to $ssh_host failed."
exit 1
fi
- echo ""
+ stty sane
+
+ c=0
+ pssh=""
+ while [ $c -lt 30 ]
+ do
+ p=`expr $pmark + $c`
+ if ps -p "$p" 2>&1 | grep "$ssh" > /dev/null; then
+ pssh=$p
+ break
+ fi
+ c=`expr $c + 1`
+ done
if [ "X$ssh_cmd" = "Xsleep $ssh_sleep" ] ; then
sleep 1
else
@@ -378,11 +475,23 @@ if [ "X$use_ssh" = "X1" ]; then
echo ""
#reset
stty sane
+ #echo "pssh=\"$pssh\""
if [ "X$use_sshssl" = "X" ]; then
echo "Running viewer:"
- echo "$VNCVIEWERCMD" "$@" localhost:$N
- echo ""
- $VNCVIEWERCMD "$@" localhost:$N
+
+ trap "final" 0 2 15
+ if [ "X$reverse" = "X" ]; then
+ echo "$VNCVIEWERCMD" "$@" localhost:$N
+ echo ""
+ $VNCVIEWERCMD "$@" localhost:$N
+ else
+ echo ""
+ echo "NOTE: Press Ctrl-C to terminate viewer LISTEN mode."
+ echo ""
+ echo "$VNCVIEWERCMD" "$@" -listen $N
+ echo ""
+ $VNCVIEWERCMD "$@" -listen $N
+ fi
exit $?
else
@@ -639,21 +748,37 @@ if [ "X$direct_connect" != "X" ]; then
SSVNC_LISTEN=$use
export SSVNC_LISTEN
$ptmp &
- sleep 2
+ if [ "X$reverse" = "X" ]; then
+ sleep 2
+ fi
host="localhost"
disp="$N"
fi
- echo "$VNCVIEWERCMD" "$@" $host:$disp
- echo ""
- $VNCVIEWERCMD "$@" $host:$disp
+ if [ "X$reverse" = "X" ]; then
+ echo "$VNCVIEWERCMD" "$@" $host:$disp
+ trap "final" 0 2 15
+ echo ""
+ $VNCVIEWERCMD "$@" $host:$disp
+ else
+ echo ""
+ echo "NOTE: Press Ctrl-C to terminate viewer LISTEN mode."
+ echo ""
+ echo "$VNCVIEWERCMD" "$@" -listen $N
+ trap "final" 0 2 15
+ echo ""
+ $VNCVIEWERCMD "$@" -listen $N
+ fi
exit $?
fi
##debug = 7
+## debug = 6
tmp=/tmp/ss_vncviewer${RANDOM}.$$
mytmp "$tmp"
-cat > "$tmp" <<END
+if [ "X$reverse" = "X" ]; then
+
+ cat > "$tmp" <<END
foreground = yes
pid =
client = yes
@@ -665,8 +790,93 @@ $cert
[vnc_stunnel]
accept = localhost:$use
$connect
+
+END
+else
+
+ p2=`expr 5500 + $N`
+ connect="connect = localhost:$p2"
+ if [ "X$cert" = "X" ]; then
+ tcert="/tmp/tcert.$$"
+ cat > $tcert <<END
+-----BEGIN RSA PRIVATE KEY-----
+MIIEowIBAAKCAQEAvkfXxb0wcxgrjV2ziFikjII+ze8iKcTBt47L0GM/c21efelN
++zZpJUUXLu4zz8Ry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FkbWluQG5vd2hlcmUubm9uZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
+AQoCggEBAL5H18W9MHMYK41ds4hYpIyCPs3vIinEwbeOy9BjP3NtXn3pTfs2aSVF
+Fy7uM8/EcqvEPrEIHzcu7kzqTfW1FGjpNU5w+4Gg0J0FojR5qm1tpC/g0jip4CVT
+6PXREwEvIX+/g9XtQwWcY03NWuEUKliYscKWI/fYsVs7vFQtpv8V7I7zrI6ePgyw
+QePdJ25ML7LZoZolptQpiOTucTpIIqFTUKh70DHVSjks/T6W472YkV9VKKqDK5Pt
+jTqsD/dEwd+cjwEl2/c1yqTuwy4ZLm3vsmBn/spOOmg+9Oy9OxG+3KLBT0vOLzWf
+YF+60NFDsJua2AP6GUwbJIGqobSM5C8CAwEAATANBgkqhkiG9w0BAQQFAAOCAQEA
+vGomHEp6TVU83X2EBUgnbOhzKJ9u3fOI/Uf5L7p//Vxqow7OR1cguzh/YEzmXOIL
+ilMVnzX9nj/bvcLAuqEP7MR1A8f4+E807p/L/Sf49BiCcwQq5I966sGKYXjkve+T
+2GTBNwMSq+5kLSf6QY8VZI+qnrAudEQMeJByQhTZZ0dH8Njeq8EGl9KUio+VWaiW
+CQK6xJuAvAHqa06OjLmwu1fYD4GLGSrOIiRVkSXV8qLIUmzxdJaIRznkFWsrCEKR
+wAH966SAOvd2s6yOHMvyDRIL7WHxfESB6rDHsdIW/yny1fBePjv473KrxyXtbz7I
+dMw1yW09l+eEo4A7GzwOdw==
+-----END CERTIFICATE-----
+END
+ chmod 600 $tcert
+ cert="cert = $tcert"
+ fi
+
+ STUNNEL_EXTRA_OPTS=`echo "$STUNNEL_EXTRA_OPTS" | sed -e 's/maxconn/#maxconn/'`
+
+ hloc=""
+ if [ "X$use_ssh" = "X1" ]; then
+ hloc="localhost:"
+ fi
+ cat > "$tmp" <<END
+foreground = yes
+pid =
+client = no
+debug = 6
+$STUNNEL_EXTRA_OPTS
+$verify
+$cert
+
+[vnc_stunnel]
+accept = $hloc$port
+$connect
+
END
+fi
+
echo ""
echo "Using this stunnel configuration:"
echo ""
@@ -675,25 +885,39 @@ echo ""
sleep 1
echo ""
-echo "Running: stunnel"
+echo "Running stunnel:"
echo "$STUNNEL $tmp"
$STUNNEL "$tmp" < /dev/tty > /dev/tty &
-pid=$!
+stunnel_pid=$!
echo ""
# pause here to let the user supply a possible passphrase for the
# mycert key:
if [ "X$mycert" != "X" ]; then
- sleep 4
+ sleep 2
+ echo ""
+ echo "(pausing for possible certificate passphrase dialog)"
+ echo ""
+ sleep 2
fi
sleep 2
rm -f "$tmp"
echo ""
echo "Running viewer:"
-echo "$VNCVIEWERCMD" "$@" localhost:$N
-echo ""
-$VNCVIEWERCMD "$@" localhost:$N
+if [ "X$reverse" = "X" ]; then
+ echo "$VNCVIEWERCMD" "$@" localhost:$N
+ trap "final" 0 2 15
+ echo ""
+ $VNCVIEWERCMD "$@" localhost:$N
+else
+ echo ""
+ echo "NOTE: Press Ctrl-C to terminate viewer LISTEN mode."
+ echo ""
+ echo "$VNCVIEWERCMD" "$@" -listen $N
+ trap "final" 0 2 15
+ echo ""
+ $VNCVIEWERCMD "$@" -listen $N
+fi
-kill $pid
sleep 1
diff --git a/x11vnc/misc/enhanced_tightvnc_viewer/bin/util/ssvnc.tcl b/x11vnc/misc/enhanced_tightvnc_viewer/bin/util/ssvnc.tcl
index 77e7c27..b583c8e 100755
--- a/x11vnc/misc/enhanced_tightvnc_viewer/bin/util/ssvnc.tcl
+++ b/x11vnc/misc/enhanced_tightvnc_viewer/bin/util/ssvnc.tcl
@@ -112,6 +112,16 @@ proc help {} {
tunnel which, in turn, encrypts and redirects the connection to the
remote VNC server.
+ If you are using a port less than the default VNC port 5900 (usually
+ the VNC display = port - 5900), use the full port number itself, e.g.:
+
+ 24.67.132.27:443
+
+ Note, however, if the number n after the colon is less than 200, then
+ a port number 5900 + n is assumed; i.e. n is the VNC display number.
+ If you must use a TCP port less than 200, specify a negative value,
+ e.g.: 24.67.132.27:-80
+
The remote VNC server must support an initial SSL handshake before
using the VNC protocol (i.e. VNC is tunnelled through the SSL channel
after it is established). "x11vnc -ssl ..." does this, and any VNC
@@ -263,6 +273,11 @@ proc help {} {
5) If you want to do a Direct VNC connection, with *NO* SSL or SSH
encryption, use the "vnc://" prefix, e.g. vnc://far-away.east:0
+ 6) Reverse VNC connections are possible as well. Go to Options and
+ select "Reverse VNC connection". In the 'VNC Host:Display' entry
+ box put in the number (e.g. "0" or ":0") that corresponds to the
+ Listening display (0 -> port 5500). See the Options Help for more
+ info.
}
.h.f.t insert end $msg
@@ -434,6 +449,48 @@ set msg {
enter a firewall) or if additional SSH port redirs are required
(CUPS, Sound, SMB tunnelling: See Advanced Options).
+ Reverse VNC connection: reverse (listening) VNC connections are possible.
+
+ For SSL connections in the 'VNC Host:Display' entry box put in
+ the number (e.g. "0" or ":0") that corresponds to the Listening
+ display (0 -> port 5500). For example x11vnc can then be used:
+ "x11vnc ... -ssl SAVE -connect hostname:port".
+
+ Then a VNC server should establish a reverse connection to
+ that port on this machine (e.g. -connect this-machine:5500)
+
+ For reverse connections in SSH or SSH + SSL modes it is a
+ little trickier. The SSH tunnel (with -R redirect) must be
+ established and remain up waiting for reverse connections.
+ The default time is "sleep 1800", i.e. 30 mins. You can put
+ a longer or shorter sleep in "Remote SSH Command" (perhaps
+ after your command runs: cmd; sleep 3600).
+
+ For SSH reverse connections put "hostname:n" in
+ 'VNC Host:Display' or "user@hostname:n". The "n" will be the
+ listening display on the *REMOTE* side. So to have the remote
+ x11vnc connect use: "x11vnc ... -connect localhost:n" or
+ "x11vnc -R connect:localhost:n" (-ssl will be needed for SSH+SSL
+ mode). If the -R port cannot be opened because it is in use
+ by another program you will have to kill everything and start
+ over using a different port.
+
+ In reverse connections mode be careful to protect the listening
+ vncviewer from direct connections (neither SSL nor SSH)
+ connecting directly to its listening port thereby bypassing
+ the tunnel. This can be done by a host-level firewall that only
+ lets in, say, port 5500. Or for SSH reverse connections allows
+ no 5500+n ports in. For SSH reverse connections the Unix viewers
+ supplied in the SSVNC package will only listen on localhost.
+
+ Note that for SSL connections use of "Proxy/Gateway" does not
+ make sense: the remote side cannot initiate its reverse connection
+ via the Proxy.
+
+ Note that for SSH or SSH+SSL connections use of "Proxy/Gateway"
+ does not make sense (the ssh cannot do a -R on a remote host:port),
+ unless it is a double proxy where the 2nd host is the machine with
+ the VNC server.
Putty PW: On Windows only: use the supplied password for plink SSH logins.
Unlike the other options the value is not saved when 'Save
@@ -724,10 +781,11 @@ proc set_defaults {} {
global sound_daemon_local_cmd sound_daemon_local_port sound_daemon_local_kill sound_daemon_local_start
global smb_su_mode smb_mount_list
global use_port_knocking port_knocking_list
- global ycrop_string
+ global ycrop_string use_listen
global include_list
set defs(use_viewonly) 0
+ set defs(use_listen) 0
set defs(use_fullscreen) 0
set defs(use_raise_on_beep) 0
set defs(use_bgr233) 0
@@ -797,6 +855,7 @@ proc do_viewer_windows {n} {
global use_alpha use_grab use_ssh use_sshssl use_viewonly use_fullscreen use_bgr233
global use_nojpeg use_raise_on_beep use_compresslevel use_quality
global change_vncviewer change_vncviewer_path vncviewer_realvnc4
+ global use_listen
set cmd "vncviewer"
if {$change_vncviewer && $change_vncviewer_path != ""} {
@@ -854,7 +913,68 @@ proc do_viewer_windows {n} {
append cmd " /quality $use_quality"
}
}
- append cmd " localhost:$n"
+ if {$use_listen} {
+ if {$vncviewer_realvnc4} {
+ append cmd " listen=1"
+ } else {
+ append cmd " /listen"
+ }
+ set nn $n
+ if {$nn < 100} {
+ set nn [expr "$nn + 5500"]
+ }
+ append cmd " $nn"
+ global did_listening_message
+ if {$did_listening_message < 3} {
+ incr did_listening_message
+ global listening_name
+
+ set msg "
+ About to start the Listening VNC Viewer.
+
+ VNC Viewer command to be run:
+
+ $cmd
+
+ The VNC server should then Reverse connect to:
+
+ $listening_name
+
+ To stop the Viewer: right click on the VNC Icon in the taskbar
+ and select 'Close listening daemon' (or similar).
+
+ You will then return to this GUI.
+
+"
+ global use_ssh use_sshssl
+ if {$use_ssh || $use_sshssl} {
+ set msg "${msg} NOTE: You will probably also need to kill the SSH in the\n terminal via Ctrl-C"
+ }
+
+ global help_font is_windows system_button_face
+ toplev .wll
+ global wll_done
+
+ set wll_done 0
+
+ eval text .wll.t -width 60 -height 18 $help_font
+ button .wll.d -text "OK" -command {destroy .wll; set wll_done 1}
+ pack .wll.t .wll.d -side top -fill x
+
+ apply_bg .wll.t
+
+ center_win .wll
+ wm resizable .wll 1 0
+
+ wm title .wll "SSL/SSH Viewer: Listening VNC Info"
+
+ .wll.t insert end $msg
+
+ vwait wll_done
+ }
+ } else {
+ append cmd " localhost:$n"
+ }
mesg $cmd
set emess ""
@@ -1095,6 +1215,7 @@ proc launch_windows_ssh {hp file n} {
global is_win9x env
global use_sshssl use_ssh putty_pw
global port_knocking_list
+ global use_listen listening_name
set hpnew [get_ssh_hp $hp]
set proxy [get_ssh_proxy $hp]
@@ -1104,7 +1225,7 @@ proc launch_windows_ssh {hp file n} {
set vnc_disp $hpnew
regsub {^.*:} $vnc_disp "" vnc_disp
- if {![regexp {^[0-9][0-9]*$} $vnc_disp]} {
+ if {![regexp {^-?[0-9][0-9]*$} $vnc_disp]} {
if {[regexp {cmd=SHELL} $hp]} {
;
} elseif {[regexp {cmd=PUTTY} $hp]} {
@@ -1116,11 +1237,21 @@ proc launch_windows_ssh {hp file n} {
}
}
- set vnc_port 5900
- if {![regexp {^[0-9][0-9]*$} $vnc_disp]} {
+ if {$use_listen} {
+ set vnc_port 5500
+ } else {
+ set vnc_port 5900
+ }
+ if {[regexp {^-[0-9][0-9]*$} $vnc_disp]} {
+ set vnc_port [expr "- $vnc_disp"]
+ } elseif {![regexp {^[0-9][0-9]*$} $vnc_disp]} {
;
} elseif {$vnc_disp < 200} {
- set vnc_port [expr $vnc_disp + 5900]
+ if {$use_listen} {
+ set vnc_port [expr $vnc_disp + 5500]
+ } else {
+ set vnc_port [expr $vnc_disp + 5900]
+ }
} else {
set vnc_port $vnc_disp
}
@@ -1207,7 +1338,11 @@ proc launch_windows_ssh {hp file n} {
set n 0
}
- set use [expr $n + 5900]
+ if {$use_listen} {
+ set use [expr $n + 5500]
+ } else {
+ set use [expr $n + 5900]
+ }
set_smb_mounts
@@ -1279,6 +1414,9 @@ proc launch_windows_ssh {hp file n} {
} else {
set sleep 20
}
+ if {$use_listen} {
+ set sleep 1800
+ }
set setup_cmds [ugly_setup_scripts post $tag]
@@ -1347,7 +1485,13 @@ proc launch_windows_ssh {hp file n} {
set vnc_host "localhost"
}
- set plink_str "plink.exe -ssh -P $ssh_port $verb -L $use:$vnc_host:$vnc_port $extra_redirs -t"
+ set redir "-L $use:$vnc_host:$vnc_port"
+ if {$use_listen} {
+ set redir "-R $vnc_port:$vnc_host:$use"
+ set listening_name "localhost:$vnc_port (on remote SSH side)"
+ }
+
+ set plink_str "plink.exe -ssh -P $ssh_port $verb $redir $extra_redirs -t"
if {$extra_redirs != ""} {
regsub {exe} $plink_str "exe -C" plink_str
}
@@ -1417,6 +1561,10 @@ proc launch_windows_ssh {hp file n} {
while {$waited < 30000} {
after 500
update
+ if {$use_listen} {
+ set gotit 1
+ break;
+ }
set ns [get_netstat]
set re ":$p_port"
append re {[ ][ ]*[0:.][0:.]*[ ][ ]*LISTEN}
@@ -1526,6 +1674,10 @@ proc launch_windows_ssh {hp file n} {
while {$waited < 30000} {
after 500
update
+ if {$use_listen} {
+ set plink_status yes
+ break;
+ }
set ns [get_netstat]
set re ":$use"
append re {[ ][ ]*[0:.][0:.]*[ ][ ]*LISTEN}
@@ -2164,10 +2316,18 @@ proc fetch_cert_windows {hp} {
set disp [string trim $disp]
regsub { .*$} $disp "" disp
- if {$disp == "" || ! [regexp {^[0-9][0-9]*$} $disp]} {
+ if {[regexp {^-[0-9][0-9]*$} $disp]} {
+ ;
+ } elseif {$disp == "" || ! [regexp {^[0-9][0-9]*$} $disp]} {
set disp 0
}
- set port [expr "$disp + 5900"]
+ if {$disp < 0} {
+ set port [expr "- $disp"]
+ } elseif {$disp < 200} {
+ set port [expr "$disp + 5900"]
+ } else {
+ set port $disp
+ }
if {$proxy != ""} {
global env
@@ -2337,6 +2497,9 @@ proc launch_unix {hp} {
set cmd "$cmd -verify '$crtdir'"
}
}
+ if {$use_listen} {
+ set cmd "$cmd -listen"
+ }
set hpnew [get_ssh_hp $hp]
set proxy [get_ssh_proxy $hp]
set sshcmd [get_ssh_cmd $hp]
@@ -2473,6 +2636,9 @@ proc launch_unix {hp} {
if {$use_grab} {
set cmd "$cmd -grab"
}
+ if {$use_listen} {
+ set cmd "$cmd -listen"
+ }
global darwin_cotvnc
if {$darwin_cotvnc} {
@@ -2550,10 +2716,16 @@ proc launch_unix {hp} {
set passwdfile ""
if {$vncauth_passwd != ""} {
+ global use_listen
set passwdfile "$env(HOME)/.vncauth_tmp.[pid]"
catch {exec vncstorepw $vncauth_passwd $passwdfile}
catch {exec chmod 600 $passwdfile}
- catch {exec sh -c "sleep 15; rm $passwdfile" &}
+ if {$use_listen} {
+ global env
+ set env(SS_VNCVIEWER_RM) $passwdfile
+ } else {
+ catch {exec sh -c "sleep 15; rm $passwdfile" &}
+ }
if {$darwin_cotvnc} {
set cmd "$cmd --PasswordFile $passwdfile"
} else {
@@ -2826,7 +2998,7 @@ proc launch {{hp ""}} {
global mycert svcert crtdir
global pids_before pids_after pids_new
global env
- global use_ssh use_sshssl
+ global use_ssh use_sshssl use_listen
set debug 0
if {$hp == ""} {
@@ -2874,6 +3046,7 @@ proc launch {{hp ""}} {
launch_unix $hp
return
}
+ ##############################################################
check_ssh_needed
@@ -2956,6 +3129,9 @@ proc launch {{hp ""}} {
set did_port_knock 0
+ global listening_name
+ set listening_name ""
+
if {$use_sshssl} {
set rc [launch_windows_ssh $hp $file2 $n2]
if {$rc == 0} {
@@ -2987,10 +3163,23 @@ proc launch {{hp ""}} {
set disp [lindex $list 1]
set disp [string trim $disp]
regsub { .*$} $disp "" disp
- if {$disp == "" || ! [regexp {^[0-9][0-9]*$} $disp]} {
+ if {[regexp {^-[0-9][0-9]*$} $disp]} {
+ ;
+ } elseif {$disp == "" || ! [regexp {^[0-9][0-9]*$} $disp]} {
set disp 0
}
- set port [expr "$disp + 5900"]
+
+ if {$disp < 0} {
+ set port [expr "- $disp"]
+ } elseif {$disp < 200} {
+ if {$use_listen} {
+ set port [expr "$disp + 5500"]
+ } else {
+ set port [expr "$disp + 5900"]
+ }
+ } else {
+ set port $disp
+ }
if {$proxy != ""} {
if [regexp {@} $proxy] {
@@ -3013,7 +3202,11 @@ proc launch {{hp ""}} {
set fh [open $file "w"]
- puts $fh "client = yes"
+ if {$use_listen} {
+ puts $fh "client = no"
+ } else {
+ puts $fh "client = yes"
+ }
puts $fh "options = ALL"
puts $fh "taskbar = yes"
puts $fh "RNDbytes = 2048"
@@ -3027,6 +3220,12 @@ proc launch {{hp ""}} {
set fail 1
}
puts $fh "cert = $mycert"
+ } elseif {$use_listen} {
+ set dummy "dummy.pem"
+ set dh [open $dummy "w"]
+ puts $dh [dummy_cert]
+ close $dh
+ puts $fh "cert = $dummy"
}
if {$svcert != ""} {
if {! [file exists $svcert]} {
@@ -3053,14 +3252,32 @@ proc launch {{hp ""}} {
set n2 11
}
puts $fh "\[vnc$n\]"
- set port2 [expr "$n + 5900"]
- puts $fh "accept = localhost:$port2"
-
- if {$use_sshssl || $proxy != ""} {
- set port [expr "$n2 + 5900"]
- puts $fh "connect = localhost:$port"
+ set port2 ""
+ if {! $use_listen} {
+ set port2 [expr "$n + 5900"]
+ puts $fh "accept = localhost:$port2"
+
+ if {$use_sshssl || $proxy != ""} {
+ set port [expr "$n2 + 5900"]
+ puts $fh "connect = localhost:$port"
+ } else {
+ puts $fh "connect = $host:$port"
+ }
} else {
- puts $fh "connect = $host:$port"
+ set port2 [expr "$n + 5500"]
+ set hloc ""
+ if {$use_ssh} {
+ set hloc "localhost:"
+ set listening_name "localhost:$port (on remote SSH side)"
+ } else {
+ set hn [get_hostname]
+ if {$hn == ""} {
+ set hn "this-computer"
+ }
+ set listening_name "$hn:$port (or IP:$port, etc.)"
+ }
+ puts $fh "accept = $hloc$port"
+ puts $fh "connect = localhost:$port2"
}
puts $fh "delay = no"
@@ -4479,6 +4696,63 @@ proc load_profile {{parent "."}} {
set profdone 1
putty_pw_entry check
+ listen_adjust
+}
+
+proc dummy_cert {} {
+ set str {
+-----BEGIN RSA PRIVATE KEY-----
+MIIEowIBAAKCAQEAvkfXxb0wcxgrjV2ziFikjII+ze8iKcTBt47L0GM/c21efelN
++zZpJUUXLu4zz8Ryq8Q+sQgfNy7uTOpN9bUUaOk1TnD7gaDQnQWiNHmqbW2kL+DS
+OKngJVPo9dETAS8hf7+D1e1DBZxjTc1a4RQqWJixwpYj99ixWzu8VC2m/xXsjvOs
+jp4+DLBB490nbkwvstmhmiWm1CmI5O5xOkgioVNQqHvQMdVKOSz9PpbjvZiRX1Uo
+qoMrk+2NOqwP90TB35yPASXb9zXKpO7DLhkube+yYGf+yk46aD707L07Eb7cosFP
+S84vNZ9gX7rQ0UOwm5rYA/oZTBskgaqhtIzkLwIDAQABAoIBAD4ot/sXt5kRn0Ca
+CIkU9AQWlC+v28grR2EQW9JiaZrqcoDNUzUqbCTJsi4ZkIFh2lf0TsqELbZYNW6Y
+6AjJM7al4E0UqYSKJTv2WCuuRxdiRs2BMwthqyBmjeanev7bB6V0ybt7u3Y8xU/o
+MrTuYnr4vrEjXPKdLirwk7AoDbKsRXHSIiHEIBOq1+dUQ32t36ukdnnza4wKDLZc
+PKHiCdCk/wOGhuDlxD6RspqUAlRnJ8/aEhrgWxadFXw1hRhRsf/v1shtB0T3DmTe
+Jchjwyiw9mryb9JZAcKxW+fUc4EVvj6VdQGqYInQJY5Yxm5JAlVQUJicuuJEvn6A
+rj5osQECgYEA552CaHpUiFlB4HGkjaH00kL+f0+gRF4PANCPk6X3UPDVYzKnzmuu
+yDvIdEETGFWBwoztUrOOKqVvPEQ+kBa2+DWWYaERZLtg2cI5byfDJxQ3ldzilS3J
+1S3WgCojqcsG/hlxoQJ1dZFanUy/QhUZ0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FICATE-----
+}
+ return $str
}
proc save_profile {{parent "."}} {
@@ -4522,7 +4796,9 @@ proc save_profile {{parent "."}} {
if {$p == ""} {
set p 0
}
- if {$p < 200} {
+ if {$p < 0} {
+ set port $p
+ } elseif {$p < 200} {
set port [expr $p + 5900]
} else {
set port $p
@@ -7144,7 +7420,12 @@ proc set_advanced_options {} {
bind .oa <Escape> {destroy .oa}
button .oa.b.help -text "Help" -command help_advanced_opts
- button .oa.b.connect -text "Connect" -command launch
+ global use_listen
+ if {$use_listen} {
+ button .oa.b.connect -text "Listen" -command launch
+ } else {
+ button .oa.b.connect -text "Connect" -command launch
+ }
pack .oa.b.help .oa.b.connect .oa.b.done -fill x -expand 1 -side left
@@ -7307,11 +7588,23 @@ proc ssl_ssh_adjust {which} {
putty_pw_entry check
}
+proc listen_adjust {} {
+ global use_listen revs_button
+ if {$use_listen} {
+ catch {.b.conn configure -text "Listen"}
+ catch {.o.b.connect configure -text "Listen"}
+ } else {
+ catch {.b.conn configure -text "Connect"}
+ catch {.o.b.connect configure -text "Connect"}
+ }
+}
+
proc set_options {} {
global use_alpha use_grab use_ssh use_sshssl use_viewonly use_fullscreen use_bgr233
global use_nojpeg use_raise_on_beep use_compresslevel use_quality
global compresslevel_text quality_text
global env is_windows darwin_cotvnc
+ global use_listen
toplev .o
wm title .o "SSL/SSH VNC Options"
@@ -7331,6 +7624,11 @@ proc set_options {} {
set iss $i
incr i
+ checkbutton .o.b$i -anchor w -variable use_listen -text \
+ "Reverse VNC Connection (-listen)" -command {listen_adjust}
+ #if {$is_windows} {.o.b$i configure -state disabled}
+ incr i
+
checkbutton .o.b$i -anchor w -variable use_viewonly -text \
"View Only"
incr i
@@ -7439,7 +7737,12 @@ proc set_options {} {
button .o.b.done -text "Done" -command {destroy .o}
bind .o <Escape> {destroy .o}
button .o.b.help -text "Help" -command help_opts
- button .o.b.connect -text "Connect" -command launch
+ global use_listen
+ if {$use_listen} {
+ button .o.b.connect -text "Listen" -command launch
+ } else {
+ button .o.b.connect -text "Connect" -command launch
+ }
pack .o.b.help .o.b.connect .o.b.done -fill x -expand 1 -side left
@@ -7535,6 +7838,9 @@ set vncproxy ""
set remote_ssh_cmd ""
set vncauth_passwd ""
+global did_listening_message
+set did_listening_message 0
+
label .l -text "SSL/SSH VNC Viewer" -relief ridge
set wl 21
@@ -7587,7 +7893,7 @@ frame .b
button .b.help -text "Help" -command help
button .b.certs -text "Certs ..." -command getcerts
button .b.opts -text "Options ..." -command set_options
-button .b.load -text "Load" -command {load_profile}
+button .b.load -text "Load ..." -command {load_profile}
button .b.conn -text "Connect" -command launch
button .b.exit -text "Exit" -command {destroy .; exit}
diff --git a/x11vnc/misc/enhanced_tightvnc_viewer/src/patches/_bundle b/x11vnc/misc/enhanced_tightvnc_viewer/src/patches/_bundle
index 63ccafe..2555aed 100755
--- a/x11vnc/misc/enhanced_tightvnc_viewer/src/patches/_bundle
+++ b/x11vnc/misc/enhanced_tightvnc_viewer/src/patches/_bundle
@@ -1,7 +1,7 @@
#!/bin/sh
rm -rf ./src/tmp/* || exit 1
-vers=1.0.13
+vers=1.0.14
cd .. || exit 1
diff --git a/x11vnc/misc/enhanced_tightvnc_viewer/src/patches/tight-vncviewer-full.patch b/x11vnc/misc/enhanced_tightvnc_viewer/src/patches/tight-vncviewer-full.patch
index 02ba032..14948bc 100644
--- a/x11vnc/misc/enhanced_tightvnc_viewer/src/patches/tight-vncviewer-full.patch
+++ b/x11vnc/misc/enhanced_tightvnc_viewer/src/patches/tight-vncviewer-full.patch
@@ -214,7 +214,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/Vncviewer vnc_unixsrc/vncview
+
diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/vncviewer/argsresources.c
--- vnc_unixsrc.orig/vncviewer/argsresources.c 2007-02-04 17:10:31.000000000 -0500
-+++ vnc_unixsrc/vncviewer/argsresources.c 2007-02-18 20:41:40.000000000 -0500
++++ vnc_unixsrc/vncviewer/argsresources.c 2007-03-20 10:10:59.000000000 -0400
@@ -31,7 +31,7 @@
char *fallback_resources[] = {
@@ -609,7 +609,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
+ "\n"
+ "Enhanced TightVNC viewer (SSVNC) options:\n"
+ "\n"
-+ " URL http://www.karlrunge.com/x11vnc/enhanced_tightvnc_viewer.html\n"
++ " URL http://www.karlrunge.com/x11vnc/ssvnc.html\n"
+ "\n"
+ " Note: ZRLE encoding is now supported.\n"
+ "\n"
@@ -748,8 +748,8 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
appData.passwordDialog = True;
diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/colour.c vnc_unixsrc/vncviewer/colour.c
--- vnc_unixsrc.orig/vncviewer/colour.c 2002-04-30 09:07:31.000000000 -0400
-+++ vnc_unixsrc/vncviewer/colour.c 2007-02-17 23:57:21.000000000 -0500
-@@ -31,6 +31,9 @@
++++ vnc_unixsrc/vncviewer/colour.c 2007-03-22 21:36:12.000000000 -0400
+@@ -31,9 +31,12 @@
#define BGR233_SIZE 256
unsigned long BGR233ToPixel[BGR233_SIZE];
@@ -758,7 +758,11 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/colour.c vnc_unixsrc/vncviewe
+
Colormap cmap;
Visual *vis;
- unsigned int visdepth, visbpp;
+-unsigned int visdepth, visbpp;
++unsigned int visdepth, visbpp, isLSB;
+ Bool allocColorFailed = False;
+
+ static int nBGR233ColoursAllocated;
@@ -45,6 +48,8 @@
static void AllocateExactBGR233Colours();
static Bool AllocateBGR233Colour(int r, int g, int b);
@@ -768,10 +772,24 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/colour.c vnc_unixsrc/vncviewe
/*
* SetVisualAndCmap() deals with the wonderful world of X "visuals" (which are
-@@ -97,6 +102,30 @@
+@@ -97,6 +102,44 @@
visbpp = GetBPPForDepth(visdepth);
cmap = DefaultColormap(dpy,DefaultScreen(dpy));
++ if (ImageByteOrder(dpy) == LSBFirst) {
++ isLSB = 1;
++ } else {
++ isLSB = 0;
++ }
++ if (visbpp == 24) {
++ if (!appData.useBGR233) {
++ fprintf(stderr, "Warning: for 24bpp enabling -bgr565 -- Don't use FullColor!\n");
++ appData.useBGR565 = True;
++ } else {
++ fprintf(stderr, "Warning: for 24bpp using -bgr233 -- Don't use FullColor!\n");
++ }
++ }
++
+ if (appData.useBGR565) {
+ if (visdepth < 24 || visbpp < 24 || vis->class != TrueColor) {
+ fprintf(stderr, "disabling -16bpp BGR565 on non-depth 24 machine\n");
@@ -799,7 +817,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/colour.c vnc_unixsrc/vncviewe
if (!appData.useBGR233 && (vis->class == TrueColor)) {
myFormat.bitsPerPixel = visbpp;
-@@ -116,21 +145,42 @@
+@@ -116,21 +159,42 @@
return;
}
@@ -848,7 +866,22 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/colour.c vnc_unixsrc/vncviewe
PrintPixelFormat(&myFormat);
SetupBGR233Map();
-@@ -394,16 +444,43 @@
+@@ -282,8 +346,12 @@
+ XFree(format);
+
+ if (bpp != 1 && bpp != 8 && bpp != 16 && bpp != 32) {
+- fprintf(stderr,"Can't cope with %d bits-per-pixel. Sorry.\n", bpp);
+- exit(1);
++ if (bpp == 24) {
++ fprintf(stderr,"Warning: 24 bits-per-pixel may have problems...\n");
++ } else {
++ fprintf(stderr,"Can't cope with %d bits-per-pixel. Sorry.\n", bpp);
++ exit(1);
++ }
+ }
+
+ return bpp;
+@@ -394,16 +462,43 @@
for (r = 0; r < 8; r++) {
for (g = 0; g < 8; g++) {
for (b = 0; b < 4; b++) {
@@ -897,7 +930,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/colour.c vnc_unixsrc/vncviewe
if (distance < minDistance) {
minDistance = distance;
-@@ -412,7 +489,7 @@
+@@ -412,7 +507,7 @@
}
}
@@ -906,7 +939,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/colour.c vnc_unixsrc/vncviewe
if (shared[nearestPixel] && !usedAsNearest[nearestPixel])
nSharedUsed++;
usedAsNearest[nearestPixel] = True;
-@@ -433,6 +510,53 @@
+@@ -433,6 +528,53 @@
}
}
@@ -960,7 +993,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/colour.c vnc_unixsrc/vncviewe
/*
* AllocateExactBGR233Colours() attempts to allocate each of the colours in the
-@@ -484,8 +608,13 @@
+@@ -484,8 +626,13 @@
ri = rn;
for (gi = 0; gi < gn; gi++) {
for (bi = 0; bi < bn; bi++) {
@@ -976,7 +1009,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/colour.c vnc_unixsrc/vncviewe
}
}
rn++;
-@@ -496,8 +625,13 @@
+@@ -496,8 +643,13 @@
gi = gn;
for (ri = 0; ri < rn; ri++) {
for (bi = 0; bi < bn; bi++) {
@@ -992,7 +1025,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/colour.c vnc_unixsrc/vncviewe
}
}
gn++;
-@@ -507,8 +641,13 @@
+@@ -507,8 +659,13 @@
bi = bn;
for (ri = 0; ri < rn; ri++) {
for (gi = 0; gi < gn; gi++) {
@@ -1008,7 +1041,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/colour.c vnc_unixsrc/vncviewe
}
}
bn++;
-@@ -529,18 +668,36 @@
+@@ -529,18 +686,36 @@
AllocateBGR233Colour(int r, int g, int b)
{
XColor c;
@@ -1116,16 +1149,22 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/corre.c vnc_unixsrc/vncviewer
+#undef FillRectangle
diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/cp_it vnc_unixsrc/vncviewer/cp_it
--- vnc_unixsrc.orig/vncviewer/cp_it 1969-12-31 19:00:00.000000000 -0500
-+++ vnc_unixsrc/vncviewer/cp_it 2007-03-01 22:46:20.000000000 -0500
-@@ -0,0 +1,8 @@
++++ vnc_unixsrc/vncviewer/cp_it 2007-03-24 10:05:16.000000000 -0400
+@@ -0,0 +1,14 @@
+#!/bin/sh
+
+dest=/dist/bin/vncviewerz-1.3dev5-resize
+suc "cp -p $dest $dest.back; mv $dest $dest.unlink; mv $dest.back $dest; rm $dest.unlink"
++strip ./vncviewer
+cat ./vncviewer > $dest
+touch -r ./vncviewer $dest
-+cp -p ./vncviewer /dist/src/apps/VNC/etc/libvncserver_cvs/expts/etv/ssvnc/bin/Linux.i686/vncviewer
-+ls -l ./vncviewer $dest /dist/src/apps/VNC/etc/libvncserver_cvs/expts/etv/ssvnc/bin/Linux.i686/vncviewer
++yy=/dist/src/apps/VNC/etc/libvncserver_cvs/expts/etv/ssvnc/bin/Linux.i686/vncviewer
++mv $yy $yy.unlink
++cp -p ./vncviewer $yy
++cp -p ./vncviewer $HOME/etv_col/Linux.i686
++chmod 755 $yy
++rm -f $yy.unlink
++ls -l ./vncviewer $dest $yy $HOME/etv_col/Linux.i686/vncviewer
diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/cursor.c vnc_unixsrc/vncviewer/cursor.c
--- vnc_unixsrc.orig/vncviewer/cursor.c 2003-01-15 04:46:52.000000000 -0500
+++ vnc_unixsrc/vncviewer/cursor.c 2007-03-17 22:48:34.000000000 -0400
@@ -1472,7 +1511,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/cursor.c vnc_unixsrc/vncviewe
-
diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncviewer/desktop.c
--- vnc_unixsrc.orig/vncviewer/desktop.c 2004-05-28 13:29:29.000000000 -0400
-+++ vnc_unixsrc/vncviewer/desktop.c 2007-03-17 23:31:56.000000000 -0400
++++ vnc_unixsrc/vncviewer/desktop.c 2007-03-24 10:18:42.000000000 -0400
@@ -28,21 +28,28 @@
#include <X11/extensions/XShm.h>
#endif
@@ -1591,28 +1630,31 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview
/*
* DesktopInitBeforeRealization creates the "desktop" widget and the viewport
-@@ -59,53 +146,158 @@
+@@ -59,52 +146,157 @@
void
DesktopInitBeforeRealization()
{
- int i;
-+ int i;
-
+-
- form = XtVaCreateManagedWidget("form", formWidgetClass, toplevel,
- XtNborderWidth, 0,
- XtNdefaultDistance, 0, NULL);
-+ form = XtVaCreateManagedWidget("form", formWidgetClass, toplevel,
-+ XtNborderWidth, 0, XtNdefaultDistance, 0, NULL);
++ int i;
- viewport = XtVaCreateManagedWidget("viewport", viewportWidgetClass, form,
- XtNborderWidth, 0,
- NULL);
-+ viewport = XtVaCreateManagedWidget("viewport", viewportWidgetClass, form,
-+ XtNborderWidth, 0, NULL);
++ form = XtVaCreateManagedWidget("form", formWidgetClass, toplevel,
++ XtNborderWidth, 0, XtNdefaultDistance, 0, NULL);
- desktop = XtVaCreateManagedWidget("desktop", coreWidgetClass, viewport,
- XtNborderWidth, 0,
- NULL);
++ viewport = XtVaCreateManagedWidget("viewport", viewportWidgetClass, form,
++ XtNborderWidth, 0, NULL);
+
+- XtVaSetValues(desktop, XtNwidth, si.framebufferWidth,
+- XtNheight, si.framebufferHeight, NULL);
+ desktop = XtVaCreateManagedWidget("desktop", coreWidgetClass, viewport,
+ XtNborderWidth, 0, NULL);
+
@@ -1642,24 +1684,19 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview
+ old_width = si.framebufferWidth;
+ old_height = si.framebufferHeight;
-- XtVaSetValues(desktop, XtNwidth, si.framebufferWidth,
-- XtNheight, si.framebufferHeight, NULL);
+- XtAddEventHandler(desktop, LeaveWindowMask|ExposureMask,
+- True, HandleBasicDesktopEvent, NULL);
+ for (i = 0; i < 256; i++) {
+ modifierPressed[i] = False;
+ }
-- XtAddEventHandler(desktop, LeaveWindowMask|ExposureMask,
-- True, HandleBasicDesktopEvent, NULL);
-+ create_image();
-+}
-
- for (i = 0; i < 256; i++)
- modifierPressed[i] = False;
-+static Widget scrollbar_y = NULL;
++ create_image();
++}
- image = NULL;
-+static int xsst = 2;
-+#include <X11/Xaw/Scrollbar.h>
++static Widget scrollbar_y = NULL;
-#ifdef MITSHM
- if (appData.useShm) {
@@ -1668,7 +1705,9 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview
- appData.useShm = False;
- }
-#endif
--
++static int xsst = 2;
++#include <X11/Xaw/Scrollbar.h>
+
- if (!image) {
- image = XCreateImage(dpy, vis, visdepth, ZPixmap, 0, NULL,
- si.framebufferWidth, si.framebufferHeight,
@@ -1694,7 +1733,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview
+ float t = 0.0;
+ XtVaSetValues(w, XtNtopOfThumb, &t, NULL);
+ }
-+}
+ }
+static XtCallbackProc Jumped(Widget w, XtPointer closure, XtPointer call_data) {
+ float top = *((float *) call_data);
+ Position x, y;
@@ -1712,9 +1751,9 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview
+ XtVaSetValues(w, XtNtopOfThumb, *(XtArgVal*)&t, XtNshown, *(XtArgVal*)&s, NULL);
+ }
+ }
- }
-
-
++}
++
++
+extern double dnow(void);
+
+void check_things() {
@@ -1779,14 +1818,13 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview
+
+ dpyWidth = WidthOfScreen(DefaultScreenOfDisplay(dpy));
+ dpyHeight = HeightOfScreen(DefaultScreenOfDisplay(dpy));
-+
+
+ last = dnow();
+}
-+
+
/*
* DesktopInitAfterRealization does things which require the X windows to
- * exist. It creates some GCs and sets the dot cursor.
-@@ -114,34 +306,108 @@
+@@ -114,34 +306,110 @@
void
DesktopInitAfterRealization()
{
@@ -1850,7 +1888,8 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview
+ attr.background_pixel = BlackPixel(dpy, DefaultScreen(dpy));
+ valuemask |= CWBackPixel;
+ }
-+
+
+- XChangeWindowAttributes(dpy, desktopWin, valuemask, &attr);
+ if (!appData.useX11Cursor) {
+ dotCursor = CreateDotCursor();
+ attr.cursor = dotCursor;
@@ -1860,7 +1899,9 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview
+
+ XChangeWindowAttributes(dpy, desktopWin, valuemask, &attr);
+ if (XGetWindowAttributes(dpy, desktopWin, &gattr)) {
++#if 0
+ fprintf(stderr, "desktopWin backingstore: %d save_under: %d\n", gattr.backing_store, gattr.save_under);
++#endif
+ }
+ fprintf(stderr, "\n");
+}
@@ -1873,8 +1914,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview
+{
+ XSetWindowAttributes attr;
+ unsigned long valuemask;
-
-- XChangeWindowAttributes(dpy, desktopWin, valuemask, &attr);
++
+ if (dotCursor == None) {
+ dotCursor = CreateDotCursor();
+ }
@@ -1922,7 +1962,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview
}
-@@ -152,39 +418,53 @@
+@@ -152,39 +420,53 @@
static void
HandleBasicDesktopEvent(Widget w, XtPointer ptr, XEvent *ev, Boolean *cont)
{
@@ -1997,7 +2037,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview
}
-@@ -201,6 +481,9 @@
+@@ -201,6 +483,9 @@
* button2 down, 3 for both, etc).
*/
@@ -2007,7 +2047,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview
void
SendRFBEvent(Widget w, XEvent *ev, String *params, Cardinal *num_params)
{
-@@ -213,6 +496,13 @@
+@@ -213,6 +498,13 @@
return;
}
@@ -2021,7 +2061,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview
if (appData.viewOnly) return;
if (*num_params != 0) {
-@@ -332,23 +622,112 @@
+@@ -332,23 +624,123 @@
static Cursor
CreateDotCursor()
{
@@ -2088,6 +2128,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview
+ unsigned short *usp;
+ unsigned int *uip;
+ char *scr;
++ int b0, b1, b2;
+
+//fprintf(stderr, "FillImage bpp=%d %04dx%04d+%04d+%04d -- 0x%x\n", bpp, width, height, x, y, fill);
+
@@ -2102,11 +2143,22 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview
+ usp = (unsigned short*) buf;
+ uip = (unsigned int*) buf;
+
++ if (isLSB) {
++ b0 = 0; b1 = 1; b2 = 2;
++ } else {
++ b0 = 2; b1 = 1; b2 = 0;
++ }
+
+- return cursor;
+ for (h = 0; h < width; h++) {
+ if (bpp == 8) {
+ *(ucp+h) = (unsigned char) fill;
+ } else if (bpp == 16) {
+ *(usp+h) = (unsigned short) fill;
++ } else if (bpp == 24) {
++ *(ucp + 3*h + b0) = (unsigned char) ((fill & 0x0000ff) >> 0);
++ *(ucp + 3*h + b1) = (unsigned char) ((fill & 0x00ff00) >> 8);
++ *(ucp + 3*h + b2) = (unsigned char) ((fill & 0xff0000) >> 16);
+ } else if (bpp == 32) {
+ *(uip+h) = (unsigned int) fill;
+ }
@@ -2121,8 +2173,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview
+ put_image(x, y, x, y, width, height);
+ maybe_sync(width, height);
+}
-
-- return cursor;
++
+void copy_rect(int x, int y, int width, int height, int src_x, int src_y) {
+ char *src, *dst;
+ int i;
@@ -2150,7 +2201,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview
}
-@@ -359,38 +738,35 @@
+@@ -359,38 +751,35 @@
void
CopyDataToScreen(char *buf, int x, int y, int width, int height)
{
@@ -2216,7 +2267,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview
}
-@@ -401,62 +777,175 @@
+@@ -401,62 +790,226 @@
static void
CopyBGR233ToScreen(CARD8 *buf, int x, int y, int width, int height)
{
@@ -2235,9 +2286,10 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview
+ int fbwb = si.framebufferWidth / 8;
+ CARD8 *scr1 = ((CARD8 *)image->data) + y * fbwb + x / 8;
+ CARD8 *scrt;
-+ CARD8 *scr8 = ((CARD8 *)image->data) + y * si.framebufferWidth + x;
++ CARD8 *scr8 = ( (CARD8 *)image->data) + y * si.framebufferWidth + x;
+ CARD16 *scr16 = ((CARD16 *)image->data) + y * si.framebufferWidth + x;
+ CARD32 *scr32 = ((CARD32 *)image->data) + y * si.framebufferWidth + x;
++ int b0, b1, b2;
- switch (visbpp) {
+ switch (visbpp) {
@@ -2290,6 +2342,25 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview
+ }
+ break;
+
++ case 24:
++ if (isLSB) {
++ b0 = 0; b1 = 1; b2 = 2;
++ } else {
++ b0 = 2; b1 = 1; b2 = 0;
++ }
++ scr8 = ((CARD8 *)image->data) + (y * si.framebufferWidth + x) * 3;
++ for (q = 0; q < height; q++) {
++ for (p = 0; p < width; p++) {
++ CARD32 v = BGR233ToPixel[*(buf++)];
++ *(scr8 + b0) = (unsigned char) ((v & 0x0000ff) >> 0);
++ *(scr8 + b1) = (unsigned char) ((v & 0x00ff00) >> 8);
++ *(scr8 + b2) = (unsigned char) ((v & 0xff0000) >> 16);
++ scr8 += 3;
++ }
++ scr8 += (si.framebufferWidth - width) * 3;
++ }
++ break;
++
+ case 32:
+ for (q = 0; q < height; q++) {
+ for (p = 0; p < width; p++) {
@@ -2314,10 +2385,17 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview
- }
- break;
+static void
-+CopyBGR565ToScreen(CARD16 *buf, int x, int y, int width, int height)
++BGR565_24bpp(CARD16 *buf, int x, int y, int width, int height)
+{
+ int p, q;
-+ CARD32 *scr32 = ((CARD32 *)image->data) + y * si.framebufferWidth + x;
++ int b0, b1, b2;
++ unsigned char *scr= (unsigned char *)image->data + (y * si.framebufferWidth + x) * 3;
++
++ if (isLSB) {
++ b0 = 0; b1 = 1; b2 = 2;
++ } else {
++ b0 = 2; b1 = 1; b2 = 0;
++ }
- case 16:
- for (q = 0; q < height; q++) {
@@ -2327,12 +2405,16 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview
- scr16 += si.framebufferWidth - width;
- }
- break;
-+ /* case 32: */
++ /* case 24: */
+ for (q = 0; q < height; q++) {
+ for (p = 0; p < width; p++) {
-+ *(scr32++) = BGR565ToPixel[*(buf++)];
++ CARD32 v = BGR565ToPixel[*(buf++)];
++ *(scr + b0) = (unsigned char) ((v & 0x0000ff) >> 0);
++ *(scr + b1) = (unsigned char) ((v & 0x00ff00) >> 8);
++ *(scr + b2) = (unsigned char) ((v & 0xff0000) >> 16);
++ scr += 3;
+ }
-+ scr32 += si.framebufferWidth - width;
++ scr += (si.framebufferWidth - width) * 3;
+ }
+}
@@ -2345,6 +2427,26 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview
- }
- break;
- }
++static void
++CopyBGR565ToScreen(CARD16 *buf, int x, int y, int width, int height)
++{
++ int p, q;
++ CARD32 *scr32 = ((CARD32 *)image->data) + y * si.framebufferWidth + x;
++
++ if (visbpp == 24) {
++ BGR565_24bpp(buf, x, y, width, height);
++ return;
++ }
++
++ /* case 32: */
++ for (q = 0; q < height; q++) {
++ for (p = 0; p < width; p++) {
++ *(scr32++) = BGR565ToPixel[*(buf++)];
++ }
++ scr32 += si.framebufferWidth - width;
++ }
++}
++
+static void reset_image(void) {
+ if (UsingShm()) {
+ ShmCleanup();
@@ -2746,6 +2848,62 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/hextile.c vnc_unixsrc/vncview
}
+
+#undef FillRectangle
+diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/listen.c vnc_unixsrc/vncviewer/listen.c
+--- vnc_unixsrc.orig/vncviewer/listen.c 2001-01-16 03:07:57.000000000 -0500
++++ vnc_unixsrc/vncviewer/listen.c 2007-03-23 22:30:46.000000000 -0400
+@@ -111,13 +111,14 @@
+ getFlashFont(d);
+
+ listenSocket = ListenAtTcpPort(listenPort);
+- flashSocket = ListenAtTcpPort(flashPort);
++//flashSocket = ListenAtTcpPort(flashPort);
++ flashSocket = 1234;
+
+ if ((listenSocket < 0) || (flashSocket < 0)) exit(1);
+
+- fprintf(stderr,"%s -listen: Listening on port %d (flash port %d)\n",
+- programName,listenPort,flashPort);
+- fprintf(stderr,"%s -listen: Command line errors are not reported until "
++ fprintf(stderr,"%s -listen: Listening on port %d\n",
++ programName,listenPort);
++ fprintf(stderr,"%s -listen: Cmdline errors are not reported until "
+ "a connection comes in.\n", programName);
+
+ while (True) {
+@@ -132,12 +133,13 @@
+
+ FD_ZERO(&fds);
+
+- FD_SET(flashSocket, &fds);
++// FD_SET(flashSocket, &fds);
+ FD_SET(listenSocket, &fds);
+ FD_SET(ConnectionNumber(d), &fds);
+
+ select(FD_SETSIZE, &fds, NULL, NULL, NULL);
+
++#if 0
+ if (FD_ISSET(flashSocket, &fds)) {
+
+ sock = AcceptTcpConnection(flashSocket);
+@@ -151,6 +153,7 @@
+ }
+ close(sock);
+ }
++#endif
+
+ if (FD_ISSET(listenSocket, &fds)) {
+ rfbsock = AcceptTcpConnection(listenSocket);
+@@ -182,6 +185,10 @@
+ exit(1);
+ }
+ getFlashFont(d);
++ fprintf(stderr,"\n\n%s -listen: Listening on port %d\n",
++ programName,listenPort);
++ fprintf(stderr,"%s -listen: Cmdline errors are not reported until "
++ "a connection comes in.\n\n", programName);
+ break;
+ }
+ }
diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/popup.c vnc_unixsrc/vncviewer/popup.c
--- vnc_unixsrc.orig/vncviewer/popup.c 2000-06-11 08:00:53.000000000 -0400
+++ vnc_unixsrc/vncviewer/popup.c 2007-02-04 11:14:45.000000000 -0500
@@ -2810,7 +2968,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/popup_ad vnc_unixsrc/vncviewe
+}
diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncviewer/rfbproto.c
--- vnc_unixsrc.orig/vncviewer/rfbproto.c 2004-03-11 13:14:39.000000000 -0500
-+++ vnc_unixsrc/vncviewer/rfbproto.c 2007-03-01 21:08:08.000000000 -0500
++++ vnc_unixsrc/vncviewer/rfbproto.c 2007-03-23 22:17:11.000000000 -0400
@@ -57,6 +57,25 @@
static Bool HandleTight16(int rx, int ry, int rw, int rh);
static Bool HandleTight32(int rx, int ry, int rw, int rh);
@@ -4923,6 +5081,18 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
#undef BPP
/*
+@@ -1358,9 +1831,9 @@
+ " %s significant bit in each byte is leftmost on the screen.\n",
+ (format->bigEndian ? "Most" : "Least"));
+ } else {
+- fprintf(stderr," %d bits per pixel.\n",format->bitsPerPixel);
++ fprintf(stderr," %d bits per pixel. ",format->bitsPerPixel);
+ if (format->bitsPerPixel != 8) {
+- fprintf(stderr," %s significant byte first in each pixel.\n",
++ fprintf(stderr,"%s significant byte first in each pixel.\n",
+ (format->bigEndian ? "Most" : "Least"));
+ }
+ if (format->trueColour) {
@@ -1463,3 +1936,115 @@
cinfo->src = &jpegSrcManager;
}
@@ -5107,7 +5277,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rre.c vnc_unixsrc/vncviewer/r
+#undef FillRectangle
diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/shm.c vnc_unixsrc/vncviewer/shm.c
--- vnc_unixsrc.orig/vncviewer/shm.c 2000-06-11 08:00:53.000000000 -0400
-+++ vnc_unixsrc/vncviewer/shm.c 2007-02-08 23:36:56.000000000 -0500
++++ vnc_unixsrc/vncviewer/shm.c 2007-03-23 22:20:35.000000000 -0400
@@ -33,68 +33,80 @@
void
ShmCleanup()
@@ -5236,7 +5406,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/shm.c vnc_unixsrc/vncviewer/s
+ needShmCleanup = True;
- fprintf(stderr,"Using shared memory PutImage\n");
-+ fprintf(stderr,"Using shared memory PutImage ycrop=%d\n", do_ycrop);
++ fprintf(stderr,"Using shared memory (PutImage ycrop=%d)\n", do_ycrop);
- return image;
+ return image;
@@ -5258,7 +5428,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/smake vnc_unixsrc/vncviewer/s
+fi
diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/sockets.c vnc_unixsrc/vncviewer/sockets.c
--- vnc_unixsrc.orig/vncviewer/sockets.c 2001-01-14 22:54:18.000000000 -0500
-+++ vnc_unixsrc/vncviewer/sockets.c 2007-02-18 20:31:30.000000000 -0500
++++ vnc_unixsrc/vncviewer/sockets.c 2007-03-23 21:23:15.000000000 -0400
@@ -63,15 +63,59 @@
XtRemoveInput(*id);
}
@@ -5325,6 +5495,17 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/sockets.c vnc_unixsrc/vncview
}
Bool
+@@ -283,6 +327,10 @@
+ addr.sin_port = htons(port);
+ addr.sin_addr.s_addr = INADDR_ANY;
+
++ if (getenv("VNCVIEWER_LISTEN_LOCALHOST")) {
++ addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
++ }
++
+ sock = socket(AF_INET, SOCK_STREAM, 0);
+ if (sock < 0) {
+ fprintf(stderr,programName);
diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/tight.c vnc_unixsrc/vncviewer/tight.c
--- vnc_unixsrc.orig/vncviewer/tight.c 2002-04-30 09:07:31.000000000 -0400
+++ vnc_unixsrc/vncviewer/tight.c 2007-02-17 22:08:20.000000000 -0500
@@ -5356,7 +5537,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/tight.c vnc_unixsrc/vncviewer
diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer._man vnc_unixsrc/vncviewer/vncviewer._man
--- vnc_unixsrc.orig/vncviewer/vncviewer._man 1969-12-31 19:00:00.000000000 -0500
-+++ vnc_unixsrc/vncviewer/vncviewer._man 2007-02-18 18:25:14.000000000 -0500
++++ vnc_unixsrc/vncviewer/vncviewer._man 2007-03-20 10:11:33.000000000 -0400
@@ -0,0 +1,497 @@
+'\" t
+.\" ** The above line should force tbl to be a preprocessor **
@@ -5533,7 +5714,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer._man vnc_unixsrc/vn
+.TP
+Enhanced TightVNC Viewer web page is located at:
+.TP
-+http://www.karlrunge.com/x11vnc/enhanced_tightvnc_viewer.html
++http://www.karlrunge.com/x11vnc/ssvnc.html
+.TP
+Note: ZRLE encoding is now supported.
+.TP
@@ -6673,7 +6854,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi
+
diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncviewer/vncviewer.h
--- vnc_unixsrc.orig/vncviewer/vncviewer.h 2004-03-11 13:14:40.000000000 -0500
-+++ vnc_unixsrc/vncviewer/vncviewer.h 2007-02-18 14:18:58.000000000 -0500
++++ vnc_unixsrc/vncviewer/vncviewer.h 2007-03-22 20:54:06.000000000 -0400
@@ -68,51 +68,69 @@
/* argsresources.c */
@@ -6785,7 +6966,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi
extern char *fallback_resources[];
extern char vncServerHost[];
-@@ -130,6 +148,7 @@
+@@ -130,10 +148,11 @@
/* colour.c */
extern unsigned long BGR233ToPixel[];
@@ -6793,6 +6974,11 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi
extern Colormap cmap;
extern Visual *vis;
+-extern unsigned int visdepth, visbpp;
++extern unsigned int visdepth, visbpp, isLSB;
+
+ extern void SetVisualAndCmap();
+
@@ -160,8 +179,14 @@
extern void SendRFBEvent(Widget w, XEvent *event, String *params,
Cardinal *num_params);
@@ -6880,7 +7066,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi
+extern void SetTextChatState(Widget w, XEvent *ev, String *params, Cardinal *num_params);
diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.man vnc_unixsrc/vncviewer/vncviewer.man
--- vnc_unixsrc.orig/vncviewer/vncviewer.man 2004-03-11 13:14:40.000000000 -0500
-+++ vnc_unixsrc/vncviewer/vncviewer.man 2007-02-18 18:25:14.000000000 -0500
++++ vnc_unixsrc/vncviewer/vncviewer.man 2007-03-20 10:11:33.000000000 -0400
@@ -168,6 +168,121 @@
\fB\-autopass\fR
Read a plain-text password from stdin. This option affects only the
@@ -6890,7 +7076,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.man vnc_unixsrc/vnc
+.TP
+Enhanced TightVNC Viewer web page is located at:
+.TP
-+http://www.karlrunge.com/x11vnc/enhanced_tightvnc_viewer.html
++http://www.karlrunge.com/x11vnc/ssvnc.html
+.TP
+Note: ZRLE encoding is now supported.
+.TP