Commit d5cba7a5 authored by runge's avatar runge

x11vnc: kill gui_pid on exit in -connect/-connect_or_exit mode.

   -grablocal n experiment (not compiled by default).  -macuskbd
   option for macosx for orig uskdb code. keycode=N remote contol
   cmd.  Find dpy look at non-NFS cookies in /tmp.  Fix gui tray
   insertion on recent gnome dt. Fix connect_file bug. Sync SSVNC
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -39,7 +39,7 @@
# and then a 2nd CONNECT to the destination VNC server.)
#
# 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'
# command (openssl(1) must in installed).
......@@ -259,8 +259,12 @@ if [ "X$reverse" != "X" ]; then
# check proxy usage under reverse connection:
if [ "X$use_ssh" = "X" -a "X$use_sshssl" = "X" ]; then
echo ""
if echo "$proxy" | egrep "repeater://" > /dev/null; then
:
else
echo "*Warning*: SSL -listen and a Web proxy does not make sense."
sleep 3
fi
elif echo "$proxy" | grep "," > /dev/null; then
:
else
......@@ -443,6 +447,9 @@ findfree() {
# removes files, etc.
final() {
echo ""
if [ "X$tmp_cfg" != "X" ]; then
rm -f $tmp_cfg
fi
if [ "X$SS_VNCVIEWER_RM" != "X" ]; then
rm -f $SS_VNCVIEWER_RM 2>/dev/null
fi
......@@ -502,6 +509,11 @@ 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
mytmp() {
tf=$1
......@@ -509,7 +521,7 @@ mytmp() {
if [ -d "$tf" ]; then
echo "tmp file $tf still exists as a directory."
exit 1
elif [ -L "$tf" ]; then
elif [ $dL "$tf" ]; then
echo "tmp file $tf still exists as a symlink."
exit 1
elif [ -f "$tf" ]; then
......@@ -564,50 +576,43 @@ pcode() {
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) {
$ENV{PPROXY_SOCKS} = 1;
$first = $1;
} elsif ($first =~ m,^socks5://(\S*)$,i) {
$ENV{PPROXY_SOCKS} = 5;
$first = $1;
} elsif ($first =~ m,^https?://(\S*)$,i) {
$ENV{PPROXY_SOCKS} = "";
$first = $1;
foreach my $var (qw(PPROXY_PROXY PPROXY_SOCKS PPROXY_DEST PPROXY_LISTEN
PPROXY_REVERSE PPROXY_REPEATER PPROXY_REMOVE PPROXY_KILLPID PPROXY_SLEEP)) {
if (0 || $ENV{SS_DEBUG}) {
print STDERR "$var: $ENV{$var}\n";
}
}
if ($ENV{PPROXY_SOCKS} ne "" && $ENV{PPROXY_PROXY} !~ m,^socks5?://,i) {
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 $connect = $ENV{PPROXY_DEST};
my $mode_2nd = "";
if ($second ne "") {
if ($second =~ m,^socks4?://(\S*)$,i) {
$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;
}
($second, $mode_2nd) = url_parse($second);
}
my $mode_3rd = "";
if ($third ne "") {
if ($third =~ m,^socks4?://(\S*)$,i) {
$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;
}
($third, $mode_3rd) = url_parse($third);
}
print STDERR "\n";
print STDERR "PPROXY v0.2: a tool for Web proxies and SOCKS connections.\n";
print STDERR "proxy_host: $proxy_host\n";
......@@ -615,10 +620,29 @@ print STDERR "proxy_port: $proxy_port\n";
print STDERR "proxy_connect: $connect\n";
print STDERR "pproxy_params: $ENV{PPROXY_PROXY}\n";
print STDERR "pproxy_listen: $ENV{PPROXY_LISTEN}\n";
print STDERR "pproxy_reverse: $ENV{PPROXY_REVERSE}\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 = "";
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(
Listen => 2,
LocalAddr => "localhost",
......@@ -626,7 +650,7 @@ if ($ENV{PPROXY_LISTEN} != "") {
Proto => "tcp"
);
if (! $listen_sock) {
die "pproxy: $!\n";
die "pproxy: $! -- PPROXY_LISTEN\n";
}
my $ip;
($listen_handle, $ip) = $listen_sock->accept();
......@@ -647,6 +671,112 @@ if (! $sock) {
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 {
my ($CONNECT, $w) = @_;
......@@ -771,6 +901,18 @@ sub connection {
close $sock;
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 {
# Web Proxy:
......@@ -799,76 +941,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 {
my($in, $out) = @_;
$RIN = $WIN = $EIN = "";
......@@ -943,6 +1015,24 @@ if [ "X$use_ssh" = "X1" ]; then
# let user override ssh via $SSH
ssh=${SSH:-"ssh -x"}
if [ "X$SSVNC_LIM_ACCEPT_PRELOAD" != "X" ]; then
SSVNC_LIM_ACCEPT_PRELOAD="$SSVNC_BASEDIR/$SSVNC_UNAME/$SSVNC_LIM_ACCEPT_PRELOAD"
fi
if [ "X$SSVNC_LIM_ACCEPT_PRELOAD" != "X" ]; then
echo ""
echo "SSVNC_LIM_ACCEPT_PRELOAD=$SSVNC_LIM_ACCEPT_PRELOAD"
fi
if [ "X$SSVNC_LIM_ACCEPT_PRELOAD" != "X" -a -f "$SSVNC_LIM_ACCEPT_PRELOAD" ]; then
plvar=LD_PRELOAD
if uname | grep Darwin >/dev/null; then
plvar="DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_INSERT_LIBRARIES"
fi
ssh="env $plvar=$SSVNC_LIM_ACCEPT_PRELOAD $ssh"
else
SSVNC_LIM_ACCEPT_PRELOAD=""
fi
if echo "$proxy" | egrep '(http|https|socks|socks4|socks5)://' > /dev/null; then
# Handle Web or SOCKS proxy(ies) for the initial connect.
Kecho host=$host
......@@ -1182,6 +1272,7 @@ Kecho proxy=$proxy
fi
if [ "X$SSVNC_EXTRA_SLEEP" != "X" ]; then
echo "sleep $SSVNC_EXTRA_SLEEP"
sleep $SSVNC_EXTRA_SLEEP
fi
......@@ -1258,10 +1349,11 @@ Kecho proxy=$proxy
c=0
pssh=""
mssh=`echo "$ssh" | sed -e 's/^env.*ssh/ssh/'`
while [ $c -lt 30 ]
do
p=`expr $pmark + $c`
if ps -p "$p" 2>&1 | grep "$ssh" > /dev/null; then
if ps -p "$p" 2>&1 | grep "$mssh" > /dev/null; then
pssh=$p
break
fi
......@@ -1269,6 +1361,8 @@ Kecho proxy=$proxy
done
if [ "X$getport" != "X" ]; then
:
elif [ "X$SSVNC_LIM_ACCEPT_PRELOAD" != "X" ] ; then
sleep 2
elif [ "X$ssh_cmd" = "Xsleep $ssh_sleep" ] ; then
#echo T sleep 1
sleep 1
......@@ -1281,12 +1375,12 @@ Kecho proxy=$proxy
sleep 5
fi
echo ""
#reset
stty sane
if [ "X$SSVNC_EXTRA_SLEEP" != "X" ]; then
#echo T sleep $SSVNC_EXTRA_SLEEP
echo "sleep $SSVNC_EXTRA_SLEEP"
sleep $SSVNC_EXTRA_SLEEP
fi
#reset
stty sane
#echo "pssh=\"$pssh\""
if [ "X$use_sshssl" = "X" -a "X$getport" = "X" ]; then
echo "Running viewer:"
......@@ -1351,12 +1445,15 @@ if [ "X$proxy" != "X" ]; then
PPROXY_REMOVE=1; export PPROXY_REMOVE
pcode "$ptmp"
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:
nd=`findfree 6700`
PPROXY_LISTEN=$nd
export PPROXY_LISTEN
$ptmp 2>/dev/null &
if [ "X$reverse" = "X" ]; then
#$ptmp 2>/dev/null &
$ptmp &
fi
#sleep 3
sleep 2
host="localhost"
......@@ -1423,7 +1520,7 @@ if [ "X$direct_connect" != "X" ]; then
disp="$N"
fi
if [ "X$SSVNC_EXTRA_SLEEP" != "X" ]; then
#echo T sleep $SSVNC_EXTRA_SLEEP
echo "T sleep $SSVNC_EXTRA_SLEEP"
sleep $SSVNC_EXTRA_SLEEP
fi
if [ "X$reverse" = "X" ]; then
......@@ -1450,30 +1547,12 @@ if [ "X$direct_connect" != "X" ]; then
exit $?
fi
tmp=/tmp/ss_vncviewer${RANDOM}.$$
mytmp "$tmp"
tmp_cfg=/tmp/ss_vncviewer${RANDOM}.$$
mytmp "$tmp_cfg"
if [ "X$reverse" = "X" ]; then
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
# make_tcert is no longer invoked via the ssvnc gui (Listen mode).
# make_tcert is for testing only now via -mycert BUILTIN
make_tcert() {
tcert="/tmp/tcert${RANDOM}.$$"
cat > $tcert <<END
-----BEGIN RSA PRIVATE KEY-----
......@@ -1528,76 +1607,131 @@ dMw1yW09l+eEo4A7GzwOdw==
-----END CERTIFICATE-----
END
chmod 600 $tcert
cert="cert = $tcert"
echo "$tcert"
}
stunnel_exec=""
if echo $STUNNEL_EXTRA_SVC_OPTS | grep '#stunnel-exec' > /dev/null; then
stunnel_exec="#"
fi
if [ "X$reverse" = "X" ]; then
if echo "$proxy" | grep repeater:// > /dev/null; then
if [ "X$cert" = "XBUILTIN" ]; then
ttcert=`make_tcert`
cert="cert = $ttcert"
fi
# Note for listen mode, an empty cert will cause stunnel to fail.
# The ssvnc gui will have already taken care of this.
fi
cat > "$tmp_cfg" <<END
foreground = yes
pid =
client = yes
debug = 6
$STUNNEL_EXTRA_OPTS
$STUNNEL_EXTRA_OPTS_USER
$verify
$cert
${stunnel_exec}[vnc_stunnel]
${stunnel_exec}accept = localhost:$use
$connect
$STUNNEL_EXTRA_SVC_OPTS
$STUNNEL_EXTRA_SVC_OPTS_USER
END
else
stunnel_exec="" # doesn't work for listening.
p2=`expr 5500 + $N`
connect="connect = localhost:$p2"
if [ "X$cert" = "XBUILTIN" ]; then
ttcert=`make_tcert`
cert="cert = $ttcert"
fi
# Note for listen mode, an empty cert will cause stunnel to fail.
# The ssvnc gui will have already taken care of this.
STUNNEL_EXTRA_OPTS=`echo "$STUNNEL_EXTRA_OPTS" | sed -e 's/maxconn/#maxconn/'`
hloc=""
if [ "X$use_ssh" = "X1" ]; then
hloc="localhost:"
fi
cat > "$tmp" <<END
cat > "$tmp_cfg" <<END
foreground = yes
pid =
client = no
debug = 6
$STUNNEL_EXTRA_OPTS
$STUNNEL_EXTRA_OPTS_USER
$verify
$cert
[vnc_stunnel]
accept = $hloc$port
$connect
$STUNNEL_EXTRA_SVC_OPTS
$STUNNEL_EXTRA_SVC_OPTS_USER
END
fi
echo ""
echo "Using this stunnel configuration:"
echo ""
cat "$tmp" | uniq
cat "$tmp_cfg" | uniq
echo ""
sleep 1
echo ""
echo "Running stunnel:"
echo "$STUNNEL $tmp"
st=`echo "$STUNNEL" | awk '{print $1}'`
$st -help > /dev/null 2>&1
$STUNNEL "$tmp" < /dev/tty > /dev/tty &
stunnel_pid=$!
echo ""
if [ "X$stunnel_exec" = "X" ]; then
echo ""
echo "Running stunnel:"
echo "$STUNNEL $tmp_cfg"
st=`echo "$STUNNEL" | awk '{print $1}'`
$st -help > /dev/null 2>&1
$STUNNEL "$tmp_cfg" < /dev/tty > /dev/tty &
stunnel_pid=$!
echo ""
# pause here to let the user supply a possible passphrase for the
# mycert key:
if [ "X$mycert" != "X" ]; then
# pause here to let the user supply a possible passphrase for the
# mycert key:
if [ "X$mycert" != "X" ]; then
sleep 1
echo ""
echo "(pausing for possible certificate passphrase dialog)"
echo ""
sleep 4
fi
#echo T sleep 1
sleep 1
rm -f "$tmp_cfg"
fi
#echo T sleep 1
sleep 1
rm -f "$tmp"
echo ""
if [ "X$SSVNC_EXTRA_SLEEP" != "X" ]; then
echo "sleep $SSVNC_EXTRA_SLEEP"
sleep $SSVNC_EXTRA_SLEEP
fi
echo "Running viewer:"
if [ "X$reverse" = "X" ]; then
echo "$VNCVIEWERCMD" "$@" localhost:$N
vnc_hp=localhost:$N
if [ "X$stunnel_exec" != "X" ]; then
vnc_hp="exec=$STUNNEL $tmp_cfg"
fi
echo "$VNCVIEWERCMD" "$@" "$vnc_hp"
trap "final" 0 2 15
echo ""
$VNCVIEWERCMD "$@" localhost:$N
$VNCVIEWERCMD "$@" "$vnc_hp"
if [ $? != 0 ]; then
echo "vncviewer command failed: $?"
if [ "X$secondtry" = "X1" ]; then
sleep 2
$VNCVIEWERCMD "$@" localhost:$N
$VNCVIEWERCMD "$@" "$vnc_hp"
fi
fi
else
......@@ -1607,6 +1741,12 @@ else
echo "$VNCVIEWERCMD" "$@" -listen $N
trap "final" 0 2 15
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
fi
......
......@@ -121,7 +121,7 @@ diff -Naur JavaViewer.orig/ButtonPanel.java JavaViewer/ButtonPanel.java
}
diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
--- JavaViewer.orig/FTPFrame.java 2005-03-15 23:53:14.000000000 -0500
+++ JavaViewer/FTPFrame.java 2007-06-02 23:24:32.000000000 -0400
+++ JavaViewer/FTPFrame.java 2008-08-31 14:46:16.000000000 -0400
@@ -24,8 +24,13 @@
import java.io.*;
import java.util.ArrayList;
......@@ -136,7 +136,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
/*
* Created on Feb 25, 2004
@@ -74,12 +79,27 @@
@@ -74,12 +79,31 @@
public javax.swing.JTextField connectionStatus = null;
public boolean updateDriveList;
private Vector remoteList = null;
......@@ -151,6 +151,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
+
+// begin runge/x11vnc
+ private javax.swing.JButton viewButton = null;
+ private javax.swing.JButton refreshButton = null;
+ public File saveLocalDirectory = null;
+ public long saveLocalDirectoryTime = 0;
+ public int saveLocalDirectoryCount = 0;
......@@ -160,15 +161,19 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
+ private boolean localCurrentIsDir = true;
+ private int lastRemoteIndex = -1;
+ private int lastLocalIndex = -1;
+ private boolean doingShortcutDir = false;
+ private boolean gotShortcutDir = false;
+ private boolean ignore_events = false;
+// end runge/x11vnc
// sf@2004 - Separate directories and files for better lisibility
private ArrayList DirsList;
@@ -125,11 +145,60 @@
@@ -125,11 +149,61 @@
void refreshRemoteLocation()
{
+
+//System.out.println("refreshRemoteLocation1");
remoteList.clear();
+ remoteListInfo.clear();
remoteFileTable.setListData(remoteList);
......@@ -225,23 +230,94 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
/*
* Prints the list of drives on the remote directory and returns a String[].
* str takes as string like A:fC:lD:lE:lF:lG:cH:c
@@ -185,6 +254,7 @@
@@ -143,6 +217,9 @@
int size = str.length();
String driveType = null;
String[] drive = new String[str.length() / 3];
+ int idx = 0, C_drive = -1, O_drive = -1;
+
+System.out.println("ComboBox: Str '" + str + "'");
// Loop through the string to create a String[]
for (int i = 0; i < size; i = i + 3) {
@@ -150,26 +227,52 @@
driveType = str.substring(i + 2, i + 3);
if (driveType.compareTo("f") == 0)
drive[i / 3] += "\\ Floppy";
- if (driveType.compareTo("l") == 0)
+ if (driveType.compareTo("l") == 0) {
drive[i / 3] += "\\ Local Disk";
+ if (drive[i/3].substring(0,1).toUpperCase().equals("C")) {
+ C_drive = idx;
+ } else if (O_drive < 0) {
+ O_drive = idx;
+ }
+ }
if (driveType.compareTo("c") == 0)
drive[i / 3] += "\\ CD-ROM";
if (driveType.compareTo("n") == 0)
drive[i / 3] += "\\ Network";
remoteDrivesComboBox.addItem(drive[i / 3]);
+System.out.println("ComboBox: Add " + idx + " '" + drive[i/3] + "'");
+ idx++;
}
+
+ // runge
+ remoteDrivesComboBox.addItem(" [My Documents]");
+ remoteDrivesComboBox.addItem(" [Desktop]");
+
//sf@ - Select Drive C:as default if possible
boolean bFound = false;
- for(int i = 0; i < remoteDrivesComboBox.getItemCount() ; i++)
- {
- if(remoteDrivesComboBox.getItemAt(i).toString().substring(0,1).toUpperCase().equals("C"))
- {
- remoteDrivesComboBox.setSelectedIndex(i);
+
+ if (false) {
+ for(int i = 0; i < remoteDrivesComboBox.getItemCount() ; i++) {
+ if(remoteDrivesComboBox.getItemAt(i).toString().substring(0,1).toUpperCase().equals("C")) {
+ remoteDrivesComboBox.setSelectedIndex(i);
+ bFound = true;
+ }
+ }
+ } else {
+ if (C_drive > 0) {
+ remoteDrivesComboBox.setSelectedIndex(C_drive);
bFound = true;
+System.out.println("ComboBox: C_drive index: " + C_drive);
+ } else if (O_drive > 0) {
+ remoteDrivesComboBox.setSelectedIndex(O_drive);
+ bFound = true;
+System.out.println("ComboBox: Other_drive index: " + O_drive);
}
}
+
if (!bFound) remoteDrivesComboBox.setSelectedIndex(0);
+
updateDriveList = false;
return drive;
}
@@ -185,6 +288,8 @@
stopButton.setVisible(true);
stopButton.setEnabled(true);
receiveButton.setEnabled(false);
+ viewButton.setEnabled(false); // runge/x11vnc
+ refreshButton.setEnabled(false);
remoteTopButton.setEnabled(false);
sendButton.setEnabled(false);
remoteFileTable.setEnabled(false);
@@ -207,6 +277,7 @@
@@ -207,6 +312,8 @@
stopButton.setVisible(false);
stopButton.setEnabled(false);
receiveButton.setEnabled(true);
+ viewButton.setEnabled(true); // runge/x11vnc
+ refreshButton.setEnabled(true);
remoteTopButton.setEnabled(true);
sendButton.setEnabled(true);
remoteFileTable.setEnabled(true);
@@ -221,10 +292,11 @@
@@ -221,10 +328,11 @@
/*
* Print Directory prints out all the contents of a directory
*/
......@@ -254,15 +330,55 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
remoteFileTable.setListData(remoteList);
}
@@ -253,6 +325,7 @@
@@ -235,10 +343,12 @@
* @return void
*/
private void initialize() {
+ ignore_events = true;
this.setSize(794, 500);
this.setContentPane(getJContentPane());
+ ignore_events = false;
updateDriveList = true;
- }
+ }
/**
* This method initializes jContentPane. This is the main content pane
*
@@ -253,6 +363,33 @@
jContentPane.add(getRemotePanel(), java.awt.BorderLayout.EAST);
jContentPane.add(getLocalPanel(), java.awt.BorderLayout.WEST);
jContentPane.add(getButtonPanel(), java.awt.BorderLayout.CENTER);
+//System.out.println("getJContentPane");
+
+ KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
+ AbstractAction escapeAction = new AbstractAction() {
+ public void actionPerformed(ActionEvent actionEvent) {
+ System.out.println("Escape Pressed");
+ if (viewer.ftpOnly) {
+ System.out.println("exiting...");
+ System.exit(0);
+ } else {
+ doClose();
+ }
+ }
+ };
+ jContentPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(stroke, "escapeAction");
+ jContentPane.getInputMap().put(stroke, "escapeAction");
+ jContentPane.getActionMap().put("escapeAction", escapeAction);
+
+ stroke = KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.CTRL_MASK);
+ AbstractAction resetAction = new AbstractAction() {
+ public void actionPerformed(ActionEvent actionEvent) {
+ System.out.println("Ctrl-R Pressed");
+ doReset();
+ }
+ };
+ jContentPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(stroke, "resetAction");
+ jContentPane.getInputMap().put(stroke, "resetAction");
+ jContentPane.getActionMap().put("resetAction", resetAction);
}
return jContentPane;
}
@@ -270,6 +343,7 @@
@@ -270,6 +407,7 @@
topPanelLocal.add(getLocalMachineLabel(), java.awt.BorderLayout.CENTER);
topPanelLocal.add(getLocalTopButton(), java.awt.BorderLayout.EAST);
topPanelLocal.setBackground(java.awt.Color.lightGray);
......@@ -270,7 +386,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
return topPanelLocal;
}
@@ -288,6 +362,7 @@
@@ -288,6 +426,7 @@
topPanelRemote.add(getRemoteMachineLabel(), java.awt.BorderLayout.CENTER);
topPanelRemote.add(getRemoteTopButton(), java.awt.BorderLayout.EAST);
topPanelRemote.setBackground(java.awt.Color.lightGray);
......@@ -278,7 +394,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
return topPanelRemote;
}
@@ -301,6 +376,7 @@
@@ -301,6 +440,7 @@
if (topPanelCenter == null) {
topPanelCenter = new javax.swing.JPanel();
topPanelCenter.add(getDummyButton(), null);
......@@ -286,7 +402,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
return topPanelCenter;
}
@@ -328,6 +404,7 @@
@@ -328,6 +468,7 @@
topPanel.add(getRemoteTopButton(), null);
topPanel.setBackground(java.awt.Color.lightGray);
*/
......@@ -294,7 +410,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
return topPanel;
}
@@ -348,6 +425,7 @@
@@ -348,6 +489,7 @@
statusPanel.add(getJProgressBar(), null);
statusPanel.add(getConnectionStatus(), null);
statusPanel.setBackground(java.awt.Color.lightGray);
......@@ -302,7 +418,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
return statusPanel;
@@ -368,6 +446,7 @@
@@ -368,6 +510,7 @@
remotePanel.add(getRemoteScrollPane(), null);
remotePanel.add(getRemoteStatus(), null);
remotePanel.setBackground(java.awt.Color.lightGray);
......@@ -310,7 +426,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
return remotePanel;
}
@@ -390,6 +469,7 @@
@@ -390,6 +533,7 @@
localPanel.setComponentOrientation(
java.awt.ComponentOrientation.UNKNOWN);
localPanel.setName("localPanel");
......@@ -318,10 +434,11 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
return localPanel;
}
@@ -405,12 +485,14 @@
@@ -405,12 +549,15 @@
buttonPanel = new javax.swing.JPanel();
buttonPanel.setLayout(null);
buttonPanel.add(getReceiveButton(), null);
+ buttonPanel.add(getRefreshButton(), null); // runge/x11vnc
+ buttonPanel.add(getViewButton(), null); // runge/x11vnc
buttonPanel.add(getNewFolderButton(), null);
buttonPanel.add(getCloseButton(), null);
......@@ -333,7 +450,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
return buttonPanel;
}
@@ -422,10 +504,11 @@
@@ -422,10 +569,11 @@
private javax.swing.JButton getSendButton() {
if (sendButton == null) {
sendButton = new javax.swing.JButton();
......@@ -346,7 +463,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
return sendButton;
@@ -438,7 +521,7 @@
@@ -438,7 +586,7 @@
private javax.swing.JButton getReceiveButton() {
if (receiveButton == null) {
receiveButton = new javax.swing.JButton();
......@@ -355,7 +472,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
receiveButton.setText("<< Receive");
receiveButton.setName("receiveButton");
receiveButton.addActionListener(this);
@@ -453,7 +536,7 @@
@@ -453,7 +601,7 @@
private javax.swing.JButton getDeleteButton() {
if (deleteButton == null) {
deleteButton = new javax.swing.JButton();
......@@ -364,7 +481,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
deleteButton.setText("Delete File");
deleteButton.setName("deleteButton");
deleteButton.addActionListener(this);
@@ -468,7 +551,7 @@
@@ -468,7 +616,7 @@
private javax.swing.JButton getNewFolderButton() {
if (newFolderButton == null) {
newFolderButton = new javax.swing.JButton();
......@@ -373,12 +490,27 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
newFolderButton.setText("New Folder");
newFolderButton.setName("newFolderButton");
newFolderButton.addActionListener(this);
@@ -476,6 +559,24 @@
@@ -476,6 +624,39 @@
return newFolderButton;
}
+// begin runge/x11vnc
+ /**
+ * This method initializes refreshButton
+ *
+ * @return javax.swing.JButton
+ */
+ private javax.swing.JButton getRefreshButton() {
+ if (refreshButton == null) {
+ refreshButton = new javax.swing.JButton();
+ refreshButton.setBounds(15, 170, 107, 25);
+ refreshButton.setText("Refresh");
+ refreshButton.setName("refreshButton");
+ refreshButton.addActionListener(this);
+ }
+ return refreshButton;
+ }
+ /**
+ * This method initializes viewButton
+ *
+ * @return javax.swing.JButton
......@@ -386,7 +518,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
+ private javax.swing.JButton getViewButton() {
+ if (viewButton == null) {
+ viewButton = new javax.swing.JButton();
+ viewButton.setBounds(15, 170, 107, 25);
+ viewButton.setBounds(15, 200, 107, 25);
+ viewButton.setText("View File");
+ viewButton.setName("viewButton");
+ viewButton.addActionListener(this);
......@@ -398,16 +530,16 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
/**
* This method initializes stopButton
*
@@ -486,7 +587,7 @@
@@ -486,7 +667,7 @@
if (stopButton == null)
{
stopButton = new javax.swing.JButton();
- stopButton.setBounds(20, 200, 97, 25);
+ stopButton.setBounds(15, 200, 107, 25); // runge/x11vnc
+ stopButton.setBounds(15, 230, 107, 25); // runge/x11vnc
stopButton.setText("Stop");
stopButton.setName("stopButton");
stopButton.addActionListener(this);
@@ -503,8 +604,12 @@
@@ -503,8 +684,12 @@
private javax.swing.JButton getCloseButton() {
if (closeButton == null) {
closeButton = new javax.swing.JButton();
......@@ -422,7 +554,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
closeButton.setName("closeButton");
closeButton.addActionListener(this);
}
@@ -551,6 +656,7 @@
@@ -551,6 +736,7 @@
//Select the second entry (e.g. C:\)
// localDrivesComboBox.setSelectedIndex(1);
localDrivesComboBox.addActionListener(this);
......@@ -430,7 +562,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
updateDriveList = false;
return localDrivesComboBox;
@@ -567,6 +673,7 @@
@@ -567,6 +753,7 @@
remoteDrivesComboBox.setFont(
new java.awt.Font("Dialog", java.awt.Font.PLAIN, 10));
remoteDrivesComboBox.addActionListener(this);
......@@ -438,7 +570,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
return remoteDrivesComboBox;
@@ -587,6 +694,7 @@
@@ -587,6 +774,7 @@
localMachineLabel.setFont(
new java.awt.Font("Dialog", java.awt.Font.BOLD, 11));
localMachineLabel.setEditable(false);
......@@ -446,7 +578,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
return localMachineLabel;
}
@@ -622,6 +730,7 @@
@@ -622,6 +810,7 @@
localTopButton.setFont(
new java.awt.Font("Dialog", java.awt.Font.BOLD, 10));
localTopButton.addActionListener(this);
......@@ -454,7 +586,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
return localTopButton;
}
@@ -638,6 +747,7 @@
@@ -638,6 +827,7 @@
remoteTopButton.setFont(
new java.awt.Font("Dialog", java.awt.Font.BOLD, 10));
remoteTopButton.addActionListener(this);
......@@ -462,7 +594,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
return remoteTopButton;
}
@@ -650,9 +760,24 @@
@@ -650,9 +840,24 @@
private javax.swing.JList getLocalFileTable() {
if (localFileTable == null) {
localList = new Vector(0);
......@@ -487,7 +619,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
return localFileTable;
}
@@ -669,6 +794,7 @@
@@ -669,6 +874,7 @@
localScrollPane.setFont(
new java.awt.Font("Dialog", java.awt.Font.PLAIN, 10));
localScrollPane.setName("localFileList");
......@@ -495,7 +627,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
return localScrollPane;
}
@@ -680,10 +806,25 @@
@@ -680,10 +886,25 @@
private javax.swing.JList getRemoteFileTable() {
if (remoteFileTable == null) {
remoteList = new Vector(0);
......@@ -521,7 +653,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
return remoteFileTable;
@@ -698,6 +839,7 @@
@@ -698,6 +919,7 @@
remoteScrollPane = new javax.swing.JScrollPane();
remoteScrollPane.setViewportView(getRemoteFileTable());
remoteScrollPane.setPreferredSize(new java.awt.Dimension(325, 418));
......@@ -529,7 +661,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
return remoteScrollPane;
}
@@ -716,6 +858,7 @@
@@ -716,6 +938,7 @@
remoteLocation.setBackground(new Color(255,255,238));
remoteLocation.setFont(
new java.awt.Font("Dialog", java.awt.Font.PLAIN, 10));
......@@ -537,7 +669,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
return remoteLocation;
}
@@ -732,6 +875,7 @@
@@ -732,6 +955,7 @@
localLocation.setBackground( new Color(255,255,238));
localLocation.setFont(
new java.awt.Font("Dialog", java.awt.Font.PLAIN, 10));
......@@ -545,7 +677,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
return localLocation;
}
@@ -748,6 +892,7 @@
@@ -748,6 +972,7 @@
localStatus.setFont(
new java.awt.Font("Dialog", java.awt.Font.PLAIN, 10));
localStatus.setEditable(false);
......@@ -553,7 +685,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
return localStatus;
}
@@ -764,6 +909,7 @@
@@ -764,6 +989,7 @@
remoteStatus.setFont(
new java.awt.Font("Dialog", java.awt.Font.PLAIN, 10));
remoteStatus.setEditable(false);
......@@ -561,15 +693,19 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
return remoteStatus;
}
@@ -780,6 +926,7 @@
historyComboBox.insertItemAt(new String("Pulldown to view history ..."),0);
@@ -777,9 +1003,10 @@
historyComboBox = new javax.swing.JComboBox();
historyComboBox.setFont(
new java.awt.Font("Dialog", java.awt.Font.BOLD, 10));
- historyComboBox.insertItemAt(new String("Pulldown to view history ..."),0);
+ historyComboBox.insertItemAt(new String("Pulldown to view history; Press Escape to Close/Quit; Press Ctrl-R to Reset Panel."),0);
historyComboBox.setSelectedIndex(0);
historyComboBox.addActionListener(this);
+//System.out.println("getHistoryComboBox");
}
return historyComboBox;
}
@@ -791,6 +938,7 @@
@@ -791,6 +1018,7 @@
private javax.swing.JProgressBar getJProgressBar() {
if (jProgressBar == null) {
jProgressBar = new javax.swing.JProgressBar();
......@@ -577,7 +713,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
return jProgressBar;
}
@@ -806,6 +954,7 @@
@@ -806,6 +1034,7 @@
connectionStatus.setBackground(java.awt.Color.lightGray);
connectionStatus.setFont(
new java.awt.Font("Dialog", java.awt.Font.PLAIN, 10));
......@@ -585,16 +721,21 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
connectionStatus.setEditable(false);
return connectionStatus;
@@ -815,7 +964,7 @@
@@ -815,7 +1044,12 @@
* Implements Action listener.
*/
public void actionPerformed(ActionEvent evt) {
- System.out.println(evt.getSource());
+// System.out.println(evt.getSource());
+
+ if (ignore_events) {
+ System.out.println("ignore_events: " + evt.getSource());
+ return;
+ }
if (evt.getSource() == closeButton)
{ // Close Button
@@ -829,14 +978,22 @@
@@ -829,15 +1063,27 @@
{
doReceive();
}
......@@ -610,22 +751,48 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
else if (evt.getSource() == remoteDrivesComboBox)
{
+System.out.println("remoteDrivesComboBox"); // runge/x11vnc
+//System.out.println("remoteDrivesComboBox"); // runge/x11vnc
changeRemoteDrive();
remoteList.clear();
- remoteList.clear();
- remoteFileTable.setListData(remoteList);
+
+ // are these really needed? changeRemoteDrive() does them at the end.
+ if (false) {
+ remoteList.clear();
+ remoteListInfo.clear();
remoteFileTable.setListData(remoteList);
+ remoteFileTable.setListData(remoteList);
+ }
}
else if (evt.getSource() == localTopButton)
@@ -845,6 +1002,7 @@
{
@@ -845,12 +1091,17 @@
}
else if (evt.getSource() == remoteTopButton)
{
+System.out.println("remoteTopButton"); // runge/x11vnc
+//System.out.println("remoteTopButton"); // runge/x11vnc
changeRemoteDrive();
}
else if(evt.getSource() == deleteButton)
@@ -880,25 +1038,42 @@
{
doDelete();
}
+ else if(evt.getSource() == refreshButton)
+ {
+ doRefresh();
+ }
else if(evt.getSource()==newFolderButton)
{
doNewFolder();
@@ -864,7 +1115,7 @@
private void doNewFolder()
{
- String name = JOptionPane.showInputDialog(null,"Enter new directory name", "Create New Directory", JOptionPane.QUESTION_MESSAGE);
+ String name = JOptionPane.showInputDialog(jContentPane,"Enter new directory name", "Create New Directory", JOptionPane.QUESTION_MESSAGE);
if(selectedTable.equals("remote"))
{
name = remoteLocation.getText()+name;
@@ -880,34 +1131,106 @@
historyComboBox.setSelectedIndex(0);
}
}
......@@ -656,6 +823,57 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
e.printStackTrace();
}
}
+ private void unSwing() {
+ jContentPane = null;
+ topPanel = null;
+ topPanelLocal = null;
+ topPanelRemote = null;
+ topPanelCenter = null;
+ statusPanel = null;
+ remotePanel = null;
+ localPanel = null;
+ buttonPanel = null;
+ sendButton = null;
+ receiveButton = null;
+ deleteButton = null;
+ newFolderButton = null;
+ stopButton = null;
+ closeButton = null;
+ dummyButton = null;
+ localDrivesComboBox = null;
+ remoteDrivesComboBox = null;
+ localMachineLabel = null;
+ remoteMachineLabel = null;
+ localTopButton = null;
+ remoteTopButton = null;
+ localScrollPane = null;
+ localFileTable = null;
+ remoteScrollPane = null;
+ remoteFileTable = null;
+ remoteLocation = null;
+ localLocation = null;
+ localStatus = null;
+ remoteStatus = null;
+ historyComboBox = null;
+ jProgressBar = null;
+ connectionStatus = null;
+ viewButton = null;
+ refreshButton = null;
+ }
+
+ public void doReset()
+ {
+ try {
+ this.setVisible(false);
+ this.dispose();
+ jContentPane = null;
+ try {Thread.sleep(500);} catch (InterruptedException e) {}
+ viewer.ftp_init();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ public void doOpen()
+ {
......@@ -676,20 +894,98 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
//Call this method to delete a file at server
if(selectedTable.equals("remote"))
{
@@ -952,7 +1127,7 @@
- String sFileName = ((String) this.remoteFileTable.getSelectedValue());
+ Object selected = this.remoteFileTable.getSelectedValue();
+ if (selected == null) {
+ return;
+ }
+ String sFileName = ((String) selected);
// sf@2004 - Directory can't be deleted
if (sFileName.substring(0, 2).equals(" [") && sFileName.substring((sFileName.length() - 1), sFileName.length()).equals("]"))
{
- JOptionPane.showMessageDialog(null, (String)"Directory Deletion is not yet available in this version...", "FileTransfer Info", JOptionPane.INFORMATION_MESSAGE);
+ JOptionPane.showMessageDialog(jContentPane, (String)"Directory Deletion is not yet available in this version...", "FileTransfer Info", JOptionPane.INFORMATION_MESSAGE);
return;
}
@@ -916,7 +1239,7 @@
// sf@2004 - Delete prompt
if (remoteList.contains(sFileName))
{
- int r = JOptionPane.showConfirmDialog(null, "Are you sure you want to delete the file \n< " + sFileName + " >\n on Remote Machine ?", "File Transfer Warning", JOptionPane.YES_NO_OPTION);
+ int r = JOptionPane.showConfirmDialog(jContentPane, "Are you sure you want to delete the file \n< " + sFileName + " >\n on Remote Machine ?", "File Transfer Warning", JOptionPane.YES_NO_OPTION);
if (r == JOptionPane.NO_OPTION)
return;
}
@@ -926,18 +1249,22 @@
}
else
{
- String sFileName = ((String) this.localFileTable.getSelectedValue());
+ Object selected = this.localFileTable.getSelectedValue();
+ if (selected == null) {
+ return;
+ }
+ String sFileName = ((String) selected);
// sf@2004 - Directory can't be deleted
if (sFileName.substring(0, 2).equals(" [") && sFileName.substring((sFileName.length() - 1), sFileName.length()).equals("]"))
{
- JOptionPane.showMessageDialog(null, (String)"Directory Deletion is not yet available in this version...", "FileTransfer Info", JOptionPane.INFORMATION_MESSAGE);
+ JOptionPane.showMessageDialog(jContentPane, (String)"Directory Deletion is not yet available in this version...", "FileTransfer Info", JOptionPane.INFORMATION_MESSAGE);
return;
}
// sf@2004 - Delete prompt
if (localList.contains(sFileName))
{
- int r = JOptionPane.showConfirmDialog(null, "Are you sure you want to delete the file \n< " + sFileName + " >\n on Local Machine ?", "File Transfer Warning", JOptionPane.YES_NO_OPTION);
+ int r = JOptionPane.showConfirmDialog(jContentPane, "Are you sure you want to delete the file \n< " + sFileName + " >\n on Local Machine ?", "File Transfer Warning", JOptionPane.YES_NO_OPTION);
if (r == JOptionPane.NO_OPTION)
return;
}
@@ -952,21 +1279,25 @@
private void doReceive()
{
- System.out.println("Received Button Pressed");
+// System.out.println("Received Button Pressed");
String sFileName = ((String) this.remoteFileTable.getSelectedValue());
- String sFileName = ((String) this.remoteFileTable.getSelectedValue());
+ Object selected = this.remoteFileTable.getSelectedValue();
+ if (selected == null) {
+ return;
+ }
+ String sFileName = ((String) selected);
// sf@2004 - Directory can't be transfered
if (sFileName.substring(0, 2).equals(" [") && sFileName.substring((sFileName.length() - 1), sFileName.length()).equals("]"))
{
- JOptionPane.showMessageDialog(null, (String)"Directory Transfer is not yet available in this version...", "FileTransfer Info", JOptionPane.INFORMATION_MESSAGE);
+ JOptionPane.showMessageDialog(jContentPane, (String)"Directory Transfer is not yet available in this version...", "FileTransfer Info", JOptionPane.INFORMATION_MESSAGE);
return;
}
@@ -979,9 +1154,59 @@
// sf@2004 - Overwrite prompt
if (localList.contains(sFileName))
{
- int r = JOptionPane.showConfirmDialog(null, "The file < " + sFileName + " >\n already exists on Local Machine\n Are you sure you want to overwrite it ?", "File Transfer Warning", JOptionPane.YES_NO_OPTION);
+ int r = JOptionPane.showConfirmDialog(jContentPane, "The file < " + sFileName + " >\n already exists on Local Machine\n Are you sure you want to overwrite it ?", "File Transfer Warning", JOptionPane.YES_NO_OPTION);
if (r == JOptionPane.NO_OPTION)
return;
}
@@ -979,23 +1310,89 @@
viewer.rfb.requestRemoteFile(remoteFileName,localDestinationPath);
}
+// begin runge/x11vnc
+ private void doRefresh()
+ {
+ System.out.println("Refreshing Local and Remote.");
+ refreshLocalLocation();
+ refreshRemoteLocation();
+ }
+
+ private void doView()
+ {
+// System.out.println("View Button Pressed");
......@@ -710,7 +1006,12 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
+ if (remoteFileTable == null) {
+ return null;
+ }
+ String sFileName = ((String) this.remoteFileTable.getSelectedValue());
+ Object selected = this.remoteFileTable.getSelectedValue();
+ if (selected == null) {
+ return null;
+ }
+ String sFileName = ((String) selected);
+
+ if (sFileName == null) {
+ return null;
+ }
......@@ -744,24 +1045,98 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
- System.out.println("Send Button Pressed");
+// System.out.println("Send Button Pressed");
String sFileName = ((String) this.localFileTable.getSelectedValue());
- String sFileName = ((String) this.localFileTable.getSelectedValue());
+ Object selected = this.localFileTable.getSelectedValue();
+ if (selected == null) {
+ return;
+ }
+ String sFileName = ((String) selected);
@@ -1035,10 +1260,14 @@
// sf@2004 - Directory can't be transfered
if (sFileName.substring(0, 2).equals(" [") && sFileName.substring((sFileName.length() - 1), sFileName.length()).equals("]"))
{
- JOptionPane.showMessageDialog(null, (String)"Directory Transfer is not yet available in this version...", "FileTransfer Info", JOptionPane.INFORMATION_MESSAGE);
+ JOptionPane.showMessageDialog(jContentPane, (String)"Directory Transfer is not yet available in this version...", "FileTransfer Info", JOptionPane.INFORMATION_MESSAGE);
return;
}
// sf@2004 - Overwrite prompt
if (remoteList.contains(sFileName))
{
- int r = JOptionPane.showConfirmDialog(null, "The file < " + sFileName + " >\n already exists on Remote Machine\n Are you sure you want to overwrite it ?", "File Transfer Warning", JOptionPane.YES_NO_OPTION);
+ int r = JOptionPane.showConfirmDialog(jContentPane, "The file < " + sFileName + " >\n already exists on Remote Machine\n Are you sure you want to overwrite it ?", "File Transfer Warning", JOptionPane.YES_NO_OPTION);
if (r == JOptionPane.NO_OPTION)
return;
}
@@ -1013,6 +1410,7 @@
//
private void doStop()
{
+ System.out.println("** Current Transfer Aborted **");
viewer.rfb.fAbort = true;
}
/**
@@ -1024,6 +1422,14 @@
System.out.println("History: " + message);
historyComboBox.insertItemAt(new String(message), 0);
}
+
+ public void receivedRemoteDirectoryName(String str) {
+ if (doingShortcutDir) {
+ if (str.length() > 1) {
+ remoteLocation.setText(str);
+ }
+ }
+ }
/**
* This method updates the file table to the current selection of the remoteComboBox
@@ -1034,11 +1440,41 @@
remoteSelection = null;
if (!updateDriveList) {
String drive = remoteDrivesComboBox.getSelectedItem().toString().substring(0,1)+ ":\\";
+//System.out.println("changeRemoteDrive-A " + drive); // runge/x11vnc
- String drive = remoteDrivesComboBox.getSelectedItem().toString().substring(0,1)+ ":\\";
- viewer.rfb.readServerDirectory(drive);
- remoteLocation.setText(drive);
+//System.out.println("changeRemoteDrive-A " + drive); // begin runge/x11vnc
+ Object selected = remoteDrivesComboBox.getSelectedItem();
+ if (selected != null) {
+ String instr = selected.toString();
+ if (instr != null) {
+System.out.println("changeRemoteDrive: instr='" + instr + "'");
+ String drive = instr.substring(0,1)+ ":\\";
+ if (instr.startsWith(" [")) {
+ int idx = instr.lastIndexOf(']');
+ if (idx > 2) {
+ drive = instr.substring(2, idx);
+ } else {
+ drive = instr.substring(2);
+ }
+ drive += "\\";
+ doingShortcutDir = true;
+ } else {
+ doingShortcutDir = false;
+ drive = saveRemoteHack(drive);
viewer.rfb.readServerDirectory(drive);
remoteLocation.setText(drive);
+//System.out.println("changeRemoteDrive-B " + drive); // runge/x11vnc
+ }
+ gotShortcutDir = false;
+ viewer.rfb.readServerDirectory(drive);
+ if (!gotShortcutDir) {
+ remoteLocation.setText(drive);
+ }
+ } else {
+System.out.println("changeRemoteDrive: instr null");
+ }
+ } else {
+System.out.println("changeRemoteDrive: selection null");
+ }
+//System.out.println("changeRemoteDrive-B " + drive); // end runge/x11vnc
}
remoteList.clear();
+ remoteListInfo.clear();
remoteFileTable.setListData(remoteList);
}
/**
@@ -1048,6 +1277,7 @@
@@ -1048,6 +1484,7 @@
private void changeLocalDrive()
{
File currentDrive = new File(localDrivesComboBox.getSelectedItem().toString());
......@@ -769,7 +1144,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
if(currentDrive.canRead())
{
localSelection = null;
@@ -1057,9 +1287,11 @@
@@ -1057,9 +1494,11 @@
else
{
localList.clear();
......@@ -781,8 +1156,20 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
/**
* Determines which FileTable was double-clicked and updates the table
@@ -1101,7 +1333,7 @@
String name = (remoteFileTable.getSelectedValue().toString()).substring(1);
@@ -1098,10 +1537,18 @@
selectedTable = "remote";
localFileTable.setBackground(new Color(238, 238, 238));
remoteFileTable.setBackground(new Color(255, 255, 255));
- String name = (remoteFileTable.getSelectedValue().toString()).substring(1);
+ Object selected = remoteFileTable.getSelectedValue();
+ if (selected == null) {
+ return;
+ }
+ String selstr = selected.toString();
+ if (selstr == null) {
+ return;
+ }
+ String name = selstr.substring(1);
if( !name.substring(0, 2).equals(" ["))
remoteSelection = remoteLocation.getText() + name.substring(0, name.length());
-
......@@ -790,7 +1177,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
/*
@@ -1115,10 +1347,38 @@
@@ -1115,10 +1562,38 @@
localFileTable.setBackground(new Color(255, 255, 255));
File currentSelection = new File(currentLocalDirectory, getTrimmedSelection());
......@@ -830,7 +1217,31 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
/**
* Updates the Remote File Table based on selection. Called from mouseClicked handler
*/
@@ -1140,6 +1400,7 @@
@@ -1126,20 +1601,29 @@
String name = null;
String action = null;
String drive = null;
- name = (remoteFileTable.getSelectedValue().toString()).substring(1);
+ Object selected = remoteFileTable.getSelectedValue();
+ if (selected == null) {
+ return;
+ }
+ String sname = selected.toString();
+ if (sname == null) {
+ return;
+ }
+ name = sname.substring(1);
if (name.equals("[..]"))
{
action = "up";
remoteSelection = null;
drive = remoteLocation.getText().substring(0, remoteLocation.getText().length() - 1);
- // JOptionPane.showMessageDialog(null, (String)drive, "FileTransfer DEBUG", JOptionPane.INFORMATION_MESSAGE);
+ // JOptionPane.showMessageDialog(jContentPane, (String)drive, "FileTransfer DEBUG", JOptionPane.INFORMATION_MESSAGE);
int index = drive.lastIndexOf("\\");
drive = drive.substring(0, index + 1);
remoteLocation.setText(drive);
viewer.rfb.readServerDirectory(drive);
remoteList.clear();
......@@ -838,7 +1249,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
remoteFileTable.setListData(remoteList);
}
else if (!name.substring(0, 2).equals(" [") && !name.substring((name.length() - 1), name.length()).equals("]"))
@@ -1149,6 +1410,7 @@
@@ -1149,6 +1633,7 @@
remoteSelection = remoteLocation.getText() + name.substring(0, name.length());
drive = remoteLocation.getText();
// ??
......@@ -846,7 +1257,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
else
{
@@ -1159,10 +1421,12 @@
@@ -1159,10 +1644,12 @@
remoteLocation.setText(drive);
viewer.rfb.readServerDirectory(drive);
remoteList.clear();
......@@ -859,7 +1270,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
/**
* Updates the Local File Table based on selection. Called from MouseClicked handler
*/
@@ -1188,6 +1452,7 @@
@@ -1188,6 +1675,7 @@
else if (currentSelection.isFile())
{
localSelection = currentSelection.getAbsoluteFile();
......@@ -867,7 +1278,37 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
}
else if (currentSelection.isDirectory())
{
@@ -1241,36 +1506,113 @@
@@ -1201,13 +1689,22 @@
*
*/
private String getTrimmedSelection(){
- String currentSelection = (localFileTable.getSelectedValue().toString()).substring(1);
- if(currentSelection.substring(0,1).equals("[") &&
- currentSelection.substring(currentSelection.length()-1,currentSelection.length()).equals("]")){
- return currentSelection.substring(1,currentSelection.length()-1);
- } else {
- return currentSelection;
- }
+ String currentSelection = "";
+ Object selected = localFileTable.getSelectedValue();
+ if (selected == null) {
+ return currentSelection;
+ }
+ String selstr = selected.toString();
+ if (selstr == null) {
+ return currentSelection;
+ }
+ currentSelection = selstr.substring(1);
+ if(currentSelection.substring(0,1).equals("[") &&
+ currentSelection.substring(currentSelection.length()-1,currentSelection.length()).equals("]")){
+ return currentSelection.substring(1,currentSelection.length()-1);
+ } else {
+ return currentSelection;
+ }
}
/*
@@ -1241,36 +1738,113 @@
return null;
}
......@@ -987,7 +1428,7 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
FilesList.clear();
DirsList.clear();
@@ -1296,3 +1638,135 @@
@@ -1296,3 +1870,147 @@
}
} // @jve:visual-info decl-index=0 visual-constraint="10,10"
......@@ -1003,11 +1444,13 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
+ int rcnt = 0;
+ int tms = 250;
+ boolean delete_it = false;
+ TextViewer me;
+
+ public TextViewer(String s, File f, boolean d) {
+
+ delete_it = d;
+ file = f;
+ me = this;
+
+ JScrollPane scrollPane = new JScrollPane(textArea,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
......@@ -1016,6 +1459,16 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
+ textArea.setEditable(false);
+ textArea.setFont(new Font("Monospaced", Font.PLAIN, 12));
+
+ KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, InputEvent.SHIFT_MASK);
+ AbstractAction escapeAction = new AbstractAction() {
+ public void actionPerformed(ActionEvent actionEvent) {
+ cleanse();
+ me.dispose();
+ }
+ };
+ textArea.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(stroke, "escapeAction");
+ textArea.getInputMap().put(stroke, "escapeAction");
+ textArea.getActionMap().put("escapeAction", escapeAction);
+
+ refreshButton = new JButton();
+ refreshButton.setText("Reload");
......@@ -1140,8 +1593,16 @@ diff -Naur JavaViewer.orig/OptionsFrame.java JavaViewer/OptionsFrame.java
choices[shareDesktopIndex].select("Yes");
diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
--- JavaViewer.orig/RfbProto.java 2006-05-24 15:14:40.000000000 -0400
+++ JavaViewer/RfbProto.java 2007-06-02 23:46:21.000000000 -0400
@@ -86,8 +86,11 @@
+++ JavaViewer/RfbProto.java 2008-09-06 21:36:14.000000000 -0400
@@ -31,6 +31,7 @@
import java.net.Socket;
import java.util.*;
import java.util.zip.*;
+import java.text.DateFormat;
class RfbProto {
@@ -86,8 +87,11 @@
// sf@2004 - FileTransfer part
ArrayList remoteDirsList;
......@@ -1153,7 +1614,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
boolean fFTInit = true; // sf@2004
boolean fFTAllowed = true;
boolean fAbort = false;
@@ -199,6 +202,10 @@
@@ -199,6 +203,10 @@
// playback.
int numUpdatesInSession;
......@@ -1164,7 +1625,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
//
// Constructor. Make TCP connection to RFB server.
//
@@ -207,7 +214,27 @@
@@ -207,7 +215,27 @@
viewer = v;
host = h;
port = p;
......@@ -1193,7 +1654,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
is =
new DataInputStream(
new BufferedInputStream(sock.getInputStream(), 16384));
@@ -215,9 +242,12 @@
@@ -215,9 +243,12 @@
osw = new OutputStreamWriter(sock.getOutputStream());
inDirectory2 = false;
a = new ArrayList();
......@@ -1206,7 +1667,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
sendFileSource = "";
}
@@ -420,7 +450,13 @@
@@ -420,7 +451,13 @@
//
int readServerMessageType() throws IOException {
......@@ -1221,7 +1682,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
// If the session is being recorded:
if (rec != null) {
@@ -600,6 +636,7 @@
@@ -600,6 +637,7 @@
contentParamT = is.readUnsignedByte();
contentParamT = contentParamT << 8;
contentParam = contentParam | contentParamT;
......@@ -1229,7 +1690,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
if (contentType == rfbRDrivesList || contentType == rfbDirPacket)
{
readDriveOrDirectory(contentParam);
@@ -610,7 +647,7 @@
@@ -610,7 +648,7 @@
}
else if (contentType == rfbFilePacket)
{
......@@ -1238,7 +1699,30 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
}
else if (contentType == rfbEndOfFile)
{
@@ -645,6 +682,7 @@
@@ -618,6 +656,10 @@
}
else if (contentType == rfbAbortFileTransfer)
{
+ System.out.println("rfbAbortFileTransfer: fFileReceptionRunning="
+ + fFileReceptionRunning + " fAbort="
+ + fAbort + " fFileReceptionError="
+ + fFileReceptionError);
if (fFileReceptionRunning)
{
endOfReceiveFile(false); // Error
@@ -626,6 +668,11 @@
{
// sf@2004 - Todo: Add TestPermission
// System.out.println("File Transfer Aborted!");
+
+ // runge: seems like we must at least read the remaining
+ // 8 bytes of the header, right?
+ int size = is.readInt();
+ int length = is.readInt();
}
}
@@ -645,6 +692,7 @@
{
System.out.println("ContentType: " + contentType);
}
......@@ -1246,7 +1730,15 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
}
//Refactored from readRfbFileTransferMsg()
@@ -688,11 +726,11 @@
@@ -662,6 +710,7 @@
//Refactored from readRfbFileTransferMsg()
public void readDriveOrDirectory(int contentParam) throws IOException {
+//System.out.println("RDOD: " + contentParam + " " + inDirectory2);
if (contentParam == rfbADrivesList)
{
readFTPMsgDriveList();
@@ -688,11 +737,11 @@
// Internally used. Write an Rfb message to the server
void writeRfbFileTransferMsg(
......@@ -1263,7 +1755,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
{
byte b[] = new byte[12];
@@ -702,7 +740,10 @@
@@ -702,7 +751,10 @@
byte by = 0;
long c = 0;
......@@ -1275,7 +1767,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
c = size & 0xFF000000;
by = (byte) (c >>> 24);
b[4] = by;
@@ -729,6 +770,8 @@
@@ -729,6 +781,8 @@
by = (byte) c;
b[11] = by;
os.write(b);
......@@ -1284,7 +1776,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
if (text != null)
@@ -746,12 +789,12 @@
@@ -746,12 +800,12 @@
//Internally used. Write an rfb message to the server for sending files ONLY
int writeRfbFileTransferMsgForSendFile(
......@@ -1303,7 +1795,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
{
File f = new File(source);
fis = new FileInputStream(f);
@@ -768,50 +811,51 @@
@@ -768,50 +822,47 @@
while (bytesRead!=-1)
{
......@@ -1369,11 +1861,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
+ null
+ );
+ // Todo: Test write error !
+ os.write(
+ fCompress ? CompressionBuffer : byteBuffer,
+ 0,
+ fCompress ? compressedSize : bytesRead
+ );
+ os.write(fCompress ? CompressionBuffer : byteBuffer, 0, fCompress ? compressedSize : bytesRead);
+
+ // Todo: test read error !
+ bytesRead = fis.read(byteBuffer);
......@@ -1399,7 +1887,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
}
writeRfbFileTransferMsg(fError ? rfbAbortFileTransfer : rfbEndOfFile, 0, 0, 0, null);
@@ -831,6 +875,15 @@
@@ -831,24 +882,30 @@
{
System.out.print((char) is.readUnsignedByte());
}
......@@ -1413,9 +1901,32 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
+ return;
+ }
int ret = writeRfbFileTransferMsgForSendFile(
rfbFilePacket,
@@ -907,7 +960,7 @@
- int ret = writeRfbFileTransferMsgForSendFile(
- rfbFilePacket,
- 0,
- 0,
- 0,
- sendFileSource);
+ int ret = writeRfbFileTransferMsgForSendFile(rfbFilePacket, 0, 0, 0, sendFileSource);
viewer.ftp.refreshRemoteLocation();
if (ret != 1)
{
viewer.ftp.connectionStatus.setText(" > Error - File NOT sent");
- viewer.ftp.historyComboBox.insertItemAt(new String(" > Error - File: <" + sendFileSource) + "> was not correctly sent (aborted by user or error)",0);
+ viewer.ftp.historyComboBox.insertItemAt(new String(" > Error - File: <" + sendFileSource)
+ + "> was not correctly sent (aborted or error). Data may still be buffered/in transit. Wait for remote listing...",0);
}
else
{
viewer.ftp.connectionStatus.setText(" > File sent");
- viewer.ftp.historyComboBox.insertItemAt(new String(" > File: <" + sendFileSource) + "> was sent to Remote Machine",0);
+ viewer.ftp.historyComboBox.insertItemAt(new String(" > File: <" + sendFileSource)
+ + "> was sent to Remote Machine. Note: data may still be buffered/in transit. Wait for remote listing...",0);
}
viewer.ftp.historyComboBox.setSelectedIndex(0);
viewer.ftp.enableButtons();
@@ -907,7 +964,7 @@
//Handles acknowledgement that the file has been deleted on the server
void deleteRemoteFileFeedback() throws IOException
{
......@@ -1424,7 +1935,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
int length = is.readInt();
String f = "";
for (int i = 0; i < length; i++)
@@ -916,7 +969,11 @@
@@ -916,7 +973,11 @@
}
viewer.ftp.refreshRemoteLocation();
......@@ -1437,24 +1948,21 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
viewer.ftp.historyComboBox.setSelectedIndex(0);
}
@@ -927,11 +984,11 @@
@@ -926,12 +987,7 @@
try
{
String temp = text;
writeRfbFileTransferMsg(
- writeRfbFileTransferMsg(
- rfbCommand,
- rfbCFileDelete,
- 0,
- temp.length(),
- temp);
+ rfbCommand,
+ rfbCFileDelete,
+ 0,
+ temp.length(),
+ temp);
+ writeRfbFileTransferMsg(rfbCommand, rfbCFileDelete, 0, temp.length(), temp);
}
catch (IOException e)
{
@@ -943,7 +1000,7 @@
@@ -943,7 +999,7 @@
// Handles acknowledgement that the directory has been created on the server
void createRemoteDirectoryFeedback() throws IOException
{
......@@ -1463,7 +1971,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
int length = is.readInt();
String f="";
for (int i = 0; i < length; i++)
@@ -951,7 +1008,11 @@
@@ -951,7 +1007,11 @@
f += (char)is.readUnsignedByte();
}
viewer.ftp.refreshRemoteLocation();
......@@ -1476,7 +1984,21 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
viewer.ftp.historyComboBox.setSelectedIndex(0);
}
@@ -979,15 +1040,17 @@
@@ -961,12 +1021,7 @@
try
{
String temp = text;
- writeRfbFileTransferMsg(
- rfbCommand,
- rfbCDirCreate,
- 0,
- temp.length(),
- temp);
+ writeRfbFileTransferMsg(rfbCommand, rfbCDirCreate, 0, temp.length(), temp);
}
catch (IOException e)
{
@@ -979,15 +1034,13 @@
{
try
{
......@@ -1485,21 +2007,18 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
String temp = text;
receivePath = localPath;
writeRfbFileTransferMsg(
- writeRfbFileTransferMsg(
- rfbFileTransferRequest,
- 0,
- 1, // 0 : compression not supported - 1 : compression supported
- temp.length(),
- temp);
+ rfbFileTransferRequest,
+ 0,
+ 1, // 0 : compression not supported - 1 : compression supported
+ temp.length(),
+ temp);
+ // 0 : compression not supported - 1 : compression supported
+ writeRfbFileTransferMsg(rfbFileTransferRequest, 0, 1, temp.length(), temp);
}
catch (IOException e)
{
@@ -1004,6 +1067,9 @@
@@ -1004,6 +1057,9 @@
viewer.ftp.disableButtons();
int size = is.readInt();
int length = is.readInt();
......@@ -1509,7 +2028,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
String tempName = "";
for (int i = 0; i < length; i++)
@@ -1011,6 +1077,15 @@
@@ -1011,6 +1067,15 @@
tempName += (char) is.readUnsignedByte();
}
......@@ -1525,7 +2044,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
// sf@2004 - Read the high part of file size (not yet in rfbFileTransferMsg for
// backward compatibility reasons...)
int sizeH = is.readInt();
@@ -1021,7 +1096,16 @@
@@ -1021,7 +1086,16 @@
fileSize=0;
fileChunkCounter = 0;
String fileName = receivePath;
......@@ -1543,24 +2062,52 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
writeRfbFileTransferMsg(rfbFileHeader, 0, 0, 0, null);
}
@@ -1133,11 +1217,11 @@
@@ -1085,7 +1159,13 @@
fAbort = false;
fFileReceptionError = true;
writeRfbFileTransferMsg(rfbAbortFileTransfer, 0, 0, 0, null);
-
+
+ //runge for use with x11vnc/libvncserver, no rfbAbortFileTransfer reply sent.
+ try {Thread.sleep(500);} catch (InterruptedException e) {}
+ viewer.ftp.enableButtons();
+ viewer.ftp.refreshLocalLocation();
+ viewer.ftp.connectionStatus.setText(" > Error - File NOT received");
+ viewer.ftp.historyComboBox.insertItemAt(new String(" > Error - File: <" + receivePath + "> not correctly received from Remote Machine (aborted by user or error)") ,0);
}
// sf@2004 - For old FT protocole only
/*
@@ -1104,7 +1184,7 @@
int length = is.readInt();
fileSize=0;
fos.close();
-
+
viewer.ftp.refreshLocalLocation();
if (fReceptionOk && !fFileReceptionError)
{
@@ -1132,12 +1212,7 @@
try
{
String temp = text;
writeRfbFileTransferMsg(
- writeRfbFileTransferMsg(
- rfbDirContentRequest,
- rfbRDirContent,
- 0,
- temp.length(),
- temp);
+ rfbDirContentRequest,
+ rfbRDirContent,
+ 0,
+ temp.length(),
+ temp);
+ writeRfbFileTransferMsg(rfbDirContentRequest, rfbRDirContent, 0, temp.length(), temp);
}
catch (IOException e)
{
@@ -1202,6 +1286,52 @@
@@ -1197,11 +1272,80 @@
str += temp;
}
}
+ // runge
+ viewer.ftp.receivedRemoteDirectoryName(str);
// viewer.ftp.changeRemoteDirectory(str);
}
}
......@@ -1574,12 +2121,33 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
+ return (int) l;
+ }
+
+ String timeStr(int t) {
+ int windozeToUnix(int L, int H) {
+ long L2 = zogswap(L);
+ long H2 = zogswap(H);
+ long unix = (H2 << 32) + L2;
+ unix -= 11644473600L * 10000000L;
+ unix /= 10000000L;
+ //System.out.println("unix time: " + unix + " H2: " + H2 + " L2: " + L2);
+ return (int) unix;
+ }
+
+ String timeStr(int t, int h) {
+ if (h == 0) {
+ // x11vnc/libvncserver unix
+ t = zogswap(t);
+ } else {
+ // ultra (except if h==0 by chance)
+ t = windozeToUnix(t, h);
+ }
+ long tl = (long) t;
+ Date date = new Date(tl * 1000);
+ if (true) {
+ return date.toString();
+ } else {
+ return DateFormat.getDateTimeInstance().format(date);
+ }
+ }
+
+ String dotPast(double f, int n) {
+ String fs = "" + f;
+ int i = fs.lastIndexOf(".") + n;
......@@ -1613,7 +2181,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
//Internally used to receive directory content from server
//Here, the server sends one file/directory with it's attributes
void readFTPMsgDirectoryListContent() throws IOException
@@ -1217,17 +1347,25 @@
@@ -1217,17 +1361,25 @@
dwReserved0,
dwReserved1;
long ftCreationTime, ftLastAccessTime, ftLastWriteTime;
......@@ -1642,11 +2210,26 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
length -= 8;
nFileSizeHigh = is.readInt();
length -= 4;
@@ -1263,11 +1401,68 @@
@@ -1253,7 +1405,9 @@
cAlternateFileName = (char) is.readUnsignedByte();
length--;
}
- if (dwFileAttributes == 268435456
+ if (fileName.length() <= 0) {
+ ;
+ } else if (dwFileAttributes == 268435456
|| dwFileAttributes == 369098752
|| dwFileAttributes == 285212672
|| dwFileAttributes == 271056896
@@ -1263,11 +1417,74 @@
|| dwFileAttributes == 369623040)
{
fileName = " [" + fileName + "]";
- remoteDirsList.add(fileName); // sf@2004
- }
- else
- {
- remoteFilesList.add(" " + fileName); // sf@2004
+// begin runge/x11vnc
+// remoteDirsList.add(fileName); // sf@2004
+ int i = -1;
......@@ -1659,14 +2242,14 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
+ break;
+ }
+ }
+ //String s = "Lastmod: " + timeStr(ftLastWriteTimeL) + " " + fileName;
+ //String s = "Lastmod: " + timeStr(ftLastWriteTimeL, ftLastWriteTimeH) + " " + fileName;
+ String f2 = fileName;
+ if (f2.length() < 24) {
+ for (int ik = f2.length(); ik < 24; ik++) {
+ f2 = f2 + " ";
+ }
+ }
+ String s = f2 + " \tLastmod: " + timeStr(ftLastWriteTimeL) + " \t\tSize: " + sizeStr(nFileSizeLow);
+ String s = f2 + " \tLastmod: " + timeStr(ftLastWriteTimeL, ftLastWriteTimeH) + " \t\tSize: " + sizeStr(nFileSizeLow);
+ //s = fileName + " Lastmod: " + zogswap(ftLastWriteTimeL);
+ if (i >= 0) {
+ remoteDirsList.add(i, fileName);
......@@ -1676,10 +2259,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
+ remoteDirsListInfo.add(s);
+ }
+// end runge/x11vnc
}
else
{
- remoteFilesList.add(" " + fileName); // sf@2004
+ } else {
+// begin runge/x11vnc
+// remoteFilesList.add(" " + fileName); // sf@2004
+
......@@ -1700,7 +2280,15 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
+ f2 = f2 + " ";
+ }
+ }
+ String s = f2 + " \tLastmod: " + timeStr(ftLastWriteTimeL) + " \t\tSize: " + sizeStr(nFileSizeLow);
+
+if (false) {
+System.out.println("fileName: " + f2);
+System.out.println("ftLastWriteTimeL: " + ftLastWriteTimeL);
+System.out.println("ftLastWriteTimeH: " + ftLastWriteTimeH);
+System.out.println("nFileSizeLow: " + nFileSizeLow);
+}
+
+ String s = f2 + " \tLastmod: " + timeStr(ftLastWriteTimeL, ftLastWriteTimeH) + " \t\tSize: " + sizeStr(nFileSizeLow);
+ //s = fileName + " Lastmod: " + ftLastWriteTimeL + "/" + zogswap(ftLastWriteTimeL) + " Size: " + nFileSizeLow + "/" + zogswap(nFileSizeLow);
+ if (i >= 0) {
+ remoteFilesList.add(i, fileName);
......@@ -1713,7 +2301,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
}
// a.add(fileName);
@@ -1282,14 +1477,31 @@
@@ -1282,14 +1499,31 @@
// sf@2004
a.clear();
......@@ -1748,7 +2336,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
}
//Internally used to signify the drive requested is not ready
@@ -1299,6 +1511,8 @@
@@ -1299,6 +1533,8 @@
System.out.println("Remote Drive unavailable");
viewer.ftp.connectionStatus.setText(" > WARNING - Remote Drive unavailable (possibly restricted access or media not present)");
viewer.ftp.remoteStatus.setText("WARNING: Remote Drive unavailable");
......@@ -1757,20 +2345,17 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
}
//Call this method to request the list of drives on the server.
@@ -1307,11 +1521,15 @@
@@ -1306,12 +1542,11 @@
{
try
{
viewer.rfb.writeRfbFileTransferMsg(
- viewer.rfb.writeRfbFileTransferMsg(
- RfbProto.rfbDirContentRequest,
- RfbProto.rfbRDrivesList,
- 0,
- 0,
- null);
+ RfbProto.rfbDirContentRequest,
+ RfbProto.rfbRDrivesList,
+ 0,
+ 0,
+ null);
+ viewer.rfb.writeRfbFileTransferMsg(RfbProto.rfbDirContentRequest, RfbProto.rfbRDrivesList, 0, 0, null);
+// begin runge/x11vnc
+ readServerDriveListCnt = 0;
+ readServerDriveListTime = System.currentTimeMillis();
......@@ -1778,7 +2363,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
}
catch (IOException e)
{
@@ -1355,21 +1573,21 @@
@@ -1355,21 +1590,21 @@
int h,
boolean incremental)
throws IOException {
......@@ -3398,8 +3983,8 @@ diff -Naur JavaViewer.orig/VncCanvas.java JavaViewer/VncCanvas.java
result = 0; // Transparent pixel
diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
--- JavaViewer.orig/VncViewer.java 2006-05-24 15:14:40.000000000 -0400
+++ JavaViewer/VncViewer.java 2007-09-03 23:31:31.000000000 -0400
@@ -80,7 +80,7 @@
+++ JavaViewer/VncViewer.java 2008-08-27 10:46:27.000000000 -0400
@@ -80,11 +80,11 @@
GridBagLayout gridbag;
ButtonPanel buttonPanel;
AuthPanel authenticator;
......@@ -3408,6 +3993,11 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
OptionsFrame options;
ClipboardFrame clipboard;
RecordingFrame rec;
- FTPFrame ftp; // KMC: FTP Frame declaration
+ FTPFrame ftp = null; // KMC: FTP Frame declaration
// Control session recording.
Object recordingSync;
@@ -96,7 +96,7 @@
// Variables read from parameter values.
......@@ -3417,7 +4007,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
String passwordParam;
String encPasswordParam;
boolean showControls;
@@ -115,6 +115,28 @@
@@ -115,28 +115,66 @@
int i;
// mslogon support 2 end
......@@ -3446,7 +4036,24 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
//
// init()
//
@@ -124,19 +146,20 @@
+public void ftp_init() {
+ boolean show = false;
+ if (ftp != null) {
+ show = true;
+ }
+ ftp = null;
+
+ ftp = new FTPFrame(this); // KMC: FTPFrame creation
+
+ if (show) {
+ ftp.doOpen();
+ rfb.readServerDriveList();
+ }
+}
+
public void init() {
readParameters();
if (inSeparateFrame) {
......@@ -3473,7 +4080,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
// authenticator = new AuthPanel(false); // mslogon support : go to connectAndAuthenticate()
if (RecordingFrame.checkSecurity())
rec = new RecordingFrame(this);
@@ -147,7 +170,7 @@
@@ -147,10 +185,11 @@
cursorUpdatesDef = null;
eightBitColorsDef = null;
......@@ -3481,8 +4088,13 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
+ if (inSeparateFrame && vncFrame != null)
vncFrame.addWindowListener(this);
ftp = new FTPFrame(this); // KMC: FTPFrame creation
@@ -186,6 +209,30 @@
- ftp = new FTPFrame(this); // KMC: FTPFrame creation
+ ftp_init();
+
rfbThread = new Thread(this);
rfbThread.start();
}
@@ -186,6 +225,30 @@
gbc.weightx = 1.0;
gbc.weighty = 1.0;
......@@ -3513,7 +4125,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
// Add ScrollPanel to applet mode
// Create a panel which itself is resizeable and can hold
@@ -286,6 +333,24 @@
@@ -286,6 +349,24 @@
void connectAndAuthenticate() throws Exception {
......@@ -3538,7 +4150,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
// If "ENCPASSWORD" parameter is set, decrypt the password into
// the passwordParam string.
@@ -336,7 +401,22 @@
@@ -336,7 +417,22 @@
//
......@@ -3562,7 +4174,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
authenticator = new AuthPanel(mslogon);
@@ -390,6 +470,10 @@
@@ -390,6 +486,10 @@
break;
//mslogon support end
......@@ -3573,7 +4185,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
// Retry on authentication failure.
authenticator.retry();
}
@@ -405,9 +489,11 @@
@@ -405,9 +505,11 @@
void prologueDetectAuthProtocol() throws Exception {
......@@ -3587,7 +4199,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
System.out.println("RFB server supports protocol version " +
rfb.serverMajor + "." + rfb.serverMinor);
@@ -431,16 +517,36 @@
@@ -431,16 +533,36 @@
boolean tryAuthenticate(String us, String pw) throws Exception {
......@@ -3607,10 +4219,10 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
+ rfb.serverMajor + "." + rfb.serverMinor);
+
+ rfb.writeVersionMsg();
+
+ authScheme = rfb.readAuthScheme();
- int authScheme = rfb.readAuthScheme();
+ authScheme = rfb.readAuthScheme();
+
+ gotAuth = true;
+ authGot = authScheme;
+ } else {
......@@ -3630,7 +4242,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
switch (authScheme) {
@@ -629,6 +735,10 @@
@@ -629,6 +751,10 @@
void doProtocolInitialisation() throws IOException {
......@@ -3641,7 +4253,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
rfb.writeClientInit();
rfb.readServerInit();
@@ -775,8 +885,25 @@
@@ -775,8 +901,25 @@
}
}
......@@ -3669,7 +4281,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
if (inAnApplet) {
str = readParameter("Open New Window", false);
@@ -804,6 +931,90 @@
@@ -804,6 +947,90 @@
deferScreenUpdates = readIntParameter("Defer screen updates", 20);
deferCursorUpdates = readIntParameter("Defer cursor updates", 10);
deferUpdateRequests = readIntParameter("Defer update requests", 50);
......
......@@ -1359,6 +1359,8 @@ static int get_cmap(int j, Colormap cmap) {
X_LOCK;
ncells = CellsOfScreen(ScreenOfDisplay(dpy, scr));
X_UNLOCK;
} else {
ncells = NCOLOR;
}
if (db24 > 1) fprintf(stderr, "get_cmap: %d 0x%x\n", j, (unsigned int) cmap);
......
2008-09-06 Karl Runge <runge@karlrunge.com>
* x11vnc: kill gui_pid on exit in -connect/-connect_or_exit mode.
-grablocal n experiment (not compiled by default). -macuskbd
option for macosx for orig uskdb code. keycode=N remote contol
cmd. Find dpy look at non-NFS cookies in /tmp. Fix gui tray
insertion on recent gnome dt. Fix connect_file bug. Sync SSVNC
2008-06-07 Karl Runge <runge@karlrunge.com>
* x11vnc: -clip xineramaN option, -DIGNORE_GETSPNAM for HP-UX.
Print info on SSH_CONNECTION override.
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -755,6 +755,10 @@ void client_gone(rfbClientPtr client) {
if (inetd && client == inetd_client) {
rfbLog("inetd viewer exited.\n");
if (gui_pid > 0) {
rfbLog("killing gui_pid %d\n", gui_pid);
kill(gui_pid, SIGTERM);
}
clean_up_exit(0);
}
if (connect_once) {
......@@ -779,6 +783,10 @@ void client_gone(rfbClientPtr client) {
}
rfbLog("viewer exited.\n");
if ((client_connect || connect_or_exit) && gui_pid > 0) {
rfbLog("killing gui_pid %d\n", gui_pid);
kill(gui_pid, SIGTERM);
}
clean_up_exit(0);
}
#ifdef MACOSX
......@@ -2423,6 +2431,10 @@ void reverse_connect(char *str) {
if (connect_or_exit) {
rfbLogEnable(1);
rfbLog("exiting under -connect_or_exit\n");
if (gui_pid > 0) {
rfbLog("killing gui_pid %d\n", gui_pid);
kill(gui_pid, SIGTERM);
}
clean_up_exit(0);
}
return;
......@@ -2458,6 +2470,10 @@ void reverse_connect(char *str) {
if (client_count <= nclients0) {
rfbLogEnable(1);
rfbLog("exiting under -connect_or_exit\n");
if (gui_pid > 0) {
rfbLog("killing gui_pid %d\n", gui_pid);
kill(gui_pid, SIGTERM);
}
clean_up_exit(0);
}
}
......@@ -2737,6 +2753,7 @@ void check_gui_inputs(void) {
static int turn_off_truecolor = 0;
static void turn_off_truecolor_ad(rfbClientPtr client) {
if (client) {}
if (turn_off_truecolor) {
rfbLog("turning off truecolor advertising.\n");
screen->serverFormat.trueColour = FALSE;
......
......@@ -25,6 +25,7 @@ Window tray_request = None;
Window tray_window = None;
int tray_unembed = 0;
pid_t run_gui_pid = 0;
pid_t gui_pid = 0;
char *get_gui_code(void);
......@@ -50,6 +51,10 @@ static Window tweak_tk_window_id(Window win) {
char *name = NULL;
Window parent, new;
if (getenv("NO_TWEAK_TK_WINDOW_ID")) {
return win;
}
/* hack for tk, does not report outermost window */
new = win;
parent = parent_window(win, &name);
......@@ -684,12 +689,14 @@ void do_gui(char *opts, int sleep) {
fprintf(icon_mode_fh, "none\n");
fflush(icon_mode_fh);
if (! got_connect_once) {
/* want -forever for tray */
if (!client_connect && !connect_or_exit) {
/* want -forever for tray? */
connect_once = 0;
}
}
}
}
}
if ((p = fork()) > 0) {
; /* parent */
......@@ -707,6 +714,7 @@ void do_gui(char *opts, int sleep) {
}
if (connect_to_x11vnc) {
run_gui_pid = p;
gui_pid = p;
}
#else
fprintf(stderr, "system does not support fork: start "
......
......@@ -12,6 +12,7 @@ extern Window tray_request;
extern Window tray_window;
extern int tray_unembed;
extern pid_t run_gui_pid;
extern pid_t gui_pid;
extern char *get_gui_code(void);
extern int tray_embed(Window iconwin, int remove);
......
......@@ -484,7 +484,7 @@ void print_help(int mode) {
" to plumb reverse connections.\n"
"\n"
"-connect_or_exit str As with -connect, except if none of the reverse\n"
" connections succeed, then x11vnc shutdowns immediately.\n"
" connections succeed, then x11vnc shuts down immediately\n"
"\n"
" By the way, if you do not want x11vnc to listen on\n"
" ANY interface use -rfbport 0 which is handy for the\n"
......@@ -628,6 +628,16 @@ void print_help(int mode) {
" use the -R remote control to turn the other back on,\n"
" e.g. -R nograbptr.\n"
"\n"
#ifdef ENABLE_GRABLOCAL
"-grablocal n If it appears that a user sitting at the physical\n"
" display has injected a keystroke or mouse event ignore\n"
" any VNC client inputs for the next n seconds. The idea\n"
" is that during a demonstration, etc, the local user\n"
" will not be interrupted by viewers accidentally moving\n"
" the mouse, etc. The detection of local user input is\n"
" approximate and so at times gives unexpected results.\n"
"\n"
#endif
"-viewpasswd string Supply a 2nd password for view-only logins. The -passwd\n"
" (full-access) password must also be supplied.\n"
"\n"
......@@ -3631,25 +3641,27 @@ void print_help(int mode) {
" You can also set the env. var X11VNC_UINPUT_DEBUG=1 or\n"
" higher to get debugging output for UINPUT mode.\n"
"\n"
"-macnodim For the native Mac OS X server, disable dimming. \n"
"-macnosleep For the native Mac OS X server, disable display sleep.\n"
"-macnosaver For the native Mac OS X server, disable screensaver.\n"
"-macnowait For the native Mac OS X server, do not wait for the\n"
"-macnodim For the native MacOSX server, disable dimming. \n"
"-macnosleep For the native MacOSX server, disable display sleep.\n"
"-macnosaver For the native MacOSX server, disable screensaver.\n"
"-macnowait For the native MacOSX server, do not wait for the\n"
" user to switch back to his display.\n"
"-macwheel n For the native Mac OS X server, set the mouse wheel\n"
"-macwheel n For the native MacOSX server, set the mouse wheel\n"
" speed to n (default 5).\n"
"-macnoswap For the native Mac OS X server, do not swap mouse\n"
"-macnoswap For the native MacOSX server, do not swap mouse\n"
" buttons 2 and 3.\n"
"-macnoresize For the native Mac OS X server, do not resize or reset\n"
"-macnoresize For the native MacOSX server, do not resize or reset\n"
" the framebuffer even if it is detected that the screen\n"
" resolution or depth has changed.\n"
"-maciconanim n For the native Mac OS X server, set n to the number\n"
"-maciconanim n For the native MacOSX server, set n to the number\n"
" of milliseconds that the window iconify/deiconify\n"
" animation takes. In -ncache mode this value will be\n"
" used to skip the animation if possible. (default 400)\n"
"-macmenu For the native Mac OS X server, in -ncache client-side\n"
"-macmenu For the native MacOSX server, in -ncache client-side\n"
" caching mode, try to cache pull down menus (not perfect\n"
" because they have animated fades, etc.)\n"
"-macuskbd For the native MacOSX server, use the original\n"
" keystroke insertion code based on a US keyboard.\n"
"\n"
"-gui [gui-opts] Start up a simple tcl/tk gui based on the the remote\n"
" control options -remote/-query described below.\n"
......@@ -3707,6 +3719,14 @@ void print_help(int mode) {
" fully functional, the gui mode should be \"start\"\n"
" (the default).\n"
"\n"
" Note that tray or icon mode will imply the -forever\n"
" x11vnc option (if the x11vnc server is started along\n"
" with the gui) unless -connect or -connect_or_exit has\n"
" been specified. So x11vnc (and the tray/icon gui)\n"
" will wait for more connections after the first client\n"
" disconnects. If you want only one viewer connection\n"
" include the -once option.\n"
"\n"
" For \"icon\" the gui just a small standalone window.\n"
" For \"tray\" it will attempt to embed itself in the\n"
" \"system tray\" if possible. If \"=setpass\" is appended then\n"
......@@ -4397,12 +4417,13 @@ void xopen_display_fail_message(char *disp) {
fprintf(stderr, "\n");
fprintf(stderr, "Some tips and guidelines:\n");
fprintf(stderr, "\n");
fprintf(stderr, " * An X server (the one you wish to view) must"
fprintf(stderr, "** An X server (the one you wish to view) must"
" be running before x11vnc is\n");
fprintf(stderr, " started: x11vnc does not start the X server. (however, see the\n");
fprintf(stderr, " recent -create option if that is what you really want).\n");
fprintf(stderr, " started: x11vnc does not start the X server. "
"(however, see the -create\n");
fprintf(stderr, " option if that is what you really want).\n");
fprintf(stderr, "\n");
fprintf(stderr, " * You must use -display <disp>, -OR- set and"
fprintf(stderr, "** You must use -display <disp>, -OR- set and"
" export your $DISPLAY\n");
fprintf(stderr, " environment variable to refer to the display of"
" the desired X server.\n");
......@@ -4414,7 +4435,7 @@ void xopen_display_fail_message(char *disp) {
" or a guru if you are having\n");
fprintf(stderr, " difficulty determining what your X DISPLAY is.\n");
fprintf(stderr, "\n");
fprintf(stderr, " * Next, you need to have sufficient permissions"
fprintf(stderr, "** Next, you need to have sufficient permissions"
" (Xauthority) \n");
fprintf(stderr, " to connect to the X DISPLAY. Here are some"
" Tips:\n");
......@@ -4438,7 +4459,7 @@ void xopen_display_fail_message(char *disp) {
" -display :0\n");
fprintf(stderr, " you must have read permission for the auth file.\n");
fprintf(stderr, "\n");
fprintf(stderr, " - If NO ONE is logged into an X session yet, but"
fprintf(stderr, "** If NO ONE is logged into an X session yet, but"
" there is a greeter login\n");
fprintf(stderr, " program like \"gdm\", \"kdm\", \"xdm\", or"
" \"dtlogin\" running, you will need\n");
......@@ -4447,18 +4468,21 @@ void xopen_display_fail_message(char *disp) {
fprintf(stderr, " Some examples for various display managers:\n");
fprintf(stderr, "\n");
fprintf(stderr, " gdm: -auth /var/gdm/:0.Xauth\n");
fprintf(stderr, " -auth /var/lib/gdm/:0.Xauth\n");
fprintf(stderr, " kdm: -auth /var/lib/kdm/A:0-crWk72\n");
fprintf(stderr, " -auth /var/run/xauth/A:0-crWk72\n");
fprintf(stderr, " xdm: -auth /var/lib/xdm/authdir/authfiles/A:0-XQvaJk\n");
fprintf(stderr, " dtlogin: -auth /var/dt/A:0-UgaaXa\n");
fprintf(stderr, "\n");
fprintf(stderr, " Sometimes the command \"ps wwwwaux | grep auth\""
" can reveal the file location.\n");
fprintf(stderr, "\n");
fprintf(stderr, " Only root will have read permission for the"
" file, and so x11vnc must be run\n");
fprintf(stderr, " as root. The random characters in the filenames"
" will of course change,\n");
fprintf(stderr, " and the directory the cookie file resides in may"
" also be system dependent.\n");
fprintf(stderr, " Sometimes the command \"ps wwwaux | grep auth\""
" can reveal the file location.\n");
fprintf(stderr, " as root (or copy it). The random characters in the filenames"
" will of course\n");
fprintf(stderr, " change and the directory the cookie file resides in"
" is system dependent.\n");
fprintf(stderr, "\n");
fprintf(stderr, "See also: http://www.karlrunge.com/x11vnc/#faq\n");
}
......@@ -4474,7 +4498,7 @@ void nopassword_warning_msg(int gotloc) {
"#@ YOU ARE RUNNING X11VNC WITHOUT A PASSWORD!! @#\n"
"#@ @#\n"
"#@ This means anyone with network access to this computer @#\n"
"#@ will be able to view and control your desktop. @#\n"
"#@ may be able to view and control your desktop. @#\n"
"#@ @#\n"
"#@ >>> If you did not mean to do this Press CTRL-C now!! <<< @#\n"
"#@ @#\n"
......
......@@ -3149,6 +3149,7 @@ void keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) {
last_rfb_down = down;
last_rfb_keysym = keysym;
last_rfb_keytime = tnow;
last_rfb_key_injected = dnow();
got_user_input++;
got_keyboard_input++;
......@@ -3176,6 +3177,7 @@ void keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) {
last_rfb_down = down;
last_rfb_keysym = keysym;
last_rfb_keytime = tnow;
last_rfb_key_injected = dnow();
got_user_input++;
got_keyboard_input++;
......
......@@ -31,6 +31,7 @@ int macosxCG_get_cursor_pos(int *x, int *y);
int macosxCG_get_cursor(void);
void macosxCG_init_key_table(void);
void macosxCG_key_inject(int down, unsigned int keysym);
void macosxCG_keycode_inject(int down, int keycode);
CGDirectDisplayID displayID = 0;
......@@ -595,6 +596,14 @@ void macosxCG_init_key_table(void) {
}
extern void init_key_table(void);
extern int macosx_us_kbd;
void macosxCG_keycode_inject(int down, int keycode) {
CGKeyCode keyCode = (CGKeyCode) keycode;
CGCharCode keyChar = 0;
CGPostKeyboardEvent(keyChar, keyCode, down);
}
void macosxCG_key_inject(int down, unsigned int keysym) {
CGKeyCode keyCode = keyTable[(unsigned short)keysym];
......@@ -606,7 +615,7 @@ void macosxCG_key_inject(int down, unsigned int keysym) {
init_key_table();
if (keysym < 0xFF) {
if (keysym < 0xFF && macosx_us_kbd) {
keyChar = (CGCharCode) keysym;
}
if (keyCode == 0xFFFF) {
......
......@@ -20,6 +20,7 @@ extern int macosxCG_get_cursor_pos(int *x, int *y);
extern int macosxCG_get_cursor(void);
extern void macosxCG_init_key_table(void);
extern void macosxCG_key_inject(int down, unsigned int keysym);
extern void macosxCG_keycode_inject(int down, int keycode);
extern void macosxCG_refresh_callback_off(void);
extern void macosxCG_refresh_callback_on(void);
......
......@@ -29,7 +29,7 @@ survey http://rechten.uvt.nl/koops/cryptolaw/index.htm for useful
information.
All work done by Karl J. Runge in this project is
Copyright (c) 2006-2007 Karl J. Runge and is licensed under the GPL as
Copyright (c) 2006-2008 Karl J. Runge and is licensed under the GPL as
described in the file COPYING in this directory.
All the files and information in this project are provided "AS IS"
......@@ -66,23 +66,30 @@ The enhanced TightVNC viewer features are:
- Create or Import SSL Certificates and Private Keys.
- Reverse (viewer listening) VNC connections via SSL and SSH.
- Support for Web Proxies, SOCKS Proxies, and the UltraVNC
repeater proxy (e.g. repeater://host:port+ID:1234). Multiple
proxies may be chained together (3 max).
- Support for SSH Gateway connections and non-standard SSH ports.
- You can also use your own VNC Viewer, e.g. UltraVNC or RealVNC,
with the front-end GUI or scripts if you like.
- Automatic Service tunnelling via SSH for CUPS and SMB Printing,
ESD/ARTSD Audio, and SMB (Windows/Samba) filesystem mounting.
- Sets up any additional SSH port redirections that you want.
- Port Knocking for "closed port" SSH/SSL connections. In addition
to a simple fixed port sequence and one-time-pad implementation,
a hook is also provided to run any port knocking client before a
connecting.
- You can also use your own VNC Viewer, e.g. UltraVNC or RealVNC,
with the front-end GUI or scripts if you like.
- Sets up any additional SSH port redirections that you want.
- Support for native MacOS X usage with bundled Chicken of the
VNC viewer.
- Reverse (viewer listening) VNC connections via SSL and SSH.
VNC viewer (the Unix X11 viewer is also provided for MacOS X,
and is better IMHO).
- Dynamic VNC Server Port determination and redirection (using
ssh's builtin SOCKS proxy, -D) for servers like x11vnc that
......@@ -116,6 +123,16 @@ The enhanced TightVNC viewer features are:
(java must be in $PATH). Note that x11vnc supports UltraVNC
file transfer.
- Connection support for the UltraVNC repeater proxy (-repeater
option).
- Support for UltraVNC Single Click operation. (both unencrypted:
SC I, and SSL encrypted: SC III)
- Instead of hostname:display one can also supply "exec=command args..."
to connect the viewer to the stdio of an external command
(e.g. stunnel or socat) rather than using a TCP/IP socket.
- Extremely low color modes: 64 and 8 colors in 8bpp
(-use64/-bgr222, -use8/-bgr111)
......@@ -391,7 +408,7 @@ If you need to Build:
If your OS/arch is not included or the provided binary has the wrong
library dependencies, etc. the script "build.unix" may be able to
successfully build on for you and deposit the binaries down in ./bin/...
using the included source code.
using the included source code. It is a hack but usually works.
You MUST run the build.unix script from this directory (that this toplevel
README is in, i.e "ssvnc") and like this:
......@@ -401,9 +418,30 @@ README is in, i.e "ssvnc") and like this:
To use custom locations for libraries see the LDFLAGS_OS and CPPFLAGS_OS
description at the top of the build.unix script.
You can set these env. vars to customize the build:
SSVNC_BUILD_NO_STATIC=1 do not try to statically link libs
SSVNC_BUILD_FORCE_OVERWRITE=1 do not prompt about existing binaries
SSVNC_BUILD_SKIP_VIEWER=1 do not build vncviewer
SSVNC_BUILD_SKIP_STUNNEL=1 do not build stunnel
SSVNC_BUILD_ULTRAFTP=1 only build the file xfer helper jar
here is an example to build only the vncviewer and with normal library
linking (and in a more or less automated way):
env SSVNC_BUILD_NO_STATIC=1 SSVNC_BUILD_FORCE_OVERWRITE=1 SSVNC_BUILD_SKIP_STUNNEL=1 ./build.unix
Feel free to ask us if you need help running ./build.unix
Convential Build:
A more conventional source tarball is provided in ssvnc-x.y.z.src.tar.gz.
It uses a more or less familiar 'make config; make all; make install'
method. It does not include stunnel, so that must be installed on the
system separately.
The programs:
------------
......@@ -519,6 +557,86 @@ as long as you install external vncviewer and stunnel packages:
ssvnc_unix_minimal-1.x.y.tar.gz
Untrusted Local Users:
---------------------
*IMPORTANT WARNING*: If you run SSVNC on a workstation or computer
that other users can log into and you DO NOT TRUST these users
(it is a shame but sometimes one has to work in an environment like
this), then please note the following warning.
By 'do not trust' we mean they might try to gain access to remote
machines you connect to via SSVNC. Note that an untrusted local
user can often obtain root access in a short amount of time; if a
user has acheived that, then all bets are off for ANYTHING that you
do on the workstation. It is best to get rid of Untrusted Local
Users as soon as possible.
Both the SSL and SSH tunnels set up by SSVNC listen on certain ports
on the 'localhost' address and redirect TCP connections to the remote
machine; usually the VNC server running there (but it could also be
another service, e.g. CUPS printing). These are the stunnel(8) SSL
redirection and the ssh(1) '-L' port redirection. Because 'localhost'
is used only users or programs on the same workstation that is
running SSVNC can connect to these ports, however this includes any
local users (not just the user running SSVNC.)
If the untrusted local user tries to connect to these ports, he may
succeed in varying degrees to gain access to the remote machine.
We now list some safeguards one can put in place to try to make this
more difficult to acheive.
It probably pays to have the VNC server require a password, even
though there has already been SSL or SSH authentication (via
certificates or passwords). In general if the VNC Server requires
SSL authentication of the viewer that helps, unless the untrusted
local user has gained access to your SSVNC certificate keys.
If the VNC server is configured to only allow one viewer connection
at a time, then the window of opportunity that the untrusted local
user can use is greatly reduced: he might only have a second or two
between the tunnel being set up and the SSVNC vncviewer connecting
to it (i.e. if the VNC server only allows a single connection, the
untrusted local user cannot connect once your session is established).
Similarly, when you disconnect the tunnel is torn down quickly and
there is little or no window of opportunity to connect (e.g. x11vnc
in its default mode exits after the first client disconnects).
Also for SSL tunnelling with stunnel(8) on Unix using one of the SSVNC
prebuilt 'bundles', a patched stunnel is provided that denies all
connections after the first one, and exits when the first one closes.
This is not true if the system installed stunnel(8) is used and is
not true when using SSVNC on Windows.
The following are two experimental features that are added to SSVNC
to improve the situation for the SSL/stunnel case. Set them via
Options -> Advanced -> "STUNNEL Local Port Protections".
1) For SSL tunnelling with stunnel(8) on Unix there is a setting
'Use stunnel EXEC mode' (experimental) that will try to exec(2)
stunnel instead of using a listening socket. This will require
using the specially modified vncviewer unix viewer provided
by SSVNC. If this mode proves stable it will become the default.
2) For SSL tunnelling with stunnel(8) on Unix there is a setting
'Use stunnel IDENT check' (experimental) to limit socket
connections to be from you (this assumes the untrusted local
user has not become root on your workstation and has modified
your local IDENT check service; if he has you have much bigger
problems to worry about...)
There is also one simple LD_PRELOAD trick for SSH to limit the number
of accepted port redirection connections. This makes the window of
time the untrusted local user can connect to the tunnel much smaller.
Enable it via Options -> Advanced -> "SSH Local Port Protections".
You will need to have the lim_accept.so file in your SSVNC package.
The main message is to 'Watch your Back' when you connect via the
SSVNC tunnels and there are users you don't trust on your workstation.
The same applies to ANY use of SSH '-L' port redirections or outgoing
stunnel SSL redirection services.
Help and Info:
-------------
......
start ssvnc.exe -ssh %1 %2 %3 %4 %5 %6 %7 %8 %9
start ssvnc.exe -ts %1 %2 %3 %4 %5 %6 %7 %8 %9
#!/bin/sh
#
# wrapper for SSH_ONLY mode
#
PATH=`dirname "$0"`:$PATH; export PATH
SSVNC_SSH_ONLY=1; export SSVNC_SSH_ONLY
exec ssvnc -ssh "$@"
......@@ -79,7 +79,11 @@ nearby=0
if [ -x "$dir/vncviewer" -a -x "$dir/stunnel" ]; then
nearby=1
fi
if [ ! -d "$dir/$name" -a $nearby = 0 ]; then
if [ "X$name" = "X." ]; then
:
#type vncviewer
#type stunnel
elif [ ! -d "$dir/$name" -a $nearby = 0 ]; then
echo
echo "Cannot find platform dir for your OS `uname -sm`:"
echo
......
#!/bin/sh
#
# Copyright (c) 2006 by Karl J. Runge <runge@karlrunge.com>
# Copyright (c) 2006-2008 by Karl J. Runge <runge@karlrunge.com>
#
# ssvnc_cmd:
#
......@@ -23,9 +23,15 @@
#
# Usage:
#
# ssvnc_cmd [ss_vncviewer-args] hostname:N [tightvncviewer-args]
# ssvnc_cmd [ss_vncviewer-args] hostname:N [vncviewer-args]
#
# "hostname:N" is the host and VNC display to connect to, e.g. snoopy:0
# if, instead, this script is named "tightvncviewer" it calls the
# vncviewer directly and must be invoked as:
#
# tightvncviewer [vncviewer-args] hostname:N
#
# In both cases, "hostname:N" is the host and VNC display to connect to,
# e.g. snoopy:0
#
# See the script util/ss_vncviewer for details about its arguments:
#
......@@ -35,6 +41,8 @@
# -alpha
# -grab
#
# N.B. if this script is named "tightvncviewer" the vncviewer is called
# directly, and there won't be any SSL or SSH encryption tunnels.
#
# If the *very first* argument is "-cotvnc" then it is assumed you are on
# Darwin and want to run the Chicken of the VNC viewer via our wrapper.
......@@ -75,9 +83,12 @@
# Option names may be abbreviated, e.g. -bgr instead of -bgr233.
# See the manual page for more information.
#
# Note: the enhanced tightvnc viewer (SSVNC) has many more options, run
# this script as "ssvnc_cmd Vnc://a:0 -help" or "tightvncviewer -help"
# to seem them.
if [ "X$1" = "X-h" -o "X$1" = "X-help" -o "X$1" = "X--help" ]; then
head -76 "$0" | grep -v bin/sh
if [ "X$1" = "X-h" -o "X$1" = "X-helpxxx" -o "X$1" = "X--help" ]; then
tail -n +2 "$0" | sed -e '/^$/ q' -e 's/^#//'
exit
fi
......@@ -145,12 +156,20 @@ do
done
dir=`dirname "$f"`
PATH="$dir:$PATH"
SSVNC_BASEDIR="$dir"
export SSVNC_BASEDIR
SSVNC_UNAME="$name"
export SSVNC_UNAME
nearby=0
if [ -x "$dir/vncviewer" -a -x "$dir/stunnel" ]; then
nearby=1
fi
if [ ! -d "$dir/$name" -a $nearby = 0 ]; then
if [ "X$name" = "X." ]; then
:
#type vncviewer
#type stunnel
elif [ ! -d "$dir/$name" -a $nearby = 0 ]; then
echo
echo "Cannot find platform dir for your OS `uname -sm`:"
echo
......@@ -223,6 +242,9 @@ fi
#
#
if [ $use_ours = 1 ]; then
# avoid system vncviewer app-defaults
#XFILESEARCHPATH="/tmp/path/nowhere"; export XFILESEARCHPATH
if [ "X$base" = "Xtightvncviewer" ]; then
$VNCVIEWERCMD -encodings 'copyrect tight zrle zlib hextile' "$@"
else
......
#!/bin/sh
#
# wrapper for TS_ONLY mode
#
PATH=`dirname "$0"`:$PATH; export PATH
SSVNC_TS_ONLY=1; export SSVNC_TS_ONLY
exec ssvnc -ts "$@"
......@@ -447,6 +447,9 @@ findfree() {
# removes files, etc.
final() {
echo ""
if [ "X$tmp_cfg" != "X" ]; then
rm -f $tmp_cfg
fi
if [ "X$SS_VNCVIEWER_RM" != "X" ]; then
rm -f $SS_VNCVIEWER_RM 2>/dev/null
fi
......@@ -1012,6 +1015,24 @@ if [ "X$use_ssh" = "X1" ]; then
# let user override ssh via $SSH
ssh=${SSH:-"ssh -x"}
if [ "X$SSVNC_LIM_ACCEPT_PRELOAD" != "X" ]; then
SSVNC_LIM_ACCEPT_PRELOAD="$SSVNC_BASEDIR/$SSVNC_UNAME/$SSVNC_LIM_ACCEPT_PRELOAD"
fi
if [ "X$SSVNC_LIM_ACCEPT_PRELOAD" != "X" ]; then
echo ""
echo "SSVNC_LIM_ACCEPT_PRELOAD=$SSVNC_LIM_ACCEPT_PRELOAD"
fi
if [ "X$SSVNC_LIM_ACCEPT_PRELOAD" != "X" -a -f "$SSVNC_LIM_ACCEPT_PRELOAD" ]; then
plvar=LD_PRELOAD
if uname | grep Darwin >/dev/null; then
plvar="DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_INSERT_LIBRARIES"
fi
ssh="env $plvar=$SSVNC_LIM_ACCEPT_PRELOAD $ssh"
else
SSVNC_LIM_ACCEPT_PRELOAD=""
fi
if echo "$proxy" | egrep '(http|https|socks|socks4|socks5)://' > /dev/null; then
# Handle Web or SOCKS proxy(ies) for the initial connect.
Kecho host=$host
......@@ -1328,10 +1349,11 @@ Kecho proxy=$proxy
c=0
pssh=""
mssh=`echo "$ssh" | sed -e 's/^env.*ssh/ssh/'`
while [ $c -lt 30 ]
do
p=`expr $pmark + $c`
if ps -p "$p" 2>&1 | grep "$ssh" > /dev/null; then
if ps -p "$p" 2>&1 | grep "$mssh" > /dev/null; then
pssh=$p
break
fi
......@@ -1339,6 +1361,8 @@ Kecho proxy=$proxy
done
if [ "X$getport" != "X" ]; then
:
elif [ "X$SSVNC_LIM_ACCEPT_PRELOAD" != "X" ] ; then
sleep 2
elif [ "X$ssh_cmd" = "Xsleep $ssh_sleep" ] ; then
#echo T sleep 1
sleep 1
......@@ -1523,9 +1547,11 @@ if [ "X$direct_connect" != "X" ]; then
exit $?
fi
tmp=/tmp/ss_vncviewer${RANDOM}.$$
mytmp "$tmp"
tmp_cfg=/tmp/ss_vncviewer${RANDOM}.$$
mytmp "$tmp_cfg"
# make_tcert is no longer invoked via the ssvnc gui (Listen mode).
# make_tcert is for testing only now via -mycert BUILTIN
make_tcert() {
tcert="/tmp/tcert${RANDOM}.$$"
cat > $tcert <<END
......@@ -1584,37 +1610,50 @@ END
echo "$tcert"
}
stunnel_exec=""
if echo $STUNNEL_EXTRA_SVC_OPTS | grep '#stunnel-exec' > /dev/null; then
stunnel_exec="#"
fi
if [ "X$reverse" = "X" ]; then
if echo "$proxy" | grep repeater:// > /dev/null; then
if [ "X$cert" = "X" ]; then
if [ "X$cert" = "XBUILTIN" ]; then
ttcert=`make_tcert`
cert="cert = $ttcert"
fi
# Note for listen mode, an empty cert will cause stunnel to fail.
# The ssvnc gui will have already taken care of this.
fi
cat > "$tmp" <<END
cat > "$tmp_cfg" <<END
foreground = yes
pid =
client = yes
debug = 6
$STUNNEL_EXTRA_OPTS
$STUNNEL_EXTRA_OPTS_USER
$verify
$cert
[vnc_stunnel]
accept = localhost:$use
${stunnel_exec}[vnc_stunnel]
${stunnel_exec}accept = localhost:$use
$connect
$STUNNEL_EXTRA_SVC_OPTS
$STUNNEL_EXTRA_SVC_OPTS_USER
END
else
stunnel_exec="" # doesn't work for listening.
p2=`expr 5500 + $N`
connect="connect = localhost:$p2"
if [ "X$cert" = "X" ]; then
if [ "X$cert" = "XBUILTIN" ]; then
ttcert=`make_tcert`
cert="cert = $ttcert"
fi
# Note for listen mode, an empty cert will cause stunnel to fail.
# The ssvnc gui will have already taken care of this.
STUNNEL_EXTRA_OPTS=`echo "$STUNNEL_EXTRA_OPTS" | sed -e 's/maxconn/#maxconn/'`
......@@ -1622,18 +1661,21 @@ else
if [ "X$use_ssh" = "X1" ]; then
hloc="localhost:"
fi
cat > "$tmp" <<END
cat > "$tmp_cfg" <<END
foreground = yes
pid =
client = no
debug = 6
$STUNNEL_EXTRA_OPTS
$STUNNEL_EXTRA_OPTS_USER
$verify
$cert
[vnc_stunnel]
accept = $hloc$port
$connect
$STUNNEL_EXTRA_SVC_OPTS
$STUNNEL_EXTRA_SVC_OPTS_USER
END
fi
......@@ -1641,31 +1683,33 @@ fi
echo ""
echo "Using this stunnel configuration:"
echo ""
cat "$tmp" | uniq
cat "$tmp_cfg" | uniq
echo ""
sleep 1
echo ""
echo "Running stunnel:"
echo "$STUNNEL $tmp"
st=`echo "$STUNNEL" | awk '{print $1}'`
$st -help > /dev/null 2>&1
$STUNNEL "$tmp" < /dev/tty > /dev/tty &
stunnel_pid=$!
echo ""
if [ "X$stunnel_exec" = "X" ]; then
echo ""
echo "Running stunnel:"
echo "$STUNNEL $tmp_cfg"
st=`echo "$STUNNEL" | awk '{print $1}'`
$st -help > /dev/null 2>&1
$STUNNEL "$tmp_cfg" < /dev/tty > /dev/tty &
stunnel_pid=$!
echo ""
# pause here to let the user supply a possible passphrase for the
# mycert key:
if [ "X$mycert" != "X" ]; then
# pause here to let the user supply a possible passphrase for the
# mycert key:
if [ "X$mycert" != "X" ]; then
sleep 1
echo ""
echo "(pausing for possible certificate passphrase dialog)"
echo ""
sleep 4
fi
#echo T sleep 1
sleep 1
rm -f "$tmp_cfg"
fi
#echo T sleep 1
sleep 1
rm -f "$tmp"
echo ""
......@@ -1675,15 +1719,19 @@ if [ "X$SSVNC_EXTRA_SLEEP" != "X" ]; then
fi
echo "Running viewer:"
if [ "X$reverse" = "X" ]; then
echo "$VNCVIEWERCMD" "$@" localhost:$N
vnc_hp=localhost:$N
if [ "X$stunnel_exec" != "X" ]; then
vnc_hp="exec=$STUNNEL $tmp_cfg"
fi
echo "$VNCVIEWERCMD" "$@" "$vnc_hp"
trap "final" 0 2 15
echo ""
$VNCVIEWERCMD "$@" localhost:$N
$VNCVIEWERCMD "$@" "$vnc_hp"
if [ $? != 0 ]; then
echo "vncviewer command failed: $?"
if [ "X$secondtry" = "X1" ]; then
sleep 2
$VNCVIEWERCMD "$@" localhost:$N
$VNCVIEWERCMD "$@" "$vnc_hp"
fi
fi
else
......
......@@ -3,7 +3,7 @@
exec wish "$0" "$@"
#
# Copyright (c) 2006-2007 by Karl J. Runge <runge@karlrunge.com>
# Copyright (c) 2006-2008 by Karl J. Runge <runge@karlrunge.com>
#
# ssvnc.tcl: gui wrapper to the programs in this
# package. Also sets up service port forwarding.
......@@ -382,8 +382,8 @@ proc help {} {
SSL Certificate Verification:
*IMPORTANT*: If you do not take the steps to VERIFY the VNC Server's SSL
Certificate, you are theoretically vulnerable to a Man-In-The-Middle
***IMPORTANT***: If you do not take the steps to VERIFY the VNC Server's
SSL Certificate, you are in principle vulnerable to a Man-In-The-Middle
attack. Without SSL Certificate verification, only passive network
sniffing attacks will be guaranteed to be prevented.
......@@ -400,7 +400,8 @@ proc help {} {
However, "Fetch Cert" and "Verify All Certs" are currently disabled
in the rare "SSH + SSL" usage mode (e.g. SSH is used to enter a
firewall gateway, and then SSL is tunneled through that to reach
the workstation).
the workstation). You are always free to use a "ServerCert" (under
"Certs...") to authenticate SSL Servers against.
Windows STUNNEL:
......@@ -414,7 +415,7 @@ proc help {} {
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.
to move the mouse over the icon to make the picture go away!
In some cases you may need to terminate STUNNEL manually from the
System Tray (right click on dark green icon) and selecting "Exit".
......@@ -422,13 +423,14 @@ proc help {} {
VNC Password:
On Unix or MacOSX if there is a VNC password for the server you
On Unix or MacOSX IF there is a VNC password for the server you
can enter it in the "VNC Password:" entry box.
This is *REQUIRED* on MacOSX when Chicken of the VNC is used.
On Unix if you choose not to enter the password you will be prompted
for it in the terminal window running TightVNC viewer if one is required.
On Unix (including MacOSX using the X11 viewer) if you choose not
to enter the password you will simply be prompted for it in the
terminal window running TightVNC viewer if one is required.
On Windows TightVNC viewer should prompt you when a password is required.
......@@ -436,6 +438,85 @@ proc help {} {
need to enter it each time).
Untrusted Local Users:
*IMPORTANT WARNING*: If you run SSVNC on a workstation or computer
that other users can log into and you DO NOT TRUST these users
(it is a shame but sometimes one has to work in an environment like
this), then please note the following warning.
By 'do not trust' we mean they might try to gain access to remote
machines you connect to via SSVNC. Note that an untrusted local
user can often obtain root access in a short amount of time; if a
user has acheived that, then all bets are off for ANYTHING that you
do on the workstation. It is best to get rid of Untrusted Local
Users as soon as possible.
Both the SSL and SSH tunnels set up by SSVNC listen on certain ports
on the 'localhost' address and redirect TCP connections to the remote
machine; usually the VNC server running there (but it could also be
another service, e.g. CUPS printing). These are the stunnel(8) SSL
redirection and the ssh(1) '-L' port redirection. Because 'localhost'
is used only users or programs on the same workstation that is
running SSVNC can connect to these ports, however this includes any
local users (not just the user running SSVNC.)
If the untrusted local user tries to connect to these ports, he may
succeed in varying degrees to gain access to the remote machine.
We now list some safeguards one can put in place to try to make this
more difficult to acheive.
It probably pays to have the VNC server require a password, even
though there has already been SSL or SSH authentication (via
certificates or passwords). In general if the VNC Server requires
SSL authentication of the viewer that helps, unless the untrusted
local user has gained access to your SSVNC certificate keys.
If the VNC server is configured to only allow one viewer connection
at a time, then the window of opportunity that the untrusted local
user can use is greatly reduced: he might only have a second or two
between the tunnel being set up and the SSVNC vncviewer connecting
to it (i.e. if the VNC server only allows a single connection, the
untrusted local user cannot connect once your session is established).
Similarly, when you disconnect the tunnel is torn down quickly and
there is little or no window of opportunity to connect (e.g. x11vnc
in its default mode exits after the first client disconnects).
Also for SSL tunnelling with stunnel(8) on Unix using one of the SSVNC
prebuilt 'bundles', a patched stunnel is provided that denies all
connections after the first one, and exits when the first one closes.
This is not true if the system installed stunnel(8) is used and is
not true when using SSVNC on Windows.
The following are two experimental features that are added to SSVNC
to improve the situation for the SSL/stunnel case. Set them via
Options -> Advanced -> "STUNNEL Local Port Protections".
1) For SSL tunnelling with stunnel(8) on Unix there is a setting
'Use stunnel EXEC mode' (experimental) that will try to exec(2)
stunnel instead of using a listening socket. This will require
using the specially modified vncviewer unix viewer provided
by SSVNC. If this mode proves stable it will become the default.
2) For SSL tunnelling with stunnel(8) on Unix there is a setting
'Use stunnel IDENT check' (experimental) to limit socket
connections to be from you (this assumes the untrusted local
user has not become root on your workstation and has modified
your local IDENT check service; if he has you have much bigger
problems to worry about...)
There is also one simple LD_PRELOAD trick for SSH to limit the number
of accepted port redirection connections. This makes the window of
time the untrusted local user can connect to the tunnel much smaller.
Enable it via Options -> Advanced -> "SSH Local Port Protections".
You will need to have the lim_accept.so file in your SSVNC package.
The main message is to 'Watch your Back' when you connect via the
SSVNC tunnels and there are users you don't trust on your workstation.
The same applies to ANY use of SSH '-L' port redirections or outgoing
stunnel SSL redirection services.
SSH:
Click on "Use SSH" if you want to use an *SSH* tunnel instead of SSL
......@@ -479,7 +560,7 @@ proc help {} {
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
See 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.
......@@ -665,6 +746,9 @@ proc help {} {
the VNC server acts as a SSL *client* and so requires the Viewer end
to have an SSL cert, etc.
Note that in Listening mode you must supply a MyCert or use the
"listen.pem" one you are prompted to create.
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.
......@@ -694,6 +778,48 @@ proc help {} {
x11vnc -ssl SAVE
UltraVNC Single Click:
UltraVNC has Single Click (SC) Windows VNC servers that allow naive
users to get them running very easily (a EXE download and a few
mouse clicks). See http://sc.uvnc.com/ for details on how to create
these binaries.
One important point for SC III binary creation: do NOT include
"-id N" in the helpdesk.txt config file. This is because the Ultra
VNC repeater is not used. Use something like:
[HOST]
Internet Support XYZ
-sslproxy -connect xx.xx.xx.xx:5500 -noregistry
The Unix SSVNC vncviewer supports the both the unencrypted "SC I"
mode and the SSL encrypted "SC III" mode. For both cases SSVNC
must be run in Listening mode (Options -> Reverse VNC Connection)
For SC I, enable Reverse VNC Connection and put Vnc://0 in the
VNC Host:Display (use a different number if you are not using
the default listening port 5500). Then click on the "Listen"
button and finally have the user run your Single Click I EXE.
For SC III, enable Reverse VNC Connection and then UNSET "Verify
All Certs" (this is required). Let the VNC Host:Display be ":0"
(use a different number if you are not using the default listening
port 5500). Then click on the "Listen" button and finally have the
user run your Single Click III EXE.
For SC III, you will also need to enable the setting in the
Options menu "UltraVNC Single Click III Bug", otherwise the
STUNNEL connection may drop after 2-15 minutes.
Note that in Listening mode you MUST supply a MyCert or use the
"listen.pem" one you are prompted to create.
Single Click II using the UltraVNC repeater should also work, but
has not been tested.
SSL Certificates:
If you want to use a SSL Certificate (PEM) file to authenticate
......@@ -766,7 +892,7 @@ proc help {} {
A ShortCut for this is Ctrl-S as long as user@hostname is present
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 in the display
line "user@hostname cmd=KNOCK") then only the port-knocking is
performed.
......@@ -796,7 +922,7 @@ proc help {} {
info.
7) On Unix to have SSVNC act as a general STUNNEL redirector (i.e. no
VNC), put the the desired host:port in VNC Host:Display (use a
VNC), put the desired host:port in VNC Host:Display (use a
negative port value if it is to be less than 200), then go to
Options -> Advanced -> Change VNC Viewer. Change the "viewer"
command to be "xmessage OK" or "xmessage <port>" (or sleep) where
......@@ -885,7 +1011,7 @@ proc help {} {
before starting the viewer. The env. var. SSVNC_EXTRA_SLEEP
also does this (and also Sleep: Option setting) On Mac, you
can set DYLD_LIBRARY_PATH=... too. It should propagate down
the the viewer.
the viewer.
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.
......@@ -970,9 +1096,9 @@ proc help_certs {} {
set msg {
Description:
*IMPORTANT*: Only with SSL Certificate verification (either manually or via a
Certificate Authority certificate) can Man-In-The-Middle attacks be prevented.
Otherwise, only passive network sniffing attacks are prevented.
***IMPORTANT***: Only with SSL Certificate verification (either manually or
via a Certificate Authority certificate) can Man-In-The-Middle attacks be
prevented. Otherwise, only passive network sniffing attacks are prevented.
The SSL Certificate files described below may have been created externally
(e.g. by x11vnc or openssl): you can import them via "Import Certificate".
......@@ -984,6 +1110,13 @@ proc help_certs {} {
box description below, and then Connect. You will usually want to Save this
association in a VNC Server profile for the next time you connect.
Expiration:
SSL Certificates will Expire after a certain period (usually 1-2 years;
if you create a cert with this tool you can set it to any length you want).
So if for a particular Cert you find you can no longer connect, check the
STUNNEL log output to see if the cert has expired. Then create a new one.
Fetch Cert:
You can also retrieve and view the VNC Server's Cert via the "Fetch Cert"
......@@ -1081,7 +1214,17 @@ proc help_certs {} {
This is because of the way OpenSSL must use hash-based filenames in Cert dirs.
The file will have a "full filename:" line indicating the fingerprint and
hostname associated with it. Be sure to remove both files.
hostname associated with it. Be sure to remove both files. The Delete Certs
dialog should automatically find the matching one for you and prompt you to
remove it as well.
Deleting Certificates:
To delete a Certificate+private_key pair click on "Delete Certificate"
and select one in the menu. You will be prompted to remove it,
and also any corresponding .pem or .crt file. For "ACCEPTED_CERTS"
it will find the matching "HASH" file and prompt you to remove that too.
Notes:
......@@ -1273,7 +1416,7 @@ set msg {
x11vnc has an experiment Client-Side caching scheme "-ncache n"
that can give nice speedups. But there are some drawbacks
because the the cache-region is visible and uses much RAM.
because the cache-region is visible and uses much RAM.
http://www.karlrunge.com/x11vnc/#faq-client-caching
X11VNC Options:
......@@ -1550,11 +1693,24 @@ set msg {
Then a VNC server should establish a reverse connection to
that port on this machine (e.g. -connect this-machine:5500)
SSL certificates will be verified, however you won't be
prompted about unrecognized ones; rather, you must set
up the correct Server certificate (e.g. by importing).
Server SSL certificates will be verified, however you WILL
NOTE be prompted about unrecognized ones; rather, you MUST
set up the correct Server certificate (e.g. by importing).
prior to any connections.
If the connection is failing in Reverse VNC (listening) mode,
check the STUNNEL log output to see if STUNNEL is unable to
authenticate the VNC Server. If you want to allow in a
reverse connection with NO Server authentication, unset the
'Verify All Certs' option.
When listening in SSL, you will ALSO need to specify YOUR
OWN SSL cert, "MyCert", or otherwise let the GUI prompt you
to create a "listen.pem" and use that.
The "listen.pem" will be reused in later SSL Listening
connections unless you specify a different one with MyCert.
For reverse connections in SSH or SSH + SSL modes it is a
little trickier. The SSH tunnel (with -R tunnel) must be
established and remain up waiting for reverse connections.
......@@ -1590,6 +1746,32 @@ set msg {
unless it is a double proxy where the 2nd host is the machine with
the VNC server.
UltraVNC Single Click III Bug:
The UltraVNC Single Click III (SSL) server works with SSVNC;
it makes a reverse connection to it via an SSL tunnel:
http://www.uvnc.com/pchelpware/SCIII/index.html
Unfortunately the SSL implementation used by UltraVNC SC III
is incompatible with OpenSSL in that the connection will be
dropped after 2-15 minutes due to an unexpected packet.
However this can be worked around in STUNNEL by setting
configution item 'options = ALL'. Enabling 'UltraVNC Single
Click III Bug' passes this setting to STUNNEL.
On Windows 'options = ALL' is used by default for stunnel.
On Unix and MacOSX you will need to select this option.
Setting this option may provide a workaround for other SSL
VNC servers.
BTW, you can set the environment variable STUNNEL_EXTRA_OPTS_USER
to add any lines to the STUNNEL global config that you want to.
See the stunnel(8) man page for more details.
View Only: Have VNC Viewer ignore mouse and keyboard input.
......@@ -2041,16 +2223,19 @@ proc set_defaults {} {
global choose_ncache ts_ncache choose_multisession ts_multisession
global ts_mode ts_desktop_size ts_desktop_depth choose_desktop_geom
global additional_port_redirs additional_port_redirs_list
global stunnel_local_protection stunnel_local_protection_type ssh_local_protection multiple_listen
global sound_daemon_remote_cmd sound_daemon_remote_port sound_daemon_kill sound_daemon_restart
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 use_port_knocking port_knocking_list
global ycrop_string extra_sleep use_listen use_unixpw use_x11vnc_find unixpw_username
global use_uvnc_ssl_bug
global include_list
set defs(use_viewonly) 0
set defs(use_listen) 0
set defs(use_uvnc_ssl_bug) 0
set defs(use_unixpw) 0
set defs(unixpw_username) ""
set defs(use_x11vnc_find) 0
......@@ -2107,6 +2292,11 @@ proc set_defaults {} {
set defs(additional_port_redirs) 0
set defs(additional_port_redirs_list) ""
set defs(stunnel_local_protection) 0
set defs(stunnel_local_protection_type) "none"
set defs(ssh_local_protection) 0
set defs(multiple_listen) 0
set defs(cups_local_server) ""
set defs(cups_remote_port) ""
set defs(cups_local_smb_server) ""
......@@ -2168,7 +2358,7 @@ proc do_viewer_windows {n} {
global use_alpha use_grab use_ssh use_sshssl use_viewonly use_fullscreen use_bgr233
global use_nojpeg use_raise_on_beep use_compresslevel use_quality
global change_vncviewer change_vncviewer_path vncviewer_realvnc4
global use_listen env
global use_listen use_uvnc_ssl_bug env
set cmd "vncviewer"
if {$change_vncviewer && $change_vncviewer_path != ""} {
......@@ -2297,7 +2487,8 @@ proc do_viewer_windows {n} {
}
} else {
if [regexp {^[0-9][0-9]*$} $n] {
append cmd " localhost:$n"
global win_localhost
append cmd " $win_localhost:$n"
} else {
append cmd " $n"
}
......@@ -2358,6 +2549,21 @@ proc get_ipconfig {} {
return $ip
}
proc read_file {file} {
set str ""
if [file exists $file] {
set fh ""
catch {set fh [open $file "r"]}
if {$fh != ""} {
while {[gets $fh line] > -1} {
append str "$line\n"
}
close $fh
}
}
return $str
}
proc guess_nat_ip {} {
global save_nat last_save_nat
set s ""
......@@ -2465,8 +2671,22 @@ proc windows_start_sound_daemon {file} {
after 1500
}
proc windows_stop_sound_daemon {} {
proc winkill {pid} {
global is_win9x
if {$pid == ""} {
return
}
if {! $is_win9x} {
catch {exec tskill.exe $pid}
after 100
catch {exec taskkill.exe /PID $pid}
after 100
}
catch {exec w98/kill.exe /f $pid}
}
proc windows_stop_sound_daemon {} {
global use_sound sound_daemon_local_cmd sound_daemon_local_start
set cmd [string trim $sound_daemon_local_cmd]
......@@ -2492,11 +2712,7 @@ proc windows_stop_sound_daemon {} {
set count 0
foreach pid [array names pids] {
mesg "Stopping SOUND pid: $pid"
if {$is_win9x} {
catch {exec w98/kill.exe /f $pid}
} else {
catch {exec tskill.exe $pid}
}
winkill $pid
if {$count == 0} {
after 1200
} else {
......@@ -2578,7 +2794,7 @@ proc launch_windows_ssh {hp file n} {
global is_win9x env
global use_sshssl use_ssh putty_pw
global port_knocking_list
global use_listen listening_name
global use_listen use_uvnc_ssl_bug listening_name
global ts_only
global debug_netstat
......@@ -2586,7 +2802,9 @@ proc launch_windows_ssh {hp file n} {
set proxy [get_ssh_proxy $hp]
set sshcmd [get_ssh_cmd $hp]
set vnc_host "localhost"
global win_localhost
set vnc_host $win_localhost
set vnc_disp $hpnew
regsub {^.*:} $vnc_disp "" vnc_disp
......@@ -2595,13 +2813,13 @@ proc launch_windows_ssh {hp file n} {
if {$proxy == ""} {
if {[regexp {^([^:]*):([0-9][0-9]*)$} $hpnew mv sshhst sshpt]} {
set proxy "$sshhst:$sshpt"
set hpnew "localhost"
set hpnew $win_localhost
}
} else {
if {![regexp {,} $proxy]} {
if {$hpnew != "localhost"} {
if {$hpnew != $win_localhost} {
set proxy "$proxy,$hpnew"
set hpnew "localhost"
set hpnew $win_localhost
}
}
}
......@@ -2718,12 +2936,12 @@ proc launch_windows_ssh {hp file n} {
unset -nocomplain env(SSVNC_DEST)
if {$sproxy1 == ""} {
set proxy "localhost:$port2"
set proxy "$win_localhost:$port2"
if [regexp {^(.*)@} $ssh_host mv u] {
set proxy "$u@$proxy"
}
} else {
set proxy "${sproxy1_user}localhost:$port2"
set proxy "${sproxy1_user}$win_localhost:$port2"
}
if {$sproxy_rest != ""} {
set proxy "$proxy,$sproxy_rest"
......@@ -2767,7 +2985,7 @@ proc launch_windows_ssh {hp file n} {
}
set double_ssh "-L $p_port:$ssh_host2:$ssh_port2 -P $ssh_port1 $u1$ssh_host1"
set proxy_use "${u2}localhost:$p_port"
set proxy_use "${u2}$win_localhost:$p_port"
} else {
# user1@gateway:port1
......@@ -2785,7 +3003,7 @@ proc launch_windows_ssh {hp file n} {
set vnc_host $hpnew
regsub {:.*$} $vnc_host "" vnc_host
if {$vnc_host == ""} {
set vnc_host "localhost"
set vnc_host $win_localhost
}
}
......@@ -2985,7 +3203,7 @@ proc launch_windows_ssh {hp file n} {
}
if {$vnc_host == ""} {
set vnc_host "localhost"
set vnc_host $win_localhost
}
regsub {^.*@} $vnc_host "" vnc_host
......@@ -3460,15 +3678,15 @@ proc unix_terminal_cmd {{geometry "+100+100"} {title "xterm-command"} {cmd "echo
}
if {$bg} {
if {$xrm1 == ""} {
exec xterm -geometry "$geometry" -title "$title" -e sh -c "$cmd" 2>@stdout &
exec xterm -sb -sl 2000 -geometry "$geometry" -title "$title" -e sh -c "$cmd" 2>@stdout &
} else {
exec xterm -geometry "$geometry" -title "$title" -xrm "$xrm1" -xrm "$xrm2" -xrm "$xrm3" -e sh -c "$cmd" 2>@stdout &
exec xterm -sb -sl 2000 -geometry "$geometry" -title "$title" -xrm "$xrm1" -xrm "$xrm2" -xrm "$xrm3" -e sh -c "$cmd" 2>@stdout &
}
} else {
if {$xrm1 == ""} {
exec xterm -geometry "$geometry" -title "$title" -e sh -c "$cmd" 2>@stdout
exec xterm -sb -sl 2000 -geometry "$geometry" -title "$title" -e sh -c "$cmd" 2>@stdout
} else {
exec xterm -geometry "$geometry" -title "$title" -xrm "$xrm1" -xrm "$xrm2" -xrm "$xrm3" -e sh -c "$cmd" 2>@stdout
exec xterm -sb -sl 2000 -geometry "$geometry" -title "$title" -xrm "$xrm1" -xrm "$xrm2" -xrm "$xrm3" -e sh -c "$cmd" 2>@stdout
}
}
}
......@@ -3848,9 +4066,11 @@ proc fetch_cert_windows {hp} {
set list [split $hpnew ":"]
global win_localhost
set host [lindex $list 0]
if {$host == ""} {
set host "localhost"
set host $win_localhost
}
if [regexp {^.*@} $host match] {
......@@ -3897,7 +4117,7 @@ proc fetch_cert_windows {hp} {
set env(SSVNC_LISTEN) $port2
set env(SSVNC_DEST) "$host:$port"
set host localhost
set host $win_localhost
set port $port2
mesg "Starting TCP helper on port $port2 ..."
after 600
......@@ -3956,14 +4176,7 @@ proc fetch_cert_windows {hp} {
}
}
foreach pid $pids {
global is_win9x
if {$pid == ""} {
;
} elseif {$is_win9x} {
catch {exec w98/kill.exe /f $pid}
} else {
catch {exec tskill.exe $pid}
}
winkill $pid
}
catch {close $ph}
catch {file delete $tin $tou}
......@@ -4001,15 +4214,8 @@ if {1} {
break
}
}
global is_win9x
foreach pid $pids {
if {$pid == ""} {
;
} elseif {$is_win9x} {
catch {exec w98/kill.exe /f $pid}
} else {
catch {exec tskill.exe $pid}
}
winkill $pid
}
after 500
set ph ""
......@@ -4183,14 +4389,15 @@ proc check_accepted_certs {} {
sent to you by the server administrator).
Should this certificate be saved in the accepted certs directory and
then used to SSL authenticate VNC servers?
Do you want this certificate to be saved in the accepted certs directory
and then used to SSL authenticate VNC servers?
By clicking 'Inspect and maybe Save Cert' you will be given the opportunity
to inspect the certificate before deciding to save it or not.
Choose 'Ignore Cert for One Connection' to connect one time to the
server and not require ANY certificate verification.
Choose 'Ignore Cert for One Connection' to connect a single time to the
server with NO certificate verification. You will see this dialog again
the next time you connect to the same server.
"
if {$oth == 0} {
......@@ -4450,6 +4657,59 @@ proc init_unixpw {hp} {
}
}
proc check_for_listen_ssl_cert {} {
global mycert use_listen use_ssh
if {! $use_listen} {
return 1
}
if {$use_ssh} {
return 1
}
if {$mycert != ""} {
return 1
}
set name [get_idir_certs ""]
set name "$name/listen.pem"
if {[file exists $name]} {
set mycert $name
mesg "Using Listen Cert: $name"
after 1000
return 1
}
set title "SSL Listen requires MyCert";
set msg "In SSL Listen mode a cert+key is required, but you have not specified 'MyCert'.\n\nCreate a cert+key 'listen' now?"
set reply [tk_messageBox -type okcancel -icon warning -message $msg -title $msg]
if {$reply == "cancel"} {
return 0
}
create_cert $name
tkwait window .ccrt
if {[file exists $name]} {
set mycert $name
mesg "Using Listen Cert: $name"
after 1000
return 1
}
return 0
}
proc reset_stunnel_extra_opts {} {
global stunnel_extra_opts0 stunnel_extra_svc_opts0 env
global ssvnc_multiple_listen0
if {$stunnel_extra_opts0 != "none"} {
set env(STUNNEL_EXTRA_OPTS) $stunnel_extra_opts0
}
if {$stunnel_extra_svc_opts0 != "none"} {
set env(STUNNEL_EXTRA_SVC_OPTS) $stunnel_extra_svc_opts0
}
set env(SSVNC_LIM_ACCEPT_PRELOAD) ""
if {$ssvnc_multiple_listen0 != "none"} {
set env(SSVNC_MULTIPLE_LISTEN) $ssvnc_multiple_listen0
}
}
proc launch_unix {hp} {
global smb_redir_0 smb_mounts env
global vncauth_passwd use_unixpw unixpw_username unixpw_passwd
......@@ -4493,6 +4753,69 @@ proc launch_unix {hp} {
}
}
if {! $do_direct} {
if {! [check_for_listen_ssl_cert]} {
return
}
}
global stunnel_extra_opts0 stunnel_extra_svc_opts0
set stunnel_extra_opts0 ""
set stunnel_extra_svc_opts0 ""
global ssvnc_multiple_listen0
set ssvnc_multiple_listen0 ""
if {$use_uvnc_ssl_bug && ! $use_ssh} {
if [info exists env(STUNNEL_EXTRA_OPTS)] {
set stunnel_extra_opts0 $env(STUNNEL_EXTRA_OPTS)
set env(STUNNEL_EXTRA_OPTS) "$env(STUNNEL_EXTRA_OPTS)\noptions = ALL"
} else {
set env(STUNNEL_EXTRA_OPTS) "options = ALL"
}
}
if {$stunnel_local_protection && ! $use_listen} {
if {$stunnel_local_protection_type == "ident"} {
set user ""
if {[info exists env(USER)]} {
set user $env(USER)
} elseif {[info exists env(LOGNAME)]} {
set user $env(USER)
}
if {$user != ""} {
if [info exists env(STUNNEL_EXTRA_SVC_OPTS)] {
set stunnel_extra_svc_opts0 $env(STUNNEL_EXTRA_SVC_OPTS)
set env(STUNNEL_EXTRA_SVC_OPTS) "$env(STUNNEL_EXTRA_SVC_OPTS)\nident = $user"
} else {
set env(STUNNEL_EXTRA_SVC_OPTS) "ident = $user"
}
}
} elseif {$stunnel_local_protection_type == "exec"} {
if [info exists env(STUNNEL_EXTRA_SVC_OPTS)] {
set stunnel_extra_svc_opts0 $env(STUNNEL_EXTRA_SVC_OPTS)
set env(STUNNEL_EXTRA_SVC_OPTS) "$env(STUNNEL_EXTRA_SVC_OPTS)\n#stunnel-exec"
} else {
set env(STUNNEL_EXTRA_SVC_OPTS) "#stunnel-exec"
}
}
}
if {$ssh_local_protection} {
if {![info exists env(LIM_ACCEPT)]} {
set env(LIM_ACCEPT) 1
}
if {![info exists env(LIM_ACCEPT_TIME)]} {
set env(LIM_ACCEPT_TIME) 15
}
set env(SSVNC_LIM_ACCEPT_PRELOAD) "lim_accept.so"
mesg "SSH LIM_ACCEPT($env(LIM_ACCEPT),$env(LIM_ACCEPT_TIME)): lim_accept.so"
after 1000
}
if {$multiple_listen && $use_listen} {
if [info exists env(SSVNC_MULTIPLE_LISTEN)] {
set ssvnc_multiple_listen0 $env(SSVNC_MULTIPLE_LISTEN)
}
set env(SSVNC_MULTIPLE_LISTEN) "1"
}
if {$use_ssh || $use_sshssl} {
if {$skip_ssh} {
set cmd "ss_vncviewer"
......@@ -4512,6 +4835,9 @@ proc launch_unix {hp} {
if {$use_listen} {
set cmd "$cmd -listen"
}
if {$ssh_local_protection} {
regsub {ss_vncviewer} $cmd "ssvnc_cmd" cmd
}
set hpnew [get_ssh_hp $hp]
set proxy [get_ssh_proxy $hp]
set sshcmd [get_ssh_cmd $hp]
......@@ -4653,6 +4979,7 @@ proc launch_unix {hp} {
}
if {! $did_port_knock} {
if {! [do_port_knock $pk_hp start]} {
reset_stunnel_extra_opts
return
}
set did_port_knock 1
......@@ -4671,6 +4998,7 @@ proc launch_unix {hp} {
set env(SS_VNCVIEWER_SSH_CMD) ""
set env(SS_VNCVIEWER_SSH_ONLY) ""
set env(SS_VNCVIEWER_USE_C) ""
reset_stunnel_extra_opts
return
}
} else {
......@@ -4679,6 +5007,7 @@ proc launch_unix {hp} {
set proxy [get_ssh_proxy $hp]
if {! [repeater_proxy_check $proxy]} {
reset_stunnel_extra_opts
return
}
......@@ -4693,6 +5022,7 @@ proc launch_unix {hp} {
global skip_verify_accepted_certs
set skip_verify_accepted_certs 0
if {! [check_accepted_certs]} {
reset_stunnel_extra_opts
return
}
if {! $skip_verify_accepted_certs} {
......@@ -4763,6 +5093,7 @@ proc launch_unix {hp} {
catch {destroy .c}
mesg "file still exists: $tmp"
bell
reset_stunnel_extra_opts
return
}
catch {set fh [open $tmp "w"]}
......@@ -4771,6 +5102,7 @@ proc launch_unix {hp} {
catch {destroy .c}
mesg "cannot create: $tmp"
bell
reset_stunnel_extra_opts
return
}
puts $fh "#!/bin/sh"
......@@ -4953,6 +5285,7 @@ proc launch_unix {hp} {
if {! [do_port_knock $pk_hp start]} {
wm deiconify .
update
reset_stunnel_extra_opts
return
}
set did_port_knock 1
......@@ -5034,20 +5367,16 @@ proc launch_unix {hp} {
do_port_knock $pk_hp finish
}
reset_stunnel_extra_opts
fini_unixpw
}
proc kill_stunnel {pids} {
global is_win9x
set count 0
foreach pid $pids {
mesg "killing STUNNEL pid: $pid"
if {$is_win9x} {
catch {exec w98/kill.exe /f $pid}
} else {
catch {exec tskill.exe $pid}
}
winkill $pid
if {$count == 0} {
after 1200
} else {
......@@ -5259,7 +5588,7 @@ proc launch {{hp ""}} {
global mycert svcert crtdir
global pids_before pids_after pids_new
global env
global use_ssl use_ssh use_sshssl use_listen
global use_ssl use_ssh use_sshssl use_listen use_uvnc_ssl_bug
global vncdisplay
set debug 0
......@@ -5553,9 +5882,11 @@ proc launch {{hp ""}} {
set list [split $hp ":"]
global win_localhost
set host [lindex $list 0]
if {$host == ""} {
set host "localhost"
set host $win_localhost
}
if [regexp {^.*@} $host match] {
......@@ -5594,7 +5925,7 @@ proc launch {{hp ""}} {
after 2000
}
if {$use_listen} {
set env(SSVNC_REVERSE) "localhost:$port"
set env(SSVNC_REVERSE) "$win_localhost:$port"
} else {
set env(SSVNC_LISTEN) [expr "$n2 + 5900"]
}
......@@ -5607,6 +5938,12 @@ proc launch {{hp ""}} {
after 1000
}
if {$use_listen && $mycert == ""} {
if {! [check_for_listen_ssl_cert]} {
return;
}
}
set fail 0
set fh [open $file "w"]
......@@ -5616,7 +5953,11 @@ proc launch {{hp ""}} {
} else {
puts $fh "client = yes"
}
# WRT, UltraVNC Single Click III Bug:
# Wow, on Windows we've been using 'options = ALL'
# all along! Duh. OK keep it...
puts $fh "options = ALL"
puts $fh "taskbar = yes"
puts $fh "RNDbytes = 2048"
puts $fh "RNDfile = bananarand.bin"
......@@ -5631,12 +5972,10 @@ proc launch {{hp ""}} {
}
puts $fh "cert = $mycert"
} elseif {$use_listen} {
set dummy "dummy.pem"
set dh [open $dummy "w"]
puts $dh [dummy_cert]
close $dh
puts $fh "cert = $dummy"
# see above, this should not happen.
puts $fh "cert = _nocert_"
}
if {$svcert != ""} {
if {! [file exists $svcert]} {
mesg "ServerCert does not exist: $svcert"
......@@ -5680,11 +6019,11 @@ proc launch {{hp ""}} {
set port2 ""
if {! $use_listen} {
set port2 [expr "$n + 5900"]
puts $fh "accept = localhost:$port2"
puts $fh "accept = $win_localhost:$port2"
if {$use_sshssl || $proxy != ""} {
set port [expr "$n2 + 5900"]
puts $fh "connect = localhost:$port"
puts $fh "connect = $win_localhost:$port"
} else {
puts $fh "connect = $host:$port"
}
......@@ -5692,8 +6031,8 @@ proc launch {{hp ""}} {
set port2 [expr "$n + 5500"]
set hloc ""
if {$use_ssh} {
set hloc "localhost:"
set listening_name "localhost:$port (on remote SSH side)"
set hloc "$win_localhost:"
set listening_name "$win_localhost:$port (on remote SSH side)"
} else {
set hn [get_hostname]
if {$hn == ""} {
......@@ -5702,7 +6041,7 @@ proc launch {{hp ""}} {
set listening_name "$hn:$port (or nn.nn.nn.nn:$port, etc.)"
}
puts $fh "accept = $hloc$port"
puts $fh "connect = localhost:$port2"
puts $fh "connect = $win_localhost:$port2"
}
puts $fh "delay = no"
......@@ -5805,9 +6144,11 @@ proc direct_connect_windows {{hp ""}} {
set list [split $hp ":"]
global win_localhost
set host [lindex $list 0]
if {$host == ""} {
set host "localhost"
set host $win_localhost
}
if [regexp {^.*@} $host match] {
......@@ -5852,7 +6193,7 @@ proc direct_connect_windows {{hp ""}} {
set env(SSVNC_DEST) "$host:$port"
set port [expr $n2 + 5900]
set host "localhost"
set host $win_localhost
}
set fail 0
......@@ -5974,6 +6315,60 @@ proc get_idir_certs {str} {
return $idir
}
proc delete_cert {{parent "."}} {
set idir [get_idir_certs ""]
set f ""
unix_dialog_resize $parent
if {$idir != ""} {
set f [tk_getOpenFile -parent $parent -initialdir $idir]
} else {
set f [tk_getOpenFile -parent $parent]
}
if {$f != "" && [file exists $f]} {
set reply [tk_messageBox -parent $parent -type yesno -icon question -title "Delete Cert" -message "Delete $f"]
if {$reply == "yes"} {
global mycert svcert
set f_text [read_file $f]
set f2 ""
catch {file delete $f}
if {$f == $mycert} { set mycert "" }
if {$f == $svcert} { set svcert "" }
if [regexp {\.crt$} $f] {
regsub {\.crt$} $f ".pem" f2
} elseif [regexp {\.pem$} $f] {
regsub {\.pem$} $f ".crt" f2
}
if {$f2 != "" && [file exists $f2]} {
set reply [tk_messageBox -parent $parent -type yesno -icon question -title "Delete Cert" -message "Delete $f2"]
if {$reply == "yes"} {
catch {file delete $f2}
if {$f2 == $mycert} { set mycert "" }
if {$f2 == $svcert} { set svcert "" }
}
}
set dir [file dirname $f]
if {$f_text != "" && [regexp {accepted$} $dir]} {
foreach crt [glob -nocomplain -directory $dir {*.crt} {*.pem} {*.[0-9]}] {
#puts "try $crt"
set c_text [read_file $crt]
if {$c_text == ""} {
continue
}
if {$c_text != $f_text} {
continue
}
set reply [tk_messageBox -parent $parent -type yesno -icon question -title "Delete Identical Cert" -message "Delete Identical $crt"]
if {$reply == "yes"} {
catch {file delete $crt}
}
}
}
}
}
catch {wm deiconify .c}
update
}
proc set_mycert {{parent "."}} {
global mycert
set idir [get_idir_certs $mycert]
......@@ -5992,7 +6387,6 @@ proc set_mycert {{parent "."}} {
update
}
proc show_cert {crt} {
if {$crt == ""} {
bell
......@@ -6445,7 +6839,7 @@ emailAddress_max = 64
}
}
proc create_cert {} {
proc create_cert {{name ""}} {
toplev .ccrt
wm title .ccrt "Create SSL Certificate"
......@@ -6545,7 +6939,7 @@ proc create_cert {} {
set ccert(OUN) "Product Development"
set ccert(CN) "www.nowhere.none"
set ccert(EM) "admin@nowhere.none"
set ccert(DAYS) "365"
set ccert(DAYS) "730"
set ccert(FILE) ""
}
......@@ -6561,8 +6955,14 @@ proc create_cert {} {
set tcert(EM) "Email Address:"
set tcert(DAYS) "Days until expiration:"
if {$ccert(FILE) == ""} {
set idir [get_idir_certs ""]
if {$name != ""} {
if {[regexp {/} $name] || [regexp {\.pem$} $name] || [regexp {\.crt$} $name]} {
set ccert(FILE) $name
} else {
set ccert(FILE) "$idir/$name.pem"
}
} elseif {$ccert(FILE) == ""} {
set ccert(FILE) "$idir/vnccert.pem"
}
......@@ -6594,6 +6994,9 @@ proc create_cert {} {
entry $w.e -width $ew -textvariable ccert(FILE)
button $w.b -text "Browse..." -command {set_createcert_file; catch {raise .ccrt}}
if {$name != ""} {
$w.b configure -state disabled
}
pack $w.e -side right
pack $w.b -side right
......@@ -7129,6 +7532,7 @@ proc getcerts {} {
button .c.create -text "Create Certificate ..." -command {create_cert}
button .c.import -text "Import Certificate ..." -command {import_cert}
button .c.delete -text "Delete Certificate ..." -command {delete_cert}
frame .c.b
button .c.b.done -text "Done" -command {catch {destroy .c}}
......@@ -7156,7 +7560,7 @@ proc getcerts {} {
v_svcert
}
pack .c.mycert .c.svcert .c.crtdir .c.create .c.import .c.b -side top -fill x
pack .c.mycert .c.svcert .c.crtdir .c.create .c.import .c.delete .c.b -side top -fill x
center_win .c
wm resizable .c 1 0
......@@ -7531,62 +7935,6 @@ proc sync_use_ssl_ssh {} {
}
}
proc dummy_cert {} {
set str {
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAvkfXxb0wcxgrjV2ziFikjII+ze8iKcTBt47L0GM/c21efelN
+zZpJUUXLu4zz8Ryq8Q+sQgfNy7uTOpN9bUUaOk1TnD7gaDQnQWiNHmqbW2kL+DS
OKngJVPo9dETAS8hf7+D1e1DBZxjTc1a4RQqWJixwpYj99ixWzu8VC2m/xXsjvOs
jp4+DLBB490nbkwvstmhmiWm1CmI5O5xOkgioVNQqHvQMdVKOSz9PpbjvZiRX1Uo
qoMrk+2NOqwP90TB35yPASXb9zXKpO7DLhkube+yYGf+yk46aD707L07Eb7cosFP
S84vNZ9gX7rQ0UOwm5rYA/oZTBskgaqhtIzkLwIDAQABAoIBAD4ot/sXt5kRn0Ca
CIkU9AQWlC+v28grR2EQW9JiaZrqcoDNUzUqbCTJsi4ZkIFh2lf0TsqELbZYNW6Y
6AjJM7al4E0UqYSKJTv2WCuuRxdiRs2BMwthqyBmjeanev7bB6V0ybt7u3Y8xU/o
MrTuYnr4vrEjXPKdLirwk7AoDbKsRXHSIiHEIBOq1+dUQ32t36ukdnnza4wKDLZc
PKHiCdCk/wOGhuDlxD6RspqUAlRnJ8/aEhrgWxadFXw1hRhRsf/v1shtB0T3DmTe
Jchjwyiw9mryb9JZAcKxW+fUc4EVvj6VdQGqYInQJY5Yxm5JAlVQUJicuuJEvn6A
rj5osQECgYEA552CaHpUiFlB4HGkjaH00kL+f0+gRF4PANCPk6X3UPDVYzKnzmuu
yDvIdEETGFWBwoztUrOOKqVvPEQ+kBa2+DWWYaERZLtg2cI5byfDJxQ3ldzilS3J
1S3WgCojqcsG/hlxoQJ1dZFanUy/QhUZ0B+wlC+Zp1Q8AyuGQvhHp68CgYEA0lBI
eqq2GGCdJuNHMPFbi8Q0BnX55LW5C1hWjhuYiEkb3hOaIJuJrqvayBlhcQa2cGqp
uP34e9UCfoeLgmoCQ0b4KpL2NGov/mL4i8bMgog4hcoYuIi3qxN18vVR14VKEh4U
RLk0igAYPU+IK2QByaQlBo9OSaKkcfm7U1/pK4ECgYAxr6VpGk0GDvfF2Tsusv6d
GIgV8ZP09qSLTTJvvxvF/lQYeqZq7sjI5aJD5i3de4JhpO/IXQJzfZfWOuGc8XKA
3qYK/Y2IqXXGYRcHFGWV/Y1LFd55mCADHlk0l1WdOBOg8P5iRu/Br9PbiLpCx9oI
vrOXpnp03eod1/luZmqguwKBgQCWFRSj9Q7ddpSvG6HCG3ro0qsNsUMTI1tZ7UBX
SPogx4tLf1GN03D9ZUZLZVFUByZKMtPLX/Hi7K9K/A9ikaPrvsl6GEX6QYzeTGJx
3Pw0amFrmDzr8ySewNR6/PXahxPEuhJcuI31rPufRRI3ZLah3rFNbRbBFX+klkJH
zTnoAQKBgDbUK/aQFGduSy7WUT7LlM3UlGxJ2sA90TQh4JRQwzur0ACN5GdYZkqM
YBts4sBJVwwJoxD9OpbvKu3uKCt41BSj0/KyoBzjT44S2io2tj1syujtlVUsyyBy
/ca0A7WBB8lD1D7QMIhYUm2O9kYtSCLlUTHt5leqGaRG38DqlX36
-----END RSA PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
MIIDzDCCArQCCQDSzxzxqhyqLzANBgkqhkiG9w0BAQQFADCBpzELMAkGA1UEBhMC
VVMxFjAUBgNVBAgTDU1hc3NhY2h1c2V0dHMxDzANBgNVBAcTBkJvc3RvbjETMBEG
A1UEChMKTXkgQ29tcGFueTEcMBoGA1UECxMTUHJvZHVjdCBEZXZlbG9wbWVudDEZ
MBcGA1UEAxMQd3d3Lm5vd2hlcmUubm9uZTEhMB8GCSqGSIb3DQEJARYSYWRtaW5A
bm93aGVyZS5ub25lMB4XDTA3MDMyMzE4MDc0NVoXDTI2MDUyMjE4MDc0NVowgacx
CzAJBgNVBAYTAlVTMRYwFAYDVQQIEw1NYXNzYWNodXNldHRzMQ8wDQYDVQQHEwZC
b3N0b24xEzARBgNVBAoTCk15IENvbXBhbnkxHDAaBgNVBAsTE1Byb2R1Y3QgRGV2
ZWxvcG1lbnQxGTAXBgNVBAMTEHd3dy5ub3doZXJlLm5vbmUxITAfBgkqhkiG9w0B
CQEWEmFkbWluQG5vd2hlcmUubm9uZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
AQoCggEBAL5H18W9MHMYK41ds4hYpIyCPs3vIinEwbeOy9BjP3NtXn3pTfs2aSVF
Fy7uM8/EcqvEPrEIHzcu7kzqTfW1FGjpNU5w+4Gg0J0FojR5qm1tpC/g0jip4CVT
6PXREwEvIX+/g9XtQwWcY03NWuEUKliYscKWI/fYsVs7vFQtpv8V7I7zrI6ePgyw
QePdJ25ML7LZoZolptQpiOTucTpIIqFTUKh70DHVSjks/T6W472YkV9VKKqDK5Pt
jTqsD/dEwd+cjwEl2/c1yqTuwy4ZLm3vsmBn/spOOmg+9Oy9OxG+3KLBT0vOLzWf
YF+60NFDsJua2AP6GUwbJIGqobSM5C8CAwEAATANBgkqhkiG9w0BAQQFAAOCAQEA
vGomHEp6TVU83X2EBUgnbOhzKJ9u3fOI/Uf5L7p//Vxqow7OR1cguzh/YEzmXOIL
ilMVnzX9nj/bvcLAuqEP7MR1A8f4+E807p/L/Sf49BiCcwQq5I966sGKYXjkve+T
2GTBNwMSq+5kLSf6QY8VZI+qnrAudEQMeJByQhTZZ0dH8Njeq8EGl9KUio+VWaiW
CQK6xJuAvAHqa06OjLmwu1fYD4GLGSrOIiRVkSXV8qLIUmzxdJaIRznkFWsrCEKR
wAH966SAOvd2s6yOHMvyDRIL7WHxfESB6rDHsdIW/yny1fBePjv473KrxyXtbz7I
dMw1yW09l+eEo4A7GzwOdw==
-----END CERTIFICATE-----
}
return $str
}
proc save_profile {{parent "."}} {
global is_windows uname
global profdone
......@@ -7823,10 +8171,16 @@ proc get_sound_redir {} {
global uname
if {$uname == "Darwin"} {
set loc "127.0.0.1:$loc"
} else {
global is_windows
if {$is_windows} {
global win_localhost
set loc "$win_localhost:$loc"
} else {
set loc "localhost:$loc"
}
}
}
set redir "$sound_daemon_remote_port:$loc"
regsub -all {['" ]} $redir {} redir; #"
set redir " -R $redir"
......@@ -7899,7 +8253,11 @@ proc get_smb_redir {} {
set lport 139
}
} else {
set lhost localhost
global is_windows win_localhost
set lhost "localhost"
if {$is_windows} {
set lhost $win_localhost
}
set lport 139
}
}
......@@ -10172,13 +10530,26 @@ proc help_advanced_opts {} {
server and through that mount SMB file shares from your local
server. The remote machine must be Linux with smbmount installed.
Change vncviewer: specify a non-bundled VNC Viewer (e.g.
UltraVNC or RealVNC) to run instead of the bundled TightVNC Viewer.
Extra Redirs: specify additional -L port:host:port and
Additional Port Redirs: specify additional -L port:host:port and
-R port:host:port cmdline options for SSH to enable additional
services.
SSH Local Port Protections: and LD_PRELOAD hack to limit the
number of SSH port redirections to 1 and within the first
15 seconds. So there is a smaller window when the user can try
to use your tunnel compared to the duration of your session.
STUNNEL Local Port Protections: Try to prevent Untrusted Local
Users (see the main Help panel) from using your STUNNEL tunnel
to connect to the remote VNC Server.
Multiple LISTEN Connections: allow multiple VNC servers to
reverse connect at the same time and so display each of their
desktops on your screen at the same time.
Change VNC Viewer: specify a non-bundled VNC Viewer (e.g.
UltraVNC or RealVNC) to run instead of the bundled TightVNC Viewer.
Port Knocking: for "closed port" services, first "knock" on the
firewall ports in a certain way to open the door for SSH or SSL.
The port can also be closed when the encrypted VNC connection
......@@ -10387,6 +10758,184 @@ proc port_redir_dialog {} {
focus .redirs.path.e
}
proc stunnel_sec_dialog {} {
global stunnel_local_protection
toplev .stlsec
wm title .stlsec "STUNNEL Local Port Protections"
global help_font uname
if {$uname == "Darwin"} {
scroll_text .stlsec.f 82 36
} else {
scroll_text .stlsec.f 82 36
}
apply_bg .stlsec.f
set msg {
See the discussion of "Untrusted Local Users" in the main 'Help'
panel for info about users who are able to log into the workstation
you run SSVNC on and might try to use your encrypted tunnel to gain
access to the remote VNC machine.
For STUNNEL SSL tunnels (not SSH tunnels) we provide two options as extra
safeguards against untrusted local users. Both only apply to Unix/MacOSX.
Note that Both options are ignored in reverse connection (Listen) mode.
1) The first one 'Use stunnel EXEC mode' (it is mutually exclusive with
option 2). For this case the modified SSVNC Unix viewer must be
used: it execs the stunnel program instead of connecting to it via
TCP/IP. Thus there is no localhost listening port involved at all.
This is the best solution for SSL stunnel tunnels, but is currently
experimental. If it works well it will become the default mechanism.
2) The second one 'Use stunnel IDENT check', uses the stunnel(8)
'ident = username' to use the local identd daemon (IDENT RFC 1413
http://www.ietf.org/rfc/rfc1413.txt) to check that the locally
connecting program (the SSVNC vncviewer) is being run by your userid.
See the stunnel(8) man page for details.
Normally the IDENT check service cannot be trusted much when used
*remotely* (the remote host may be have installed a modified daemon).
However when using the IDENT check service *locally* it should be
reliable. If not, it means the local machine (where you run SSVNC)
has already been root compromised and you have a serious problem.
Enabling 'Use stunnel IDENT check' requires a working identd on the
local machine. Often it is not installed or enabled (because it is not
deemed to be useful, etc). identd is usually run out of the inetd(8)
super-server. Even when installed and running it is often configured
incorrectly. On a Debian/lenny system we actually found that the
kernel module 'tcp_diag' needed to be loaded! ('modprobe tcp_diag')
}
.stlsec.f.t insert end $msg
radiobutton .stlsec.ident -relief ridge -anchor w -variable stunnel_local_protection_type -value "ident" -text "Use stunnel IDENT check"
radiobutton .stlsec.exec -relief ridge -anchor w -variable stunnel_local_protection_type -value "exec" -text "Use stunnel EXEC mode"
button .stlsec.cancel -text "Cancel" -command {set stunnel_local_protection 0; destroy .stlsec}
bind .stlsec <Escape> {set stunnel_local_protection 0; destroy .stlsec}
wm protocol .stlsec WM_DELETE_WINDOW {set stunnel_local_protection 0; destroy .stlsec}
button .stlsec.done -text "Done" -command {if {$stunnel_local_protection_type == "none"} {set stunnel_local_protection 0}; destroy .stlsec}
pack .stlsec.f .stlsec.exec .stlsec.ident .stlsec.cancel .stlsec.done -side top -fill x
center_win .stlsec
wm resizable .stlsec 1 0
}
proc ssh_sec_dialog {} {
global ssh_local_protection
toplev .sshsec
wm title .sshsec "SSH Local Port Protections"
global help_font
eval text .sshsec.t -width 80 -height 28 $help_font
apply_bg .sshsec.t
set msg {
See the discussion of "Untrusted Local Users" in the main 'Help'
panel for info about users who are able to log into the workstation
you run SSVNC on and might try to use your encrypted tunnel to gain
access to the remote VNC machine.
For SSH tunnels we have an LD_PRELOAD hack (lim_accept.so) that
will limit ssh from accepting any local redirection connections
after the first one or after 15 seconds, whichever comes first.
The first SSH port redirection connection is intended to be the
one that tunnels your VNC Viewer to reach the remote server.
You can adjust these defaults LIM_ACCEPT=1 LIM_ACCEPT_TIME=15 by
setting those env. vars. to different values.
Note that there is still a window of a few seconds the Untrusted
Local User can try to connect before your VNC Viewer does. So this
method is far from perfect. But once your VNC session is established,
he should be blocked out. Test to make sure blocking is taking place.
Do not use this option if you are doing SSH Service redirections
'Additional Port Redirections' that redirect a local port to the
remote server via ssh -L.
Note that if the shared object "lim_accept.so" cannot be found,
this option has no effect. Watch the output in the terminal for
the "SSVNC_LIM_ACCEPT_PRELOAD" setting.
}
.sshsec.t insert end $msg
button .sshsec.cancel -text "Cancel" -command {set ssh_local_protection 0; destroy .sshsec}
bind .sshsec <Escape> {set ssh_local_protection 0; destroy .sshsec}
wm protocol .sshsec WM_DELETE_WINDOW {set ssh_local_protection 0; destroy .sshsec}
button .sshsec.done -text "Done" -command {destroy .sshsec}
pack .sshsec.t .sshsec.cancel .sshsec.done -side top -fill x
center_win .sshsec
wm resizable .sshsec 1 0
}
proc multilisten_dialog {} {
global multiple_listen
toplev .multil
wm title .multil "Multiple LISTEN Connections"
global help_font
eval text .multil.t -width 84 -height 33 $help_font
apply_bg .multil.t
set msg {
Set this option to allow SSVNC (when in LISTEN / Reverse connections
mode) to allow multiple VNC servers to connect at the same time and
so display each of their desktops on your screen at the same time.
This option only applies on Unix or MaOSX when using the supplied
SSVNC vncviewer. If you specify your own VNC Viewer it has no effect.
On Windows (only the stock TightVNC viewer is provided) it has no
effect. On MacOSX if the COTVNC viewer is used it has no effect.
It only applies to LISTEN mode, not for forward connections.
Rationale: To play it safe, the Unix vncviewer provided by SSVNC
(ssvncviewer) only allows one LISTEN reverse connection at a time.
This is to prohibit malicious people on the network from depositing
as many desktops on your screen as he likes, even if you are already
connected to VNC server you desire.
For example, perhaps the malicious user could trick you into typing
a password into the desktop he displays on your screen.
This protection is not perfect, because the malicious user could
try to reverse connect to you before the correct VNC server reverse
connects to you. This is even more of a problem if you keep your
SSVNC viewer in LISTEN mode but unconnected for long periods of time.
Pay careful attention in this case if you are to supplying sensitive
information to the remote desktop.
Enable 'Multiple LISTEN Connections' if you want to disable the default
protection in the Unix SSVNC vncviewer; i.e. allow multiple reverse
connections simultaneously (all vnc viewers we know of do this by default)
}
.multil.t insert end $msg
button .multil.cancel -text "Cancel" -command {set multiple_listen 0; destroy .multil}
bind .multil <Escape> {set multiple_listen 0; destroy .multil}
wm protocol .multil WM_DELETE_WINDOW {set multiple_listen 0; destroy .multil}
button .multil.done -text "Done" -command {destroy .multil}
pack .multil.t .multil.cancel .multil.done -side top -fill x
center_win .multil
wm resizable .multil 1 0
}
proc find_netcat {} {
global is_windows
......@@ -11296,6 +11845,8 @@ proc set_advanced_options {} {
global change_vncviewer
global use_port_knocking port_knocking_list
global is_windows darwin_cotvnc
global use_ssh use_sshssl
global adv_ssh
catch {destroy .o}
toplev .oa
......@@ -11306,29 +11857,65 @@ proc set_advanced_options {} {
checkbutton .oa.b$i -anchor w -variable use_cups -text \
"Enable CUPS Print tunnelling" \
-command {if {$use_cups} {cups_dialog}}
if {!$use_ssh && !$use_sshssl} {.oa.b$i configure -state disabled}
set adv_ssh(cups) .oa.b$i
incr i
checkbutton .oa.b$i -anchor w -variable use_sound -text \
"Enable ESD/ARTSD Audio tunnelling" \
-command {if {$use_sound} {sound_dialog}}
if {!$use_ssh && !$use_sshssl} {.oa.b$i configure -state disabled}
set adv_ssh(snd) .oa.b$i
incr i
checkbutton .oa.b$i -anchor w -variable use_smbmnt -text \
"Enable SMB mount tunnelling" \
-command {if {$use_smbmnt} {smb_dialog}}
if {!$use_ssh && !$use_sshssl} {.oa.b$i configure -state disabled}
set adv_ssh(smb) .oa.b$i
incr i
checkbutton .oa.b$i -anchor w -variable additional_port_redirs -text \
"Additional Port Redirs" \
-command {if {$additional_port_redirs} {port_redir_dialog}}
if {!$use_ssh && !$use_sshssl} {.oa.b$i configure -state disabled}
set adv_ssh(redirs) .oa.b$i
incr i
global use_ssl use_ssh use_sshssl
checkbutton .oa.b$i -anchor w -variable ssh_local_protection -text \
"SSH Local Port Protections" \
-command {if {$ssh_local_protection} {ssh_sec_dialog}}
global ssh_local_protection_button
set ssh_local_protection_button .oa.b$i
if {$use_ssl} {.oa.b$i configure -state disabled}
if {$is_windows} {.oa.b$i configure -state disabled}
incr i
checkbutton .oa.b$i -anchor w -variable stunnel_local_protection -text \
"STUNNEL Local Port Protections" \
-command {if {$stunnel_local_protection} {stunnel_sec_dialog}}
global stunnel_local_protection_button
set stunnel_local_protection_button .oa.b$i
if {$use_ssh} {.oa.b$i configure -state disabled}
if {$is_windows} {.oa.b$i configure -state disabled}
incr i
checkbutton .oa.b$i -anchor w -variable multiple_listen -text \
"Multiple LISTEN Connections" \
-command {if {$multiple_listen} {multilisten_dialog}}
global multiple_listen_button use_listen
set multiple_listen_button .oa.b$i
if {$is_windows} {.oa.b$i configure -state disabled}
if {!$use_listen} {.oa.b$i configure -state disabled}
incr i
checkbutton .oa.b$i -anchor w -variable change_vncviewer -text \
"Change VNC Viewer" \
-command {if {$change_vncviewer} {change_vncviewer_dialog}}
incr i
checkbutton .oa.b$i -anchor w -variable additional_port_redirs -text \
"Additional Port Redirs" \
-command {if {$additional_port_redirs} {port_redir_dialog}}
incr i
checkbutton .oa.b$i -anchor w -variable use_port_knocking -text \
"Port Knocking" \
-command {if {$use_port_knocking} {port_knocking_dialog}}
......@@ -11518,11 +12105,45 @@ proc putty_pw_entry {mode} {
catch {.o.pw.e configure -state normal}
}
}
proc adv_ssh_tog {on} {
global adv_ssh
foreach b {cups snd smb redirs} {
if [info exists adv_ssh($b)] {
if {$on} {
catch {$adv_ssh($b) configure -state normal}
} else {
catch {$adv_ssh($b) configure -state disabled}
}
}
}
}
proc adv_listen_ssl_tog {on} {
global stunnel_local_protection_button
if [info exists stunnel_local_protection_button] {
if {$on} {
catch {$stunnel_local_protection_button configure -state normal}
} else {
catch {$stunnel_local_protection_button configure -state disabled}
}
}
}
proc adv_listen_ssh_tog {on} {
global ssh_local_protection_button
if [info exists ssh_local_protection_button] {
if {$on} {
catch {$ssh_local_protection_button configure -state normal}
} else {
catch {$ssh_local_protection_button configure -state disabled}
}
}
}
proc ssl_ssh_adjust {which} {
global use_ssl use_ssh use_sshssl sshssl_sw
global remote_ssh_cmd_list
global x11vnc_find_widget x11vnc_xlogin_widget
global x11vnc_find_widget x11vnc_xlogin_widget uvnc_bug_widget
if {$which == "ssl"} {
set use_ssl 1
......@@ -11537,6 +12158,12 @@ proc ssl_ssh_adjust {which} {
if [info exists x11vnc_xlogin_widget] {
catch {$x11vnc_xlogin_widget configure -state disabled}
}
if [info exists uvnc_bug_widget] {
catch {$uvnc_bug_widget configure -state normal}
}
adv_ssh_tog 0
adv_listen_ssl_tog 1
adv_listen_ssh_tog 0
} elseif {$which == "ssh"} {
set use_ssl 0
set use_ssh 1
......@@ -11550,6 +12177,12 @@ proc ssl_ssh_adjust {which} {
if [info exists x11vnc_xlogin_widget] {
catch {$x11vnc_xlogin_widget configure -state normal}
}
if [info exists uvnc_bug_widget] {
catch {$uvnc_bug_widget configure -state disabled}
}
adv_ssh_tog 1
adv_listen_ssl_tog 0
adv_listen_ssh_tog 1
} elseif {$which == "sshssl"} {
set use_ssl 0
set use_ssh 0
......@@ -11563,6 +12196,12 @@ proc ssl_ssh_adjust {which} {
if [info exists x11vnc_xlogin_widget] {
catch {$x11vnc_xlogin_widget configure -state normal}
}
if [info exists uvnc_bug_widget] {
catch {$uvnc_bug_widget configure -state normal}
}
adv_ssh_tog 1
adv_listen_ssl_tog 1
adv_listen_ssh_tog 1
}
if [info exists remote_ssh_cmd_list] {
......@@ -11594,13 +12233,18 @@ proc ssl_ssh_adjust {which} {
}
proc listen_adjust {} {
global use_listen revs_button
global use_listen revs_button multiple_listen_button
if {![info exists multiple_listen_button]} {
set multiple_listen_button "none"
}
if {$use_listen} {
catch {.b.conn configure -text "Listen"}
catch {.o.b.connect configure -text "Listen"}
catch {$multiple_listen_button configure -state normal}
} else {
catch {.b.conn configure -text "Connect"}
catch {.o.b.connect configure -text "Connect"}
catch {$multiple_listen_button configure -state disabled}
}
}
......@@ -11661,7 +12305,7 @@ proc set_options {} {
global env is_windows darwin_cotvnc uname
global use_listen
global use_x11vnc_find x11vnc_find_widget
global use_x11vnc_xlogin x11vnc_xlogin_widget
global use_x11vnc_xlogin x11vnc_xlogin_widget uvnc_bug_widget
global ts_only
if {$ts_only} {
set_ts_options
......@@ -11705,11 +12349,18 @@ proc set_options {} {
incr i
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 {$use_listen} {destroy .o}}
#if {$is_windows} {.o.b$i configure -state disabled}
if {$darwin_cotvnc} {.o.b$i configure -state disabled}
incr i
checkbutton .o.b$i -anchor w -variable use_uvnc_ssl_bug -text \
"UltraVNC Single Click III Bug"
if {$is_windows} {.o.b$i configure -state disabled}
if {$use_ssh && !$use_sshssl} {.o.b$i configure -state disabled}
set uvnc_bug_widget ".o.b$i"
incr i
checkbutton .o.b$i -anchor w -variable use_viewonly -text \
"View Only"
incr i
......@@ -12002,6 +12653,9 @@ set ts_desktop_depth_def ""
set ts_desktop_type_def ""
set ts_xserver_type_def ""
global win_localhost
set win_localhost "127.0.0.1"
if [file exists $ssvncrc] {
set fh ""
catch {set fh [open $ssvncrc "r"]}
......
#!/bin/sh
# Notes: to customize locations, e.g. for libjpeg, set LDFLAGS_OS and/or CPPFLAGS_OS
# See the README in this directory for more info on using this script
# (build.unix). Search for SSVNC_BUILD.
#
# Notes: to customize locations, e.g. for libjpeg, set LDFLAGS_OS and/or
# CPPFLAGS_OS
#
# e.g. on Darwin we did:
#
......@@ -45,6 +49,10 @@ if [ ! -d ./bin -o ! -d src/patches -o ! -f ./build.unix ]; then
exit $?
fi
pline() {
echo "------------------------------------------------------------------"
}
# Try to find osname.arch
#
name=$UNAME
......@@ -62,35 +70,73 @@ if [ `uname` = "Darwin" ]; then
LDD="otool -L"
fi
# Create a tmp dir for this build:
#
tmp=./src/tmp/$name.$$
if [ "X$TMPDIR" != "X" ]; then
tmp="$TMPDIR/$tmp"
fi
mkdir -p $tmp || exit 1
# Do ultraftp Java viewer (only):
#
if [ "X$SSVNC_BUILD_ULTRAFTP" != "X" ]; then
ultraftp_tar=`ls -td ./src/zips/ultraftp.tar* | head -1`
if [ ! -f $ultraftp_tar ]; then
echo "could not locate ultraftp java vnc viewer source"
exit 1
fi
echo ""
pline
echo "BUILDING THE ULTRAFTP HELPER JAR"
echo ""
sleep 1
cat $ultraftp_tar | (cd $tmp; tar xvf -) || exit 1
cd $tmp/ultraftp || exit 1
pwd
echo
make install
exit 0 # DONE
fi
# Work out main destination:
#
dest=./bin/$name
if [ -d $dest ]; then
printf "$dest exists. overwrite it? [y]/n "
if [ "X$SSVNC_BUILD_FORCE_OVERWRITE" = "X" ]; then
printf "$dest exists. overwrite in it? [y]/n "
read x
if [ "X$x" = "Xn" ]; then
exit
fi
rm -f $dest/*stunnel*
rm -f $dest/*vncviewer*
else
echo "$dest exists. overwriting in it."
fi
if [ "X$SSVNC_BUILD_SKIP_VIEWER" = "X" ]; then
if [ `uname` = "Darwin" ]; then
rm -f $dest/vncviewer.x11*
else
rm -f $dest/vncviewer*
fi
fi
if [ "X$SSVNC_BUILD_SKIP_STUNNEL" = "X" ]; then
rm -f $dest/stunnel*
fi
fi
mkdir -p $dest || exit 1
# Create a tmp dir for this build:
#
tmp=./src/tmp/$name.$$
if [ "X$TMPDIR" != "X" ]; then
tmp="$TMPDIR/$tmp"
fi
mkdir -p $tmp || exit 1
# Try to find some static archives of various libraries:
#
libs="$tmp/libs"
mkdir -p $libs || exit 1
for liba in libz.a libjpeg.a libssl.a libcrypto.a
#for liba in libz.a libjpeg.a
do
if [ "X$SSVNC_BUILD_NO_STATIC" != "X" ]; then
break
fi
for dir in /usr/lib /lib /usr/local/lib /usr/pkg/lib /usr/sfw/lib /usr/openwin/lib
do
if [ "$name" = "Linux.x86_64" -o "$name" = "Linux.ppc64" ] ; then
......@@ -105,10 +151,12 @@ do
fi
done
done
echo "Found these static archive libraries, will try to use them..."
ls -ld $libs
ls -l $libs
echo
if [ "X$SSVNC_BUILD_NO_STATIC" = "X" ]; then
echo "Found these static archive libraries, will try to use them..."
ls -ld $libs
ls -l $libs
echo
fi
have_gcc=""
if type gcc > /dev/null; then
......@@ -132,7 +180,7 @@ END
fi
fi
if [ -d /var/tmp/LIBS ]; then
if [ -d /var/tmp/LIBS -a "X$SSVNC_BUILD_NO_STATIC" = "X" ]; then
LDFLAGS_OS="$LDFLAGS_OS -L/var/tmp/LIBS"
fi
......@@ -150,27 +198,37 @@ if [ $cnt -lt 1 ]; then
exit 1
fi
pline() {
echo "------------------------------------------------------------------"
}
# Do tightvnc viewer:
#
tight_src=`ls -td ./src/vnc_unixsrc* | head -1`
if [ ! -d $tight_src ]; then
if [ "X$SSVNC_BUILD_SKIP_VIEWER" = "X" ]; then
tight_src=`ls -td ./src/vnc_unixsrc* | head -1`
if [ ! -d $tight_src ]; then
echo "could not locate tight vnc viewer source"
exit 1
fi
fi
echo ""
pline
echo "BUILDING THE VNCVIEWER"
echo ""
sleep 1
cp -pR "$tight_src" "$tmp/vnc_unixsrc" || exit 1
cp -pR "$tight_src" "$tmp/vnc_unixsrc" || exit 1
echo "applying tight vnc patches:"
start=`pwd`
cd $tmp;
failed=0
count=0
patches="../../patches/tight-vncviewer-full.patch"
if [ ! -f "$patches" ]; then
echo "applying tight vnc patches:"
start=`pwd`
cd $tmp;
failed=0
count=0
patches="../../patches/tight-vncviewer-full.patch"
if [ ! -f "$patches" ]; then
patches=`ls ../../patches/tight* | grep -v 'tight-vncviewer-full.patch'`
fi
for patch in $patches
do
fi
for patch in $patches
do
if [ ! -f "$patch" ]; then
continue
fi
......@@ -187,82 +245,102 @@ do
else
count=`expr $count + 1`
fi
done
sleep 1
cd "$start"
if [ $failed != 0 -o $count = 0 ]; then
done
sleep 1
cd "$start"
if [ $failed != 0 -o $count = 0 ]; then
ball=src/zips/vnc_unixsrc_vncviewer.patched.tar
echo "patches failed, trying to use backup tarball:"
ls -l $ball
sleep 2
cat $ball | (cd $tmp; tar -xvf -)
fi
echo
fi
echo
cd $tmp/vnc_unixsrc
xmkmf
make Makefiles
mv vncviewer/Makefile vncviewer/Makefile.orig
sed -e "s,EXTRA_LDOPTIONS =,EXTRA_LDOPTIONS = -L$start/$libs $LDFLAGS_OS," \
cd $tmp/vnc_unixsrc
xmkmf
make Makefiles
mv vncviewer/Makefile vncviewer/Makefile.orig
sed -e "s,EXTRA_LDOPTIONS =,EXTRA_LDOPTIONS = -L$start/$libs $LDFLAGS_OS," \
-e "s,CCOPTIONS =,CCOPTIONS = $CPPFLAGS_OS," \
vncviewer/Makefile.orig > vncviewer/Makefile
if [ `uname` = "SunOS" ]; then
if [ `uname` = "SunOS" ]; then
for d in vncviewer libvncauth vncconnect vncpasswd
do
mv $d/Makefile $d/Makefile.orig
sed -e "s,CCOPTIONS =.*\$,CCOPTIONS = $CPPFLAGS_OS," \
$d/Makefile.orig > $d/Makefile
done
fi
fi
make depend
echo $PATH
make all
ls -l vncviewer/vncviewer
cd "$start"
src=$tmp/vnc_unixsrc/vncviewer/vncviewer
sync
sleep 2
sync
strip $src
sync
sleep 2
sync
wc $src
sum $src
sleep 2
suff=""
if [ `uname` = "Darwin" ]; then
make depend
echo $PATH
make all
ls -l vncviewer/vncviewer
cd "$start"
src=$tmp/vnc_unixsrc/vncviewer/vncviewer
sync
sleep 2
sync
strip $src
sync
sleep 2
sync
wc $src
sum $src
sleep 2
suff=""
if [ `uname` = "Darwin" ]; then
suff=".x11"
fi
echo cp -p $src $dest/vncviewer$suff
sleep 1
cp -p $src $dest/vncviewer$suff || exit 1
echo
pline
echo "LISTING, HELP, and LDD THE VNCVIEWER:"
echo
sleep 1
ls -l $src $dest/vncviewer$suff
echo
echo $dest/vncviewer$suff -h
echo
$dest/vncviewer$suff -h
echo
echo $LDD $dest/vncviewer$suff
echo
$LDD $dest/vncviewer$suff
echo ""
fi
echo cp -p $src $dest/vncviewer$suff
sleep 1
cp -p $src $dest/vncviewer$suff || exit 1
ls -l $src $dest/vncviewer$suff
$dest/vncviewer$suff -h
$LDD $dest/vncviewer$suff
echo ""
# Do stunnel:
#
stunnel_src=`ls -td ./src/stunnel* | head -1`
if [ ! -d $stunnel_src ]; then
if [ "X$SSVNC_BUILD_SKIP_STUNNEL" = "X" ]; then
stunnel_src=`ls -td ./src/stunnel* | head -1`
if [ ! -d $stunnel_src ]; then
echo "could not locate stunnel source"
exit 1
fi
fi
echo ""
pline
echo "BUILDING THE STUNNEL"
echo ""
sleep 1
cp -pR "$stunnel_src" "$tmp/stunnel" || exit 1
cp -pR "$stunnel_src" "$tmp/stunnel" || exit 1
echo "applying stunnel patches:"
start=`pwd`
cd $tmp;
failed=0
count=0
for patch in ../../patches/stunnel*
do
echo "applying stunnel patches:"
start=`pwd`
cd $tmp;
failed=0
count=0
for patch in ../../patches/stunnel*
do
if [ ! -f "$patch" ]; then
continue
fi
......@@ -279,47 +357,103 @@ do
else
count=`expr $count + 1`
fi
done
sleep 1
cd "$start"
if [ $failed != 0 -o $count = 0 ]; then
done
sleep 1
cd "$start"
if [ $failed != 0 -o $count = 0 ]; then
ball=src/zips/stunnel.patched.tar
echo "patches failed, trying to use backup tarball:"
ls -l $ball
sleep 2
cat $ball | (cd $tmp; tar -xvf -)
fi
echo
fi
echo
cd $tmp/stunnel
if [ `uname` = "SunOS" ]; then
cd $tmp/stunnel
if [ `uname` = "SunOS" ]; then
cp configure configure.orig
sed -e "s,/var/ssl,/var/ssl /usr/sfw," configure.orig > configure
fi
env LDFLAGS="-L$start/$libs $LDFLAGS_OS" CPPFLAGS="$CPPFLAGS_OS" ./configure --disable-libwrap
make
ls -l src/stunnel
cd "$start"
src=$tmp/stunnel/src/stunnel
sync
sleep 2
sync
strip $src
sync
sleep 2
sync
wc $src
sum $src
sleep 2
echo cp -p $src $dest/stunnel
cp -p $src $dest/stunnel || exit 1
sleep 1
cp -p $src $dest/stunnel || exit 1
echo
pline
echo "LISTING, HELP, and LDD THE STUNNEL:"
echo
sleep 1
ls -l $src $dest/stunnel
echo
echo $dest/stunnel -help
echo
$dest/stunnel -help
echo
echo $LDD $dest/stunnel
echo
$LDD $dest/stunnel
echo ""
fi
# Do vncstorepw and ld preload friends:
#
if [ "X$SSVNC_BUILD_SKIP_VNCSTOREPW" = "X" ]; then
vncpw_tar=`ls -td ./src/zips/vncstorepw* | head -1`
if [ ! -f $vncpw_tar ]; then
echo "could not locate vncstorepw source"
exit 1
fi
echo ""
pline
echo "BUILDING THE VNCSTOREPW AND FRIENDS"
echo ""
sleep 1
cat "$vncpw_tar" | (cd $tmp; tar xvf -)
cd $tmp/vncstorepw
make
cd "$start"
cp -p $tmp/vncstorepw/vncstorepw $tmp/vncstorepw/lim_accept.so $dest
echo ""
fi
if [ "X$SSVNC_BUILD_SKIP_VIEWER" = "X" -a "X$SSVNC_BUILD_SKIP_STUNNEL" = "X" ]; then
# list the viewer again.
echo
pline
echo "LISTING, HELP, and LDD THE VNCVIEWER (again):"
echo
sleep 1
ls -l $dest/vncviewer$suff
echo
echo $dest/vncviewer$suff -h
echo
$dest/vncviewer$suff -h
echo
echo $LDD $dest/vncviewer$suff
echo
$LDD $dest/vncviewer$suff
fi
env LDFLAGS="-L$start/$libs $LDFLAGS_OS" CPPFLAGS="$CPPFLAGS_OS" ./configure --disable-libwrap
make
ls -l src/stunnel
cd "$start"
src=$tmp/stunnel/src/stunnel
sync
sleep 2
sync
strip $src
sync
sleep 2
sync
wc $src
sum $src
sleep 2
echo cp -p $src $dest/stunnel
cp -p $src $dest/stunnel || exit 1
sleep 1
cp -p $src $dest/stunnel || exit 1
ls -l $src $dest/stunnel
$dest/stunnel -help
$LDD $dest/stunnel
echo ""
$dest/vncviewer$suff -h
$LDD $dest/vncviewer$suff
'\" t
.\" ** The above line should force tbl to be a preprocessor **
.\" Man page for the SSVNC vncviewer
.\"
.\" Copyright (C) 2006-2008 Karl J. Runge <runge@karlrunge.com>
.\"
.\" 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 ssvnc 1 "September 2008" "" "SSVNC"
.SH NAME
ssvnc \- a GUI wrapper for SSL and SSH VNC connections.
.SH SYNOPSIS
.B ssvnc
.br
.B ssvnc
.RI [\| host \|][\| :display \|]
.br
.B ssvnc
.RI [\| saved-profile-name \|]
.br
.B ssvnc
.RI [\| options \|][\| host-or-profile \]
.br
.B ssvnc
.IR \--help
.br
.SH DESCRIPTION
.B ssvnc
is a tcl/tk gui wrapper that runs on Unix, MacOSX, and Windows.
It sets up an SSL or SSH tunnel to the remote VNC Server and then launches
the VNC viewer (either the one provided or another one that you have
specified) to use that encrypted tunnel to connect to the VNC Server.
The use of Proxies and Gateways to make the connections is implemented.
Once you have started the SSVNC gui, you can click on the buttons
"Help", "Options -> Help", "Certs -> Help", etc. for much information
on how to use and configure the tool.
In short, you supply a VNC server "hostname:display" in the
"VNC Host:Display" entry box and then press the "Connect" button to
connect to the server via SSL (stunnel). E.g. "far-away.east:0".
Port numbers are also allowed, e.g. far-away.east:5905.
Or supply user@hostname:display and click on the "Use SSH" option, then
press the "Connect" button to connect to the server via an SSH tunnel.
E.g. "fred@far-away.east:0".
As an easter egg, we note it is also possible to disable the use of SSL/SSH
encryption tunnels by using a vnc:// or Vnc:// prefix before
host:display.
Normally you do not specify any command line options. You simply
run \fBssvnc\fR and use the GUI that starts up.
However, as shortcuts you can supply a VNC host:display (or host:port)
on the command line. to connect to immediately (the GUI is started
and the connection is initiated). For example, "\fBssvnc far-away.east:0\fR"
Instead of a host:display, you can specify the name of a saved profile to
automatically load that profile and then connect to its server.
For example "\fBssvnc far\fR", if you name the profile "far".
You can use the \fB-profiles\fR option to list the profiles you have saved.
The related commands \fBsshvnc\fR and \fBtsvnc\fR start up the GUI in
simplified modes: SSH Only Mode, and Terminal Services Mode, respectively.
See below and the application Help for more information on the modes.
There are also some command line options described as follows.
.SH OPTIONS
.TP
\fB\--help\fR
Starts up the GUI as though the 'Help' button was pressed to show the
main Help panel.
.TP
\fB\-profiles\fR
List the saved SSVNC profiles you have created. A profile
is a destination host with specific parameter settings.
.TP
\fB\-list\fR
Same as \fB\-profiles\fR
.TP
\fB\-ssh\fR
Start in "SSH Only Mode". No SSL aspects are shown.
Same as running the command \fBsshvnc\fR
.TP
\fB\-ts\fR
Start in "Terminal Services Mode". This is like "SSH Only Mode", but
simpler and assumes \fBx11vnc\fR is available on the remote side
to start and manage X and VNC sessions.
Same as running the command \fBtsvnc\fR
.TP
\fB\-tso\fR
Same as \fB-ts\fR "Terminal Services Mode", however never let the
user leave this mode (no button to switch modes is provided.)
Same as SSVNC_TS_ALWAYS=1.
.TP
\fB\-ssl\fR
Force the full GUI Mode: both SSL and SSH. This is the default.
.TP
\fB\-nv\fR
Toggle the "Verify All Certs" button to be off at startup.
.TP
\fB\-nvb\fR
Never show the "Verify All Certs" button.
Same as SSVNC_NO_VERIFY_ALL_BUTTON=1.
.TP
\fB\-bigger\fR
Make the Profile Selection Dialog window bigger.
Same as SSVNC_BIGGER_DIALOG=1.
.SH URL NOTATION
Here are all of our URL-like prefixes that you can put in front of
host:display (or host:port):
For SSL: vncs:// vncssl:// and vnc+ssl://
For SSH: vncssh:// and vnc+ssh://
For No Encryption Tunnel: vnc:// and Vnc://
Examples:
To quickly make an SSL connection: \fBssvnc vncs://snoopy.com:0\fR
To quickly make an SSH connection: \fBssvnc vnc+ssh://fred@snoopy.com:0\fR
To quickly make a direct connection: \fBssvnc Vnc://snoopy.com:0\fR
The above will also work in the "VNC Host:Display" entry box in the GUI.
Press the "Connect" button after entering them.
.SH FILES
Your SSVNC vnc profiles are stored in the \fB$HOME/.vnc/profiles\fR
directory. They end in suffix \fB.vnc\fR
Your SSVNC vnc certificates and keys are stored in the \fB$HOME/.vnc/certs\fR
directory. They typically end in \fB.pem\fR (both certificate and
private key) or \fB.crt\fR (certificate only).
You can put a few global parameters (e.g. mode=sshvnc) in your
\fB$HOME/.ssvncrc\fR file (\fBssvnc_rc\fR on Windows); see the
application Help for more information.
.SH SEE ALSO
\fBssvncviewer\fB(1), \fBvncviewer\fR(1), \fBstunnel\fR(8), \fBssh\fR(1), \fBx11vnc\fR(1), \fBvncserver\fR(1)
http://www.karlrunge.com/x11vnc http://www.karlrunge.com/x11vnc/ssvnc.html
.SH AUTHORS
Karl J. Runge <runge@karlrunge.com> wrote the SSVNC gui (tcl/tk) and
associated wrapper scripts.
'\" 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>
.\" Copyright (C) 2006-2008 Karl J. Runge <runge@karlrunge.com>
.\"
.\" 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 ssvncviewer 1 "August 2008" "" "SSVNC"
.SH NAME
ssvncviewer \- an X viewer client for VNC
.SH SYNOPSIS
.B ssvncviewer
.RI [\| options \|]
.RI [\| host \|][\| :display \|]
.br
.B ssvncviewer
.RI [\| options \|]
.RI [\| host \|][\| ::port \|]
.br
.B ssvncviewer
.RI [\| options \|]
.RI exec=[\| cmd+args... \|]
.br
.B ssvncviewer
.RI [\| options \|]
.RI /path/to/unix/socket
.br
.B ssvncviewer
.RI [\| options \|]
.IR \-listen
.RI [\| display \|]
.br
.B ssvncviewer
.IR \-help
.br
.SH DESCRIPTION
.B ssvncviewer
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, WinVNC, or \fBx11vnc\fR, allowing you to control desktop environment
of a different machine.
ssvncviewer is an enhanced version of the tightvnc unix viewer that can
take advantage of features in the \fBx11vnc\fR and UltraVNC VNC servers.
See below for the description of these features.
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
Note: In -listen mode set the env var. SSVNC_MULTIPLE_LISTEN=1
to allow more than one incoming VNC server at a time.
.TP
Note: If the host:port is specified as "exec=command args..."
then instead of making a TCP/IP socket connection to the
remote VNC server, "command args..." is executed and the
viewer is attached to its stdio. This enables tunnelling
established via an external command, e.g. an stunnel(8)
that does not involve a listening socket.
This mode does not work for -listen reverse connections.
.TP
Note: If the host:port contains a '/' it is interpreted as a
unix-domain socket (AF_LOCAL insead of AF_INET)
.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-repeater\fR str This is for use with UltraVNC repeater proxy described
here: http://www.uvnc.com/addons/repeater.html. The "str"
is the ID string to be sent to the repeater. E.g. ID:1234
It can also be the hostname and port or display of the VNC
server, e.g. 12.34.56.78:0 or snoopy.com:1. Note that when
using -repeater, the host:dpy on the cmdline is the repeater
server, NOT the VNC server. The repeater will connect you.
Example: vncviewer ... -repeater ID:3333 repeat.host:5900
Example: vncviewer ... -repeater vhost:0 repeat.host:5900
.TP
\fB\-printres\fR Print out the Ssvnc X resources (appdefaults) and
then exit. You can save them to a file and customize them (e.g. the
keybindings and Popup menu) Then point to the file via
XENVIRONMENT or XAPPLRESDIR.
.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.
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 a single window.
(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>
......@@ -3,3 +3,7 @@
cp -p /dist/src/apps/VNC/tight_vnc_1.3dev5/tight-vncviewer*patch .
cp -p /dist/src/apps/VNC/tight_vnc_1.3dev5/vnc_unixsrc_vncviewer.patched.tar ../zips/
cp -p /dist/src/apps/VNC/etc/libvncserver_cvs/expts/java_ssl/ultra/ultraftp.tar ../zips/
cp -p /dist/src/apps/VNC/etc/libvncserver_cvs/expts/vncstorepw.tar ../zips/
cp -p /dist/src/apps/VNC/tight_vnc_1.3dev5/vnc_unixsrc/vncviewer/vncviewer.man ../../man/man1/ssvncviewer.1
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -241,6 +241,7 @@ int ncache_dt_change = 1;
int ncache_keep_anims = 0;
int ncache_old_wm = 0;
int macosx_ncache_macmenu = 0;
int macosx_us_kbd = 0;
int ncache_beta_tester = 0;
int ncdb = 0;
......
......@@ -182,6 +182,7 @@ extern int ncache_xrootpmap;
extern int ncache_keep_anims;
extern int ncache_old_wm;
extern int macosx_ncache_macmenu;
extern int macosx_us_kbd;
extern int ncache_beta_tester;
extern int ncdb;
......
......@@ -690,6 +690,9 @@ void pointer(int mask, int x, int y, rfbClientPtr client) {
button_mask_prev = button_mask;
button_mask = mask;
}
if (!view_only && (input.motion || input.button)) {
last_rfb_ptr_injected = dnow();
}
return;
}
}
......@@ -714,6 +717,7 @@ void pointer(int mask, int x, int y, rfbClientPtr client) {
last_pointer_client = client;
last_pointer_time = now;
last_rfb_ptr_injected = dnow();
if (blackout_ptr && blackouts) {
int b, ok = 1;
......
......@@ -630,6 +630,10 @@ int remote_control_access_ok(void) {
#endif /* NO_X11 */
}
#ifdef MACOSX
void macosxCG_keycode_inject(int down, int keycode);
#endif
/*
* Huge, ugly switch to handle all remote commands and queries
* -remote/-R and -query/-Q.
......@@ -3502,6 +3506,19 @@ char *process_remote_cmd(char *cmd, int stringonly) {
adjust_grabs(0, 0);
rfbLog("disabled grab_always\n");
} else if (strstr(p, "grablocal") == p) {
COLON_CHECK("grablocal:")
if (query) {
snprintf(buf, bufn, "ans=%s%s%d", p, co,
grab_local);
goto qry;
}
p += strlen("grablocal:");
grab_local = atoi(p);
rfbLog("remote_cmd: changed -grablocal to: %d\n",
grab_local);
} else if (strstr(p, "client_input") == p) {
NOTAPP
COLON_CHECK("client_input:")
......@@ -3578,6 +3595,28 @@ char *process_remote_cmd(char *cmd, int stringonly) {
rfbLog("remote_cmd: turning off debug_keyboard.\n");
debug_keyboard = 0;
} else if (strstr(p, "keycode") == p) {
int kc;
NOTAPP
COLON_CHECK("keycode:")
p += strlen("keycode:");
kc = atoi(p);
if (kc < 0) kc = 0;
kc = kc % 256;
rfbLog("remote_cmd: insert keycode %d\n", kc);
if (macosx_console) {
#ifdef MACOSX
macosxCG_keycode_inject(1, kc);
usleep(100*1000);
macosxCG_keycode_inject(0, kc);
#endif
} else {
XTestFakeKeyEvent_wr(dpy, kc, 1, CurrentTime);
usleep(100*1000);
XTestFakeKeyEvent_wr(dpy, kc, 0, CurrentTime);
}
} else if (strstr(p, "deferupdate") == p) {
int d;
COLON_CHECK("deferupdate:")
......@@ -4421,6 +4460,19 @@ char *process_remote_cmd(char *cmd, int stringonly) {
rfbLog("remote_cmd: disable macosx_ncache_macmenu.\n");
macosx_ncache_macmenu = 0;
} else if (!strcmp(p, "macuskbd")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p, macosx_us_kbd); goto qry;
}
rfbLog("remote_cmd: enable macosx_us_kbd.\n");
macosx_us_kbd = 1;
} else if (!strcmp(p, "nomacuskbd")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p, !macosx_us_kbd); goto qry;
}
rfbLog("remote_cmd: disable macosx_us_kbd.\n");
macosx_us_kbd = 0;
} else if (strstr(p, "hack") == p) { /* skip-cmd-list */
COLON_CHECK("hack:")
if (query) {
......
......@@ -532,6 +532,12 @@ static void solid_gnome(char *color) {
"/desktop/gnome/background/picture_options";
char set_option[] = "gconftool-2 --set "
"/desktop/gnome/background/picture_options --type string '%s'";
#if 0
char get_filename[] = "gconftool-2 --get "
"/desktop/gnome/background/picture_filename";
char set_filename[] = "gconftool-2 --set "
"/desktop/gnome/background/picture_filename --type string '%s'";
#endif
static char *orig_color = NULL;
static char *orig_option = NULL;
char *cmd;
......@@ -607,6 +613,14 @@ static void solid_gnome(char *color) {
sprintf(cmd, set_option, "none");
dt_cmd(cmd);
free(cmd);
#if 0
cmd = (char *) malloc(strlen(set_filename) + strlen("none") + 1);
sprintf(cmd, set_filename, "none");
dt_cmd(cmd);
free(cmd);
#endif
#endif /* NO_X11 */
}
......
......@@ -694,12 +694,16 @@ char find_display[] =
"# display + xauth info to caller (x11vnc running as root or nobody).\n"
"# x11vnc then uses the info to open the display.\n"
"#\n"
"# If not called with -unixpw, root, etc. uses current $USER.\n"
"\n"
"#FIND_DISPLAY_OUTPUT=/tmp/fdo.$USER.txt\n"
"\n"
"if [ \"X$FIND_DISPLAY_OUTPUT\" != \"X\" ]; then\n"
" if [ \"X$FIND_DISPLAY_EXEC\" = \"X\" ]; then\n"
" FIND_DISPLAY_EXEC=1\n"
" export FIND_DISPLAY_EXEC\n"
" # we rerun ourselves with verbose output to a file:\n"
" #\n"
" if [ \"X$FIND_DISPLAY_OUTPUT\" != \"X\" ]; then\n"
" /bin/sh $0 \"$@\" 2> $FIND_DISPLAY_OUTPUT\n"
" else\n"
......@@ -710,13 +714,19 @@ char find_display[] =
"fi\n"
"\n"
"if [ \"X$FIND_DISPLAY_OUTPUT\" != \"X\" ]; then\n"
" # turn on verbose output\n"
" set -xv\n"
"fi\n"
"if [ \"X$FIND_DISPLAY_DEBUG\" != \"X\" ]; then\n"
" # print environment and turn on verbose output\n"
" env\n"
" set -xv\n"
"fi\n"
"\n"
"#env; set -xv\n"
"PATH=$PATH:/bin:/usr/bin:/usr/X11R6/bin:/usr/bin/X11:/usr/openwin/bin:/usr/ucb\n"
"export PATH\n"
"\n"
"# This is to try to trick ps(1) into writing wide lines: \n"
"COLUMNS=256\n"
"export COLUMNS\n"
"\n"
......@@ -726,6 +736,8 @@ char find_display[] =
" showxauth=\"\"\n"
" shift\n"
"fi\n"
"\n"
"# -f means use this xauthority file:\n"
"if [ \"X$1\" = \"X-f\" ]; then\n"
" shift\n"
" if [ ! -r $1 ]; then\n"
......@@ -736,6 +748,8 @@ char find_display[] =
" shift\n"
"fi\n"
"\n"
"# we need to set user:\n"
"#\n"
"user=\"$1\" # cmd line arg takes precedence\n"
"if [ \"X$user\" = \"X\" ]; then\n"
" user=$X11VNC_USER # then X11VNC_USER\n"
......@@ -754,20 +768,30 @@ char find_display[] =
" exit 1\n"
"fi\n"
"\n"
"# util to try to match a display with a Linux VT and print\n"
"# disp,VT=... etc. Otherwise just print out display.\n"
"#\n"
"prdpy () {\n"
" d1=$1\n"
" chvt0=\"\"\n"
" # we can only do chvt on Linux:\n"
" if [ \"X$uname\" = \"XLinux\" ]; then\n"
" d2=$d1\n"
" d3=`echo \"$d2\" | sed -e 's/^.*:/:/' -e 's/\\..*$//'`\n"
" d4=\"($d2|$d3)\"\n"
"\n"
" # vt is usually in X server line:\n"
" #\n"
" vt=`ps wwwwwaux | grep X | egrep -v 'startx|xinit' | egrep \" $d4 \" | egrep ' vt([789]|[1-9][0-9][0-9]*) ' | grep -v grep | head -n 1`\n"
"\n"
" if [ \"X$vt\" != \"X\" ]; then\n"
" # strip it out and add it.\n"
" vt=`echo \"$vt\" | sed -e 's/^.* vt\\([0-9][0-9]*\\) .*$/\\1/'`\n"
" if echo \"$vt\" | grep '^[0-9][0-9]*$' > /dev/null; then\n"
" chvt0=\",VT=$vt\"\n"
" fi\n"
" else\n"
" # otherwise look for tty:\n"
" vt=`ps wwwwwaux | grep X | egrep \" $d4 \" | egrep ' tty([789]|[1-9][0-9][0-9]*) ' | grep -v grep | head -n 1`\n"
" if [ \"X$vt\" != \"X\" ]; then\n"
" vt=`echo \"$vt\" | sed -e 's/^.* tty\\([0-9][0-9]*\\) .*$/\\1/'`\n"
......@@ -775,21 +799,27 @@ char find_display[] =
" chvt0=\",VT=$vt\"\n"
" fi\n"
" else\n"
" # otherwise try lsof:\n"
" pvt=`ps wwwwwaux | grep X | egrep -v 'startx|xinit' | egrep \" $d4 \" | head -n 1 | awk '{print $2}'`\n"
" if [ \"X$pvt\" != \"X\" ]; then\n"
" vt=`lsof -p \"$pvt\" 2>/dev/null | egrep '/dev/tty([789]|[1-9][0-9][0-9]*)$' | grep -v grep | head -n 1 | awk '{print $NF}' | sed -e 's,/dev/tty,,'`\n"
" if echo \"$vt\" | grep '^[0-9][0-9]*$' > /dev/null; then\n"
" chvt0=\",VT=$vt\"\n"
" else\n"
" # if this fails, at least tell them the XPID:\n"
" chvt0=\",XPID=$pvt\"\n"
" fi\n"
" fi\n"
" fi\n"
" fi\n"
" fi\n"
"\n"
" # return the string, possibly with ,VT=... appended:\n"
" #\n"
" echo \"$d1$chvt0\"\n"
"}\n"
"\n"
"# save uname, netstat, and ps output:\n"
"uname=`uname`\n"
"nsout=`netstat -an`\n"
"if [ \"X$uname\" = \"XDarwin\" ]; then\n"
......@@ -800,6 +830,10 @@ char find_display[] =
" pslist=`echo \"$psout\" | awk '{print $2}'`\n"
"fi\n"
"\n"
"# this mode is to try to grab a display manager (gdm, kdm, xdm...) display\n"
"# when we are run as root (e.g. no one is logged in yet). We look at the\n"
"# -auth line in the X/Xorg commandline.\n"
"#\n"
"if [ \"X$FD_XDM\" != \"X\" ]; then\n"
" list=\"\"\n"
" for pair in `echo \"$psout\" | grep '/X.* :[0-9][0-9]* .*-auth' | egrep -v 'startx|xinit' | sed -e 's,^.*/X.* \\(:[0-9][0-9]*\\) .* -auth \\([^ ][^ ]*\\).*$,\\1\\,\\2,' | sort -u`\n"
......@@ -807,6 +841,8 @@ char find_display[] =
" da=`echo \"$pair\" | awk -F, '{print $1}'`\n"
" xa=`echo \"$pair\" | awk -F, '{print $2}'`\n"
" if [ -f $xa -a -r $xa ]; then\n"
" # if we have an xauth file, we proceed to test it:\n"
" #\n"
" env XAUTHORITY=\"$xa\" xdpyinfo -display \"$da\" >/dev/null 2>&1\n"
" if [ $? = 0 ]; then\n"
" env XAUTHORITY=/dev/null xdpyinfo -display \"$da\" >/dev/null 2>&1\n"
......@@ -814,6 +850,7 @@ char find_display[] =
" y=`prdpy $da`\n"
" echo \"DISPLAY=$y\"\n"
" if [ \"X$showxauth\" != \"X\" ]; then\n"
" # copy the cookie:\n"
" cook=`xauth -f \"$xa\" list | head -n 1 | awk '{print $NF}'`\n"
" tf=$HOME/.xat.$$\n"
" rm -f $tf\n"
......@@ -838,6 +875,7 @@ char find_display[] =
" xauth -f $tf extract - \"$da\" 2>/dev/null\n"
" rm -f $tf\n"
" fi\n"
" # DONE\n"
" exit 0\n"
" fi\n"
" fi\n"
......@@ -847,26 +885,54 @@ char find_display[] =
" if [ \"X$showxauth\" != \"X\" ]; then\n"
" echo \"\"\n"
" fi\n"
" # DONE\n"
" exit 1\n"
"fi\n"
"\n"
"# Now try to match X DISPLAY to user:\n"
"# Normal case here (not xdm...).\n"
"\n"
"# Try to match X DISPLAY to user:\n"
"\n"
"# who(1) output column 2:\n"
"#gone=`last $user | grep 'gone.*no.logout' | awk '{print $2}' | grep '^:' | sed -e 's,/.*,,' | tr '\\n' '|'`\n"
"#gone=\"${gone}__quite_impossible__\"\n"
"#display=`who 2>/dev/null | grep \"^${user}[ ][ ]*:[0-9]\" | egrep -v \" ($gone)\\>\" | head -n 1 \\\n"
"# | awk '{print $2}' | sed -e 's,/.*$,,'`\n"
"\n"
"poss=\"\"\n"
"list=`who 2>/dev/null | grep \"^${user}[ ][ ]*:[0-9]\" | awk '{print $2}' | sed -e 's,/.*$,,'`\n"
"list=\"$list \"`w -h \"$user\" 2>/dev/null | grep \"^${user}[ ][ ]*:[0-9]\" | awk '{print $2}' | sed -e 's,/.*$,,'`\n"
"list=\"$list \"`who 2>/dev/null | grep \"^${user}[ ]\" | awk '{print $NF}' | grep '(:[0-9]' | sed -e 's/[()]//g'`\n"
"host=`hostname 2>/dev/null | sed -e 's/\\..*$//'`\n"
"\n"
"if [ \"X$X11VNC_FINDDISPLAY_SKIP_XAUTH\" = \"X\" ]; then\n"
" # do a normal xauth list:\n"
" list=\"$list \"`xauth list | awk '{print $1}' | grep /unix | grep \"^${host}\" | sed -e 's/^.*:/:/' | sort -n | uniq`\n"
"\n"
" # check for gdm and kdm non-NFS cookies in /tmp:\n"
" for xa in /tmp/.gdm* /tmp/.Xauth*\n"
" do\n"
" # try to be somewhat careful about the real owner of the file:\n"
" if id | sed -e 's/ gid.*$//' | grep -w root > /dev/null; then\n"
" break\n"
" fi\n"
" if [ -f $xa -a -r $xa ]; then\n"
" if ls -l \"$xa\" | sed -e 's,/tmp.*$,,' | grep -w \"$user\" > /dev/null; then\n"
" # append these too:\n"
" if find \"$xa\" -user \"$user\" -perm 600 > /dev/null; then\n"
" :\n"
" else\n"
" continue\n"
" fi\n"
" # it passes the ownership tests, add it:\n"
" list=\"$list \"`xauth -f \"$xa\" list | awk '{print $1}' | grep /unix | grep \"^${host}\" | sed -e 's/^.*:/:/' | sort -n | uniq | sed -e \"s,\\$,\\,$xa,\"`\n"
" fi\n"
" fi\n"
" done\n"
"fi\n"
"\n"
"if [ \"X$uname\" = \"XDarwin\" ]; then\n"
" # macosx uses \"console\" string (in leopard X11 runs/launched by default)\n"
" if who 2>/dev/null | grep -i \"^${user}[ ][ ]*console[ ]\" > /dev/null; then\n"
" echo \"DISPLAY=console\"\n"
" if [ \"X$FIND_DISPLAY_ALL\" = \"X\" ]; then\n"
......@@ -878,12 +944,15 @@ char find_display[] =
" fi\n"
"fi\n"
"\n"
"# try the items in the list:\n"
"#\n"
"for p in $list\n"
"do\n"
" xa=`echo \"$p\" | awk -F, '{print $2}'`\n"
" d=`echo \"$p\" | sed -e 's/,.*$//' -e 's/://' -e 's/\\..*$//'`\n"
" ok=\"\"\n"
" if [ \"X$X11VNC_SKIP_DISPLAY\" != \"X\" ]; then\n"
" # user supplied skip list:\n"
" mat=\"\"\n"
" for skip in `echo $X11VNC_SKIP_DISPLAY | tr ',' '\\n'`\n"
" do\n"
......@@ -902,6 +971,8 @@ char find_display[] =
" continue\n"
" fi\n"
" fi\n"
"\n"
" # check for the local X11 files:\n"
" xd=\"/tmp/.X11-unix/X$d\"\n"
" if [ -r \"$xd\" -o -w \"$xd\" -o -x \"$xd\" ]; then\n"
" if echo \"$nsout\" | grep \"/tmp/.X11-unix/X$d[ ]*\\$\" > /dev/null; then\n"
......@@ -909,6 +980,7 @@ char find_display[] =
" fi\n"
" fi\n"
" if [ \"X$ok\" = \"X\" ]; then\n"
" # instead check for the lock:\n"
" if [ -f \"/tmp/.X$d-lock\" ]; then\n"
" pid=`cat \"/tmp/.X$d-lock\" | sed -e 's/[ ]//g'`\n"
" if echo \"$pid\" | grep '^[0-9][0-9]*$' > /dev/null; then\n"
......@@ -922,14 +994,21 @@ char find_display[] =
" fi\n"
" fi\n"
" fi\n"
"\n"
" if [ \"X$ok\" = \"X1\" ]; then\n"
" # ok, put it on the list\n"
" poss=\"$poss $p\"\n"
" if [ \"X$xa\" != \"X\" ]; then\n"
" # xauth file too, if applicable\n"
" poss=\"$poss,$xa\"\n"
" fi\n"
" fi\n"
"done\n"
"\n"
"seenvalues=\"\"\n"
"\n"
"seen() {\n"
" # simple util to skip repeats\n"
" v=$1\n"
" if [ \"X$seenvalues\" != \"X\" ]; then\n"
" for v2 in $seenvalues\n"
......@@ -948,9 +1027,14 @@ char find_display[] =
" seenret=0\n"
"}\n"
"\n"
"# now get read to try each one in $poss\n"
"#\n"
"poss=`echo \"$poss\" | sed -e 's/^ *//' -e 's/ *$//'`\n"
"display=\"\"\n"
"xauth_use=\"\"\n"
"\n"
"if [ \"X$X11VNC_FINDDISPLAY_SKIP_XAUTH\" != \"X\" ]; then\n"
" # we are not supposed to call xauth(1), simply report\n"
" if [ \"X$FIND_DISPLAY_ALL\" != \"X\" ]; then\n"
" for p in $poss\n"
" do\n"
......@@ -961,6 +1045,8 @@ char find_display[] =
" if [ \"X$seenret\" = \"X1\" ]; then\n"
" continue\n"
" fi\n"
" # get rid of any ,xauth\n"
" p=`echo \"$p\" | sed -e 's/,.*$//'`\n"
" y=`prdpy $p`\n"
" echo $y\n"
" done\n"
......@@ -969,6 +1055,7 @@ char find_display[] =
" display=`echo \"$poss\" | tr ' ' '\\n' | head -n 1`\n"
"else\n"
" freebie=\"\"\n"
" xauth_freebie=\"\"\n"
" for p in $poss\n"
" do\n"
" if [ \"X$p\" = \"X\" ]; then\n"
......@@ -978,22 +1065,47 @@ char find_display[] =
" if [ \"X$seenret\" = \"X1\" ]; then\n"
" continue\n"
" fi\n"
"\n"
" # extract ,xauth if any.\n"
" xa=\"\"\n"
" xa=`echo \"$p\" | awk -F, '{print $2}'`\n"
" p=`echo \"$p\" | sed -e 's/,.*$//'`\n"
"\n"
" # check xauth for it:\n"
" if [ \"X$xa\" != \"X\" ]; then\n"
" XAUTHORITY=\"$xa\" xdpyinfo -display \"$p\" >/dev/null 2>&1\n"
" else\n"
" xdpyinfo -display \"$p\" >/dev/null 2>&1\n"
" fi\n"
"\n"
" if [ $? = 0 ]; then\n"
" if [ \"X$FD_TAG\" != \"X\" ]; then\n"
" # look for x11vnc special FD_TAG property:\n"
" if [ \"X$xa\" = \"X\" ]; then\n"
" if xprop -display \"$p\" -root -len 128 FD_TAG | grep -iv no.such.atom \\\n"
" | grep \"=[ ][ ]*\\\"$FD_TAG\\\"\" > /dev/null; then\n"
" :\n"
" else\n"
" continue\n"
" fi\n"
" else\n"
" if env XAUTHORITY=\"$xa\" xprop -display \"$p\" -root -len 128 FD_TAG | grep -iv no.such.atom \\\n"
" | grep \"=[ ][ ]*\\\"$FD_TAG\\\"\" > /dev/null; then\n"
" :\n"
" else\n"
" continue\n"
" fi\n"
" # try again with no authority:\n"
" fi\n"
" fi\n"
"\n"
" # Now try again with no authority:\n"
" env XAUTHORITY=/dev/null xdpyinfo -display \"$p\" >/dev/null 2>&1\n"
" # 0 means got in for free... skip it.\n"
"\n"
" # 0 means got in for free... skip it unless we don't find anything else.\n"
" if [ $? != 0 ]; then\n"
" # keep it\n"
" display=\"$p\"\n"
" xauth_use=\"$xa\"\n"
" if [ \"X$FIND_DISPLAY_ALL\" != \"X\" ]; then\n"
" y=`prdpy $p`\n"
" echo \"DISPLAY=$y\"\n"
......@@ -1001,6 +1113,7 @@ char find_display[] =
" fi\n"
" break\n"
" else\n"
" # store in freebie as fallback\n"
" if [ \"X$FIND_DISPLAY_ALL\" != \"X\" ]; then\n"
" y=`prdpy $p`\n"
" echo \"$y,NOXAUTH\"\n"
......@@ -1008,16 +1121,20 @@ char find_display[] =
" fi\n"
" if [ \"X$freebie\" = \"X\" ]; then\n"
" freebie=\"$p\"\n"
" xauth_freebie=\"$xa\"\n"
" fi\n"
" fi\n"
" fi\n"
" done\n"
" if [ \"X$display\" = \"X\" -a \"X$freebie\" != \"X\" ]; then\n"
" # fallback to the freebie (if any)\n"
" display=\"$freebie\"\n"
" xauth_use=\"$xauth_freebie\"\n"
" fi\n"
"fi\n"
"\n"
"if [ \"X$FIND_DISPLAY_ALL\" != \"X\" ]; then\n"
" # we have listed everything, get out.\n"
" exit\n"
"fi\n"
"if [ \"X$display\" = \"X\" ]; then\n"
......@@ -1030,11 +1147,25 @@ char find_display[] =
" exit 1\n"
"fi\n"
"\n"
"# append ,VT=n if applicable:\n"
"dpy2=`prdpy \"$display\"`\n"
"\n"
"echo \"DISPLAY=$dpy2\"\n"
"if [ \"X$FIND_DISPLAY_XAUTHORITY_PATH\" != \"X\" ]; then\n"
" # caller wants XAUTHORITY printed out too.\n"
" if [ \"X$xauth_use\" != \"X\" -a -f \"$xauth_use\" ]; then\n"
" echo \"XAUTHORITY=$xauth_use\"\n"
" else\n"
" echo \"XAUTHORITY=$XAUTHORITY\"\n"
" fi\n"
"fi\n"
"if [ \"X$showxauth\" != \"X\" ]; then\n"
" # show the (binary) xauth data:\n"
" if [ \"X$xauth_use\" != \"X\" -a -f \"$xauth_use\" ]; then\n"
" xauth -f \"$xauth_use\" extract - \"$display\" 2>/dev/null\n"
" else\n"
" xauth extract - \"$display\" 2>/dev/null\n"
" fi\n"
"fi\n"
"\n"
"exit 0\n"
......
......@@ -340,6 +340,7 @@ Permissions
grabkbd
grabptr
grabalways
grablocal:
forcedpms
clientdpms
noserverdpms
......@@ -4828,7 +4829,10 @@ proc get_icon_label {{set 0}} {
if {$icon_minimal} {
set lab [get_vnc_display_number]
if {$lab != "none"} {
set lab " :$lab"
#set lab " :$lab"
set lab ":$lab"
} else {
set lab "-"
}
} else {
set lab $lab0
......@@ -5074,7 +5078,7 @@ proc make_icon {} {
wm title . "tkx11vnc"
update
if {$tray_embed && $tray_running} {
wm deiconify .
#wm deiconify .; # why did we have this???
#after 10000 {wm deiconify .; puts "reqheight [winfo reqheight .]"; puts "reqwidth [winfo reqwidth .]"; puts "height [winfo height .]"; puts "width [winfo width .]"}
} else {
wm deiconify .
......@@ -5146,7 +5150,7 @@ proc clean_icon_exit {} {
}
proc make_gui {mode} {
global icon_mode tray_embed full_win icon_win
global icon_mode tray_embed tray_running full_win icon_win
global top_widget_names x11vnc_gui_geom
global gui_current_state make_gui_count
global x11vnc_connect connected_to_x11vnc
......@@ -5226,7 +5230,9 @@ proc make_gui {mode} {
update
if {!$tray_embed || !$tray_running} {
wm deiconify .
}
update idletasks
wm minsize $w [winfo width $w] [winfo height $w]
if {$mode == "full" && $make_gui_count > 1} {
......@@ -6187,6 +6193,9 @@ proc change_view_state {} {
exit
}
make_gui $new
if {$new == "tray"} {
wm withdraw .
}
} else {
set_view_variable $old
}
......@@ -6346,10 +6355,16 @@ set ls ""
catch {set ls [font metrics $bfont -linespace]}
if {$ls != ""} {
if {$ls > 14} {
# some recent setups have BIG rendering for the above fonts:
# some recent setups have BIG rendering for the above fonts.
# on recent (8/08) debian these are really ragged:
set bfont "-adobe-helvetica-bold-r-*-*-*-90-*-*-*-*-*-*"
set sfont "-adobe-helvetica-bold-r-*-*-*-75-*-*-*-*-*-*"
set snfont "-adobe-helvetica-medium-r-*-*-*-75-*-*-*-*-*-*"
# these are bigger but look better... but for how long?
set bfont "-adobe-helvetica-bold-r-*-*-*-100-*-*-*-*-*-*"
set sfont "-adobe-helvetica-bold-r-*-*-*-80-*-*-*-*-*-*"
set snfont "-adobe-helvetica-medium-r-*-*-*-80-*-*-*-*-*-*"
}
}
set help_indent 24;
......
......@@ -351,6 +351,7 @@ char gui_code[] = "";
" grabkbd\n"
" grabptr\n"
" grabalways\n"
" grablocal:\n"
" forcedpms\n"
" clientdpms\n"
" noserverdpms\n"
......@@ -4839,7 +4840,10 @@ char gui_code[] = "";
" if {$icon_minimal} {\n"
" set lab [get_vnc_display_number]\n"
" if {$lab != \"none\"} {\n"
" set lab \" :$lab\"\n"
" #set lab \" :$lab\"\n"
" set lab \":$lab\"\n"
" } else {\n"
" set lab \"-\"\n"
" }\n"
" } else {\n"
" set lab $lab0\n"
......@@ -5085,7 +5089,7 @@ char gui_code[] = "";
" wm title . \"tkx11vnc\"\n"
" update\n"
" if {$tray_embed && $tray_running} {\n"
" wm deiconify .\n"
" #wm deiconify .; # why did we have this???\n"
" #after 10000 {wm deiconify .; puts \"reqheight [winfo reqheight .]\"; puts \"reqwidth [winfo reqwidth .]\"; puts \"height [winfo height .]\"; puts \"width [winfo width .]\"}\n"
" } else {\n"
" wm deiconify .\n"
......@@ -5157,7 +5161,7 @@ char gui_code[] = "";
"}\n"
"\n"
"proc make_gui {mode} {\n"
" global icon_mode tray_embed full_win icon_win\n"
" global icon_mode tray_embed tray_running full_win icon_win\n"
" global top_widget_names x11vnc_gui_geom\n"
" global gui_current_state make_gui_count\n"
" global x11vnc_connect connected_to_x11vnc\n"
......@@ -5237,7 +5241,9 @@ char gui_code[] = "";
"\n"
"\n"
" update\n"
" if {!$tray_embed || !$tray_running} {\n"
" wm deiconify .\n"
" }\n"
" update idletasks\n"
" wm minsize $w [winfo width $w] [winfo height $w]\n"
" if {$mode == \"full\" && $make_gui_count > 1} {\n"
......@@ -6198,6 +6204,9 @@ char gui_code[] = "";
" exit\n"
" }\n"
" make_gui $new\n"
" if {$new == \"tray\"} {\n"
" wm withdraw .\n"
" }\n"
" } else {\n"
" set_view_variable $old\n"
" }\n"
......@@ -6357,10 +6366,16 @@ char gui_code[] = "";
"catch {set ls [font metrics $bfont -linespace]}\n"
"if {$ls != \"\"} {\n"
" if {$ls > 14} {\n"
" # some recent setups have BIG rendering for the above fonts:\n"
" # some recent setups have BIG rendering for the above fonts.\n"
" # on recent (8/08) debian these are really ragged:\n"
" set bfont \"-adobe-helvetica-bold-r-*-*-*-90-*-*-*-*-*-*\"\n"
" set sfont \"-adobe-helvetica-bold-r-*-*-*-75-*-*-*-*-*-*\"\n"
" set snfont \"-adobe-helvetica-medium-r-*-*-*-75-*-*-*-*-*-*\"\n"
"\n"
" # these are bigger but look better... but for how long?\n"
" set bfont \"-adobe-helvetica-bold-r-*-*-*-100-*-*-*-*-*-*\"\n"
" set sfont \"-adobe-helvetica-bold-r-*-*-*-80-*-*-*-*-*-*\"\n"
" set snfont \"-adobe-helvetica-medium-r-*-*-*-80-*-*-*-*-*-*\"\n"
" }\n"
"}\n"
"set help_indent 24;\n"
......
......@@ -2524,6 +2524,8 @@ fprintf(stderr, "\n");}
return 1;
}
void ssh_remote_tunnel(char *, int);
static XImage ximage_struct;
int wait_for_client(int *argc, char** argv, int http) {
......
......@@ -3575,7 +3575,7 @@ void check_fixscreen(void) {
}
if (advertise_truecolor && advertise_truecolor_reset && indexed_color) {
/* this will reset framebuffer to correct colors, if needed */
static dlast = 0.0;
static double dlast = 0.0;
now = dnow();
if (now > last_client + 1.0 && now < last_client + 3.0 && now > dlast + 5.0) {
rfbLog("advertise truecolor reset framebuffer\n");
......@@ -9080,6 +9080,8 @@ if (hack_val == 2) {
for (k = 1; k <= 3; k++) {
int j, retry = 0;
if (retry) {}
nsave = n;
if (k > 1 && ncdb) fprintf(stderr, "read_events-%d\n", k);
......@@ -9250,12 +9252,10 @@ if (ncdb) fprintf(stderr, "SKIPWINS: Ev_unmap/map: 0x%lx %d\n", twin, n2);
}
}
if (ncache_old_wm) {
int old_maps = 0;
int old_unmaps = 0;
int shifts = 0;
for (i=0; i < n; i++) {
XEvent ev;
int ns, skip = 0, type, idx = -1, state, valid;
int type, idx = -1;
int ik = Ev_order[i];
int x_new, y_new, w_new, h_new;
int x_old, y_old, w_old, h_old;
......@@ -9517,7 +9517,7 @@ if (ncdb) fprintf(stderr, "UM Ev_order[%d] = %d oku=%d okm=%d\n", i, j, oku, okm
} else if (n_MN <= 2 && n_ON_st <= 1) {
for (i=0; i < n; i++) {
XEvent ev;
int ns, skip = 0, type, idx = -1, state, valid;
int type, idx = -1, state, valid;
int ik = Ev_order[i];
if (Ev_done[ik]) continue;
......
.\" This file was automatically generated from x11vnc -help output.
.TH X11VNC "1" "June 2008" "x11vnc " "User Commands"
.TH X11VNC "1" "September 2008" "x11vnc " "User Commands"
.SH NAME
x11vnc - allow VNC connections to real X11 displays
version: 0.9.4, lastmod: 2008-06-06
version: 0.9.4, lastmod: 2008-09-06
.SH SYNOPSIS
.B x11vnc
[OPTION]...
......@@ -566,7 +566,7 @@ to plumb reverse connections.
\fB-connect_or_exit\fR \fIstr\fR
.IP
As with \fB-connect,\fR except if none of the reverse
connections succeed, then x11vnc shutdowns immediately.
connections succeed, then x11vnc shuts down immediately
.IP
By the way, if you do not want x11vnc to listen on
ANY interface use \fB-rfbport\fR 0 which is handy for the
......@@ -4239,50 +4239,55 @@ higher to get debugging output for UINPUT mode.
.PP
\fB-macnodim\fR
.IP
For the native Mac OS X server, disable dimming.
For the native MacOSX server, disable dimming.
.PP
\fB-macnosleep\fR
.IP
For the native Mac OS X server, disable display sleep.
For the native MacOSX server, disable display sleep.
.PP
\fB-macnosaver\fR
.IP
For the native Mac OS X server, disable screensaver.
For the native MacOSX server, disable screensaver.
.PP
\fB-macnowait\fR
.IP
For the native Mac OS X server, do not wait for the
For the native MacOSX server, do not wait for the
user to switch back to his display.
.PP
\fB-macwheel\fR \fIn\fR
.IP
For the native Mac OS X server, set the mouse wheel
For the native MacOSX server, set the mouse wheel
speed to n (default 5).
.PP
\fB-macnoswap\fR
.IP
For the native Mac OS X server, do not swap mouse
For the native MacOSX server, do not swap mouse
buttons 2 and 3.
.PP
\fB-macnoresize\fR
.IP
For the native Mac OS X server, do not resize or reset
For the native MacOSX server, do not resize or reset
the framebuffer even if it is detected that the screen
resolution or depth has changed.
.PP
\fB-maciconanim\fR \fIn\fR
.IP
For the native Mac OS X server, set n to the number
For the native MacOSX server, set n to the number
of milliseconds that the window iconify/deiconify
animation takes. In \fB-ncache\fR mode this value will be
used to skip the animation if possible. (default 400)
.PP
\fB-macmenu\fR
.IP
For the native Mac OS X server, in \fB-ncache\fR client-side
For the native MacOSX server, in \fB-ncache\fR client-side
caching mode, try to cache pull down menus (not perfect
because they have animated fades, etc.)
.PP
\fB-macuskbd\fR
.IP
For the native MacOSX server, use the original
keystroke insertion code based on a US keyboard.
.PP
\fB-gui\fR \fI[gui-opts]\fR
.IP
Start up a simple tcl/tk gui based on the the remote
......@@ -4341,6 +4346,14 @@ the full gui is available under "Advanced". To be
fully functional, the gui mode should be "start"
(the default).
.IP
Note that tray or icon mode will imply the \fB-forever\fR
x11vnc option (if the x11vnc server is started along
with the gui) unless \fB-connect\fR or \fB-connect_or_exit\fR has
been specified. So x11vnc (and the tray/icon gui)
will wait for more connections after the first client
disconnects. If you want only one viewer connection
include the \fB-once\fR option.
.IP
For "icon" the gui just a small standalone window.
For "tray" it will attempt to embed itself in the
"system tray" if possible. If "=setpass" is appended then
......
......@@ -965,7 +965,7 @@ void check_redir_services(void) {
}
void ssh_remote_tunnel(char *instr, int lport) {
char *p, *q, *cmd, *ssh;
char *q, *cmd, *ssh;
char *s = strdup(instr);
int sleep = 300, disp = 0, sport = 0;
int rc, len, rport;
......@@ -1089,7 +1089,6 @@ void ssh_remote_tunnel(char *instr, int lport) {
free(cmd);
free(s);
}
void check_filexfer(void) {
......@@ -1272,6 +1271,11 @@ static void watch_loop(void) {
check_xrecord_reset(0);
check_add_keysyms();
check_new_passwds(0);
#ifdef ENABLE_GRABLOCAL
if (grab_local) {
check_local_grab();
}
#endif
if (started_as_root) {
check_switched_user();
}
......@@ -2600,14 +2604,19 @@ int main(int argc, char* argv[]) {
} else if (!strcmp(arg, "-connect") ||
!strcmp(arg, "-connect_or_exit")) {
CHECK_ARGC
if (strchr(argv[++i], '/' && !strstr(argv[i], "repeater://"))) {
if (!strcmp(arg, "-connect_or_exit")) {
connect_or_exit = 1;
}
if (strchr(argv[++i], '/') && !strstr(argv[i], "repeater://")) {
struct stat sb;
client_connect_file = strdup(argv[i]);
if (stat(client_connect_file, &sb) != 0) {
FILE* f = fopen(client_connect_file, "w");
if (f != NULL) fclose(f);
}
} else {
client_connect = strdup(argv[i]);
}
if (!strcmp(arg, "-connect_or_exit")) {
connect_or_exit = 1;
}
} else if (!strcmp(arg, "-proxy")) {
CHECK_ARGC
connect_proxy = strdup(argv[++i]);
......@@ -2634,6 +2643,11 @@ int main(int argc, char* argv[]) {
grab_kbd = 1;
grab_ptr = 1;
grab_always = 1;
#ifdef ENABLE_GRABLOCAL
} else if (!strcmp(arg, "-grablocal")) {
CHECK_ARGC
grab_local = atoi(argv[++i]);
#endif
} else if (!strcmp(arg, "-viewpasswd")) {
vpw_loc = i;
CHECK_ARGC
......@@ -3368,6 +3382,8 @@ int main(int argc, char* argv[]) {
macosx_icon_anim_time = atoi(argv[++i]);
} else if (!strcmp(arg, "-macmenu")) {
macosx_ncache_macmenu = 1;
} else if (!strcmp(arg, "-macuskbd")) {
macosx_us_kbd = 1;
} else if (!strcmp(arg, "-gui")) {
launch_gui = 1;
if (i < argc-1) {
......
......@@ -456,7 +456,7 @@ extern unsigned char *tile_has_xdamage_diff, *tile_row_has_xdamage_diff;
/* times of recent events */
extern time_t last_event, last_input, last_client;
extern time_t last_keyboard_input, last_pointer_input;
extern time_t last_local_input;
extern time_t last_local_input; /* macosx */
extern time_t last_fb_bytes_sent;
extern double last_keyboard_time;
extern double last_pointer_time;
......@@ -507,6 +507,8 @@ extern rfbBool last_rfb_down;
extern rfbBool last_rfb_key_accepted;
extern rfbKeySym last_rfb_keysym;
extern double last_rfb_keytime;
extern double last_rfb_key_injected;
extern double last_rfb_ptr_injected;
extern int fb_copy_in_progress;
extern int drag_in_progress;
extern int shut_down;
......
......@@ -15,7 +15,7 @@ int xtrap_base_event_type = 0;
int xdamage_base_event_type = 0;
/* date +'lastmod: %Y-%m-%d' */
char lastmod[] = "0.9.4 lastmod: 2008-06-06";
char lastmod[] = "0.9.4 lastmod: 2008-09-06";
/* X display info */
......@@ -170,6 +170,8 @@ rfbBool last_rfb_down = FALSE;
rfbBool last_rfb_key_accepted = FALSE;
rfbKeySym last_rfb_keysym = 0;
double last_rfb_keytime = 0.0;
double last_rfb_key_injected = 0.0;
double last_rfb_ptr_injected = 0.0;
int fb_copy_in_progress = 0;
int drag_in_progress = 0;
int shut_down = 0;
......
......@@ -24,6 +24,7 @@ int grab_buster = 0;
int grab_kbd = 0;
int grab_ptr = 0;
int grab_always = 0;
int grab_local = 0;
int sync_tod_delay = 20;
void initialize_vnc_connect_prop(void);
......@@ -694,6 +695,96 @@ void check_keycode_state(void) {
}
}
/*
* To use the experimental -grablocal option configure like this:
* env CPPFLAGS=-DENABLE_GRABLOCAL LDFLAGS=-lXss ./configure
*/
#ifdef ENABLE_GRABLOCAL
#include <X11/extensions/scrnsaver.h>
void check_local_grab(void) {
static double last_check = 0.0;
double now;
if (grab_local <= 0) {
return;
}
if (! client_count) {
return;
}
if (unixpw_in_progress) return;
if (last_rfb_key_injected <= 0.0 && last_rfb_ptr_injected <= 0.0) {
return;
}
RAWFB_RET_VOID
now = dnow();
if (now > last_check + 0.1) {
#if !NO_X11
int ret;
double idle;
XScreenSaverInfo info;
static int save_viewonly = -1, local_is_idle = -1, db = -1;
if (debug_keyboard) db = debug_keyboard;
if (debug_pointer ) db = debug_pointer;
if (db < 0) {
if (getenv("LOCAL_GRAB_DEBUG")) {
db = atoi(getenv("LOCAL_GRAB_DEBUG"));
} else {
db = 0;
}
}
ret = XScreenSaverQueryInfo(dpy, RootWindowOfScreen(
ScreenOfDisplay(dpy, 0)), &info);
if (ret) {
double tlatest_rfb = 0.0;
idle = ((double) info.idle)/1000.0;
now = dnow();
if (last_rfb_key_injected > 0.0) {
tlatest_rfb = last_rfb_key_injected;
}
if (last_rfb_ptr_injected > tlatest_rfb) {
tlatest_rfb = last_rfb_ptr_injected;
}
if (db > 1) fprintf(stderr, "idle: %.4f latest: %.4f dt: %.4f\n", idle, now - tlatest_rfb, idle - (now - tlatest_rfb));
if (now - tlatest_rfb <= idle + 0.005) {
/* 0.005 is 5ms tolerance */
} else if (idle < grab_local) {
if (local_is_idle < 0 || local_is_idle) {
save_viewonly = view_only;
view_only = 1;
if (db) {
rfbLog("check_local_grab: set viewonly\n");
}
}
local_is_idle = 0;
} else {
if (!local_is_idle && save_viewonly >= 0) {
view_only = save_viewonly;
if (db) {
rfbLog("check_local_grab: restored viewonly; %d\n", view_only);
}
}
local_is_idle = 1;
}
}
#endif
last_check = dnow();
}
}
#endif
void check_autorepeat(void) {
static time_t last_check = 0;
time_t now = time(NULL);
......
......@@ -7,6 +7,7 @@ extern int grab_buster;
extern int grab_kbd;
extern int grab_ptr;
extern int grab_always;
extern int grab_local;
extern int sync_tod_delay;
extern void initialize_vnc_connect_prop(void);
......
......@@ -267,7 +267,7 @@ void check_xinerama_clip(void) {
}
}
for (i=0; i <= k; i++) {
int j, jmon, mon = -1, mox = -1;
int j, jmon = 0, mon = -1, mox = -1;
for (j=0; j < is; j++) {
if (mon < 0 || score[j] < mon) {
mon = score[j];
......
......@@ -13,5 +13,6 @@ extern void push_sleep(int n);
extern void push_black_screen(int n);
extern void refresh_screen(int push);
extern void zero_fb(int x1, int y1, int x2, int y2);
extern void check_xinerama_clip(void);
#endif /* _X11VNC_XINERAMA_H */
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