Commit b2306270 authored by runge's avatar runge

Many improvement to the frontend and unix viewer. UltraVNC proxy support,

and other proxy improvements.
parent abbdf92a
...@@ -196,6 +196,7 @@ Unix and Mac OS X: ...@@ -196,6 +196,7 @@ Unix and Mac OS X:
have the XDarwin X server installed, you can set DISPLAY before starting have the XDarwin X server installed, you can set DISPLAY before starting
ssvnc (or type DISPLAY=... in Host:Disp and hit Return). Then our ssvnc (or type DISPLAY=... in Host:Disp and hit Return). Then our
enhanced TightVNC viewer will be used instead of COTVNC. enhanced TightVNC viewer will be used instead of COTVNC.
Update: there is now a 'Use X11 vncviewer on MacOSX' under Options ...
If you want a SSH-only tool (without the distractions of SSL) run If you want a SSH-only tool (without the distractions of SSL) run
......
#!/usr/bin/wish #!/usr/bin/wish
proc check_callback {} { proc check_callback {} {
global debug global debug
if {$debug} { if {$debug} {
...@@ -20,6 +21,11 @@ proc getout {} { ...@@ -20,6 +21,11 @@ proc getout {} {
after $delay after $delay
catch {close $server_fh} catch {close $server_fh}
after $delay after $delay
global bmesg_cnt
if [info exists bmesg_cnt] {
catch {tkwait window .bmesg$bmesg_cnt}
}
destroy . destroy .
exit exit
} }
...@@ -48,7 +54,8 @@ proc check_closed {} { ...@@ -48,7 +54,8 @@ proc check_closed {} {
proc xfer_in_to_out {} { proc xfer_in_to_out {} {
global client_fh server_fh debug global client_fh server_fh debug
if {$client_fh != "" && ![eof $client_fh]} { if {$client_fh != "" && ![eof $client_fh]} {
set str [read $client_fh 4096] set str ""
catch {set str [read $client_fh 4096]}
if {$debug} { if {$debug} {
puts stderr "xfer_in_to_out: $str" puts stderr "xfer_in_to_out: $str"
} }
...@@ -63,7 +70,8 @@ proc xfer_in_to_out {} { ...@@ -63,7 +70,8 @@ proc xfer_in_to_out {} {
proc xfer_out_to_in {} { proc xfer_out_to_in {} {
global client_fh server_fh debug global client_fh server_fh debug
if {$server_fh != "" && ![eof $server_fh]} { if {$server_fh != "" && ![eof $server_fh]} {
set str [read $server_fh 4096] set str ""
catch {set str [read $server_fh 4096]}
if {$debug} { if {$debug} {
puts stderr "xfer_out_to_in: $str" puts stderr "xfer_out_to_in: $str"
} }
...@@ -75,6 +83,22 @@ proc xfer_out_to_in {} { ...@@ -75,6 +83,22 @@ proc xfer_out_to_in {} {
check_closed check_closed
} }
proc bmesg {msg} {
return
global bmesg_cnt
if {! [info exists bmesg_cnt]} {
set bmesg_cnt 0
}
incr bmesg_cnt
set w .bmesg$bmesg_cnt
catch {destroy $w}
toplevel $w
label $w.l -width 70 -text "$msg"
pack $w.l
update
}
proc do_connect_http {sock hostport which} { proc do_connect_http {sock hostport which} {
global debug cur_proxy global debug cur_proxy
set con "" set con ""
...@@ -83,6 +107,7 @@ proc do_connect_http {sock hostport which} { ...@@ -83,6 +107,7 @@ proc do_connect_http {sock hostport which} {
append con "Connection: close\r\n\r\n" append con "Connection: close\r\n\r\n"
puts stderr "pxy=$which CONNECT $hostport HTTP/1.1 via $cur_proxy" puts stderr "pxy=$which CONNECT $hostport HTTP/1.1 via $cur_proxy"
bmesg "H: $which CONNECT $hostport HTTP/1.1 $cur_proxy";
puts -nonewline $sock $con puts -nonewline $sock $con
flush $sock flush $sock
...@@ -323,6 +348,38 @@ proc do_connect_socks5 {sock hostport which} { ...@@ -323,6 +348,38 @@ proc do_connect_socks5 {sock hostport which} {
} }
} }
proc do_connect_repeater {sock hostport which repeater} {
global debug cur_proxy
# 250 is UltraVNC buffer size.
set con [binary format a250 $repeater]
puts stderr "pxy=$which REPEATER $repeater via $cur_proxy"
bmesg "R: $which CONNECT $hostport | $repeater $cur_proxy";
puts -nonewline $sock $con
flush $sock
set r ""
set cnt 0
while {1} {
incr cnt
set c [read $sock 1]
if {$c == ""} {
check_closed
after 20
}
append r $c
if {[string length $r] >= 12} {
puts stderr "do_connect_repeater: $r"
break
}
if {$cnt > 30000} {
break
}
}
}
proc do_connect {sock type hostport which} { proc do_connect {sock type hostport which} {
if {$type == "http"} { if {$type == "http"} {
do_connect_http $sock $hostport $which do_connect_http $sock $hostport $which
...@@ -330,6 +387,9 @@ proc do_connect {sock type hostport which} { ...@@ -330,6 +387,9 @@ proc do_connect {sock type hostport which} {
do_connect_socks4 $sock $hostport $which do_connect_socks4 $sock $hostport $which
} elseif {$type == "socks5"} { } elseif {$type == "socks5"} {
do_connect_socks5 $sock $hostport $which do_connect_socks5 $sock $hostport $which
} elseif [regexp -nocase {^repeater:} $type] {
regsub -nocase {^repeater:} $type "" repeater
do_connect_repeater $sock $hostport $which $repeater
} }
} }
...@@ -376,11 +436,11 @@ proc handle_connection {fh host port} { ...@@ -376,11 +436,11 @@ proc handle_connection {fh host port} {
set cur_proxy $proxy1 set cur_proxy $proxy1
if {$proxy2 != ""} { if {$proxy2 != ""} {
do_connect $sock $proxy1_type $proxy2 1 do_connect $sock $proxy1_type "$proxy2_host:$proxy2_port" 1
set cur_proxy $proxy2 set cur_proxy $proxy2
if {$proxy3 != ""} { if {$proxy3 != ""} {
do_connect $sock $proxy2_type $proxy3 2 do_connect $sock $proxy2_type "$proxy3_host:$proxy3_port" 2
set cur_proxy $proxy3 set cur_proxy $proxy3
do_connect $sock $proxy3_type $dest 3 do_connect $sock $proxy3_type $dest 3
...@@ -406,11 +466,22 @@ proc proxy_type {proxy} { ...@@ -406,11 +466,22 @@ proc proxy_type {proxy} {
return "http" return "http"
} elseif [regexp -nocase {^https://} $proxy] { } elseif [regexp -nocase {^https://} $proxy] {
return "http" return "http"
} elseif [regexp -nocase {^repeater://.*\+(.*)$} $proxy mat idstr] {
return "repeater:$idstr"
} else { } else {
return "http" return "http"
} }
} }
proc proxy_hostport {proxy} {
regsub -nocase {^[a-z][a-z]*://} $proxy "" hp
regsub {\+.*$} $hp "" hp
if {! [regexp {:[0-9]} $hp] && [regexp {^repeater:} $proxy]} {
set hp "$hp:5900"
}
return $hp
}
global env global env
set proxy1 "" set proxy1 ""
...@@ -437,7 +508,7 @@ if {$debug} { ...@@ -437,7 +508,7 @@ if {$debug} {
if {! [info exists env(SSVNC_PROXY)]} { if {! [info exists env(SSVNC_PROXY)]} {
destroy .; exit; destroy .; exit;
} }
if {! [info exists env(SSVNC_LISTEN)]} { if {! [info exists env(SSVNC_LISTEN)] && ! [info exists env(SSVNC_REVERSE)]} {
destroy .; exit; destroy .; exit;
} }
} }
...@@ -453,10 +524,10 @@ if [regexp {,} $env(SSVNC_PROXY)] { ...@@ -453,10 +524,10 @@ if [regexp {,} $env(SSVNC_PROXY)] {
set proxy1 $env(SSVNC_PROXY) set proxy1 $env(SSVNC_PROXY)
} }
set proxy1_type [proxy_type $proxy1] set proxy1_type [proxy_type $proxy1]
regsub {^[A-z0-9][A-z0-9]*://} $proxy1 "" proxy1 set proxy1_hp [proxy_hostport $proxy1]
set s [split $proxy1 ":"] set s [split $proxy1_hp ":"]
set proxy1_host [lindex $s 0] set proxy1_host [lindex $s 0]
set proxy1_port [lindex $s 1] set proxy1_port [lindex $s 1]
...@@ -464,39 +535,58 @@ set proxy2_type "" ...@@ -464,39 +535,58 @@ set proxy2_type ""
set proxy2_host "" set proxy2_host ""
set proxy2_port "" set proxy2_port ""
set proxy3_type ""
set proxy3_host ""
set proxy3_port ""
if {$proxy2 != ""} { if {$proxy2 != ""} {
set proxy2_type [proxy_type $proxy2] set proxy2_type [proxy_type $proxy2]
regsub {^[A-z0-9][A-z0-9]*://} $proxy2 "" proxy2 set proxy2_hp [proxy_hostport $proxy2]
set s [split $proxy2 ":"] set s [split $proxy2_hp ":"]
set proxy2_host [lindex $s 0] set proxy2_host [lindex $s 0]
set proxy2_port [lindex $s 1] set proxy2_port [lindex $s 1]
} }
set proxy3_type ""
set proxy3_host ""
set proxy3_port ""
if {$proxy3 != ""} { if {$proxy3 != ""} {
set proxy3_type [proxy_type $proxy3] set proxy3_type [proxy_type $proxy3]
regsub {^[A-z0-9][A-z0-9]*://} $proxy3 "" proxy3 set proxy3_hp [proxy_hostport $proxy3]
set s [split $proxy3 ":"] set s [split $proxy3_hp ":"]
set proxy3_host [lindex $s 0] set proxy3_host [lindex $s 0]
set proxy3_port [lindex $s 1] set proxy3_port [lindex $s 1]
} }
set lport $env(SSVNC_LISTEN) bmesg "1: '$proxy1_host' '$proxy1_port' '$proxy1_type'";
bmesg "2: '$proxy2_host' '$proxy2_port' '$proxy2_type'";
bmesg "3: '$proxy3_host' '$proxy3_port' '$proxy3_type'";
set got_connection 0 set got_connection 0
set rc [catch {set lsock [socket -myaddr 127.0.0.1 -server handle_connection $lport]}]
if {$rc != 0} {
puts stderr "error listening"
destroy .
exit
}
if {1} { proc setb {} {
wm withdraw . wm withdraw .
button .b -text "CONNECT_BR" -command {destroy .}
pack .b
after 1000 check_callback
}
if [info exists env(SSVNC_REVERSE)] {
set s [split $env(SSVNC_REVERSE) ":"]
set rhost [lindex $s 0]
set rport [lindex $s 1]
set rc [catch {set lsock [socket $rhost $rport]}]
if {$rc != 0} {
puts stderr "error reversing"
destroy .; exit 1
}
puts stderr "SSVNC_REVERSE to $rhost $rport OK";
setb
handle_connection $lsock $rhost $rport
} else {
set lport $env(SSVNC_LISTEN)
set rc [catch {set lsock [socket -myaddr 127.0.0.1 -server handle_connection $lport]}]
if {$rc != 0} {
puts stderr "error listening"
destroy .; exit 1
}
puts stderr "SSVNC_LISTEN on $lport OK";
setb
} }
button .b -text "CONNECT_BR" -command {destroy .}
pack .b
after 1000 check_callback
...@@ -52,10 +52,15 @@ if [ "X$name" = "X" ]; then ...@@ -52,10 +52,15 @@ if [ "X$name" = "X" ]; then
name=`uname -sm | sed -e 's/ /./g' -e 's,/.*,,' -e 's/Linux\.i.86/Linux.i686/'` name=`uname -sm | sed -e 's/ /./g' -e 's,/.*,,' -e 's/Linux\.i.86/Linux.i686/'`
fi fi
dL="-L"
if uname -sr | egrep 'SunOS 5\.[5-8]' > /dev/null; then
dL="-h"
fi
f="$0" f="$0"
for t in 1 2 3 4 5 for t in 1 2 3 4 5
do do
if [ -L "$f" ]; then if [ $dL "$f" ]; then
f0="$f" f0="$f"
f=`ls -l "$f" | sed -e 's/^.* -> //'` f=`ls -l "$f" | sed -e 's/^.* -> //'`
if echo "$f" | grep '^/' > /dev/null; then if echo "$f" | grep '^/' > /dev/null; then
......
...@@ -123,10 +123,15 @@ if [ "X$name" = "X" ]; then ...@@ -123,10 +123,15 @@ if [ "X$name" = "X" ]; then
name=`uname -sm | sed -e 's/ /./g' -e 's,/.*,,' -e 's/Linux\.i.86/Linux.i686/'` name=`uname -sm | sed -e 's/ /./g' -e 's,/.*,,' -e 's/Linux\.i.86/Linux.i686/'`
fi fi
dL="-L"
if uname -sr | egrep 'SunOS 5\.[5-8]' > /dev/null; then
dL="-h"
fi
f="$0" f="$0"
for t in 1 2 3 4 5 6 for t in 1 2 3 4 5 6
do do
if [ -L "$f" ]; then if [ $dL "$f" ]; then
f0="$f" f0="$f"
f=`ls -l "$f" | sed -e 's/^.* -> //'` f=`ls -l "$f" | sed -e 's/^.* -> //'`
if echo "$f" | grep '^/' > /dev/null; then if echo "$f" | grep '^/' > /dev/null; then
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# ss_vncviewer: wrapper for vncviewer to use an stunnel SSL tunnel # ss_vncviewer: wrapper for vncviewer to use an stunnel SSL tunnel
# or an SSH tunnel. # or an SSH tunnel.
# #
# Copyright (c) 2006-2007 by Karl J. Runge <runge@karlrunge.com> # Copyright (c) 2006-2008 by Karl J. Runge <runge@karlrunge.com>
# #
# You must have stunnel(8) installed on the system and in your PATH # 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) # (however, see the -ssh option below, in which case you will need ssh(1)
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
# and then a 2nd CONNECT to the destination VNC server.) # and then a 2nd CONNECT to the destination VNC server.)
# #
# Use socks://host:port, socks4://host:port, or socks5://host,port # Use socks://host:port, socks4://host:port, or socks5://host,port
# to force usage of a SOCKS proxy. # to force usage of a SOCKS proxy. Also repeater://host:port.
# #
# -showcert Only fetch the certificate using the 'openssl s_client' # -showcert Only fetch the certificate using the 'openssl s_client'
# command (openssl(1) must in installed). # command (openssl(1) must in installed).
...@@ -259,8 +259,12 @@ if [ "X$reverse" != "X" ]; then ...@@ -259,8 +259,12 @@ if [ "X$reverse" != "X" ]; then
# check proxy usage under reverse connection: # check proxy usage under reverse connection:
if [ "X$use_ssh" = "X" -a "X$use_sshssl" = "X" ]; then if [ "X$use_ssh" = "X" -a "X$use_sshssl" = "X" ]; then
echo "" echo ""
echo "*Warning*: SSL -listen and a Web proxy does not make sense." if echo "$proxy" | egrep "repeater://" > /dev/null; then
sleep 3 :
else
echo "*Warning*: SSL -listen and a Web proxy does not make sense."
sleep 3
fi
elif echo "$proxy" | grep "," > /dev/null; then elif echo "$proxy" | grep "," > /dev/null; then
: :
else else
...@@ -502,6 +506,11 @@ rchk() { ...@@ -502,6 +506,11 @@ rchk() {
} }
rchk rchk
dL="-L"
if uname -sr | egrep 'SunOS 5\.[5-8]' > /dev/null; then
dL="-h"
fi
# a portable, but not absolutely safe, tmp file creator # a portable, but not absolutely safe, tmp file creator
mytmp() { mytmp() {
tf=$1 tf=$1
...@@ -509,7 +518,7 @@ mytmp() { ...@@ -509,7 +518,7 @@ mytmp() {
if [ -d "$tf" ]; then if [ -d "$tf" ]; then
echo "tmp file $tf still exists as a directory." echo "tmp file $tf still exists as a directory."
exit 1 exit 1
elif [ -L "$tf" ]; then elif [ $dL "$tf" ]; then
echo "tmp file $tf still exists as a symlink." echo "tmp file $tf still exists as a symlink."
exit 1 exit 1
elif [ -f "$tf" ]; then elif [ -f "$tf" ]; then
...@@ -564,50 +573,43 @@ pcode() { ...@@ -564,50 +573,43 @@ pcode() {
use IO::Socket::INET; use IO::Socket::INET;
my ($first, $second, $third) = split(/,/, $ENV{PPROXY_PROXY}, 3); if (exists $ENV{PPROXY_SLEEP}) {
print STDERR "PPROXY_PID: $$\n";
sleep $ENV{PPROXY_SLEEP};
}
if ($first =~ m,^socks4?://(\S*)$,i) { foreach my $var (qw(PPROXY_PROXY PPROXY_SOCKS PPROXY_DEST PPROXY_LISTEN
$ENV{PPROXY_SOCKS} = 1; PPROXY_REVERSE PPROXY_REPEATER PPROXY_REMOVE PPROXY_KILLPID PPROXY_SLEEP)) {
$first = $1; if (0 || $ENV{SS_DEBUG}) {
} elsif ($first =~ m,^socks5://(\S*)$,i) { print STDERR "$var: $ENV{$var}\n";
$ENV{PPROXY_SOCKS} = 5; }
$first = $1; }
} elsif ($first =~ m,^https?://(\S*)$,i) {
$ENV{PPROXY_SOCKS} = ""; if ($ENV{PPROXY_SOCKS} ne "" && $ENV{PPROXY_PROXY} !~ m,^socks5?://,i) {
$first = $1; if ($ENV{PPROXY_SOCKS} eq "5") {
$ENV{PPROXY_PROXY} = "socks5://$ENV{PPROXY_PROXY}";
} else {
$ENV{PPROXY_PROXY} = "socks://$ENV{PPROXY_PROXY}";
}
} }
my ($first, $second, $third) = split(/,/, $ENV{PPROXY_PROXY}, 3);
my ($mode_1st, $mode_2nd, $mode_3rd) = ("", "", "");
($first, $mode_1st) = url_parse($first);
my ($proxy_host, $proxy_port) = split(/:/, $first); my ($proxy_host, $proxy_port) = split(/:/, $first);
my $connect = $ENV{PPROXY_DEST}; my $connect = $ENV{PPROXY_DEST};
my $mode_2nd = "";
if ($second ne "") { if ($second ne "") {
if ($second =~ m,^socks4?://(\S*)$,i) { ($second, $mode_2nd) = url_parse($second);
$mode_2nd = "socks4";
$second = $1;
} elsif ($second =~ m,^socks5://(\S*)$,i) {
$mode_2nd = "socks5";
$second = $1;
} elsif ($second =~ m,^https?://(\S*)$,i) {
$mode_2nd = "http";
$second = $1;
}
} }
my $mode_3rd = "";
if ($third ne "") { if ($third ne "") {
if ($third =~ m,^socks4?://(\S*)$,i) { ($third, $mode_3rd) = url_parse($third);
$mode_3rd = "socks4";
$third = $1;
} elsif ($third =~ m,^socks5://(\S*)$,i) {
$mode_3rd = "socks5";
$third = $1;
} elsif ($third =~ m,^https?://(\S*)$,i) {
$mode_3rd = "http";
$third = $1;
}
} }
print STDERR "\n"; print STDERR "\n";
print STDERR "PPROXY v0.2: a tool for Web proxies and SOCKS connections.\n"; print STDERR "PPROXY v0.2: a tool for Web proxies and SOCKS connections.\n";
print STDERR "proxy_host: $proxy_host\n"; print STDERR "proxy_host: $proxy_host\n";
...@@ -615,10 +617,29 @@ print STDERR "proxy_port: $proxy_port\n"; ...@@ -615,10 +617,29 @@ print STDERR "proxy_port: $proxy_port\n";
print STDERR "proxy_connect: $connect\n"; print STDERR "proxy_connect: $connect\n";
print STDERR "pproxy_params: $ENV{PPROXY_PROXY}\n"; print STDERR "pproxy_params: $ENV{PPROXY_PROXY}\n";
print STDERR "pproxy_listen: $ENV{PPROXY_LISTEN}\n"; print STDERR "pproxy_listen: $ENV{PPROXY_LISTEN}\n";
print STDERR "pproxy_reverse: $ENV{PPROXY_REVERSE}\n";
print STDERR "\n"; print STDERR "\n";
if (1) {
print STDERR "pproxy 1st: $first\t- $mode_1st\n";
print STDERR "pproxy 2nd: $second\t- $mode_2nd\n";
print STDERR "pproxy 3rd: $third\t- $mode_3rd\n";
print STDERR "\n";
}
my $listen_handle = ""; my $listen_handle = "";
if ($ENV{PPROXY_LISTEN} != "") { if ($ENV{PPROXY_REVERSE} ne "") {
my ($rhost, $rport) = split(/:/, $ENV{PPROXY_REVERSE});
$rport = 5900 unless $rport;
$listen_handle = IO::Socket::INET->new(
PeerAddr => $rhost,
PeerPort => $rport,
Proto => "tcp"
);
if (! $listen_handle) {
die "pproxy: $! -- PPROXY_REVERSE\n";
}
print STDERR "PPROXY_REVERSE: connected to $rhost $rport\n";
} elsif ($ENV{PPROXY_LISTEN} ne "") {
my $listen_sock = IO::Socket::INET->new( my $listen_sock = IO::Socket::INET->new(
Listen => 2, Listen => 2,
LocalAddr => "localhost", LocalAddr => "localhost",
...@@ -626,7 +647,7 @@ if ($ENV{PPROXY_LISTEN} != "") { ...@@ -626,7 +647,7 @@ if ($ENV{PPROXY_LISTEN} != "") {
Proto => "tcp" Proto => "tcp"
); );
if (! $listen_sock) { if (! $listen_sock) {
die "pproxy: $!\n"; die "pproxy: $! -- PPROXY_LISTEN\n";
} }
my $ip; my $ip;
($listen_handle, $ip) = $listen_sock->accept(); ($listen_handle, $ip) = $listen_sock->accept();
...@@ -647,6 +668,112 @@ if (! $sock) { ...@@ -647,6 +668,112 @@ if (! $sock) {
die "pproxy: $err\n"; die "pproxy: $err\n";
} }
unlink($0) if $ENV{PPROXY_REMOVE};
$cur_proxy = $first;
setmode($mode_1st);
if ($second ne "") {
connection($second, 1);
setmode($mode_2nd);
$cur_proxy = $second;
if ($third ne "") {
connection($third, 2);
setmode($mode_3rd);
$cur_proxy = $third;
connection($connect, 3);
} else {
connection($connect, 2);
}
} else {
connection($connect, 1);
}
$parent = $$;
$child = fork;
if (! defined $child) {
kill "TERM", $ENV{PPROXY_KILLPID} if $ENV{PPROXY_KILLPID};
exit 1;
}
if ($child) {
print STDERR "pproxy parent\[$$] STDIN -> socket\n";
if ($listen_handle) {
xfer($listen_handle, $sock);
} else {
xfer(STDIN, $sock);
}
select(undef, undef, undef, 0.25);
if (kill 0, $child) {
select(undef, undef, undef, 1.5);
#print STDERR "pproxy\[$$]: kill TERM $child\n";
kill "TERM", $child;
}
} else {
print STDERR "pproxy child \[$$] socket -> STDOUT\n";
if ($listen_handle) {
xfer($sock, $listen_handle);
} else {
xfer($sock, STDOUT);
}
select(undef, undef, undef, 0.25);
if (kill 0, $parent) {
select(undef, undef, undef, 1.5);
#print STDERR "pproxy\[$$]: kill TERM $parent\n";
kill "TERM", $parent;
}
}
if ($ENV{PPROXY_KILLPID} ne "") {
if ($ENV{PPROXY_KILLPID} =~ /^(\+|-)/) {
$ENV{PPROXY_KILLPID} = $$ + $ENV{PPROXY_KILLPID};
}
print STDERR "kill TERM, $ENV{PPROXY_KILLPID}\n";
kill "TERM", $ENV{PPROXY_KILLPID};
}
exit;
sub url_parse {
my $hostport = shift;
my $mode = "http";
if ($hostport =~ m,^socks4?://(\S*)$,i) {
$mode = "socks4";
$hostport = $1;
} elsif ($hostport =~ m,^socks5://(\S*)$,i) {
$mode = "socks5";
$hostport = $1;
} elsif ($hostport =~ m,^https?://(\S*)$,i) {
$mode = "http";
$hostport = $1;
} elsif ($hostport =~ m,^repeater://(\S*)\+(\S*)$,i) {
# ultravnc repeater proxy.
$hostport = $1;
$mode = "repeater:$2";
if ($hostport !~ /:\d+/) {
$hostport .= ":5900";
}
}
return ($hostport, $mode);
}
sub setmode {
my $mode = shift;
$ENV{PPROXY_REPEATER} = "";
if ($mode =~ /^socks/) {
if ($mode =~ /^socks5/) {
$ENV{PPROXY_SOCKS} = 5;
} else {
$ENV{PPROXY_SOCKS} = 1;
}
} elsif ($mode =~ /^repeater:(.*)/) {
$ENV{PPROXY_REPEATER} = $1;
$ENV{PPROXY_SOCKS} = "";
} else {
$ENV{PPROXY_SOCKS} = "";
}
}
sub connection { sub connection {
my ($CONNECT, $w) = @_; my ($CONNECT, $w) = @_;
...@@ -771,6 +898,18 @@ sub connection { ...@@ -771,6 +898,18 @@ sub connection {
close $sock; close $sock;
exit(1); exit(1);
} }
} elsif ($ENV{PPROXY_REPEATER} ne "") {
my $rep = $ENV{PPROXY_REPEATER};
print STDERR "repeater: $rep\n";
$rep .= pack("x") x 250;
syswrite($sock, $rep, 250);
my $ok = 1;
for (my $i = 0; $i < 12; $i++) {
my $c;
sysread($sock, $c, 1);
print STDERR $c;
}
} else { } else {
# Web Proxy: # Web Proxy:
...@@ -799,76 +938,6 @@ sub connection { ...@@ -799,76 +938,6 @@ sub connection {
} }
} }
unlink($0) if $ENV{PPROXY_REMOVE};
$cur_proxy = $first;
if ($second ne "") {
connection($second, 1);
setmode($mode_2nd);
$cur_proxy = $second;
if ($third ne "") {
connection($third, 2);
setmode($mode_3rd);
$cur_proxy = $third;
connection($connect, 3);
} else {
connection($connect, 2);
}
} else {
connection($connect, 1);
}
$parent = $$;
$child = fork;
if (! defined $child) {
exit 1;
}
if ($child) {
print STDERR "pproxy parent\[$$] STDIN -> socket\n";
if ($listen_handle) {
xfer($listen_handle, $sock);
} else {
xfer(STDIN, $sock);
}
select(undef, undef, undef, 0.25);
if (kill 0, $child) {
select(undef, undef, undef, 1.5);
#print STDERR "pproxy\[$$]: kill TERM $child\n";
kill "TERM", $child;
}
} else {
print STDERR "pproxy child \[$$] socket -> STDOUT\n";
if ($listen_handle) {
xfer($sock, $listen_handle);
} else {
xfer($sock, STDOUT);
}
select(undef, undef, undef, 0.25);
if (kill 0, $parent) {
select(undef, undef, undef, 1.5);
#print STDERR "pproxy\[$$]: kill TERM $parent\n";
kill "TERM", $parent;
}
}
exit;
sub setmode {
my $mode = shift;
if ($mode =~ /^socks/) {
if ($mode =~ /^socks5/) {
$ENV{PPROXY_SOCKS} = 5;
} else {
$ENV{PPROXY_SOCKS} = 1;
}
} else {
$ENV{PPROXY_SOCKS} = "";
}
}
sub xfer { sub xfer {
my($in, $out) = @_; my($in, $out) = @_;
$RIN = $WIN = $EIN = ""; $RIN = $WIN = $EIN = "";
...@@ -1182,6 +1251,7 @@ Kecho proxy=$proxy ...@@ -1182,6 +1251,7 @@ Kecho proxy=$proxy
fi fi
if [ "X$SSVNC_EXTRA_SLEEP" != "X" ]; then if [ "X$SSVNC_EXTRA_SLEEP" != "X" ]; then
echo "sleep $SSVNC_EXTRA_SLEEP"
sleep $SSVNC_EXTRA_SLEEP sleep $SSVNC_EXTRA_SLEEP
fi fi
...@@ -1281,12 +1351,12 @@ Kecho proxy=$proxy ...@@ -1281,12 +1351,12 @@ Kecho proxy=$proxy
sleep 5 sleep 5
fi fi
echo "" echo ""
#reset
stty sane
if [ "X$SSVNC_EXTRA_SLEEP" != "X" ]; then if [ "X$SSVNC_EXTRA_SLEEP" != "X" ]; then
#echo T sleep $SSVNC_EXTRA_SLEEP echo "sleep $SSVNC_EXTRA_SLEEP"
sleep $SSVNC_EXTRA_SLEEP sleep $SSVNC_EXTRA_SLEEP
fi fi
#reset
stty sane
#echo "pssh=\"$pssh\"" #echo "pssh=\"$pssh\""
if [ "X$use_sshssl" = "X" -a "X$getport" = "X" ]; then if [ "X$use_sshssl" = "X" -a "X$getport" = "X" ]; then
echo "Running viewer:" echo "Running viewer:"
...@@ -1351,12 +1421,15 @@ if [ "X$proxy" != "X" ]; then ...@@ -1351,12 +1421,15 @@ if [ "X$proxy" != "X" ]; then
PPROXY_REMOVE=1; export PPROXY_REMOVE PPROXY_REMOVE=1; export PPROXY_REMOVE
pcode "$ptmp" pcode "$ptmp"
if [ "X$showcert" != "X1" -a "X$direct_connect" = "X" ]; then if [ "X$showcert" != "X1" -a "X$direct_connect" = "X" ]; then
if uname | grep Darwin >/dev/null; then if uname | egrep 'Darwin|SunOS' >/dev/null; then
# on mac we need to listen on socket instead of stdio: # on mac we need to listen on socket instead of stdio:
nd=`findfree 6700` nd=`findfree 6700`
PPROXY_LISTEN=$nd PPROXY_LISTEN=$nd
export PPROXY_LISTEN export PPROXY_LISTEN
$ptmp 2>/dev/null & if [ "X$reverse" = "X" ]; then
#$ptmp 2>/dev/null &
$ptmp &
fi
#sleep 3 #sleep 3
sleep 2 sleep 2
host="localhost" host="localhost"
...@@ -1423,7 +1496,7 @@ if [ "X$direct_connect" != "X" ]; then ...@@ -1423,7 +1496,7 @@ if [ "X$direct_connect" != "X" ]; then
disp="$N" disp="$N"
fi fi
if [ "X$SSVNC_EXTRA_SLEEP" != "X" ]; then if [ "X$SSVNC_EXTRA_SLEEP" != "X" ]; then
#echo T sleep $SSVNC_EXTRA_SLEEP echo "T sleep $SSVNC_EXTRA_SLEEP"
sleep $SSVNC_EXTRA_SLEEP sleep $SSVNC_EXTRA_SLEEP
fi fi
if [ "X$reverse" = "X" ]; then if [ "X$reverse" = "X" ]; then
...@@ -1453,29 +1526,9 @@ fi ...@@ -1453,29 +1526,9 @@ fi
tmp=/tmp/ss_vncviewer${RANDOM}.$$ tmp=/tmp/ss_vncviewer${RANDOM}.$$
mytmp "$tmp" mytmp "$tmp"
if [ "X$reverse" = "X" ]; then make_tcert() {
tcert="/tmp/tcert${RANDOM}.$$"
cat > "$tmp" <<END cat > $tcert <<END
foreground = yes
pid =
client = yes
debug = 6
$STUNNEL_EXTRA_OPTS
$verify
$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${RANDOM}.$$"
cat > $tcert <<END
-----BEGIN RSA PRIVATE KEY----- -----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAvkfXxb0wcxgrjV2ziFikjII+ze8iKcTBt47L0GM/c21efelN MIIEowIBAAKCAQEAvkfXxb0wcxgrjV2ziFikjII+ze8iKcTBt47L0GM/c21efelN
+zZpJUUXLu4zz8Ryq8Q+sQgfNy7uTOpN9bUUaOk1TnD7gaDQnQWiNHmqbW2kL+DS +zZpJUUXLu4zz8Ryq8Q+sQgfNy7uTOpN9bUUaOk1TnD7gaDQnQWiNHmqbW2kL+DS
...@@ -1527,8 +1580,40 @@ wAH966SAOvd2s6yOHMvyDRIL7WHxfESB6rDHsdIW/yny1fBePjv473KrxyXtbz7I ...@@ -1527,8 +1580,40 @@ wAH966SAOvd2s6yOHMvyDRIL7WHxfESB6rDHsdIW/yny1fBePjv473KrxyXtbz7I
dMw1yW09l+eEo4A7GzwOdw== dMw1yW09l+eEo4A7GzwOdw==
-----END CERTIFICATE----- -----END CERTIFICATE-----
END END
chmod 600 $tcert chmod 600 $tcert
cert="cert = $tcert" echo "$tcert"
}
if [ "X$reverse" = "X" ]; then
if echo "$proxy" | grep repeater:// > /dev/null; then
if [ "X$cert" = "X" ]; then
ttcert=`make_tcert`
cert="cert = $ttcert"
fi
fi
cat > "$tmp" <<END
foreground = yes
pid =
client = yes
debug = 6
$STUNNEL_EXTRA_OPTS
$verify
$cert
[vnc_stunnel]
accept = localhost:$use
$connect
END
else
p2=`expr 5500 + $N`
connect="connect = localhost:$p2"
if [ "X$cert" = "X" ]; then
ttcert=`make_tcert`
cert="cert = $ttcert"
fi fi
STUNNEL_EXTRA_OPTS=`echo "$STUNNEL_EXTRA_OPTS" | sed -e 's/maxconn/#maxconn/'` STUNNEL_EXTRA_OPTS=`echo "$STUNNEL_EXTRA_OPTS" | sed -e 's/maxconn/#maxconn/'`
...@@ -1551,7 +1636,6 @@ accept = $hloc$port ...@@ -1551,7 +1636,6 @@ accept = $hloc$port
$connect $connect
END END
fi fi
echo "" echo ""
...@@ -1583,8 +1667,10 @@ fi ...@@ -1583,8 +1667,10 @@ fi
sleep 1 sleep 1
rm -f "$tmp" rm -f "$tmp"
echo "" echo ""
if [ "X$SSVNC_EXTRA_SLEEP" != "X" ]; then if [ "X$SSVNC_EXTRA_SLEEP" != "X" ]; then
echo "sleep $SSVNC_EXTRA_SLEEP"
sleep $SSVNC_EXTRA_SLEEP sleep $SSVNC_EXTRA_SLEEP
fi fi
echo "Running viewer:" echo "Running viewer:"
...@@ -1607,6 +1693,12 @@ else ...@@ -1607,6 +1693,12 @@ else
echo "$VNCVIEWERCMD" "$@" -listen $N echo "$VNCVIEWERCMD" "$@" -listen $N
trap "final" 0 2 15 trap "final" 0 2 15
echo "" echo ""
if [ "X$proxy" != "X" ]; then
PPROXY_REVERSE="localhost:$port"; export PPROXY_REVERSE
PPROXY_SLEEP=1; export PPROXY_SLEEP;
PPROXY_KILLPID=+1; export PPROXY_KILLPID;
$ptmp &
fi
$VNCVIEWERCMD "$@" -listen $N $VNCVIEWERCMD "$@" -listen $N
fi fi
......
...@@ -33,6 +33,16 @@ proc center_win {w} { ...@@ -33,6 +33,16 @@ proc center_win {w} {
update update
} }
proc mac_raise {} {
global uname
if {$uname == "Darwin"} {
catch {exec /bin/sh -c {osascript -e 'tell application "Wish Shell" to activate' >/dev/null 2>&1 &}}
after 150
update
update idletasks
}
}
proc toplev {w} { proc toplev {w} {
catch {destroy $w} catch {destroy $w}
toplevel $w toplevel $w
...@@ -105,16 +115,18 @@ proc ts_help {} { ...@@ -105,16 +115,18 @@ proc ts_help {} {
The Terminal Services VNC Viewer uses SSH to establish an encrypted The Terminal Services VNC Viewer uses SSH to establish an encrypted
and authenticated connection to the remote server. and authenticated connection to the remote server.
On the remote server x11vnc is run in terminal services mode to find Through the SSH channel, it automatically starts x11vnc in terminal
or create your desktop session. x11vnc is used for both the session services mode on the remote server to find or create your desktop
management and the VNC transport. session. x11vnc is used for both the session management and the
VNC transport.
You MUST be able to log in via SSH to the remote terminal server. You MUST be able to log in via SSH to the remote terminal server.
Ask your administrator to set this up for you if it isn't already. Ask your administrator to set this up for you if it isn't already.
Also see "Requirements" below. x11vnc must also be installed on the remote server machine.
See "Requirements" below.
This mode is started by the commands 'tsvnc' or 'ssvnc -ts' or This mode is started by the commands 'tsvnc' or 'ssvnc -ts' or
toggling by pressing Ctrl-t. "SSVNC Mode" under Options -> Advanced toggled by pressing Ctrl-t. "SSVNC Mode" under Options -> Advanced
will also return to the full SSVNC. will also return to the full SSVNC.
Or in your ~/.ssvncrc (or ~/ssvnc_rc on Windows) put "mode=tsvnc" Or in your ~/.ssvncrc (or ~/ssvnc_rc on Windows) put "mode=tsvnc"
...@@ -322,11 +334,11 @@ proc help {} { ...@@ -322,11 +334,11 @@ proc help {} {
set msg { set msg {
Hosts and Displays: Hosts and Displays:
Enter the VNC host and display in the 'VNC Host:Display' entry box. Enter the VNC host and display in the 'VNC Host:Display' entry box.
It is of the form "host:number", where "host" is the hostname of the It is of the form "host:number", where "host" is the hostname of the
machine running the VNC Server and "number" is the VNC display number; machine running the VNC Server and "number" is the VNC display number;
it is often "0". Examples: it is often "0". Some Examples:
snoopy:0 snoopy:0
...@@ -336,13 +348,13 @@ proc help {} { ...@@ -336,13 +348,13 @@ proc help {} {
24.67.132.27:0 24.67.132.27:0
Then click on "Connect". When you do so the STUNNEL program will be Then click on "Connect". When you do the STUNNEL program will be
started locally to provide you with an outgoing SSL tunnel. started locally to provide you with an outgoing SSL tunnel.
Once the STUNNEL is running, the TightVNC Viewer (Or Chicken of the Once the STUNNEL is running, the TightVNC Viewer (Or Chicken of the
VNC on Mac OS X) will be automatically started directed to the local VNC on Mac OS X, or one you set under Options) will be automatically
port of the SSL tunnel which, in turn, encrypts and redirects the started directed to the local port of the SSL tunnel which, in turn,
connection to the remote VNC server. encrypts and redirects the connection to the remote VNC server.
The remote VNC server MUST support an initial SSL handshake before The remote VNC server MUST support an initial SSL handshake before
using the VNC protocol (i.e. VNC is tunnelled through the SSL channel using the VNC protocol (i.e. VNC is tunnelled through the SSL channel
...@@ -351,15 +363,21 @@ proc help {} { ...@@ -351,15 +363,21 @@ proc help {} {
Automatic SSH tunnels are described below. Automatic SSH tunnels are described below.
If you are using a port less than the default VNC port 5900 (usually See tip 5) below for how to disable encryption.
the VNC display = port - 5900), use the full port number itself, e.g.:
24.67.132.27:443 Port numbers:
Note, however, if the number n after the colon is < 200, then a If you are using a port less than the default VNC port 5900
port number 5900 + n is assumed; i.e. n is the VNC display number. (usually the VNC display = port - 5900), use the full port number
If you must use a TCP port less than 200, specify a negative value, itself, e.g.:
e.g.: 24.67.132.27:-80
24.67.132.27:443
Note, however, if the number n after the colon is < 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
SSL Certificate Verification: SSL Certificate Verification:
...@@ -377,21 +395,29 @@ proc help {} { ...@@ -377,21 +395,29 @@ proc help {} {
and so the first time you connect to a new server you may need to and so the first time you connect to a new server you may need to
follow a few dialogs to inspect and save the server certificate. follow a few dialogs to inspect and save the server certificate.
See the "Certs... -> Help" for information on how to manage certificates. See the "Certs... -> Help" for information on how to manage certificates.
"Verify All Certs" is on by default.
"Fetch Cert" and "Verify All Certs" are currently disabled in the rare However, "Fetch Cert" and "Verify All Certs" are currently disabled
"SSH + SSL" usage mode (e.g. SSH is used to enter a firewall gateway, in the rare "SSH + SSL" usage mode (e.g. SSH is used to enter a
and then SSL is tunneled through that to reach the workstation). firewall gateway, and then SSL is tunneled through that to reach
the workstation).
Windows STUNNEL: Windows STUNNEL:
Note that on Windows when the Viewer connection is finished you may Note that on Windows when the Viewer connection is finished you
need to terminate STUNNEL manually from the System Tray (right click will be prompted if you want SSVNC to try to kill the STUNNEL process
on dark green icon) and selecting "Exit". Double clicking that icon for you. Usually you will say Yes, however if there are problems
will show you its log file (useful for debugging connections). connecting you may want to look at the STUNNEL Log first.
Double clicking the STUNNEL tray icon (dark green) will show you
its Log file (useful for debugging connections).
SSVNC will kill the STUNNEL process for you, but you may still need
to move the mouse over the icon to make it go away.
SSVNC will try to kill the STUNNEL process for you, but you may still In some cases you may need to terminate STUNNEL manually from the
need to move the mouse over the icon to make it go away. System Tray (right click on dark green icon) and selecting "Exit".
VNC Password: VNC Password:
...@@ -406,7 +432,7 @@ proc help {} { ...@@ -406,7 +432,7 @@ proc help {} {
On Windows TightVNC viewer should prompt you when a password is required. On Windows TightVNC viewer should prompt you when a password is required.
NOTE: when you Save a VNC profile, the password is not saved (you NOTE: when you Save a VNC profile, the password is NOT saved (you
need to enter it each time). need to enter it each time).
...@@ -414,6 +440,7 @@ proc help {} { ...@@ -414,6 +440,7 @@ proc help {} {
Click on "Use SSH" if you want to use an *SSH* tunnel instead of SSL Click on "Use SSH" if you want to use an *SSH* tunnel instead of SSL
(then the VNC Server does not need to speak SSL or use STUNNEL). (then the VNC Server does not need to speak SSL or use STUNNEL).
You will need to be able to login to your account on the remote host You will need to be able to login to your account on the remote host
via SSH (e.g. via password or ssh-agent). via SSH (e.g. via password or ssh-agent).
...@@ -435,6 +462,50 @@ proc help {} { ...@@ -435,6 +462,50 @@ proc help {} {
the -ssh command line option or "sshvnc". the -ssh command line option or "sshvnc".
Remote SSH Command:
In SSH or SSH + SSL mode you can also specify a remote command
to run on the remote ssh host in the "Remote SSH Command" entry.
The default is just to sleep a bit (e.g. sleep 30) to make sure
the port tunnels are established. Alternatively you could have the
remote command start the VNC server, e.g.
x11vnc -display :0 -rfbport 5900 -localhost -nopw
When starting the VNC server this way, note that sometimes you
will need to correlate the VNC Display number with the "-rfbport"
(or similar) option of the server. E.g.:
VNC Host:Display username@somehost.com:2
Remote SSH Command: x11vnc -find -rfbport 5902 -nopw
See the the Tip below (11) for using x11vnc PORT=NNNN feature (or
vncserver(1) output) to not need to specify the VNC display number
or the x11vnc -rfbport option.
Profiles:
Use "Save" to save a profile (i.e. a host:display and its specific
settings) with a name.
To load in a saved Options profile, click on the "Load" button.
To list your profiles from the command line use:
ssvnc -profiles (or -list)
You can launch ssvnc and have it immediately connect to the server
by invoking it something like this:
ssvnc profile1 (launches profile named "profile1")
ssvnc hostname:0 (connect to hostname VNC disp 0 via SSL)
ssvnc vnc+ssl://hostname:0 (same)
ssvnc vnc+ssh://hostname:0 (connect to hostname VNC disp 0 via SSH)
see the Tips 5 and 9 below for more about the URL-like syntax.
Proxies/Gateways: Proxies/Gateways:
If an intermediate proxy is needed to make the SSL connection If an intermediate proxy is needed to make the SSL connection
...@@ -466,12 +537,12 @@ proc help {} { ...@@ -466,12 +537,12 @@ proc help {} {
You can prefix web proxies with http:// but it doesn't matter since You can prefix web proxies with http:// but it doesn't matter since
that is the default. that is the default.
Note that Web proxies are often configured to only allow outgoing Note that Web proxies are often configured to ONLY allow outgoing
connections to ports 443 (HTTPS) and 563 (SNEWS), so you might connections to ports 443 (HTTPS) and 563 (SNEWS), so you might
have run the VNC server (or router port redirector) on those ports. have run the VNC server (or router port redirector) on those ports.
SOCKS proxies usually have no restrictions on port number. SOCKS proxies usually have no restrictions on port number.
On Unix you can chain up to 3 proxies (any combination of http:// and You can chain up to 3 proxies (any combination of http:// and
socks://) by separating them with commas (i.e. first,second,third). socks://) by separating them with commas (i.e. first,second,third).
See the ss_vncviewer description and x11vnc FAQ for info on proxies: See the ss_vncviewer description and x11vnc FAQ for info on proxies:
...@@ -523,6 +594,7 @@ proc help {} { ...@@ -523,6 +594,7 @@ proc help {} {
will also work going to a different internal machine, e.g. "joes-pc:0" will also work going to a different internal machine, e.g. "joes-pc:0"
instead of "localhost:0", as in the first example. instead of "localhost:0", as in the first example.
A Web or SOCKS proxy can also be used with SSH. Use this if you are A Web or SOCKS proxy can also be used with SSH. Use this if you are
inside a firewall that prohibits direct connections to remote SSH servers. inside a firewall that prohibits direct connections to remote SSH servers.
...@@ -536,7 +608,7 @@ proc help {} { ...@@ -536,7 +608,7 @@ proc help {} {
use socks5://... to force the SOCKS5 version. use socks5://... to force the SOCKS5 version.
On Unix you can chain up to 3 proxies (any combination of http:// and You can chain up to 3 proxies (any combination of http:// and
socks://) by separating them with commas (i.e. first,second,third). socks://) by separating them with commas (i.e. first,second,third).
For a non-standard SSH port and a Web or SOCKS proxy try: For a non-standard SSH port and a Web or SOCKS proxy try:
...@@ -551,26 +623,75 @@ proc help {} { ...@@ -551,26 +623,75 @@ proc help {} {
Proxy/Gateway: http://mysocks.west:1080,ssh.company.com,joes-pc Proxy/Gateway: http://mysocks.west:1080,ssh.company.com,joes-pc
Remote SSH Command: UltraVNC Proxies/Gateways:
In SSH or SSH + SSL mode you can also specify a remote command UltraVNC has a "repeater" tool (http://www.uvnc.com/addons/repeater.html
to run on the remote ssh host in the "Remote SSH Command" entry. and http://koti.mbnet.fi/jtko/) that acts as an VNC proxy. SSVNC can
The default is just to sleep a bit (e.g. sleep 30) to make sure work with both mode I and mode II schemes of this repeater.
the port tunnels are established. Alternatively you could have the
remote command start the VNC server, e.g.
x11vnc -display :0 -rfbport 5900 -localhost -nopw Note: only SSL (or unencrypted) SSVNC connections make sense with
the UltraVNC repeater. SSH connections (previous section) do not
seem to (let us know if you find a way to use it).
When starting the VNC server this way, note that sometimes you For mode I repeater the viewer initiates the connection and passes
will need to correlate the VNC Display number with the "-rfbport" a string that is the internal VNC server's IP address (or hostname)
(or similar) option of the server. E.g.: and port or display:
VNC Host:Display username@somehost.com:2 VNC Host:Display: :0
Remote SSH Command: x11vnc -find -rfbport 5902 -nopw Proxy/Gateway: repeater://myproxy.west:5900+joes-pc:1
See the the Tip below (11) for using x11vnc PORT=NNNN feature (or Note here that the VNC Host:Display can be anything; we use :0.
vncserver(1) output) to not need to specify the VNC display number
or the x11vnc -rfbport option. The Proxy/Gateway format is repeater://proxy:port+vncserver:display.
The string after the "+" sign is passed to the repeater server for
it to interpret. For this example, instead of joes-pc:1 it could
be joes-pc:5901 or 192.168.1.4:1, 192.168.1.4:5901, etc.
If you do not supply a proxy port, then the default 5900 is assumed,
e.g. repeater://myproxy.west+joes-pc:1
For mode II repeater both the VNC viewer and VNC server initiate
connections to the repeater proxy. In this case they pass a string
that identifies their mutual connection via "ID:NNNN":
VNC Host:Display: :0
Proxy/Gateway: repeater://myproxy.west:5900+ID:1234
again, the default proxy port is 5900 if not supplied.
In this case, mode II, you MUST set Options -> Reverse VNC Connection.
That is to say a "Listening Connection". The reason for this is that
the VNC server acts as a SSL *client* and so requires the Viewer end
to have an SSL cert, etc.
Set REPEATER_FORCE=1 in the Host:Display (hit Enter, and then clear
it) to force SSVNC to try to a forward connection in this situation.
We have also found that usually the Listening viewer must be started
BEFORE the VNC Server connects to the proxy. This is a likely bug
in the repeater tool.
For mode II, you probably should also disable "Verify All Certs"
unless you have taken the steps beforehand to save the VNC server's
certificate, or have previously accepted it using another method.
Also, after the connection you MUST terminate the listening VNC Viewer
(Ctrl-C) and connect again (the proxy only runs once.) In Windows,
go to the System Tray and terminate the Listening VNC Viewer.
BTW, the x11vnc VNC server command for the mode II case would be
something like:
x11vnc -ssl SAVE -connect repeater=ID:1234+myproxy.west:5500 ...
It also supports -connect repeater://myproxy.west:5500+ID:1234
notation.
For mode I operation x11vnc simply runs as a normal SSL/VNC server
x11vnc -ssl SAVE
SSL Certificates: SSL Certificates:
...@@ -599,10 +720,10 @@ proc help {} { ...@@ -599,10 +720,10 @@ proc help {} {
the other one in the "Certs ..." dialog. the other one in the "Certs ..." dialog.
Alternatively you can use the "Import Certificate" action to paste Alternatively you can use the "Import Certificate" action to paste
in a certificate or read one in from a file or use the "Fetch Cert" in a certificate or read one in from a file. Or you can use the
button on the main panel. If "Verify All Certs" is checked, you "Fetch Cert" button on the main panel. If "Verify All Certs" is
will be forced to check Certs of any new servers the first time checked, you will be forced to check Certs of any new servers the
you connect. first time you connect.
Note that "Verify All Certs" is on by default so that users who do Note that "Verify All Certs" is on by default so that users who do
not understand the SSL Man-In-The-Middle problem will not be left not understand the SSL Man-In-The-Middle problem will not be left
...@@ -620,27 +741,6 @@ proc help {} { ...@@ -620,27 +741,6 @@ proc help {} {
number of colors used. click on the "Options ..." button and read number of colors used. click on the "Options ..." button and read
the Help there. the Help there.
Profiles:
Use "Save" to save a profile (i.e. a host:display and its specific
settings) with a name.
To load in a saved Options profile, click on the "Load" button.
To list your profiles from the command line use:
ssvnc -profiles (or -list)
You can launch ssvnc and have it immediately connect to the server
by invoking it something like this:
ssvnc profile1 (launches profile named "profile1")
ssvnc hostname:0 (connect to hostname VNC disp 0 via SSL)
ssvnc vnc+ssl://hostname:0 (same)
ssvnc vnc+ssh://hostname:0 (connect to hostname VNC disp 0 via SSH)
see the Tips 5 and 9 below for more about the URL-like syntax.
More Info: More Info:
...@@ -662,20 +762,25 @@ proc help {} { ...@@ -662,20 +762,25 @@ proc help {} {
line: "user@hostname cmd=SHELL") then you get an SSH shell only: line: "user@hostname cmd=SHELL") then you get an SSH shell only:
no VNC viewer will be launched. On Windows "PUTTY" will try no VNC viewer will be launched. On Windows "PUTTY" will try
to use putty.exe (better terminal emulation than plink.exe). to use putty.exe (better terminal emulation than plink.exe).
A ShortCut for this is Ctrl-S as long as user@hostname is present A ShortCut for this is Ctrl-S as long as user@hostname is present
in the entry box. in the entry box.
3) If you use "KNOCK" for the "Remote SSH Command" (or int he display 3) If you use "KNOCK" for the "Remote SSH Command" (or int he display
line "user@hostname cmd=KNOCK") then only the port-knocking is line "user@hostname cmd=KNOCK") then only the port-knocking is
performed. A ShortCut for this is Ctrl-P as long as hostname performed.
is present in the entry box. If it is KNOCKF, i.e. an extra
"F", then the port-knocking "FINISH" sequence is sent, if any. A ShortCut for this is Ctrl-P as long as hostname is present in
A ShortCut for this Shift-Ctrl-P as long as hostname is present. the entry box.
If it is KNOCKF, i.e. an extra "F", then the port-knocking
"FINISH" sequence is sent, if any. A ShortCut for this
Shift-Ctrl-P as long as hostname is present.
4) Pressing the "Load" button or pressing Ctrl-L or Clicking the Right 4) Pressing the "Load" button or pressing Ctrl-L or Clicking the Right
mouse button on the main GUI will invoke the Load dialog. mouse button on the main GUI will invoke the Load dialog.
5) If you want to do a Direct VNC connection, WITH **NO(* SSL OR SSH 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 ENCRYPTION, use the "vnc://" prefix, e.g. vnc://far-away.east:0
This also works for reverse connections (see below). This also works for reverse connections (see below).
...@@ -720,11 +825,13 @@ proc help {} { ...@@ -720,11 +825,13 @@ proc help {} {
10) Mobile USB memory stick / flash drive usage: You can unpack 10) Mobile USB memory stick / flash drive usage: You can unpack
ssvnc to a flash drive for impromptu usage (e.g. from a friends ssvnc to a flash drive for impromptu usage (e.g. from a friends
computer) If you create a directory "Home" in the toplevel ssvnc computer).
directory, then that will be the default location for your VNC
profiles and certs. So they follow the drive this way. If you If you create a directory "Home" in the toplevel ssvnc directory,
run like this: "ssvnc ." or "ssvnc.exe ." the "Home" directory then that will be the default location for your VNC profiles
will be created for you. and certs. So they follow the drive this way. If you run like
this: "ssvnc ." or "ssvnc.exe ." the "Home" directory will be
created for you.
WARNING: if you use ssvnc from an "Internet Cafe", i.e. an WARNING: if you use ssvnc from an "Internet Cafe", i.e. an
untrusted computer, an unscrupulous person may be capturing untrusted computer, an unscrupulous person may be capturing
...@@ -773,10 +880,12 @@ proc help {} { ...@@ -773,10 +880,12 @@ proc help {} {
This only works with x11vnc (not vncserver). This only works with x11vnc (not vncserver).
12) You can change the X DISPLAY variable by typing DISPLAY=... into 12) You can change the X DISPLAY variable by typing DISPLAY=... into
VNC Host:Display and hitting Return or clicking Connect. Same for VNC Host:Display and hitting Return or clicking Connect. Same
HOME=. Setting SLEEP=n increases the amount of time waited before for HOME=. Setting SLEEP=n increases the amount of time waited
starting the viewer. On Mac, you can set DYLD_LIBRARY_PATH=... too. before starting the viewer. The env. var. SSVNC_EXTRA_SLEEP
It should propagate down the the viewer. also does this (and also Sleep: Option setting) On Mac, you
can set DYLD_LIBRARY_PATH=... too. It should propagate down
the the viewer.
13) If you want this application to be SSH only, then supply the 13) If you want this application to be SSH only, then supply the
command line option "-ssh" or set the env. var SSVNC_SSH_ONLY=1. command line option "-ssh" or set the env. var SSVNC_SSH_ONLY=1.
...@@ -1777,6 +1886,7 @@ proc ts_x11vnc_cmd {} { ...@@ -1777,6 +1886,7 @@ proc ts_x11vnc_cmd {} {
global choose_filexfer ts_filexfer global choose_filexfer ts_filexfer
global ts_x11vnc_opts ts_x11vnc_path ts_x11vnc_autoport choose_x11vnc_opts global ts_x11vnc_opts ts_x11vnc_path ts_x11vnc_autoport choose_x11vnc_opts
global ts_othervnc choose_othervnc ts_xlogin global ts_othervnc choose_othervnc ts_xlogin
global choose_sleep extra_sleep
set cmd "" set cmd ""
if {$choose_x11vnc_opts && $ts_x11vnc_path != ""} { if {$choose_x11vnc_opts && $ts_x11vnc_path != ""} {
...@@ -1798,6 +1908,12 @@ proc ts_x11vnc_cmd {} { ...@@ -1798,6 +1908,12 @@ proc ts_x11vnc_cmd {} {
set type "Xvnc.redirect" set type "Xvnc.redirect"
} }
if [info exists choose_sleep] {
if {! $choose_sleep} {
set extra_sleep ""
}
}
if {$choose_othervnc && $ts_othervnc != "find"} { if {$choose_othervnc && $ts_othervnc != "find"} {
set cmd "$cmd -redirect $ts_othervnc" set cmd "$cmd -redirect $ts_othervnc"
} elseif {$type == ""} { } elseif {$type == ""} {
...@@ -1921,7 +2037,7 @@ proc set_defaults {} { ...@@ -1921,7 +2037,7 @@ proc set_defaults {} {
global choose_xserver ts_xserver_type choose_desktop ts_desktop_type ts_unixpw ts_vncshared global choose_xserver ts_xserver_type choose_desktop ts_desktop_type ts_unixpw ts_vncshared
global choose_filexfer ts_filexfer global choose_filexfer ts_filexfer
global ts_x11vnc_opts choose_x11vnc_opts ts_x11vnc_path ts_x11vnc_autoport ts_xlogin global ts_x11vnc_opts choose_x11vnc_opts ts_x11vnc_path ts_x11vnc_autoport ts_xlogin
global ts_othervnc choose_othervnc global ts_othervnc choose_othervnc choose_sleep
global choose_ncache ts_ncache choose_multisession ts_multisession global choose_ncache ts_ncache choose_multisession ts_multisession
global ts_mode ts_desktop_size ts_desktop_depth choose_desktop_geom global ts_mode ts_desktop_size ts_desktop_depth choose_desktop_geom
global additional_port_redirs additional_port_redirs_list global additional_port_redirs additional_port_redirs_list
...@@ -1929,7 +2045,7 @@ proc set_defaults {} { ...@@ -1929,7 +2045,7 @@ proc set_defaults {} {
global sound_daemon_local_cmd sound_daemon_local_port sound_daemon_local_kill sound_daemon_x11vnc sound_daemon_local_start global sound_daemon_local_cmd sound_daemon_local_port sound_daemon_local_kill sound_daemon_x11vnc sound_daemon_local_start
global smb_su_mode smb_mount_list global smb_su_mode smb_mount_list
global use_port_knocking port_knocking_list global use_port_knocking port_knocking_list
global ycrop_string use_listen use_unixpw use_x11vnc_find unixpw_username global ycrop_string extra_sleep use_listen use_unixpw use_x11vnc_find unixpw_username
global include_list global include_list
...@@ -2010,8 +2126,9 @@ proc set_defaults {} { ...@@ -2010,8 +2126,9 @@ proc set_defaults {} {
set defs(sound_daemon_local_kill) 0 set defs(sound_daemon_local_kill) 0
set defs(sound_daemon_x11vnc) 0 set defs(sound_daemon_x11vnc) 0
set defs(use_port_knocking) 0
set defs(ycrop_string) "" set defs(ycrop_string) ""
set defs(extra_sleep) ""
set defs(use_port_knocking) 0
set defs(port_knocking_list) "" set defs(port_knocking_list) ""
set defs(include_list) "" set defs(include_list) ""
...@@ -2131,20 +2248,24 @@ proc do_viewer_windows {n} { ...@@ -2131,20 +2248,24 @@ proc do_viewer_windows {n} {
} }
set msg " set msg "
About to start the Listening VNC Viewer. About to start the Listening VNC Viewer (Reverse Connection).
VNC Viewer command to be run: The VNC Viewer command to be run is:
$cmd $cmd
The VNC server should then Reverse connect to: After the Viewer starts listening, the VNC server should
then Reverse connect to:
$ln $ln
To stop the Viewer: right click on the VNC Icon in the tray When the VNC Connection has ended **YOU MUST MANUALLY STOP**
and select 'Close listening daemon' (or similar). the Listening VNC Viewer.
You will then return to this GUI. To stop the Listening Viewer: right click on the VNC Icon in
the tray and select 'Close listening daemon' (or similar).
ONLY AFTER THAT will you return to the SSVNC GUI.
Click OK now to start the Listening VNC Viewer. Click OK now to start the Listening VNC Viewer.
" "
...@@ -2159,7 +2280,7 @@ proc do_viewer_windows {n} { ...@@ -2159,7 +2280,7 @@ proc do_viewer_windows {n} {
set wll_done 0 set wll_done 0
eval text .wll.t -width 60 -height 19 $help_font eval text .wll.t -width 64 -height 22 $help_font
button .wll.d -text "OK" -command {destroy .wll; set wll_done 1} button .wll.d -text "OK" -command {destroy .wll; set wll_done 1}
pack .wll.t .wll.d -side top -fill x pack .wll.t .wll.d -side top -fill x
...@@ -2188,6 +2309,13 @@ proc do_viewer_windows {n} { ...@@ -2188,6 +2309,13 @@ proc do_viewer_windows {n} {
set t [expr "$t * 1000"] set t [expr "$t * 1000"]
after $t after $t
} }
global extra_sleep
if {$extra_sleep != ""} {
set t $extra_sleep
mesg "sleeping an extra $t seconds..."
set t [expr "$t * 1000"]
after $t
}
mesg $cmd mesg $cmd
set emess "" set emess ""
...@@ -2426,12 +2554,33 @@ proc ssh_split {str} { ...@@ -2426,12 +2554,33 @@ proc ssh_split {str} {
return [list $ssh_user $ssh_host $ssh_port] return [list $ssh_user $ssh_host $ssh_port]
} }
proc check_debug_netstat {port str wn} {
global debug_netstat
if {! [info exists debug_netstat]} {
return
}
if {$debug_netstat == "0" || $debug_netstat == ""} {
return
}
mesg "DBG: $wn"
toplev .dbns
scroll_text_dismiss .dbns.f 82 35
center_win .dbns
.dbns.f.t insert end "LOOKING FOR PORT: $port\n\n$str"
jiggle_text .dbns.f.t
update
after 1000
}
proc launch_windows_ssh {hp file n} { proc launch_windows_ssh {hp file n} {
global is_win9x env global is_win9x env
global use_sshssl use_ssh putty_pw global use_sshssl use_ssh putty_pw
global port_knocking_list global port_knocking_list
global use_listen listening_name global use_listen listening_name
global ts_only global ts_only
global debug_netstat
set hpnew [get_ssh_hp $hp] set hpnew [get_ssh_hp $hp]
set proxy [get_ssh_proxy $hp] set proxy [get_ssh_proxy $hp]
...@@ -2500,7 +2649,7 @@ proc launch_windows_ssh {hp file n} { ...@@ -2500,7 +2649,7 @@ proc launch_windows_ssh {hp file n} {
set double_ssh "" set double_ssh ""
set p_port "" set p_port ""
if {$proxy != ""} { if {$proxy != ""} {
if [regexp -nocase {(http|https|socks|socks4|socks5)://} $proxy] { if [regexp -nocase {(http|https|socks|socks4|socks5|repeater)://} $proxy] {
set pproxy "" set pproxy ""
set sproxy1 "" set sproxy1 ""
set sproxy_rest "" set sproxy_rest ""
...@@ -2511,7 +2660,7 @@ proc launch_windows_ssh {hp file n} { ...@@ -2511,7 +2660,7 @@ proc launch_windows_ssh {hp file n} {
if {[regexp {^[ ]*$} $part]} { if {[regexp {^[ ]*$} $part]} {
continue continue
} }
if [regexp -nocase {^(http|https|socks|socks4|socks5)://} $part] { if [regexp -nocase {^(http|https|socks|socks4|socks5|repeater)://} $part] {
if {$pproxy == ""} { if {$pproxy == ""} {
set pproxy $part set pproxy $part
} else { } else {
...@@ -2933,6 +3082,7 @@ proc launch_windows_ssh {hp file n} { ...@@ -2933,6 +3082,7 @@ proc launch_windows_ssh {hp file n} {
} }
set ns [get_netstat] set ns [get_netstat]
set re ":$p_port" set re ":$p_port"
check_debug_netstat $p_port $ns $waited
append re {[ ][ ]*[0:.][0:.]*[ ][ ]*LISTEN} append re {[ ][ ]*[0:.][0:.]*[ ][ ]*LISTEN}
if [regexp $re $ns] { if [regexp $re $ns] {
set gotit 1 set gotit 1
...@@ -2945,8 +3095,17 @@ proc launch_windows_ssh {hp file n} { ...@@ -2945,8 +3095,17 @@ proc launch_windows_ssh {hp file n} {
} }
} }
set wdraw 1
if [info exists debug_netstat] {
if {$debug_netstat != "" && $debug_netstat != "0"} {
set wdraw 0
}
}
if {$is_win9x} { if {$is_win9x} {
wm withdraw . if {$wdraw} {
wm withdraw .
}
update update
win9x_plink_msg $file win9x_plink_msg $file
global win9x_plink_msg_done global win9x_plink_msg_done
...@@ -3012,7 +3171,9 @@ proc launch_windows_ssh {hp file n} { ...@@ -3012,7 +3171,9 @@ proc launch_windows_ssh {hp file n} {
if {! $do_shell} { if {! $do_shell} {
make_plink make_plink
} }
wm withdraw . if {$wdraw} {
wm withdraw .
}
update update
if {$do_shell && [regexp {FINISH} $port_knocking_list]} { if {$do_shell && [regexp {FINISH} $port_knocking_list]} {
catch {exec $com /c $file} catch {exec $com /c $file}
...@@ -3046,6 +3207,7 @@ proc launch_windows_ssh {hp file n} { ...@@ -3046,6 +3207,7 @@ proc launch_windows_ssh {hp file n} {
} }
set ns [get_netstat] set ns [get_netstat]
set re ":$use" set re ":$use"
check_debug_netstat $use $ns $waited
append re {[ ][ ]*[0:.][0:.]*[ ][ ]*LISTEN} append re {[ ][ ]*[0:.][0:.]*[ ][ ]*LISTEN}
if [regexp $re $ns] { if [regexp $re $ns] {
set plink_status yes set plink_status yes
...@@ -3228,6 +3390,7 @@ proc darwin_terminal_cmd {{title ""} {cmd ""} {bg 0}} { ...@@ -3228,6 +3390,7 @@ proc darwin_terminal_cmd {{title ""} {cmd ""} {bg 0}} {
if {! [info exists darwin_terminal]} { if {! [info exists darwin_terminal]} {
raise . raise .
tk_messageBox -type ok -icon error -message "Cannot find Darwin Terminal program." -title "Cannot find Terminal program" tk_messageBox -type ok -icon error -message "Cannot find Darwin Terminal program." -title "Cannot find Terminal program"
mac_raise
return return
} }
...@@ -3244,6 +3407,7 @@ proc darwin_terminal_cmd {{title ""} {cmd ""} {bg 0}} { ...@@ -3244,6 +3407,7 @@ proc darwin_terminal_cmd {{title ""} {cmd ""} {bg 0}} {
if {$fh == ""} { if {$fh == ""} {
raise . raise .
tk_messageBox -type ok -icon error -message "Cannot open temporary file: $tmp" -title "Cannot open file" tk_messageBox -type ok -icon error -message "Cannot open temporary file: $tmp" -title "Cannot open file"
mac_raise
return return
} }
global env global env
...@@ -3268,6 +3432,7 @@ proc darwin_terminal_cmd {{title ""} {cmd ""} {bg 0}} { ...@@ -3268,6 +3432,7 @@ proc darwin_terminal_cmd {{title ""} {cmd ""} {bg 0}} {
puts $fh { echo termpid-find-fail: termpid=$termpid mypid=$$} puts $fh { echo termpid-find-fail: termpid=$termpid mypid=$$}
puts $fh {fi} puts $fh {fi}
puts $fh {trap "rm -f $tmp; kill -TERM $termpid; kill -TERM $mypid; kill -KILL $mypid; exit 0" 0 2 15} puts $fh {trap "rm -f $tmp; kill -TERM $termpid; kill -TERM $mypid; kill -KILL $mypid; exit 0" 0 2 15}
puts $fh {osascript -e 'tell application "Terminal" to activate' >/dev/null 2>&1 &}
puts $fh "$cmd" puts $fh "$cmd"
puts $fh "sleep 1" puts $fh "sleep 1"
puts $fh {rm -f $tmp} puts $fh {rm -f $tmp}
...@@ -3559,12 +3724,14 @@ proc fetch_cert {save} { ...@@ -3559,12 +3724,14 @@ proc fetch_cert {save} {
mesg "No host:disp supplied." mesg "No host:disp supplied."
bell bell
catch {raise .} catch {raise .}
mac_raise
return return
} }
if {[regexp -- {--nohost--} $tt]} { if {[regexp -- {--nohost--} $tt]} {
mesg "No host:disp supplied." mesg "No host:disp supplied."
bell bell
catch {raise .} catch {raise .}
mac_raise
return return
} }
if {! [regexp ":" $hp]} { if {! [regexp ":" $hp]} {
...@@ -4160,6 +4327,39 @@ proc tpid {} { ...@@ -4160,6 +4327,39 @@ proc tpid {} {
return $p return $p
} }
proc repeater_proxy_check {proxy} {
if [regexp {^repeater://.*\+ID:[0-9]} $proxy] {
global env
set force 0
if [info exists env(REPEATER_FORCE)] {
if {$env(REPEATER_FORCE) != "" && $env(REPEATER_FORCE) != "0"} {
set force 1
}
}
global use_listen
if {! $use_listen} {
if {$force} {
mesg "WARNING: repeater:// ID:nnn proxy must use Listen Mode"
after 1000
} else {
bell
mesg "ERROR: repeater:// ID:nnn proxy must use Listen Mode"
after 1000
return 0
}
}
global always_verify_ssl
if [info exists always_verify_ssl] {
if {$always_verify_ssl} {
bell
mesg "WARNING: repeater:// ID:nnn Verify All Certs may fail"
after 2500
}
}
}
return 1
}
proc fini_unixpw {} { proc fini_unixpw {} {
global named_pipe_fh unixpw_tmp global named_pipe_fh unixpw_tmp
...@@ -4477,6 +4677,11 @@ proc launch_unix {hp} { ...@@ -4477,6 +4677,11 @@ proc launch_unix {hp} {
set cmd "ssvnc_cmd" set cmd "ssvnc_cmd"
set hpnew [get_ssh_hp $hp] set hpnew [get_ssh_hp $hp]
set proxy [get_ssh_proxy $hp] set proxy [get_ssh_proxy $hp]
if {! [repeater_proxy_check $proxy]} {
return
}
if {! $do_direct && ![regexp -nocase {ssh://} $hpnew]} { if {! $do_direct && ![regexp -nocase {ssh://} $hpnew]} {
if {$mycert != ""} { if {$mycert != ""} {
set cmd "$cmd -mycert '$mycert'" set cmd "$cmd -mycert '$mycert'"
...@@ -4519,6 +4724,7 @@ proc launch_unix {hp} { ...@@ -4519,6 +4724,7 @@ proc launch_unix {hp} {
} }
} }
if {$use_alpha} { if {$use_alpha} {
set cmd "$cmd -alpha" set cmd "$cmd -alpha"
} }
...@@ -4775,12 +4981,30 @@ proc launch_unix {hp} { ...@@ -4775,12 +4981,30 @@ proc launch_unix {hp} {
if {$ts_only} { if {$ts_only} {
set te "" set te ""
} }
global extra_sleep
set ssvnc_extra_sleep_save ""
if {$extra_sleep != ""} {
if [info exists env(SSVNC_EXTRA_SLEEP)] {
set ssvnc_extra_sleep_save $env(SSVNC_EXTRA_SLEEP)
}
set env(SSVNC_EXTRA_SLEEP) $extra_sleep
}
unix_terminal_cmd $geometry "SSL/SSH VNC Viewer $hp" \ unix_terminal_cmd $geometry "SSL/SSH VNC Viewer $hp" \
"$te$cmd; set +xv; ulimit -c 0; trap 'printf \"Paused. Press Enter to exit:\"; read x' QUIT; echo; echo $m; echo; echo sleep 5; echo; sleep 6" 0 $xrm1 $xrm2 $xrm3 "$te$cmd; set +xv; ulimit -c 0; trap 'printf \"Paused. Press Enter to exit:\"; read x' QUIT; echo; echo $m; echo; echo sleep 5; echo; sleep 6" 0 $xrm1 $xrm2 $xrm3
set env(SS_VNCVIEWER_SSH_CMD) "" set env(SS_VNCVIEWER_SSH_CMD) ""
set env(SS_VNCVIEWER_USE_C) "" set env(SS_VNCVIEWER_USE_C) ""
if {$extra_sleep != ""} {
if {$ssvnc_extra_sleep_save != ""} {
set env(SSVNC_EXTRA_SLEEP) $ssvnc_extra_sleep_save
} else {
catch {unset env(SSVNC_EXTRA_SLEEP)}
}
}
if {$use_sound && $sound_daemon_local_kill && $sound_daemon_local_cmd != ""} { if {$use_sound && $sound_daemon_local_kill && $sound_daemon_local_cmd != ""} {
# XXX need to kill just one... # XXX need to kill just one...
set daemon [string trim $sound_daemon_local_cmd] set daemon [string trim $sound_daemon_local_cmd]
...@@ -4804,6 +5028,7 @@ proc launch_unix {hp} { ...@@ -4804,6 +5028,7 @@ proc launch_unix {hp} {
catch {file delete $passwdfile} catch {file delete $passwdfile}
} }
wm deiconify . wm deiconify .
mac_raise
mesg "Disconnected from $hp" mesg "Disconnected from $hp"
if {[regexp {FINISH} $port_knocking_list]} { if {[regexp {FINISH} $port_knocking_list]} {
do_port_knock $pk_hp finish do_port_knock $pk_hp finish
...@@ -5035,6 +5260,7 @@ proc launch {{hp ""}} { ...@@ -5035,6 +5260,7 @@ proc launch {{hp ""}} {
global pids_before pids_after pids_new global pids_before pids_after pids_new
global env global env
global use_ssl use_ssh use_sshssl use_listen global use_ssl use_ssh use_sshssl use_listen
global vncdisplay
set debug 0 set debug 0
if {$hp == ""} { if {$hp == ""} {
...@@ -5051,6 +5277,7 @@ proc launch {{hp ""}} { ...@@ -5051,6 +5277,7 @@ proc launch {{hp ""}} {
set t [string trim $t] set t [string trim $t]
set env(SSVNC_HOME) $t set env(SSVNC_HOME) $t
mesg "set SSVNC_HOME to $t" mesg "set SSVNC_HOME to $t"
set vncdisplay ""
return 0 return 0
} }
if {[regexp {^DISPLAY=} $hpt] || [regexp {^SSVNC_DISPLAY=} $hpt]} { if {[regexp {^DISPLAY=} $hpt] || [regexp {^SSVNC_DISPLAY=} $hpt]} {
...@@ -5059,6 +5286,7 @@ proc launch {{hp ""}} { ...@@ -5059,6 +5286,7 @@ proc launch {{hp ""}} {
set t [string trim $t] set t [string trim $t]
set env(DISPLAY) $t set env(DISPLAY) $t
mesg "set DISPLAY to $t" mesg "set DISPLAY to $t"
set vncdisplay ""
global uname darwin_cotvnc global uname darwin_cotvnc
if {$uname == "Darwin"} { if {$uname == "Darwin"} {
if {$t != ""} { if {$t != ""} {
...@@ -5076,6 +5304,7 @@ proc launch {{hp ""}} { ...@@ -5076,6 +5304,7 @@ proc launch {{hp ""}} {
set env(DYLD_LIBRARY_PATH) $t set env(DYLD_LIBRARY_PATH) $t
set env(SSVNC_DYLD_LIBRARY_PATH) $t set env(SSVNC_DYLD_LIBRARY_PATH) $t
mesg "set DYLD_LIBRARY_PATH to $t" mesg "set DYLD_LIBRARY_PATH to $t"
set vncdisplay ""
return 0 return 0
} }
if {[regexp {^SLEEP=} $hpt] || [regexp {^SSVNC_EXTRA_SLEEP=} $hpt]} { if {[regexp {^SLEEP=} $hpt] || [regexp {^SSVNC_EXTRA_SLEEP=} $hpt]} {
...@@ -5084,6 +5313,24 @@ proc launch {{hp ""}} { ...@@ -5084,6 +5313,24 @@ proc launch {{hp ""}} {
set t [string trim $t] set t [string trim $t]
set env(SSVNC_EXTRA_SLEEP) $t set env(SSVNC_EXTRA_SLEEP) $t
mesg "set SSVNC_EXTRA_SLEEP to $t" mesg "set SSVNC_EXTRA_SLEEP to $t"
set vncdisplay ""
return 0
}
if {[regexp {^DEBUG_NETSTAT=} $hpt]} {
set t $hpt
regsub {^.*DEBUG_NETSTAT=} $t "" t
global debug_netstat
set debug_netstat $t
mesg "set DEBUG_NETSTAT to $t"
set vncdisplay ""
return 0
}
if {[regexp {^REPEATER_FORCE=} $hpt]} {
set t $hpt
regsub {^.*REPEATER_FORCE=} $t "" t
set env(REPEATER_FORCE) $t
mesg "set REPEATER_FORCE to $t"
set vncdisplay ""
return 0 return 0
} }
if {[regexp -nocase {^SSH.?ONLY} $hpt]} { if {[regexp -nocase {^SSH.?ONLY} $hpt]} {
...@@ -5112,12 +5359,14 @@ proc launch {{hp ""}} { ...@@ -5112,12 +5359,14 @@ proc launch {{hp ""}} {
mesg "No host:disp supplied." mesg "No host:disp supplied."
bell bell
catch {raise .} catch {raise .}
mac_raise
return return
} }
if {[regexp -- {--nohost--} $tt]} { if {[regexp -- {--nohost--} $tt]} {
mesg "No host:disp supplied." mesg "No host:disp supplied."
bell bell
catch {raise .} catch {raise .}
mac_raise
return return
} }
if {! [regexp ":" $hp]} { if {! [regexp ":" $hp]} {
...@@ -5243,6 +5492,9 @@ proc launch {{hp ""}} { ...@@ -5243,6 +5492,9 @@ proc launch {{hp ""}} {
if {$use_sshssl} { if {$use_sshssl} {
set proxy "" set proxy ""
} }
if {! [repeater_proxy_check $proxy]} {
return
}
for {set i 30} {$i < 90} {incr i} { for {set i 30} {$i < 90} {incr i} {
set try "$prefix-$i.$suffix" set try "$prefix-$i.$suffix"
...@@ -5295,6 +5547,7 @@ proc launch {{hp ""}} { ...@@ -5295,6 +5547,7 @@ proc launch {{hp ""}} {
set did_port_knock 1 set did_port_knock 1
} elseif {$use_ssh} { } elseif {$use_ssh} {
launch_windows_ssh $hp $file $n launch_windows_ssh $hp $file $n
# WE ARE DONE.
return return
} }
...@@ -5340,8 +5593,12 @@ proc launch {{hp ""}} { ...@@ -5340,8 +5593,12 @@ proc launch {{hp ""}} {
mesg "WARNING: SSL proxy contains \"@\" sign" mesg "WARNING: SSL proxy contains \"@\" sign"
after 2000 after 2000
} }
if {$use_listen} {
set env(SSVNC_REVERSE) "localhost:$port"
} else {
set env(SSVNC_LISTEN) [expr "$n2 + 5900"]
}
set env(SSVNC_PROXY) $proxy set env(SSVNC_PROXY) $proxy
set env(SSVNC_LISTEN) [expr "$n2 + 5900"]
set env(SSVNC_DEST) "$host:$port" set env(SSVNC_DEST) "$host:$port"
} }
...@@ -5442,7 +5699,7 @@ proc launch {{hp ""}} { ...@@ -5442,7 +5699,7 @@ proc launch {{hp ""}} {
if {$hn == ""} { if {$hn == ""} {
set hn "this-computer" set hn "this-computer"
} }
set listening_name "$hn:$port (or IP:$port, etc.)" set listening_name "$hn:$port (or nn.nn.nn.nn:$port, etc.)"
} }
puts $fh "accept = $hloc$port" puts $fh "accept = $hloc$port"
puts $fh "connect = localhost:$port2" puts $fh "connect = localhost:$port2"
...@@ -5471,6 +5728,7 @@ proc launch {{hp ""}} { ...@@ -5471,6 +5728,7 @@ proc launch {{hp ""}} {
set proxy_pid [exec "connect_br.exe" &] set proxy_pid [exec "connect_br.exe" &]
unset -nocomplain env(SSVNC_PROXY) unset -nocomplain env(SSVNC_PROXY)
unset -nocomplain env(SSVNC_LISTEN) unset -nocomplain env(SSVNC_LISTEN)
unset -nocomplain env(SSVNC_REVERSE)
unset -nocomplain env(SSVNC_DEST) unset -nocomplain env(SSVNC_DEST)
} }
...@@ -8380,6 +8638,46 @@ proc ts_othervnc_dialog {} { ...@@ -8380,6 +8638,46 @@ proc ts_othervnc_dialog {} {
focus .ovnc.c.e focus .ovnc.c.e
} }
proc ts_sleep_dialog {} {
toplev .eslp
wm title .eslp "Extra Sleep"
scroll_text .eslp.f 80 5
global extra_sleep
set msg {
Sleep: Enter a number to indicate how many extra seconds to sleep
while waiting for the VNC viewer to start up. On Windows this
can give extra time to enter the Putty/Plink password, etc.
}
.eslp.f.t insert end $msg
frame .eslp.c
label .eslp.c.l -anchor w -text "Extra Sleep:"
entry .eslp.c.e -width 20 -textvariable extra_sleep
pack .eslp.c.l -side left
pack .eslp.c.e -side left -expand 1 -fill x
button .eslp.cancel -text "Cancel" -command {destroy .eslp; set choose_sleep 0}
bind .eslp <Escape> {destroy .eslp; set choose_sleep 0}
wm protocol .eslp WM_DELETE_WINDOW {destroy .eslp; set choose_sleep 0}
button .eslp.done -text "Done" -command {destroy .eslp; set choose_sleep 1}
bind .eslp.c.e <Return> {destroy .eslp; set choose_sleep 1}
global choose_sleep
if {! $choose_sleep} {
set extra_sleep ""
}
pack .eslp.done .eslp.cancel .eslp.c -side bottom -fill x
pack .eslp.f -side top -fill both -expand 1
center_win .eslp
focus .eslp.c.e
}
proc ts_ncache_dialog {} { proc ts_ncache_dialog {} {
toplev .nche toplev .nche
...@@ -9911,6 +10209,10 @@ proc help_advanced_opts {} { ...@@ -9911,6 +10209,10 @@ proc help_advanced_opts {} {
in them will be applied first, and then any values in the loaded in them will be applied first, and then any values in the loaded
Profile will override them. Profile will override them.
Sleep: Enter a number to indicate how many extra seconds to sleep
while waiting for the VNC viewer to start up. On Windows this
can give extra time to enter the Putty/Plink password, etc.
ssh-agent: On Unix only: restart the GUI in the presence of ssh-agent: On Unix only: restart the GUI in the presence of
ssh-agent(1) (e.g. in case you forgot to start your agent before ssh-agent(1) (e.g. in case you forgot to start your agent before
starting this GUI). An xterm will be used to enter passphrases, starting this GUI). An xterm will be used to enter passphrases,
...@@ -10906,7 +11208,7 @@ proc set_ts_options {} { ...@@ -10906,7 +11208,7 @@ proc set_ts_options {} {
proc set_ts_adv_options {} { proc set_ts_adv_options {} {
global ts_only ts_unixpw ts_vncshared global ts_only ts_unixpw ts_vncshared
global ts_ncache ts_multisession global ts_ncache ts_multisession
global choose_othervnc darwin_cotvnc global choose_othervnc darwin_cotvnc choose_sleep
if {! $ts_only} { if {! $ts_only} {
return return
...@@ -10957,6 +11259,11 @@ proc set_ts_adv_options {} { ...@@ -10957,6 +11259,11 @@ proc set_ts_adv_options {} {
-command {if {$choose_x11vnc_opts} {ts_x11vnc_opts_dialog}} -command {if {$choose_x11vnc_opts} {ts_x11vnc_opts_dialog}}
incr i incr i
checkbutton .ot2.b$i -anchor w -variable choose_sleep -text \
"Extra Sleep" \
-command {if {$choose_sleep} {ts_sleep_dialog}}
incr i
global env global env
if {![info exists env(SSVNC_TS_ALWAYS)]} { if {![info exists env(SSVNC_TS_ALWAYS)]} {
button .ot2.b$i -anchor w -text " SSVNC Mode" \ button .ot2.b$i -anchor w -text " SSVNC Mode" \
...@@ -11059,6 +11366,15 @@ proc set_advanced_options {} { ...@@ -11059,6 +11366,15 @@ proc set_advanced_options {} {
incr i incr i
global extra_sleep
frame .oa.b$i
label .oa.b$i.l -text "Sleep: "
entry .oa.b$i.e -width 10 -textvariable extra_sleep
pack .oa.b$i.l -side left
pack .oa.b$i.e -side right -expand 1 -fill x
incr i
if {$is_windows} { if {$is_windows} {
.oa.b$ix configure -state disabled .oa.b$ix configure -state disabled
.oa.b$ia configure -state disabled .oa.b$ia configure -state disabled
...@@ -11389,7 +11705,7 @@ proc set_options {} { ...@@ -11389,7 +11705,7 @@ proc set_options {} {
incr i incr i
checkbutton .o.b$i -anchor w -variable use_listen -text \ checkbutton .o.b$i -anchor w -variable use_listen -text \
"Reverse VNC Connection (-listen)" -command {listen_adjust; if {$vncdisplay == ""} {set vncdisplay ":0"}} "Reverse VNC Connection (-LISTEN)" -command {listen_adjust; if {$vncdisplay == ""} {set vncdisplay ":0"}}
#if {$is_windows} {.o.b$i configure -state disabled} #if {$is_windows} {.o.b$i configure -state disabled}
if {$darwin_cotvnc} {.o.b$i configure -state disabled} if {$darwin_cotvnc} {.o.b$i configure -state disabled}
incr i incr i
...@@ -12042,6 +12358,8 @@ bind .f0.l <ButtonPress> {set button_gui_top 1} ...@@ -12042,6 +12358,8 @@ bind .f0.l <ButtonPress> {set button_gui_top 1}
update update
mac_raise
set didload 0 set didload 0
for {set i 0} {$i < $argc} {incr i} { for {set i 0} {$i < $argc} {incr i} {
......
...@@ -446,7 +446,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/Vncviewer vnc_unixsrc/vncview ...@@ -446,7 +446,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 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.orig/vncviewer/argsresources.c 2007-02-04 17:10:31.000000000 -0500
+++ vnc_unixsrc/vncviewer/argsresources.c 2008-02-17 13:34:30.000000000 -0500 +++ vnc_unixsrc/vncviewer/argsresources.c 2008-04-28 21:30:05.000000000 -0400
@@ -31,7 +31,7 @@ @@ -31,7 +31,7 @@
char *fallback_resources[] = { char *fallback_resources[] = {
...@@ -456,7 +456,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v ...@@ -456,7 +456,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
"Vncviewer.translations:\ "Vncviewer.translations:\
<Enter>: SelectionToVNC()\\n\ <Enter>: SelectionToVNC()\\n\
@@ -45,8 +45,14 @@ @@ -45,8 +45,58 @@
"*viewport.useRight: True", "*viewport.useRight: True",
"*viewport*Scrollbar*thumb: None", "*viewport*Scrollbar*thumb: None",
...@@ -464,6 +464,50 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v ...@@ -464,6 +464,50 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
+ "*viewport.vertical.width: 6 ", + "*viewport.vertical.width: 6 ",
+ "vncviewer*viewport.horizontal.height: 6 ", + "vncviewer*viewport.horizontal.height: 6 ",
+ "vncviewer*viewport.vertical.width: 6 ", + "vncviewer*viewport.vertical.width: 6 ",
+
+ "*viewport.horizontal.translations: #override\\n\
+ <KeyPress>Right: StartScroll(Forward)\\n\
+ <KeyRelease>Right: NotifyScroll(FullLength) EndScroll()\\n\
+ <KeyPress>Left: StartScroll(Backward)\\n\
+ <KeyRelease>Left: NotifyScroll(FullLength) EndScroll()\\n\
+ <KeyPress>Next: StartScroll(Forward)\\n\
+ <KeyRelease>Next: NotifyScroll(FullLength) EndScroll()\\n\
+ <KeyPress>Prior: StartScroll(Backward)\\n\
+ <KeyRelease>Prior: NotifyScroll(FullLength) EndScroll()\\n\
+ <KeyPress>z: StartScroll(Forward)\\n\
+ <KeyRelease>z: NotifyScroll(FullLength) EndScroll()\\n\
+ <KeyPress>a: StartScroll(Backward)\\n\
+ <KeyRelease>a: NotifyScroll(FullLength) EndScroll()\\n\
+ <KeyPress>f: StartScroll(Forward)\\n\
+ <KeyRelease>f: NotifyScroll(FullLength) EndScroll()\\n\
+ <KeyPress>b: StartScroll(Backward)\\n\
+ <KeyRelease>b: NotifyScroll(FullLength) EndScroll()\\n\
+ <KeyPress>Down: StartScroll(Forward)\\n\
+ <KeyRelease>Down: NotifyScroll(FullLength) EndScroll()\\n\
+ <KeyPress>Up: StartScroll(Backward)\\n\
+ <KeyRelease>Up: NotifyScroll(FullLength) EndScroll()",
+
+ "*viewport.vertical.translations: #override\\n\
+ <KeyPress>Down: StartScroll(Forward)\\n\
+ <KeyRelease>Down: NotifyScroll(FullLength) EndScroll()\\n\
+ <KeyPress>Up: StartScroll(Backward)\\n\
+ <KeyRelease>Up: NotifyScroll(FullLength) EndScroll()\\n\
+ <KeyPress>Next: StartScroll(Forward)\\n\
+ <KeyRelease>Next: NotifyScroll(FullLength) EndScroll()\\n\
+ <KeyPress>Prior: StartScroll(Backward)\\n\
+ <KeyRelease>Prior: NotifyScroll(FullLength) EndScroll()\\n\
+ <KeyPress>z: StartScroll(Forward)\\n\
+ <KeyRelease>z: NotifyScroll(FullLength) EndScroll()\\n\
+ <KeyPress>a: StartScroll(Backward)\\n\
+ <KeyRelease>a: NotifyScroll(FullLength) EndScroll()\\n\
+ <KeyPress>f: StartScroll(Forward)\\n\
+ <KeyRelease>f: NotifyScroll(FullLength) EndScroll()\\n\
+ <KeyPress>b: StartScroll(Backward)\\n\
+ <KeyRelease>b: NotifyScroll(FullLength) EndScroll()\\n\
+ <KeyPress>Right: StartScroll(Forward)\\n\
+ <KeyRelease>Right: NotifyScroll(FullLength) EndScroll()\\n\
+ <KeyPress>Left: StartScroll(Backward)\\n\
+ <KeyRelease>Left: NotifyScroll(FullLength) EndScroll()",
+ +
"*desktop.baseTranslations:\ "*desktop.baseTranslations:\
- <Key>F8: ShowPopup()\\n\ - <Key>F8: ShowPopup()\\n\
...@@ -472,7 +516,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v ...@@ -472,7 +516,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
<ButtonPress>: SendRFBEvent()\\n\ <ButtonPress>: SendRFBEvent()\\n\
<ButtonRelease>: SendRFBEvent()\\n\ <ButtonRelease>: SendRFBEvent()\\n\
<Motion>: SendRFBEvent()\\n\ <Motion>: SendRFBEvent()\\n\
@@ -58,23 +64,58 @@ @@ -58,23 +108,58 @@
"*serverDialog.dialog.value.translations: #override\\n\ "*serverDialog.dialog.value.translations: #override\\n\
<Key>Return: ServerDialogDone()", <Key>Return: ServerDialogDone()",
...@@ -536,7 +580,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v ...@@ -536,7 +580,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
"*popup*button1.label: Dismiss popup", "*popup*button1.label: Dismiss popup",
"*popup*button1.translations: #override\\n\ "*popup*button1.translations: #override\\n\
@@ -84,7 +125,7 @@ @@ -84,7 +169,7 @@
"*popup*button2.translations: #override\\n\ "*popup*button2.translations: #override\\n\
<Btn1Down>,<Btn1Up>: Quit()", <Btn1Down>,<Btn1Up>: Quit()",
...@@ -545,7 +589,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v ...@@ -545,7 +589,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
"*popup*button3.type: toggle", "*popup*button3.type: toggle",
"*popup*button3.translations: #override\\n\ "*popup*button3.translations: #override\\n\
<Visible>: SetFullScreenState()\\n\ <Visible>: SetFullScreenState()\\n\
@@ -115,6 +156,305 @@ @@ -115,6 +200,305 @@
"*popup*button8.translations: #override\\n\ "*popup*button8.translations: #override\\n\
<Btn1Down>,<Btn1Up>: SendRFBEvent(key,F8) HidePopup()", <Btn1Down>,<Btn1Up>: SendRFBEvent(key,F8) HidePopup()",
...@@ -851,7 +895,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v ...@@ -851,7 +895,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
NULL NULL
}; };
@@ -135,6 +475,7 @@ @@ -135,6 +519,7 @@
*/ */
AppData appData; AppData appData;
...@@ -859,12 +903,15 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v ...@@ -859,12 +903,15 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
static XtResource appDataResourceList[] = { static XtResource appDataResourceList[] = {
{"shareDesktop", "ShareDesktop", XtRBool, sizeof(Bool), {"shareDesktop", "ShareDesktop", XtRBool, sizeof(Bool),
@@ -155,14 +496,29 @@ @@ -155,14 +540,32 @@
{"userLogin", "UserLogin", XtRString, sizeof(String), {"userLogin", "UserLogin", XtRString, sizeof(String),
XtOffsetOf(AppData, userLogin), XtRImmediate, (XtPointer) 0}, XtOffsetOf(AppData, userLogin), XtRImmediate, (XtPointer) 0},
+ {"unixPW", "UnixPW", XtRString, sizeof(String), + {"unixPW", "UnixPW", XtRString, sizeof(String),
+ XtOffsetOf(AppData, unixPW), XtRImmediate, (XtPointer) 0}, + XtOffsetOf(AppData, unixPW), XtRImmediate, (XtPointer) 0},
+
+ {"repeaterUltra", "RepeaterUltra", XtRString, sizeof(String),
+ XtOffsetOf(AppData, repeaterUltra), XtRImmediate, (XtPointer) 0},
+ +
{"passwordDialog", "PasswordDialog", XtRBool, sizeof(Bool), {"passwordDialog", "PasswordDialog", XtRBool, sizeof(Bool),
XtOffsetOf(AppData, passwordDialog), XtRImmediate, (XtPointer) False}, XtOffsetOf(AppData, passwordDialog), XtRImmediate, (XtPointer) False},
...@@ -891,7 +938,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v ...@@ -891,7 +938,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
{"nColours", "NColours", XtRInt, sizeof(int), {"nColours", "NColours", XtRInt, sizeof(int),
XtOffsetOf(AppData, nColours), XtRImmediate, (XtPointer) 256}, XtOffsetOf(AppData, nColours), XtRImmediate, (XtPointer) 256},
@@ -179,9 +535,12 @@ @@ -179,9 +582,12 @@
{"requestedDepth", "RequestedDepth", XtRInt, sizeof(int), {"requestedDepth", "RequestedDepth", XtRInt, sizeof(int),
XtOffsetOf(AppData, requestedDepth), XtRImmediate, (XtPointer) 0}, XtOffsetOf(AppData, requestedDepth), XtRImmediate, (XtPointer) 0},
...@@ -905,7 +952,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v ...@@ -905,7 +952,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
{"wmDecorationWidth", "WmDecorationWidth", XtRInt, sizeof(int), {"wmDecorationWidth", "WmDecorationWidth", XtRInt, sizeof(int),
XtOffsetOf(AppData, wmDecorationWidth), XtRImmediate, (XtPointer) 4}, XtOffsetOf(AppData, wmDecorationWidth), XtRImmediate, (XtPointer) 4},
@@ -191,6 +550,9 @@ @@ -191,6 +597,9 @@
{"popupButtonCount", "PopupButtonCount", XtRInt, sizeof(int), {"popupButtonCount", "PopupButtonCount", XtRInt, sizeof(int),
XtOffsetOf(AppData, popupButtonCount), XtRImmediate, (XtPointer) 0}, XtOffsetOf(AppData, popupButtonCount), XtRImmediate, (XtPointer) 0},
...@@ -915,7 +962,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v ...@@ -915,7 +962,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
{"debug", "Debug", XtRBool, sizeof(Bool), {"debug", "Debug", XtRBool, sizeof(Bool),
XtOffsetOf(AppData, debug), XtRImmediate, (XtPointer) False}, XtOffsetOf(AppData, debug), XtRImmediate, (XtPointer) False},
@@ -206,8 +568,13 @@ @@ -206,8 +615,13 @@
{"bumpScrollPixels", "BumpScrollPixels", XtRInt, sizeof(int), {"bumpScrollPixels", "BumpScrollPixels", XtRInt, sizeof(int),
XtOffsetOf(AppData, bumpScrollPixels), XtRImmediate, (XtPointer) 20}, XtOffsetOf(AppData, bumpScrollPixels), XtRImmediate, (XtPointer) 20},
...@@ -929,7 +976,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v ...@@ -929,7 +976,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
{"qualityLevel", "QualityLevel", XtRInt, sizeof(int), {"qualityLevel", "QualityLevel", XtRInt, sizeof(int),
XtOffsetOf(AppData, qualityLevel), XtRImmediate, (XtPointer) 6}, XtOffsetOf(AppData, qualityLevel), XtRImmediate, (XtPointer) 6},
@@ -218,14 +585,55 @@ @@ -218,14 +632,55 @@
{"useRemoteCursor", "UseRemoteCursor", XtRBool, sizeof(Bool), {"useRemoteCursor", "UseRemoteCursor", XtRBool, sizeof(Bool),
XtOffsetOf(AppData, useRemoteCursor), XtRImmediate, (XtPointer) True}, XtOffsetOf(AppData, useRemoteCursor), XtRImmediate, (XtPointer) True},
...@@ -987,11 +1034,12 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v ...@@ -987,11 +1034,12 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
}; };
@@ -242,8 +650,22 @@ @@ -242,8 +697,23 @@
{"-noraiseonbeep", "*raiseOnBeep", XrmoptionNoArg, "False"}, {"-noraiseonbeep", "*raiseOnBeep", XrmoptionNoArg, "False"},
{"-passwd", "*passwordFile", XrmoptionSepArg, 0}, {"-passwd", "*passwordFile", XrmoptionSepArg, 0},
{"-user", "*userLogin", XrmoptionSepArg, 0}, {"-user", "*userLogin", XrmoptionSepArg, 0},
+ {"-unixpw", "*unixPW", XrmoptionSepArg, 0}, + {"-unixpw", "*unixPW", XrmoptionSepArg, 0},
+ {"-repeater", "*repeaterUltra", XrmoptionSepArg, 0},
{"-encodings", "*encodings", XrmoptionSepArg, 0}, {"-encodings", "*encodings", XrmoptionSepArg, 0},
- {"-bgr233", "*useBGR233", XrmoptionNoArg, "True"}, - {"-bgr233", "*useBGR233", XrmoptionNoArg, "True"},
+ {"-bgr233", "*useBGR233", XrmoptionNoArg, "256"}, + {"-bgr233", "*useBGR233", XrmoptionNoArg, "256"},
...@@ -1011,7 +1059,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v ...@@ -1011,7 +1059,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
{"-owncmap", "*forceOwnCmap", XrmoptionNoArg, "True"}, {"-owncmap", "*forceOwnCmap", XrmoptionNoArg, "True"},
{"-truecolor", "*forceTrueColour", XrmoptionNoArg, "True"}, {"-truecolor", "*forceTrueColour", XrmoptionNoArg, "True"},
{"-truecolour", "*forceTrueColour", XrmoptionNoArg, "True"}, {"-truecolour", "*forceTrueColour", XrmoptionNoArg, "True"},
@@ -253,7 +675,19 @@ @@ -253,7 +723,19 @@
{"-nojpeg", "*enableJPEG", XrmoptionNoArg, "False"}, {"-nojpeg", "*enableJPEG", XrmoptionNoArg, "False"},
{"-nocursorshape", "*useRemoteCursor", XrmoptionNoArg, "False"}, {"-nocursorshape", "*useRemoteCursor", XrmoptionNoArg, "False"},
{"-x11cursor", "*useX11Cursor", XrmoptionNoArg, "True"}, {"-x11cursor", "*useX11Cursor", XrmoptionNoArg, "True"},
...@@ -1032,7 +1080,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v ...@@ -1032,7 +1080,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
}; };
@@ -268,15 +702,73 @@ @@ -268,15 +750,77 @@
{"SendRFBEvent", SendRFBEvent}, {"SendRFBEvent", SendRFBEvent},
{"ShowPopup", ShowPopup}, {"ShowPopup", ShowPopup},
{"HidePopup", HidePopup}, {"HidePopup", HidePopup},
...@@ -1040,6 +1088,10 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v ...@@ -1040,6 +1088,10 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
+ {"HideQuality", HideQuality}, + {"HideQuality", HideQuality},
+ {"HideCompress", HideCompress}, + {"HideCompress", HideCompress},
{"ToggleFullScreen", ToggleFullScreen}, {"ToggleFullScreen", ToggleFullScreen},
+ {"JumpLeft", JumpLeft},
+ {"JumpRight", JumpRight},
+ {"JumpUp", JumpUp},
+ {"JumpDown", JumpDown},
{"SetFullScreenState", SetFullScreenState}, {"SetFullScreenState", SetFullScreenState},
{"SelectionFromVNC", SelectionFromVNC}, {"SelectionFromVNC", SelectionFromVNC},
{"SelectionToVNC", SelectionToVNC}, {"SelectionToVNC", SelectionToVNC},
...@@ -1106,7 +1158,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v ...@@ -1106,7 +1158,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
}; };
@@ -302,8 +794,8 @@ @@ -302,8 +846,8 @@
void void
usage(void) usage(void)
{ {
...@@ -1117,7 +1169,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v ...@@ -1117,7 +1169,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
"\n" "\n"
"Usage: %s [<OPTIONS>] [<HOST>][:<DISPLAY#>]\n" "Usage: %s [<OPTIONS>] [<HOST>][:<DISPLAY#>]\n"
" %s [<OPTIONS>] [<HOST>][::<PORT#>]\n" " %s [<OPTIONS>] [<HOST>][::<PORT#>]\n"
@@ -332,10 +824,148 @@ @@ -332,10 +876,154 @@
" -autopass\n" " -autopass\n"
"\n" "\n"
"Option names may be abbreviated, e.g. -bgr instead of -bgr233.\n" "Option names may be abbreviated, e.g. -bgr instead of -bgr233.\n"
...@@ -1223,6 +1275,12 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v ...@@ -1223,6 +1275,12 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
+ " it is taken as username@password. Otherwise, the program\n" + " it is taken as username@password. Otherwise, the program\n"
+ " exits with an error. Got all that?\n" + " exits with an error. Got all that?\n"
+ "\n" + "\n"
+ " -repeater str This is for use with UltraVNC repeater proxy described\n"
+ " here: http://www.uvnc.com/addons/repeater.html. The \"str\"\n"
+ " is the ID string to be sent to the repeater. E.g. ID:1234\n"
+ " In this case host:dpy on the command line is the repeater\n"
+ " server, not the VNC server. The repeater will connect you.\n"
+ "\n"
+ " New Popup actions:\n" + " New Popup actions:\n"
+ "\n" + "\n"
+ " ViewOnly: ~ -viewonly\n" + " ViewOnly: ~ -viewonly\n"
...@@ -1267,7 +1325,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v ...@@ -1267,7 +1325,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
/* /*
@@ -350,6 +980,7 @@ @@ -350,6 +1038,7 @@
int i; int i;
char *vncServerName, *colonPos; char *vncServerName, *colonPos;
int len, portOffset; int len, portOffset;
...@@ -1275,7 +1333,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v ...@@ -1275,7 +1333,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
/* Turn app resource specs into our appData structure for the rest of the /* Turn app resource specs into our appData structure for the rest of the
program to use */ program to use */
@@ -357,6 +988,23 @@ @@ -357,6 +1046,23 @@
XtGetApplicationResources(toplevel, &appData, appDataResourceList, XtGetApplicationResources(toplevel, &appData, appDataResourceList,
XtNumber(appDataResourceList), 0, 0); XtNumber(appDataResourceList), 0, 0);
...@@ -1299,7 +1357,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v ...@@ -1299,7 +1357,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
/* Add our actions to the actions table so they can be used in widget /* Add our actions to the actions table so they can be used in widget
resource specs */ resource specs */
@@ -376,6 +1024,10 @@ @@ -376,6 +1082,10 @@
return; return;
} }
...@@ -1310,7 +1368,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v ...@@ -1310,7 +1368,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
if (argc == 1) { if (argc == 1) {
vncServerName = DoServerDialog(); vncServerName = DoServerDialog();
appData.passwordDialog = True; appData.passwordDialog = True;
@@ -414,6 +1066,13 @@ @@ -414,6 +1124,13 @@
if (!len || strspn(colonPos + 1, "0123456789") != len) { if (!len || strspn(colonPos + 1, "0123456789") != len) {
usage(); usage();
} }
...@@ -3492,8 +3550,18 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/dialogs.c vnc_unixsrc/vncview ...@@ -3492,8 +3550,18 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/dialogs.c vnc_unixsrc/vncview
while (!passwordDialogDone) { while (!passwordDialogDone) {
diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncviewer/fullscreen.c diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncviewer/fullscreen.c
--- vnc_unixsrc.orig/vncviewer/fullscreen.c 2003-10-09 05:23:49.000000000 -0400 --- vnc_unixsrc.orig/vncviewer/fullscreen.c 2003-10-09 05:23:49.000000000 -0400
+++ vnc_unixsrc/vncviewer/fullscreen.c 2007-02-17 16:32:23.000000000 -0500 +++ vnc_unixsrc/vncviewer/fullscreen.c 2008-02-22 09:03:22.000000000 -0500
@@ -85,10 +85,14 @@ @@ -27,7 +27,9 @@
#include <X11/Xaw/Toggle.h>
static Bool DoBumpScroll();
+static Bool DoJumpScroll();
static void BumpScrollTimerCallback(XtPointer clientData, XtIntervalId *id);
+static void JumpScrollTimerCallback(XtPointer clientData, XtIntervalId *id);
static XtIntervalId timer;
static Bool timerSet = False;
static Bool scrollLeft, scrollRight, scrollUp, scrollDown;
@@ -85,10 +87,14 @@
Dimension oldViewportWidth, oldViewportHeight, clipWidth, clipHeight; Dimension oldViewportWidth, oldViewportHeight, clipWidth, clipHeight;
Position viewportX, viewportY; Position viewportX, viewportY;
...@@ -3508,7 +3576,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv ...@@ -3508,7 +3576,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv
XtVaSetValues(viewport, XtNforceBars, True, NULL); XtVaSetValues(viewport, XtNforceBars, True, NULL);
XtVaGetValues(viewport, XtNwidth, &oldViewportWidth, XtVaGetValues(viewport, XtNwidth, &oldViewportWidth,
XtNheight, &oldViewportHeight, NULL); XtNheight, &oldViewportHeight, NULL);
@@ -105,16 +109,23 @@ @@ -105,16 +111,23 @@
toplevelWidth = dpyWidth; toplevelWidth = dpyWidth;
} }
...@@ -3534,7 +3602,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv ...@@ -3534,7 +3602,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv
toplevelWidth = dpyWidth; toplevelWidth = dpyWidth;
toplevelHeight = dpyHeight; toplevelHeight = dpyHeight;
} }
@@ -129,7 +140,12 @@ @@ -129,7 +142,12 @@
reparenting our window to the root. The window manager will get a reparenting our window to the root. The window manager will get a
ReparentNotify and hopefully clean up its frame window. */ ReparentNotify and hopefully clean up its frame window. */
...@@ -3547,7 +3615,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv ...@@ -3547,7 +3615,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv
XReparentWindow(dpy, XtWindow(toplevel), DefaultRootWindow(dpy), 0, 0); XReparentWindow(dpy, XtWindow(toplevel), DefaultRootWindow(dpy), 0, 0);
@@ -139,6 +155,8 @@ @@ -139,6 +157,8 @@
with XReparentWindow. The last XSync seems to prevent losing with XReparentWindow. The last XSync seems to prevent losing
focus, but I don't know why. */ focus, but I don't know why. */
XSync(dpy, False); XSync(dpy, False);
...@@ -3556,7 +3624,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv ...@@ -3556,7 +3624,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv
XMoveWindow(dpy, XtWindow(toplevel), 0, 0); XMoveWindow(dpy, XtWindow(toplevel), 0, 0);
XSync(dpy, False); XSync(dpy, False);
@@ -164,25 +182,67 @@ @@ -164,25 +184,67 @@
XtManageChild(viewport); XtManageChild(viewport);
...@@ -3631,7 +3699,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv ...@@ -3631,7 +3699,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv
} }
} }
@@ -210,8 +270,14 @@ @@ -210,8 +272,14 @@
appData.fullScreen = False; appData.fullScreen = False;
...@@ -3648,7 +3716,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv ...@@ -3648,7 +3716,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv
XtUnmapWidget(toplevel); XtUnmapWidget(toplevel);
@@ -238,6 +304,9 @@ @@ -238,6 +306,9 @@
XtManageChild(viewport); XtManageChild(viewport);
XtVaSetValues(toplevel, XtNoverrideRedirect, False, NULL); XtVaSetValues(toplevel, XtNoverrideRedirect, False, NULL);
...@@ -3658,7 +3726,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv ...@@ -3658,7 +3726,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv
if ((toplevelWidth + appData.wmDecorationWidth) >= dpyWidth) if ((toplevelWidth + appData.wmDecorationWidth) >= dpyWidth)
toplevelWidth = dpyWidth - appData.wmDecorationWidth; toplevelWidth = dpyWidth - appData.wmDecorationWidth;
@@ -345,7 +414,9 @@ @@ -345,7 +416,9 @@
} }
if (scrollDown) { if (scrollDown) {
...@@ -3669,6 +3737,122 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv ...@@ -3669,6 +3737,122 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv
desktopY += appData.bumpScrollPixels; desktopY += appData.bumpScrollPixels;
if (desktopY > si.framebufferHeight - dpyHeight) if (desktopY > si.framebufferHeight - dpyHeight)
desktopY = si.framebufferHeight - dpyHeight; desktopY = si.framebufferHeight - dpyHeight;
@@ -375,3 +448,115 @@
{
DoBumpScroll();
}
+
+/* not working: */
+
+Bool
+JumpScroll(int up, int vert) {
+ scrollLeft = scrollRight = scrollUp = scrollDown = False;
+
+
+ if (appData.fullScreen) {
+ return True;
+ }
+ fprintf(stderr, "JumpScroll(%d, %d)\n", up, vert);
+
+ if (vert) {
+ if (up) {
+ scrollUp = True;
+ } else {
+ scrollDown = True;
+ }
+ } else {
+ if (up) {
+ scrollRight = True;
+ } else {
+ scrollLeft = True;
+ }
+ }
+
+ if (scrollLeft || scrollRight || scrollUp || scrollDown) {
+ if (timerSet) {
+ return True;
+ }
+
+ XtVaGetValues(desktop, XtNx, &desktopX, XtNy, &desktopY, NULL);
+ desktopX = -desktopX;
+ desktopY = -desktopY;
+ return DoJumpScroll();
+ }
+
+ if (timerSet) {
+ XtRemoveTimeOut(timer);
+ timerSet = False;
+ }
+
+ return False;
+}
+
+static Bool
+DoJumpScroll() {
+ int oldx = desktopX, oldy = desktopY;
+ int jumpH = si.framebufferWidth / 4;
+ int jumpV = si.framebufferHeight / 4;
+
+ if (scrollRight) {
+ if (desktopX < si.framebufferWidth - dpyWidth) {
+ desktopX += jumpH;
+ if (desktopX > si.framebufferWidth - dpyWidth)
+ desktopX = si.framebufferWidth - dpyWidth;
+ }
+ } else if (scrollLeft) {
+ if (desktopX > 0) {
+ desktopX -= jumpH;
+ if (desktopX < 0)
+ desktopX = 0;
+ }
+ }
+
+ if (scrollDown) {
+ if (appData.yCrop > 0 && desktopY + dpyHeight >= appData.yCrop) {
+ ;
+ } else if (desktopY < si.framebufferHeight - dpyHeight) {
+ desktopY += jumpV;
+ if (desktopY > si.framebufferHeight - dpyHeight)
+ desktopY = si.framebufferHeight - dpyHeight;
+ }
+ } else if (scrollUp) {
+ if (desktopY > 0) {
+ desktopY -= jumpV;
+ if (desktopY < 0)
+ desktopY = 0;
+ }
+ }
+
+ if (oldx != desktopX || oldy != desktopY) {
+ XawViewportSetCoordinates(viewport, desktopX, desktopY);
+ timer = XtAppAddTimeOut(appContext, appData.bumpScrollTime,
+ JumpScrollTimerCallback, NULL);
+ timerSet = True;
+ return True;
+ }
+
+ timerSet = False;
+ return False;
+}
+
+static void
+JumpScrollTimerCallback(XtPointer clientData, XtIntervalId *id) {
+ DoJumpScroll();
+}
+void JumpRight(Widget w, XEvent *ev, String *params, Cardinal *num_params) {
+ JumpScroll(1, 0);
+}
+void JumpLeft(Widget w, XEvent *ev, String *params, Cardinal *num_params) {
+ JumpScroll(0, 0);
+}
+void JumpUp(Widget w, XEvent *ev, String *params, Cardinal *num_params) {
+ JumpScroll(1, 1);
+}
+void JumpDown(Widget w, XEvent *ev, String *params, Cardinal *num_params) {
+ JumpScroll(0, 1);
+}
+
+
diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/hextile.c vnc_unixsrc/vncviewer/hextile.c diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/hextile.c vnc_unixsrc/vncviewer/hextile.c
--- vnc_unixsrc.orig/vncviewer/hextile.c 2007-02-17 22:33:46.000000000 -0500 --- vnc_unixsrc.orig/vncviewer/hextile.c 2007-02-17 22:33:46.000000000 -0500
+++ vnc_unixsrc/vncviewer/hextile.c 2007-02-17 22:48:39.000000000 -0500 +++ vnc_unixsrc/vncviewer/hextile.c 2007-02-17 22:48:39.000000000 -0500
...@@ -4403,7 +4587,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/popup_ad vnc_unixsrc/vncviewe ...@@ -4403,7 +4587,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 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.orig/vncviewer/rfbproto.c 2004-03-11 13:14:39.000000000 -0500
+++ vnc_unixsrc/vncviewer/rfbproto.c 2008-02-17 10:38:27.000000000 -0500 +++ vnc_unixsrc/vncviewer/rfbproto.c 2008-05-11 11:20:45.000000000 -0400
@@ -57,6 +57,44 @@ @@ -57,6 +57,44 @@
static Bool HandleTight16(int rx, int ry, int rw, int rh); static Bool HandleTight16(int rx, int ry, int rw, int rh);
static Bool HandleTight32(int rx, int ry, int rw, int rh); static Bool HandleTight32(int rx, int ry, int rw, int rh);
...@@ -4875,14 +5059,14 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie ...@@ -4875,14 +5059,14 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ break; + break;
+ } + }
+ } + }
+
- return (int)secType;
+ free(secTypes); + free(secTypes);
+ +
+ if (secType == rfbSecTypeInvalid) { + if (secType == rfbSecTypeInvalid) {
+ fprintf(stderr, "Server did not offer supported security type\n"); + fprintf(stderr, "Server did not offer supported security type\n");
+ } + }
+
- return (int)secType;
+ return (int)secType; + return (int)secType;
} }
...@@ -5470,13 +5654,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie ...@@ -5470,13 +5654,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
{ {
- rfbFramebufferUpdateRequestMsg fur; - rfbFramebufferUpdateRequestMsg fur;
+ rfbFramebufferUpdateRequestMsg fur; + rfbFramebufferUpdateRequestMsg fur;
+
- fur.type = rfbFramebufferUpdateRequest;
- fur.incremental = incremental ? 1 : 0;
- fur.x = Swap16IfLE(x);
- fur.y = Swap16IfLE(y);
- fur.w = Swap16IfLE(w);
- fur.h = Swap16IfLE(h);
+ if (appData.fileActive) { + if (appData.fileActive) {
+ if (time(NULL) < last_filexfer + 2) { + if (time(NULL) < last_filexfer + 2) {
+// fprintf(stderr, "skip SendFramebufferUpdateRequest: %d - %d\n", last_filexfer, time(NULL)); +// fprintf(stderr, "skip SendFramebufferUpdateRequest: %d - %d\n", last_filexfer, time(NULL));
...@@ -5486,8 +5664,12 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie ...@@ -5486,8 +5664,12 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ } + }
+ } + }
- if (!WriteExact(rfbsock, (char *)&fur, sz_rfbFramebufferUpdateRequestMsg)) - fur.type = rfbFramebufferUpdateRequest;
- return False; - fur.incremental = incremental ? 1 : 0;
- fur.x = Swap16IfLE(x);
- fur.y = Swap16IfLE(y);
- fur.w = Swap16IfLE(w);
- fur.h = Swap16IfLE(h);
+ fur.type = rfbFramebufferUpdateRequest; + fur.type = rfbFramebufferUpdateRequest;
+ fur.incremental = incremental ? 1 : 0; + fur.incremental = incremental ? 1 : 0;
+ fur.x = Swap16IfLE(x); + fur.x = Swap16IfLE(x);
...@@ -5501,11 +5683,13 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie ...@@ -5501,11 +5683,13 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ sent_FBU = 2; + sent_FBU = 2;
+ } + }
- return True; - if (!WriteExact(rfbsock, (char *)&fur, sz_rfbFramebufferUpdateRequestMsg))
- return False;
+ if (!WriteExact(rfbsock, (char *)&fur, sz_rfbFramebufferUpdateRequestMsg)) { + if (!WriteExact(rfbsock, (char *)&fur, sz_rfbFramebufferUpdateRequestMsg)) {
+ return False; + return False;
+ } + }
+
- return True;
+ return True; + return True;
} }
...@@ -5516,13 +5700,6 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie ...@@ -5516,13 +5700,6 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
{ {
- rfbPointerEventMsg pe; - rfbPointerEventMsg pe;
+ rfbPointerEventMsg pe; + rfbPointerEventMsg pe;
+
+ if (appData.fileActive) {
+ if (time(NULL) < last_filexfer + 2) {
+ //fprintf(stderr, "skip SendPointerEvent: %d - %d\n", last_filexfer, time(NULL));
+ return True;
+ }
+ }
- pe.type = rfbPointerEvent; - pe.type = rfbPointerEvent;
- pe.buttonMask = buttonMask; - pe.buttonMask = buttonMask;
...@@ -5535,6 +5712,13 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie ...@@ -5535,6 +5712,13 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
- pe.x = Swap16IfLE(x); - pe.x = Swap16IfLE(x);
- pe.y = Swap16IfLE(y); - pe.y = Swap16IfLE(y);
- return WriteExact(rfbsock, (char *)&pe, sz_rfbPointerEventMsg); - return WriteExact(rfbsock, (char *)&pe, sz_rfbPointerEventMsg);
+ if (appData.fileActive) {
+ if (time(NULL) < last_filexfer + 2) {
+ //fprintf(stderr, "skip SendPointerEvent: %d - %d\n", last_filexfer, time(NULL));
+ return True;
+ }
+ }
+
+ pe.type = rfbPointerEvent; + pe.type = rfbPointerEvent;
+ pe.buttonMask = buttonMask; + pe.buttonMask = buttonMask;
+ if (x < 0) x = 0; + if (x < 0) x = 0;
...@@ -5568,7 +5752,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie ...@@ -5568,7 +5752,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
} }
@@ -942,281 +1093,675 @@ @@ -942,281 +1093,716 @@
Bool Bool
SendClientCutText(char *str, int len) SendClientCutText(char *str, int len)
{ {
...@@ -5872,7 +6056,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie ...@@ -5872,7 +6056,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ if (db) write(2, fxfer, len); + if (db) write(2, fxfer, len);
+ if (db) fprintf(stderr, "\n"); + if (db) fprintf(stderr, "\n");
+ write(filexfer_sock, fxfer, len); + write(filexfer_sock, fxfer, len);
} + }
+ len = (hdr[4] << 24) | (hdr[5] << 16) | (hdr[6] << 8) | hdr[7]; + len = (hdr[4] << 24) | (hdr[5] << 16) | (hdr[6] << 8) | hdr[7];
+ if (hdr[1] == rfbFileHeader && len != rfbRErrorCmd) { + if (hdr[1] == rfbFileHeader && len != rfbRErrorCmd) {
+ if (db) fprintf(stderr, "Got rfbFileTransfer: rfbFileHeader\n"); + if (db) fprintf(stderr, "Got rfbFileTransfer: rfbFileHeader\n");
...@@ -5884,7 +6068,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie ...@@ -5884,7 +6068,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ if (db) write(2, fxfer, len); + if (db) write(2, fxfer, len);
+ if (db) fprintf(stderr, "\n"); + if (db) fprintf(stderr, "\n");
+ write(filexfer_sock, fxfer, len); + write(filexfer_sock, fxfer, len);
+ } }
+ if (db) fprintf(stderr, "Got rfbFileTransfer done.\n"); + if (db) fprintf(stderr, "Got rfbFileTransfer done.\n");
+ skip_XtUpdateAll = 0; + skip_XtUpdateAll = 0;
...@@ -5909,43 +6093,81 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie ...@@ -5909,43 +6093,81 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+Bool +Bool
+HandleRFBServerMessage() +HandleRFBServerMessage()
+{ +{
+ int db = 0; + static int db = -1;
+ rfbServerToClientMsg msg; + rfbServerToClientMsg msg;
- bytesPerLine = rect.r.w * myFormat.bitsPerPixel / 8; - bytesPerLine = rect.r.w * myFormat.bitsPerPixel / 8;
- linesToRead = BUFFER_SIZE / bytesPerLine; - linesToRead = BUFFER_SIZE / bytesPerLine;
+ if (!ReadFromRFBServer((char *)&msg, 1)) { + if (db < 0) {
+ return False; + if (getenv("DEBUG_RFB_SMSG")) {
+ db = 1;
+ } else {
+ db = 0;
+ }
+ } + }
- while (rect.r.h > 0) { - while (rect.r.h > 0) {
- if (linesToRead > rect.r.h) - if (linesToRead > rect.r.h)
- linesToRead = rect.r.h; - linesToRead = rect.r.h;
+ if (msg.type == rfbFileTransfer) { + if (!ReadFromRFBServer((char *)&msg, 1)) {
+ return HandleFileXfer(); + return False;
+ } + }
- if (!ReadFromRFBServer(buffer,bytesPerLine * linesToRead)) - if (!ReadFromRFBServer(buffer,bytesPerLine * linesToRead))
- return False; - return False;
+ switch (msg.type) { + if (msg.type == rfbFileTransfer) {
+ return HandleFileXfer();
+ }
- CopyDataToScreen(buffer, rect.r.x, rect.r.y, rect.r.w, - CopyDataToScreen(buffer, rect.r.x, rect.r.y, rect.r.w,
- linesToRead); - linesToRead);
+ switch (msg.type) {
- rect.r.h -= linesToRead;
- rect.r.y += linesToRead;
+ case rfbSetColourMapEntries: + case rfbSetColourMapEntries:
+ { + {
+ int i; + int i;
+ CARD16 rgb[3]; + CARD16 rgb[3];
+ XColor xc; + XColor xc;
- rect.r.h -= linesToRead;
- rect.r.y += linesToRead;
+ if (!ReadFromRFBServer(((char *)&msg) + 1, sz_rfbSetColourMapEntriesMsg - 1)) { + if (!ReadFromRFBServer(((char *)&msg) + 1, sz_rfbSetColourMapEntriesMsg - 1)) {
+ return False; + return False;
+ } }
- break;
- case rfbEncodingCopyRect:
- {
- rfbCopyRect cr;
-
- if (!ReadFromRFBServer((char *)&cr, sz_rfbCopyRect))
- return False;
-
- cr.srcX = Swap16IfLE(cr.srcX);
- cr.srcY = Swap16IfLE(cr.srcY);
-
- /* If RichCursor encoding is used, we should extend our
- "cursor lock area" (previously set to destination
- rectangle) to the source rectangle as well. */
- SoftCursorLockArea(cr.srcX, cr.srcY, rect.r.w, rect.r.h);
-
- if (appData.copyRectDelay != 0) {
- XFillRectangle(dpy, desktopWin, srcGC, cr.srcX, cr.srcY,
- rect.r.w, rect.r.h);
- XFillRectangle(dpy, desktopWin, dstGC, rect.r.x, rect.r.y,
- rect.r.w, rect.r.h);
- XSync(dpy,False);
- usleep(appData.copyRectDelay * 1000);
- XFillRectangle(dpy, desktopWin, dstGC, rect.r.x, rect.r.y,
- rect.r.w, rect.r.h);
- XFillRectangle(dpy, desktopWin, srcGC, cr.srcX, cr.srcY,
- rect.r.w, rect.r.h);
- }
+ msg.scme.firstColour = Swap16IfLE(msg.scme.firstColour); + msg.scme.firstColour = Swap16IfLE(msg.scme.firstColour);
+ msg.scme.nColours = Swap16IfLE(msg.scme.nColours); + msg.scme.nColours = Swap16IfLE(msg.scme.nColours);
+
- XCopyArea(dpy, desktopWin, desktopWin, gc, cr.srcX, cr.srcY,
- rect.r.w, rect.r.h, rect.r.x, rect.r.y);
+ for (i = 0; i < msg.scme.nColours; i++) { + for (i = 0; i < msg.scme.nColours; i++) {
+ if (!ReadFromRFBServer((char *)rgb, 6)) { + if (!ReadFromRFBServer((char *)rgb, 6)) {
+ return False; + return False;
...@@ -5962,11 +6184,30 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie ...@@ -5962,11 +6184,30 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ } + }
+ xc.flags = DoRed|DoGreen|DoBlue; + xc.flags = DoRed|DoGreen|DoBlue;
+ XStoreColor(dpy, cmap, &xc); + XStoreColor(dpy, cmap, &xc);
} + }
+
break; break;
- }
+ } + }
+
- case rfbEncodingRRE:
- {
- switch (myFormat.bitsPerPixel) {
- case 8:
- if (!HandleRRE8(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- return False;
- break;
- case 16:
- if (!HandleRRE16(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- return False;
- break;
- case 32:
- if (!HandleRRE32(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- return False;
- break;
- }
- break;
- }
+ case rfbFramebufferUpdate: + case rfbFramebufferUpdate:
+ { + {
+ rfbFramebufferUpdateRectHeader rect; + rfbFramebufferUpdateRectHeader rect;
...@@ -5981,55 +6222,96 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie ...@@ -5981,55 +6222,96 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ int area_raw = 0; + int area_raw = 0;
+ if (db) fprintf(stderr, "FBU-0: %.6f\n", dnow()); + if (db) fprintf(stderr, "FBU-0: %.6f\n", dnow());
- case rfbEncodingCopyRect: - case rfbEncodingCoRRE:
- { - {
- rfbCopyRect cr; - switch (myFormat.bitsPerPixel) {
- - case 8:
- if (!ReadFromRFBServer((char *)&cr, sz_rfbCopyRect)) - if (!HandleCoRRE8(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- return False; - return False;
- - break;
- cr.srcX = Swap16IfLE(cr.srcX); - case 16:
- cr.srcY = Swap16IfLE(cr.srcY); - if (!HandleCoRRE16(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- - return False;
- /* If RichCursor encoding is used, we should extend our - break;
- "cursor lock area" (previously set to destination - case 32:
- rectangle) to the source rectangle as well. */ - if (!HandleCoRRE32(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- SoftCursorLockArea(cr.srcX, cr.srcY, rect.r.w, rect.r.h); - return False;
- - break;
- if (appData.copyRectDelay != 0) { - }
- XFillRectangle(dpy, desktopWin, srcGC, cr.srcX, cr.srcY, - break;
- rect.r.w, rect.r.h); - }
- XFillRectangle(dpy, desktopWin, dstGC, rect.r.x, rect.r.y,
- rect.r.w, rect.r.h);
- XSync(dpy,False);
- usleep(appData.copyRectDelay * 1000);
- XFillRectangle(dpy, desktopWin, dstGC, rect.r.x, rect.r.y,
- rect.r.w, rect.r.h);
- XFillRectangle(dpy, desktopWin, srcGC, cr.srcX, cr.srcY,
- rect.r.w, rect.r.h);
+ int skip_incFBU = 0; + int skip_incFBU = 0;
+ sent_FBU = -1; + sent_FBU = -1;
+
- case rfbEncodingHextile:
- {
- switch (myFormat.bitsPerPixel) {
- case 8:
- if (!HandleHextile8(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- return False;
- break;
- case 16:
- if (!HandleHextile16(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- return False;
- break;
- case 32:
- if (!HandleHextile32(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- return False;
- break;
+ if (!ReadFromRFBServer(((char *)&msg.fu) + 1, sz_rfbFramebufferUpdateMsg - 1)) { + if (!ReadFromRFBServer(((char *)&msg.fu) + 1, sz_rfbFramebufferUpdateMsg - 1)) {
+ return False; + return False;
} }
- XCopyArea(dpy, desktopWin, desktopWin, gc, cr.srcX, cr.srcY,
- rect.r.w, rect.r.h, rect.r.x, rect.r.y);
+ msg.fu.nRects = Swap16IfLE(msg.fu.nRects);
- break; - break;
- } - }
+ for (i = 0; i < msg.fu.nRects; i++) {
+ if (!ReadFromRFBServer((char *)&rect, sz_rfbFramebufferUpdateRectHeader)) { - case rfbEncodingZlib:
+ return False; - {
+ } - switch (myFormat.bitsPerPixel) {
+ - case 8:
+ rect.encoding = Swap32IfLE(rect.encoding); - if (!HandleZlib8(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
+ if (rect.encoding == rfbEncodingLastRect) { - return False;
+ break; - break;
+ } - case 16:
+ - if (!HandleZlib16(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- return False;
- break;
- case 32:
- if (!HandleZlib32(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- return False;
- break;
- }
- break;
- }
+ msg.fu.nRects = Swap16IfLE(msg.fu.nRects);
- case rfbEncodingTight:
- {
- switch (myFormat.bitsPerPixel) {
- case 8:
- if (!HandleTight8(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- return False;
- break;
- case 16:
- if (!HandleTight16(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- return False;
- break;
- case 32:
- if (!HandleTight32(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- return False;
- break;
- }
- break;
- }
+ for (i = 0; i < msg.fu.nRects; i++) {
+ if (!ReadFromRFBServer((char *)&rect, sz_rfbFramebufferUpdateRectHeader)) {
+ return False;
+ }
+
+ rect.encoding = Swap32IfLE(rect.encoding);
+ if (rect.encoding == rfbEncodingLastRect) {
+ break;
+ }
+
+ rect.r.x = Swap16IfLE(rect.r.x); + rect.r.x = Swap16IfLE(rect.r.x);
+ rect.r.y = Swap16IfLE(rect.r.y); + rect.r.y = Swap16IfLE(rect.r.y);
+ rect.r.w = Swap16IfLE(rect.r.w); + rect.r.w = Swap16IfLE(rect.r.w);
...@@ -6300,8 +6582,41 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie ...@@ -6300,8 +6582,41 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ unsigned int maxColor=(myFormat.redMax<<myFormat.redShift)| + unsigned int maxColor=(myFormat.redMax<<myFormat.redShift)|
+ (myFormat.greenMax<<myFormat.greenShift)| + (myFormat.greenMax<<myFormat.greenShift)|
+ (myFormat.blueMax<<myFormat.blueShift); + (myFormat.blueMax<<myFormat.blueShift);
+ static int ZRLE32 = -1;
+
+ if (ZRLE32 < 0) {
+ /* for debugging or workaround e.g. BE display to LE */
+ if (getenv("ZRLE32")) {
+ if (strstr(getenv("ZRLE32"), "24Up")) {
+ ZRLE32 = 3;
+ } else if (strstr(getenv("ZRLE32"), "24Down")) {
+ ZRLE32 = 2;
+ } else {
+ ZRLE32 = 1;
+ }
+ } else {
+ ZRLE32 = 0;
+ }
+ }
+
+if (db) fprintf(stderr, "maxColor: 0x%x mfbigEnding: %d\n", maxColor, myFormat.bigEndian); +if (db) fprintf(stderr, "maxColor: 0x%x mfbigEnding: %d\n", maxColor, myFormat.bigEndian);
+ if ((myFormat.bigEndian && (maxColor&0xff)==0) || (!myFormat.bigEndian && (maxColor&0xff000000)==0)) { +
+ if (ZRLE32 == 1) {
+if (db) fprintf(stderr, "HandleZRLE32\n");
+ if (!HandleZRLE32(rect.r.x,rect.r.y,rect.r.w,rect.r.h)) {
+ return False;
+ }
+ } else if (ZRLE32 == 2) {
+if (db) fprintf(stderr, "HandleZRLE24Down\n");
+ if (!HandleZRLE24Down(rect.r.x,rect.r.y,rect.r.w,rect.r.h)) {
+ return False;
+ }
+ } else if (ZRLE32 == 3) {
+if (db) fprintf(stderr, "HandleZRLE24Up\n");
+ if (!HandleZRLE24Up(rect.r.x,rect.r.y,rect.r.w,rect.r.h)) {
+ return False;
+ }
+ } else if ((myFormat.bigEndian && (maxColor&0xff)==0) || (!myFormat.bigEndian && (maxColor&0xff000000)==0)) {
+if (db) fprintf(stderr, "HandleZRLE24\n"); +if (db) fprintf(stderr, "HandleZRLE24\n");
+ if (!HandleZRLE24(rect.r.x,rect.r.y,rect.r.w,rect.r.h)) { + if (!HandleZRLE24(rect.r.x,rect.r.y,rect.r.w,rect.r.h)) {
+ return False; + return False;
...@@ -6330,105 +6645,27 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie ...@@ -6330,105 +6645,27 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ return False; + return False;
+ } + }
- case rfbEncodingRRE: - default:
- { - fprintf(stderr,"Unknown rect encoding %d\n",
- switch (myFormat.bitsPerPixel) { - (int)rect.encoding);
- case 8: - return False;
- if (!HandleRRE8(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- return False;
- break;
- case 16:
- if (!HandleRRE16(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- return False;
- break;
- case 32:
- if (!HandleRRE32(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- return False;
- break;
- }
- break;
- } - }
+ /* Now we may discard "soft cursor locks". */ + /* Now we may discard "soft cursor locks". */
+ if (db) fprintf(stderr, "FBU-SUL1 %.6f\n", dnow()); + if (db) fprintf(stderr, "FBU-SUL1 %.6f\n", dnow());
- case rfbEncodingCoRRE: - /* Now we may discard "soft cursor locks". */
- { - SoftCursorUnlockScreen();
- switch (myFormat.bitsPerPixel) { - }
- case 8:
- if (!HandleCoRRE8(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- return False;
- break;
- case 16:
- if (!HandleCoRRE16(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- return False;
- break;
- case 32:
- if (!HandleCoRRE32(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- return False;
- break;
- }
- break;
- }
+ SoftCursorUnlockScreen(); + SoftCursorUnlockScreen();
+
- case rfbEncodingHextile:
- {
- switch (myFormat.bitsPerPixel) {
- case 8:
- if (!HandleHextile8(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- return False;
- break;
- case 16:
- if (!HandleHextile16(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- return False;
- break;
- case 32:
- if (!HandleHextile32(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- return False;
- break;
+ if (db) fprintf(stderr, "FBU-SUL2 %.6f\n", dnow()); + if (db) fprintf(stderr, "FBU-SUL2 %.6f\n", dnow());
} + }
- break; +
- }
- case rfbEncodingZlib:
- {
- switch (myFormat.bitsPerPixel) {
- case 8:
- if (!HandleZlib8(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- return False;
- break;
- case 16:
- if (!HandleZlib16(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- return False;
- break;
- case 32:
- if (!HandleZlib32(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- return False;
- break;
+ if (1 || area_copyrect) { + if (1 || area_copyrect) {
+ if (db) fprintf(stderr, "FBU-XSN1 %.6f\n", dnow()); + if (db) fprintf(stderr, "FBU-XSN1 %.6f\n", dnow());
+ XSync(dpy, False); + XSync(dpy, False);
+ if (db) fprintf(stderr, "FBU-XSN2 %.6f\n", dnow()); + if (db) fprintf(stderr, "FBU-XSN2 %.6f\n", dnow());
} + }
- break;
- }
-
- case rfbEncodingTight:
- {
- switch (myFormat.bitsPerPixel) {
- case 8:
- if (!HandleTight8(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- return False;
- break;
- case 16:
- if (!HandleTight16(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- return False;
- break;
- case 32:
- if (!HandleTight32(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
- return False;
- break;
+ sent_FBU = 0; + sent_FBU = 0;
+ /* + /*
+ * we need to be careful since Xt events are processed + * we need to be careful since Xt events are processed
...@@ -6457,23 +6694,11 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie ...@@ -6457,23 +6694,11 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ SendFramebufferUpdateRequest(0, 0, si.framebufferWidth, + SendFramebufferUpdateRequest(0, 0, si.framebufferWidth,
+ si.framebufferHeight, False); + si.framebufferHeight, False);
+ } + }
} + }
- break;
- }
-
- default:
- fprintf(stderr,"Unknown rect encoding %d\n",
- (int)rect.encoding);
- return False;
- }
-
- /* Now we may discard "soft cursor locks". */
- SoftCursorUnlockScreen();
- }
#ifdef MITSHM #ifdef MITSHM
/* if using shared memory PutImage, make sure that the X server has /* if using shared memory PutImage, make sure that the X server has
@@ -1224,59 +1769,149 @@ @@ -1224,59 +1810,149 @@
mainly to avoid copyrect using invalid screen contents - not sure mainly to avoid copyrect using invalid screen contents - not sure
if we'd need it otherwise. */ if we'd need it otherwise. */
...@@ -6504,12 +6729,12 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie ...@@ -6504,12 +6729,12 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
{ {
- Window toplevelWin; - Window toplevelWin;
+ Window toplevelWin; + Window toplevelWin;
+
- XBell(dpy, 0);
+ if (appData.useBell) { + if (appData.useBell) {
+ XBell(dpy, 0); + XBell(dpy, 0);
+ } + }
+
- XBell(dpy, 0);
+ if (appData.raiseOnBeep) { + if (appData.raiseOnBeep) {
+ toplevelWin = XtWindow(toplevel); + toplevelWin = XtWindow(toplevel);
+ XMapRaised(dpy, toplevelWin); + XMapRaised(dpy, toplevelWin);
...@@ -6656,7 +6881,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie ...@@ -6656,7 +6881,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
} }
@@ -1296,26 +1931,47 @@ @@ -1296,26 +1972,47 @@
#define CONCAT2(a,b) a##b #define CONCAT2(a,b) a##b
#define CONCAT2E(a,b) CONCAT2(a,b) #define CONCAT2E(a,b) CONCAT2(a,b)
...@@ -6704,7 +6929,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie ...@@ -6704,7 +6929,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
#undef BPP #undef BPP
/* /*
@@ -1358,9 +2014,9 @@ @@ -1358,9 +2055,9 @@
" %s significant bit in each byte is leftmost on the screen.\n", " %s significant bit in each byte is leftmost on the screen.\n",
(format->bigEndian ? "Most" : "Least")); (format->bigEndian ? "Most" : "Least"));
} else { } else {
...@@ -6716,7 +6941,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie ...@@ -6716,7 +6941,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
(format->bigEndian ? "Most" : "Least")); (format->bigEndian ? "Most" : "Least"));
} }
if (format->trueColour) { if (format->trueColour) {
@@ -1462,4 +2118,3 @@ @@ -1462,4 +2159,3 @@
cinfo->src = &jpegSrcManager; cinfo->src = &jpegSrcManager;
} }
...@@ -7263,9 +7488,557 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/tunnel.c vnc_unixsrc/vncviewe ...@@ -7263,9 +7488,557 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/tunnel.c vnc_unixsrc/vncviewe
} }
sprintf(lastArgv, "localhost::%d", localPort); sprintf(lastArgv, "localhost::%d", localPort);
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 2008-02-17 13:52:41.000000000 -0500
@@ -0,0 +1,544 @@
+'\" t
+.\" ** The above line should force tbl to be a preprocessor **
+.\" Man page for X vncviewer
+.\"
+.\" Copyright (C) 1998 Marcus.Brinkmann@ruhr-uni-bochum.de
+.\" Copyright (C) 2000,2001 Red Hat, Inc.
+.\" Copyright (C) 2001-2003 Constantin Kaplinsky <const@ce.cctpu.edu.ru>
+.\"
+.\" You may distribute under the terms of the GNU General Public
+.\" License as specified in the file LICENCE.TXT that comes with the
+.\" TightVNC distribution.
+.\"
+.TH vncviewer 1 "January 2003" "" "TightVNC"
+.SH NAME
+vncviewer \- an X viewer client for VNC
+.SH SYNOPSIS
+.B vncviewer
+.RI [\| options \|]
+.RI [\| host \|][\| :display \|]
+.br
+.B vncviewer
+.RI [\| options \|]
+.RI [\| host \|][\| ::port \|]
+.br
+.B vncviewer
+.RI [\| options \|]
+.IR \-listen
+.RI [\| display \|]
+.br
+.B vncviewer
+.IR \-help
+.br
+.SH DESCRIPTION
+.B vncviewer
+is an Xt\-based client application for the VNC (Virtual Network
+Computing) system. It can connect to any VNC\-compatible server such
+as \fBXvnc\fR or WinVNC, allowing you to control desktop environment
+of a different machine.
+
+You can use F8 to display a pop\-up utility menu. Press F8 twice to
+pass single F8 to the remote side.
+.SH OPTIONS
+.TP
+\fB\-help\fR
+Prints a short usage notice to stderr.
+.TP
+\fB\-listen\fR
+Make the viewer listen on port 5500+\fIdisplay\fR for reverse
+connections from a server. WinVNC supports reverse connections using
+the "Add New Client" menu option, or the \-connect command line
+option. \fBXvnc\fR requires the use of the helper program
+\fBvncconnect\fR.
+.TP
+\fB\-via\fR \fIgateway\fR
+Automatically create encrypted TCP tunnel to the \fIgateway\fR machine
+before connection, connect to the \fIhost\fR through that tunnel
+(TightVNC\-specific). By default, this option invokes SSH local port
+forwarding, assuming that SSH client binary can be accessed as
+/usr/bin/ssh. Note that when using the \fB\-via\fR option, the host
+machine name should be specified as known to the gateway machine, e.g.
+"localhost" denotes the \fIgateway\fR, not the machine where vncviewer
+was launched. See the ENVIRONMENT section below for the information on
+configuring the \fB\-via\fR option.
+.TP
+\fB\-shared\fR
+When connecting, specify that a shared connection is requested. In
+TightVNC, this is the default mode, allowing you to share the desktop
+with other clients already using it.
+.TP
+\fB\-noshared\fR
+When connecting, specify that the session may not be shared. This
+would either disconnect other connected clients or refuse your
+connection, depending on the server configuration.
+.TP
+\fB\-viewonly\fR
+Disable transfer of mouse and keyboard events from the client to the
+server.
+.TP
+\fB\-fullscreen\fR
+Start in full\-screen mode. Please be aware that operating in
+full\-screen mode may confuse X window managers. Typically, such
+conflicts cause incorrect handling of input focus or make the viewer
+window disappear mysteriously. See the grabKeyboard setting in the
+RESOURCES section below for a method to solve input focus problem.
+.TP
+\fB\-noraiseonbeep\fR
+By default, the viewer shows and raises its window on remote beep
+(bell) event. This option disables such behaviour
+(TightVNC\-specific).
+.TP
+\fB\-user\fR \fIusername\fR
+User name for Unix login authentication. Default is to use current
+Unix user name. If this option was given, the viewer will prefer Unix
+login authentication over the standard VNC authentication.
+.TP
+\fB\-passwd\fR \fIpasswd\-file\fR
+File from which to get the password (as generated by the
+\fBvncpasswd\fR(1) program). This option affects only the standard VNC
+authentication.
+.TP
+\fB\-encodings\fR \fIencoding\-list\fR
+TightVNC supports several different compression methods to encode
+screen updates; this option specifies a set of them to use in order of
+preference. Encodings are specified separated with spaces, and must
+thus be enclosed in quotes if more than one is specified. Available
+encodings, in default order for a remote connection, are "copyrect
+tight hextile zlib corre rre raw". For a local connection (to the same
+machine), the default order to try is "raw copyrect tight hextile zlib
+corre rre". Raw encoding is always assumed as a last option if no
+other encoding can be used for some reason. For more information on
+encodings, see the section ENCODINGS below.
+.TP
+\fB\-bgr233\fR
+Always use the BGR233 format to encode pixel data. This reduces
+network traffic, but colors may be represented inaccurately. The
+bgr233 format is an 8\-bit "true color" format, with 2 bits blue, 3
+bits green, and 3 bits red.
+.TP
+\fB\-owncmap\fR
+Try to use a PseudoColor visual and a private colormap. This allows
+the VNC server to control the colormap.
+.TP
+\fB\-truecolour\fR, \fB\-truecolor\fR
+Try to use a TrueColor visual.
+.TP
+\fB\-depth\fR \fIdepth\fR
+On an X server which supports multiple TrueColor visuals of different
+depths, attempt to use the specified one (in bits per pixel); if
+successful, this depth will be requested from the VNC server.
+.TP
+\fB\-compresslevel \fIlevel\fR
+Use specified compression \fIlevel\fR (0..9) for "tight" and "zlib"
+encodings (TightVNC\-specific). Level 1 uses minimum of CPU time and
+achieves weak compression ratios, while level 9 offers best
+compression but is slow in terms of CPU time consumption on the server
+side. Use high levels with very slow network connections, and low
+levels when working over high\-speed LANs. It's not recommended to use
+compression level 0, reasonable choices start from the level 1.
+.TP
+\fB\-quality \fIlevel\fR
+Use the specified JPEG quality \fIlevel\fR (0..9) for the "tight"
+encoding (TightVNC\-specific). Quality level 0 denotes bad image
+quality but very impressive compression ratios, while level 9 offers
+very good image quality at lower compression ratios. Note that the
+"tight" encoder uses JPEG to encode only those screen areas that look
+suitable for lossy compression, so quality level 0 does not always
+mean unacceptable image quality.
+.TP
+\fB\-nojpeg\fR
+Disable lossy JPEG compression in Tight encoding (TightVNC\-specific).
+Disabling JPEG compression is not a good idea in typical cases, as
+that makes the Tight encoder less efficient. You might want to use
+this option if it's absolutely necessary to achieve perfect image
+quality (see also the \fB\-quality\fR option).
+.TP
+\fB\-nocursorshape\fR
+Disable cursor shape updates, protocol extensions used to handle
+remote cursor movements locally on the client side
+(TightVNC\-specific). Using cursor shape updates decreases delays with
+remote cursor movements, and can improve bandwidth usage dramatically.
+.TP
+\fB\-x11cursor\fR
+Use a real X11 cursor with X-style cursor shape updates, instead of
+drawing the remote cursor on the framebuffer. This option also
+disables the dot cursor, and disables cursor position updates in
+non-fullscreen mode.
+.TP
+\fB\-autopass\fR
+Read a plain-text password from stdin. This option affects only the
+standard VNC authentication.
+
+.SH Enhanced TightVNC Viewer (SSVNC) OPTIONS
+.TP
+Enhanced TightVNC Viewer (SSVNC) web page is located at:
+.TP
+http://www.karlrunge.com/x11vnc/ssvnc.html
+.TP
+Note: ZRLE and ZYWRLE encodings are now supported.
+.TP
+Note: F9 is shortcut to Toggle FullScreen mode.
+.TP
+\fB\-use64\fR
+In \fB\-bgr233\fR mode, use 64 colors instead of 256.
+.TP
+\fB\-bgr222\fR
+Same as \fB\-use64\fR.
+.TP
+\fB\-use8\fR
+In \fB\-bgr233\fR mode, use 8 colors instead of 256.
+.TP
+\fB\-bgr111\fR
+Same as \fB\-use8\fR.
+.TP
+\fB\-16bpp\fR
+If the vnc viewer X display is depth 24 at 32bpp
+request a 16bpp format from the VNC server to cut
+network traffic by up to 2X, then tranlate the
+pixels to 32bpp locally.
+.TP
+\fB\-bgr565\fR
+Same as \fB\-16bpp\fR.
+.TP
+\fB\-grey\fR
+Use a grey scale for the 16- and 8\fB\-bpp\fR modes.
+.TP
+\fB\-alpha\fR
+Use alphablending transparency for local cursors
+requires: x11vnc server, both client and server
+must be 32bpp and same endianness.
+.TP
+\fB\-ycrop\fR n
+Only show the top n rows of the framebuffer. For
+use with x11vnc \fB\-ncache\fR client caching option
+to help "hide" the pixel cache region.
+Use a negative value (e.g. \fB\-1\fR) for autodetection.
+Autodetection will always take place if the remote
+fb height is more than 2 times the width.
+.TP
+\fB\-sbwidth\fR n
+Scrollbar width for x11vnc \fB\-ncache\fR mode (\fB\-ycrop\fR),
+default is very narrow: 2 pixels, it is narrow to
+avoid distraction in \fB\-ycrop\fR mode.
+.TP
+\fB\-nobell\fR
+Disable bell.
+.TP
+\fB\-rawlocal\fR
+Prefer raw encoding for localhost, default is
+no, i.e. assumes you have a SSH tunnel instead.
+.TP
+\fB\-graball\fR
+Grab the entire X server when in fullscreen mode,
+needed by some old window managers like fvwm2.
+.TP
+\fB\-popupfix\fR
+Warp the popup back to the pointer position,
+needed by some old window managers like fvwm2.
+.TP
+\fB\-grabkbd\fR
+Grab the X keyboard when in fullscreen mode,
+needed by some window managers. Same as \fB\-grabkeyboard\fR.
+\fB\-grabkbd\fR is the default, use \fB\-nograbkbd\fR to disable.
+.TP
+\fB\-bs\fR, \fB\-nobs\fR
+Whether or not to use X server Backingstore for the
+main viewer window. The default is to not, mainly
+because most Linux, etc, systems X servers disable
+*all* Backingstore by default. To re\fB\-enable\fR it put
+Option "Backingstore"
+in the Device section of /etc/X11/xorg.conf.
+In \fB\-bs\fR mode with no X server backingstore, whenever an
+area of the screen is re\fB\-exposed\fR it must go out to the
+VNC server to retrieve the pixels. This is too slow.
+In \fB\-nobs\fR mode, memory is allocated by the viewer to
+provide its own backing of the main viewer window. This
+actually makes some activities faster (changes in large
+regions) but can appear to "flash" too much.
+.TP
+\fB\-noshm\fR
+Disable use of MIT shared memory extension (not recommended)
+.TP
+\fB\-termchat\fR
+Do the UltraVNC chat in the terminal vncviewer is in
+instead of in an independent window.
+.TP
+\fB\-unixpw\fR
+str Useful for logging into x11vnc in \fB\-unixpw\fR mode. "str" is a
+string that allows many ways to enter the Unix Username
+and Unix Password. These characters: username, newline,
+password, newline are sent to the VNC server after any VNC
+authentication has taken place. Under x11vnc they are
+used for the \fB\-unixpw\fR login. Other VNC servers could do
+something similar.
+You can also indicate "str" via the environment
+variable SSVNC_UNIXPW.
+Note that the Escape key is actually sent first to tell
+x11vnc to not echo the Unix Username back to the VNC
+viewer. Set SSVNC_UNIXPW_NOESC=1 to override this.
+If str is ".", then you are prompted at the command line
+for the username and password in the normal way. If str is
+"-" the stdin is read via getpass(3) for username@password.
+Otherwise if str is a file, it is opened and the first line
+read is taken as the Unix username and the 2nd as the
+password. If str prefixed by "rm:" the file is removed
+after reading. Otherwise, if str has a "@" character,
+it is taken as username@password. Otherwise, the program
+exits with an error. Got all that?
+.TP
+\fB New Popup actions:\fR
+
+ ViewOnly: ~ -viewonly
+ Disable Bell: ~ -nobell
+ Cursor Shape: ~ -nocursorshape
+ X11 Cursor: ~ -x11cursor
+ Cursor Alphablend: ~ -alpha
+ Toggle Tight/ZRLE: ~ -encodings ...
+ Toggle ZRLE/ZYWRLE: ~ -encodings zywrle...
+ Quality Level ~ -quality (both Tight and ZYWRLE)
+ Compress Level ~ -compresslevel
+ Disable JPEG: ~ -nojpeg (Tight)
+ Full Color as many colors as local screen allows.
+ Grey scale (16 & 8-bpp) ~ -grey, for low colors 16/8bpp modes only.
+ 16 bit color (BGR565) ~ -16bpp / -bgr565
+ 8 bit color (BGR233) ~ -bgr233
+ 256 colors ~ -bgr233 default # of colors.
+ 64 colors ~ -bgr222 / -use64
+ 8 colors ~ -bgr111 / -use8
+ Set Y Crop (y-max) ~ -ycrop
+ Set Scrollbar Width ~ -sbwidth
+
+ UltraVNC Extensions:
+
+ Set 1/n Server Scale Ultravnc ext. Scale desktop by 1/n.
+ Text Chat Ultravnc ext. Do Text Chat.
+ File Transfer Ultravnc ext. File xfer via Java helper.
+ Single Window Ultravnc ext. Grab and view a single window.
+ (select then click on the window you want).
+ Disable Remote Input Ultravnc ext. Try to prevent input and
+ viewing of monitor at physical display.
+
+ Note: the Ultravnc extensions only apply to servers that support
+ them. x11vnc/libvncserver supports some of them.
+
+.SH ENCODINGS
+The server supplies information in whatever format is desired by the
+client, in order to make the client as easy as possible to implement.
+If the client represents itself as able to use multiple formats, the
+server will choose one.
+
+.I Pixel format
+refers to the representation of an individual pixel. The most common
+formats are 24 and 16 bit "true\-color" values, and 8\-bit "color map"
+representations, where an arbitrary map converts the color number to
+RGB values.
+
+.I Encoding
+refers to how a rectangle of pixels are sent (all pixel information in
+VNC is sent as rectangles). All rectangles come with a header giving
+the location and size of the rectangle and an encoding type used by
+the data which follows. These types are listed below.
+.TP
+.B Raw
+The raw encoding simply sends width*height pixel values. All clients
+are required to support this encoding type. Raw is also the fastest
+when the server and viewer are on the same machine, as the connection
+speed is essentially infinite and raw encoding minimizes processing
+time.
+.TP
+.B CopyRect
+The Copy Rectangle encoding is efficient when something is being
+moved; the only data sent is the location of a rectangle from which
+data should be copied to the current location. Copyrect could also be
+used to efficiently transmit a repeated pattern.
+.TP
+.B RRE
+The Rise\-and\-Run\-length\-Encoding is basically a 2D version of
+run\-length encoding (RLE). In this encoding, a sequence of identical
+pixels are compressed to a single value and repeat count. In VNC, this
+is implemented with a background color, and then specifications of an
+arbitrary number of subrectangles and color for each. This is an
+efficient encoding for large blocks of constant color.
+.TP
+.B CoRRE
+This is a minor variation on RRE, using a maximum of 255x255 pixel
+rectangles. This allows for single\-byte values to be used, reducing
+packet size. This is in general more efficient, because the savings
+from sending 1\-byte values generally outweighs the losses from the
+(relatively rare) cases where very large regions are painted the same
+color.
+.TP
+.B Hextile
+Here, rectangles are split up in to 16x16 tiles, which are sent in a
+predetermined order. The data within the tiles is sent either raw or
+as a variant on RRE. Hextile encoding is usually the best choice for
+using in high\-speed network environments (e.g. Ethernet local\-area
+networks).
+.TP
+.B Zlib
+Zlib is a very simple encoding that uses zlib library to compress raw
+pixel data. This encoding achieves good compression, but consumes a
+lot of CPU time. Support for this encoding is provided for
+compatibility with VNC servers that might not understand Tight
+encoding which is more efficient than Zlib in nearly all real\-life
+situations.
+.TP
+.B Tight
+Like Zlib encoding, Tight encoding uses zlib library to compress the
+pixel data, but it pre\-processes data to maximize compression ratios,
+and to minimize CPU usage on compression. Also, JPEG compression may
+be used to encode color\-rich screen areas (see the description of
+\-quality and \-nojpeg options above). Tight encoding is usually the
+best choice for low\-bandwidth network environments (e.g. slow modem
+connections).
+.TP
+.B ZRLE
+The SSVNC viewer has ported the RealVNC (www.realvnc.com) ZRLE encoding
+to the unix tightvnc viewer.
+.TP
+.B ZYWRLE
+The SSVNC viewer has ported the Hitachi lossy wavelet based ZRLE
+encoding from http://mobile.hitachi-system.co.jp/publications/ZYWRLE/
+to the unix tightvnc viewer.
+.SH RESOURCES
+X resources that \fBvncviewer\fR knows about, aside from the
+normal Xt resources, are as follows:
+.TP
+.B shareDesktop
+Equivalent of \fB\-shared\fR/\fB\-noshared\fR options. Default true.
+.TP
+.B viewOnly
+Equivalent of \fB\-viewonly\fR option. Default false.
+.TP
+.B fullScreen
+Equivalent of \fB\-fullscreen\fR option. Default false.
+.TP
+.B grabKeyboard
+Grab keyboard in full-screen mode. This can help to solve problems
+with losing keyboard focus. Default false.
+.TP
+.B raiseOnBeep
+Equivalent of \fB\-noraiseonbeep\fR option, when set to false. Default
+true.
+.TP
+.B passwordFile
+Equivalent of \fB\-passwd\fR option.
+.TP
+.B userLogin
+Equivalent of \fB\-user\fR option.
+.TP
+.B passwordDialog
+Whether to use a dialog box to get the password (true) or get it from
+the tty (false). Irrelevant if \fBpasswordFile\fR is set. Default
+false.
+.TP
+.B encodings
+Equivalent of \fB\-encodings\fR option.
+.TP
+.B compressLevel
+Equivalent of \fB\-compresslevel\fR option (TightVNC\-specific).
+.TP
+.B qualityLevel
+Equivalent of \fB\-quality\fR option (TightVNC\-specific).
+.TP
+.B enableJPEG
+Equivalent of \fB\-nojpeg\fR option, when set to false. Default true.
+.TP
+.B useRemoteCursor
+Equivalent of \fB\-nocursorshape\fR option, when set to false
+(TightVNC\-specific). Default true.
+.TP
+.B useBGR233
+Equivalent of \fB\-bgr233\fR option. Default false.
+.TP
+.B nColours
+When using BGR233, try to allocate this many "exact" colors from the
+BGR233 color cube. When using a shared colormap, setting this resource
+lower leaves more colors for other X clients. Irrelevant when using
+truecolor. Default is 256 (i.e. all of them).
+.TP
+.B useSharedColours
+If the number of "exact" BGR233 colors successfully allocated is less
+than 256 then the rest are filled in using the "nearest" colors
+available. This resource says whether to only use the "exact" BGR233
+colors for this purpose, or whether to use other clients' "shared"
+colors as well. Default true (i.e. use other clients' colors).
+.TP
+.B forceOwnCmap
+Equivalent of \fB\-owncmap\fR option. Default false.
+.TP
+.B forceTrueColour
+Equivalent of \fB\-truecolour\fR option. Default false.
+.TP
+.B requestedDepth
+Equivalent of \fB\-depth\fR option.
+.TP
+.B useSharedMemory
+Use MIT shared memory extension if on the same machine as the X
+server. Default true.
+.TP
+.B wmDecorationWidth, wmDecorationHeight
+The total width and height taken up by window manager decorations.
+This is used to calculate the maximum size of the VNC viewer window.
+Default is width 4, height 24.
+.TP
+.B bumpScrollTime, bumpScrollPixels
+When in full screen mode and the VNC desktop is bigger than the X
+display, scrolling happens whenever the mouse hits the edge of the
+screen. The maximum speed of scrolling is bumpScrollPixels pixels
+every bumpScrollTime milliseconds. The actual speed of scrolling will
+be slower than this, of course, depending on how fast your machine is.
+Default 20 pixels every 25 milliseconds.
+.TP
+.B popupButtonCount
+The number of buttons in the popup window. See the README file for
+more information on how to customize the buttons.
+.TP
+.B debug
+For debugging. Default false.
+.TP
+.B rawDelay, copyRectDelay
+For debugging, see the README file for details. Default 0 (off).
+.SH ENVIRONMENT
+When started with the \fB\-via\fR option, vncviewer reads the
+\fBVNC_VIA_CMD\fR environment variable, expands patterns beginning
+with the "%" character, and executes result as a command assuming that
+it would create TCP tunnel that should be used for VNC connection. If
+not set, this environment variable defaults to "/usr/bin/ssh -f -L
+%L:%H:%R %G sleep 20".
+
+The following patterns are recognized in the \fBVNC_VIA_CMD\fR (note
+that all the patterns %G, %H, %L and %R must be present in the command
+template):
+.TP
+.B %%
+A literal "%";
+.TP
+.B %G
+gateway host name;
+.TP
+.B %H
+remote VNC host name, as known to the gateway;
+.TP
+.B %L
+local TCP port number;
+.TP
+.B %R
+remote TCP port number.
+.SH SEE ALSO
+\fBvncserver\fR(1), \fBXvnc\fR(1), \fBvncpasswd\fR(1),
+\fBvncconnect\fR(1), \fBssh\fR(1)
+.SH AUTHORS
+Original VNC was developed in AT&T Laboratories Cambridge. TightVNC
+additions was implemented by Constantin Kaplinsky. Many other people
+participated in development, testing and support.
+
+\fBMan page authors:\fR
+.br
+Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>,
+.br
+Terran Melconian <terran@consistent.org>,
+.br
+Tim Waugh <twaugh@redhat.com>,
+.br
+Constantin Kaplinsky <const@ce.cctpu.edu.ru>
diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncviewer/vncviewer.c diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncviewer/vncviewer.c
--- vnc_unixsrc.orig/vncviewer/vncviewer.c 2004-01-13 09:22:05.000000000 -0500 --- vnc_unixsrc.orig/vncviewer/vncviewer.c 2004-01-13 09:22:05.000000000 -0500
+++ vnc_unixsrc/vncviewer/vncviewer.c 2008-02-17 13:27:17.000000000 -0500 +++ vnc_unixsrc/vncviewer/vncviewer.c 2008-04-28 21:20:06.000000000 -0400
@@ -22,6 +22,7 @@ @@ -22,6 +22,7 @@
*/ */
...@@ -7445,7 +8218,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi ...@@ -7445,7 +8218,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi
/* The -listen option is used to make us a daemon process which listens for /* The -listen option is used to make us a daemon process which listens for
incoming connections from servers, rather than actively connecting to a incoming connections from servers, rather than actively connecting to a
@@ -45,89 +203,1154 @@ @@ -45,89 +203,1172 @@
listenForIncomingConnections() returns, setting the listenSpecified listenForIncomingConnections() returns, setting the listenSpecified
flag. */ flag. */
...@@ -7540,6 +8313,24 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi ...@@ -7540,6 +8313,24 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi
+ if (!ConnectToRFBServer(vncServerHost, vncServerPort)) { + if (!ConnectToRFBServer(vncServerHost, vncServerPort)) {
+ exit(1); + exit(1);
+ } + }
+ if (appData.repeaterUltra != NULL) {
+ char tmp[256];
+ if (ReadFromRFBServer(tmp, 12)) {
+ if (strstr(tmp, "RFB 000.000") == tmp) {
+ int i;
+ for (i=0; i<256; i++) {
+ tmp[i] = '\0';
+ }
+ for (i=0; i<250; i++) {
+ if (i >= strlen(appData.repeaterUltra)) {
+ break;
+ }
+ tmp[i] = appData.repeaterUltra[i];
+ }
+ WriteExact(rfbsock, tmp,250);
+ }
+ }
+ }
+ } + }
/* Initialise the VNC connection, including reading the password */ /* Initialise the VNC connection, including reading the password */
...@@ -8638,7 +9429,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi ...@@ -8638,7 +9429,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 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.orig/vncviewer/vncviewer.h 2004-03-11 13:14:40.000000000 -0500
+++ vnc_unixsrc/vncviewer/vncviewer.h 2008-02-17 12:36:58.000000000 -0500 +++ vnc_unixsrc/vncviewer/vncviewer.h 2008-04-28 21:08:16.000000000 -0400
@@ -51,7 +51,7 @@ @@ -51,7 +51,7 @@
(((l) & 0x0000ff00) << 8) | \ (((l) & 0x0000ff00) << 8) | \
(((l) & 0x000000ff) << 24)) : (l)) (((l) & 0x000000ff) << 24)) : (l))
...@@ -8648,7 +9439,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi ...@@ -8648,7 +9439,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi
#define FLASH_PORT_OFFSET 5400 #define FLASH_PORT_OFFSET 5400
#define LISTEN_PORT_OFFSET 5500 #define LISTEN_PORT_OFFSET 5500
@@ -68,51 +68,74 @@ @@ -68,51 +68,75 @@
/* argsresources.c */ /* argsresources.c */
typedef struct { typedef struct {
...@@ -8723,6 +9514,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi ...@@ -8723,6 +9514,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi
+ +
+ char *userLogin; + char *userLogin;
+ char *unixPW; + char *unixPW;
+ char *repeaterUltra;
+ +
+ char *passwordFile; + char *passwordFile;
+ Bool passwordDialog; + Bool passwordDialog;
...@@ -8764,7 +9556,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi ...@@ -8764,7 +9556,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi
extern char *fallback_resources[]; extern char *fallback_resources[];
extern char vncServerHost[]; extern char vncServerHost[];
@@ -130,10 +153,11 @@ @@ -130,10 +154,11 @@
/* colour.c */ /* colour.c */
extern unsigned long BGR233ToPixel[]; extern unsigned long BGR233ToPixel[];
...@@ -8777,7 +9569,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi ...@@ -8777,7 +9569,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi
extern void SetVisualAndCmap(); extern void SetVisualAndCmap();
@@ -157,13 +181,40 @@ @@ -157,13 +182,40 @@
extern void DesktopInitBeforeRealization(); extern void DesktopInitBeforeRealization();
extern void DesktopInitAfterRealization(); extern void DesktopInitAfterRealization();
...@@ -8818,7 +9610,19 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi ...@@ -8818,7 +9610,19 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi
extern void ServerDialogDone(Widget w, XEvent *event, String *params, extern void ServerDialogDone(Widget w, XEvent *event, String *params,
Cardinal *num_params); Cardinal *num_params);
extern char *DoServerDialog(); extern char *DoServerDialog();
@@ -207,6 +258,18 @@ @@ -181,6 +233,11 @@
extern void FullScreenOn();
extern void FullScreenOff();
+extern void JumpLeft(Widget w, XEvent *event, String *params, Cardinal *num_params);
+extern void JumpRight(Widget w, XEvent *event, String *params, Cardinal *num_params);
+extern void JumpUp(Widget w, XEvent *event, String *params, Cardinal *num_params);
+extern void JumpDown(Widget w, XEvent *event, String *params, Cardinal *num_params);
+
/* listen.c */
extern void listenForIncomingConnections();
@@ -207,6 +264,18 @@
Cardinal *num_params); Cardinal *num_params);
extern void CreatePopup(); extern void CreatePopup();
...@@ -8837,7 +9641,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi ...@@ -8837,7 +9641,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi
/* rfbproto.c */ /* rfbproto.c */
extern int rfbsock; extern int rfbsock;
@@ -229,6 +292,15 @@ @@ -229,6 +298,15 @@
extern Bool SendClientCutText(char *str, int len); extern Bool SendClientCutText(char *str, int len);
extern Bool HandleRFBServerMessage(); extern Bool HandleRFBServerMessage();
...@@ -8853,7 +9657,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi ...@@ -8853,7 +9657,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi
extern void PrintPixelFormat(rfbPixelFormat *format); extern void PrintPixelFormat(rfbPixelFormat *format);
/* selection.c */ /* selection.c */
@@ -241,8 +313,9 @@ @@ -241,8 +319,9 @@
/* shm.c */ /* shm.c */
...@@ -8864,7 +9668,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi ...@@ -8864,7 +9668,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi
/* sockets.c */ /* sockets.c */
@@ -271,3 +344,63 @@ @@ -271,3 +350,63 @@
extern XtAppContext appContext; extern XtAppContext appContext;
extern Display* dpy; extern Display* dpy;
extern Widget toplevel; extern Widget toplevel;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment