Commit 5f9693d4 authored by runge's avatar runge

Add Darwin stuff. Sync to current 1.0.7

parent 2635ae44
...@@ -20,6 +20,7 @@ by others. See these sites and related ones for more information: ...@@ -20,6 +20,7 @@ by others. See these sites and related ones for more information:
http://stunnel.mirt.net http://stunnel.mirt.net
http://www.openssl.org http://www.openssl.org
http://www.chiark.greenend.org.uk/~sgtatham/putty/ http://www.chiark.greenend.org.uk/~sgtatham/putty/
http://sourceforge.net/projects/cotvnc/
Note: Some of the Windows binaries included contain cryptographic software Note: Some of the Windows binaries included contain cryptographic software
that you may not be allowed to download, use, or redistribute. Please that you may not be allowed to download, use, or redistribute. Please
...@@ -107,6 +108,9 @@ README is in) and like this: ...@@ -107,6 +108,9 @@ README is in) and like this:
./build.unix ./build.unix
To use custom locations for libraries see the LDFLAGS_OS and CPPFLAGS_OS
description at the top of the build.unix script.
The programs: The programs:
------------ ------------
...@@ -129,9 +133,10 @@ you can run this instead: ...@@ -129,9 +133,10 @@ you can run this instead:
this is essentially the same GUI that is run on Windows (the this is essentially the same GUI that is run on Windows (the
ssl_tightvncviewer.exe). ssl_tightvncviewer.exe).
Using the GUI is it impossible to initiate a VNC connection that is not Using the GUI is it not possible (well not easy) to initiate
encrypted with either SSL or SSH. Unencrypted VNC connections can only a VNC connection that is not encrypted with either SSL or SSH.
be started by manually running the ./bin/tightvncviewer script. Unencrypted VNC connections can only be started by manually running the
./bin/tightvncviewer script.
For convenience, you can make symlinks from a directory in your PATH to For convenience, you can make symlinks from a directory in your PATH to
any of the 3 programs above you wish to run. That is all you usually any of the 3 programs above you wish to run. That is all you usually
...@@ -144,6 +149,10 @@ assuming $HOME/bin is in your $PATH: ...@@ -144,6 +149,10 @@ assuming $HOME/bin is in your $PATH:
(note the "." at the end). The above commands is basically the way to (note the "." at the end). The above commands is basically the way to
"install" this package on Unix. "install" this package on Unix.
Also symlinks to the GUI launcher script are provided in:
MacOSX/ssl_vnc_gui.sh
Unix/ssl_vnc_gui
On Windows unpack your archive and run: On Windows unpack your archive and run:
...@@ -224,6 +233,7 @@ See also: ...@@ -224,6 +233,7 @@ See also:
http://www.tightvnc.com http://www.tightvnc.com
http://www.realvnc.com http://www.realvnc.com
http://www.chiark.greenend.org.uk/~sgtatham/putty/ http://www.chiark.greenend.org.uk/~sgtatham/putty/
http://sourceforge.net/projects/cotvnc/
Windows: Windows:
......
#!/bin/sh
cp -p vncviewer.sh vncviewer
pwd
ls -l vncviewer.sh vncviewer
(cd ../Darwin.i386; .cpover)
#!/bin/sh
# copy "vncviewer.sh" back over to "vncviewer" in case you delete or overwrite it
# via build.unix. etc
dir=`dirname "$0"`
if [ "X$DISPLAY" != "X" ]; then
"$dir/vncviewer.x11" "$@"
else
args=""
for a in "$@"
do
if echo "$a" | grep '^-' > /dev/null; then
args="$args $a"
elif echo "$a" | grep ':' > /dev/null; then
h=`echo "$a" | awk -F: '{print $1}'`
p=`echo "$a" | awk -F: '{print $2}'`
if [ "X$p" != "X" ]; then
if [ $p -lt 5900 ]; then
p=`expr $p + 5900`
fi
fi
args="$args $h:$p"
else
args="$args $a"
fi
done
"$dir/../../MacOSX/Chicken of the VNC.app/Contents/MacOS/Chicken of the VNC" $args
fi
#!/bin/sh
cp -p ../Darwin.Power.Macintosh/vncviewer.sh .
cp -p vncviewer.sh vncviewer
pwd
ls -l vncviewer.sh vncviewer
...@@ -36,6 +36,10 @@ ...@@ -36,6 +36,10 @@
# -grab # -grab
# #
# #
# 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.
#
#
# See the TightVNC viewer documentation for on its cmdline arguments. # See the TightVNC viewer documentation for on its cmdline arguments.
# #
# For convenience, here is the current (7/2006) TightVNC viewer -help output: # For convenience, here is the current (7/2006) TightVNC viewer -help output:
...@@ -73,7 +77,7 @@ ...@@ -73,7 +77,7 @@
# #
if [ "X$1" = "X-h" -o "X$1" = "X-help" -o "X$1" = "X--help" ]; then if [ "X$1" = "X-h" -o "X$1" = "X-help" -o "X$1" = "X--help" ]; then
head -70 "$0" | grep -v bin/sh head -76 "$0" | grep -v bin/sh
exit exit
fi fi
...@@ -84,26 +88,44 @@ export PATH ...@@ -84,26 +88,44 @@ export PATH
# Set this for ssl_vncviewer to pick up: # Set this for ssl_vncviewer to pick up:
# #
VNCVIEWERCMD="vncviewer" use_ours=0
export VNCVIEWERCMD if [ "X$1" = "X-cotvnc" ]; then
shift
DARWIN_COTVNC=1
export DARWIN_COTVNC
fi
if [ "X$VNCVIEWERCMD" = "X" ]; then
VNCVIEWERCMD="vncviewer"
export VNCVIEWERCMD
if [ "X$DARWIN_COTVNC" = "X" ]; then
use_ours=1
fi
fi
# work out os.arch platform string and check for binaries: # work out os.arch platform string and check for binaries:
# #
name=$UNAME name=$UNAME
if [ "X$name" = "X" ]; then if [ "X$name" = "X" ]; then
name=`uname -sm | sed -e 's/ /./'` name=`uname -sm | sed -e 's/ /./g'`
fi fi
if [ -L "$0" ]; then f="$0"
d=`dirname "\`ls -l "$0" | sed -e 's/^.* -> //'\`"` for t in 1 2 3 4 5
if echo "$d" | grep '^/' > /dev/null; then do
dir="$d" if [ -L "$f" ]; then
f0="$f"
f=`ls -l "$f" | sed -e 's/^.* -> //'`
if echo "$f" | grep '^/' > /dev/null; then
:
else else
dir="`dirname "$0"`/$d" f="`dirname "$f0"`/$f"
fi fi
else else
dir=`dirname "$0"` break
fi fi
done
dir=`dirname "$f"`
if [ ! -d "$dir/$name" ]; then if [ ! -d "$dir/$name" ]; then
echo "cannot find platform dir: $dir/$name for your OS:" echo "cannot find platform dir: $dir/$name for your OS:"
uname -sm uname -sm
...@@ -115,10 +137,22 @@ fi ...@@ -115,10 +137,22 @@ fi
# pick them up: # pick them up:
# #
PATH="$dir:$dir/$name:$dir/util:$PATH" PATH="$dir:$dir/$name:$dir/util:$PATH"
if echo "$dir" | grep '^/' > /dev/null; then
:
else
dir=`pwd`/$dir
PATH="$dir:$dir/$name:$dir/util:$PATH"
fi
STUNNEL_EXTRA_OPTS=${STUNNEL_EXTRA_OPTS:-"maxconn = 1"} STUNNEL_EXTRA_OPTS=${STUNNEL_EXTRA_OPTS:-"maxconn = 1"}
export STUNNEL_EXTRA_OPTS export STUNNEL_EXTRA_OPTS
# Force the use of tight encoding for localhost redir connection: # If ours (and not cotvnc), force the use of tight encoding for localhost
# redir connection:
# #
ssl_vncviewer "$@" -encodings 'copyrect tight zrle zlib hextile' #
if [ $use_ours = 1 ]; then
ssl_vncviewer "$@" -encodings 'copyrect tight zrle zlib hextile'
else
ssl_vncviewer "$@"
fi
...@@ -21,6 +21,7 @@ fi ...@@ -21,6 +21,7 @@ fi
PATH=$PATH:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/openwin/bin PATH=$PATH:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/openwin/bin
export PATH export PATH
SSL_VNC_GUI_CMD="$0 $*" SSL_VNC_GUI_CMD="$0 $*"
export SSL_VNC_GUI_CMD export SSL_VNC_GUI_CMD
SSL_VNC_LAUNCH=$SSL_VNC_GUI_CMD SSL_VNC_LAUNCH=$SSL_VNC_GUI_CMD
...@@ -30,19 +31,26 @@ export SSL_VNC_LAUNCH ...@@ -30,19 +31,26 @@ export SSL_VNC_LAUNCH
# #
name=$UNAME name=$UNAME
if [ "X$name" = "X" ]; then if [ "X$name" = "X" ]; then
name=`uname -sm | sed -e 's/ /./'` name=`uname -sm | sed -e 's/ /./g'`
fi fi
if [ -L "$0" ]; then f="$0"
d=`dirname "\`ls -l "$0" | sed -e 's/^.* -> //'\`"` for t in 1 2 3 4 5
if echo "$d" | grep '^/' > /dev/null; then do
dir="$d" if [ -L "$f" ]; then
f0="$f"
f=`ls -l "$f" | sed -e 's/^.* -> //'`
if echo "$f" | grep '^/' > /dev/null; then
:
else else
dir="`dirname "$0"`/$d" f="`dirname "$f0"`/$f"
fi fi
else else
dir=`dirname "$0"` break
fi fi
done
dir=`dirname "$f"`
if [ ! -d "$dir/$name" ]; then if [ ! -d "$dir/$name" ]; then
echo "cannot find platform dir: $dir/$name for your OS:" echo "cannot find platform dir: $dir/$name for your OS:"
uname -sm uname -sm
...@@ -54,6 +62,12 @@ fi ...@@ -54,6 +62,12 @@ fi
# pick them up: # pick them up:
# #
PATH="$dir:$dir/$name:$dir/util:$PATH" PATH="$dir:$dir/$name:$dir/util:$PATH"
if echo "$dir" | grep '^/' > /dev/null; then
:
else
dir=`pwd`/$dir
PATH="$dir:$dir/$name:$dir/util:$PATH"
fi
SSL_VNC_BASEDIR="$dir" SSL_VNC_BASEDIR="$dir"
export SSL_VNC_BASEDIR export SSL_VNC_BASEDIR
......
...@@ -32,7 +32,10 @@ ...@@ -32,7 +32,10 @@
# #
# "hostname:N" is the host and VNC display to connect to, e.g. snoopy:0 # "hostname:N" is the host and VNC display to connect to, e.g. snoopy:0
# #
# If the first argument is "-ssl" then ssl_tightvncviewer is called # 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.
#
# If the next argument is "-ssl" then ssl_tightvncviewer is called
# instead. See that script for details. # instead. See that script for details.
# #
# See the TightVNC viewer documentation for on its cmdline arguments. # See the TightVNC viewer documentation for on its cmdline arguments.
...@@ -72,7 +75,7 @@ ...@@ -72,7 +75,7 @@
# #
if [ "X$1" = "X-h" -o "X$1" = "X-help" -o "X$1" = "X--help" ]; then if [ "X$1" = "X-h" -o "X$1" = "X-help" -o "X$1" = "X--help" ]; then
head -69 "$0" | grep -v bin/sh head -76 "$0" | grep -v bin/sh
exit exit
fi fi
...@@ -83,26 +86,44 @@ export PATH ...@@ -83,26 +86,44 @@ export PATH
# Set this for ssl_vncviewer to pick up: # Set this for ssl_vncviewer to pick up:
# #
VNCVIEWERCMD="vncviewer" use_ours=0
export VNCVIEWERCMD if [ "X$1" = "X-cotvnc" ]; then
shift
DARWIN_COTVNC=1
export DARWIN_COTVNC
fi
if [ "X$VNCVIEWERCMD" = "X" ]; then
VNCVIEWERCMD="vncviewer"
export VNCVIEWERCMD
if [ "X$DARWIN_COTVNC" = "X" ]; then
use_ours=1
fi
fi
# work out os.arch platform string and check for binaries: # work out os.arch platform string and check for binaries:
# #
name=$UNAME name=$UNAME
if [ "X$name" = "X" ]; then if [ "X$name" = "X" ]; then
name=`uname -sm | sed -e 's/ /./'` name=`uname -sm | sed -e 's/ /./g'`
fi fi
if [ -L "$0" ]; then f="$0"
d=`dirname "\`ls -l "$0" | sed -e 's/^.* -> //'\`"` for t in 1 2 3 4 5
if echo "$d" | grep '^/' > /dev/null; then do
dir="$d" if [ -L "$f" ]; then
f0="$f"
f=`ls -l "$f" | sed -e 's/^.* -> //'`
if echo "$f" | grep '^/' > /dev/null; then
:
else else
dir="`dirname "$0"`/$d" f="`dirname "$f0"`/$f"
fi fi
else else
dir=`dirname "$0"` break
fi fi
done
dir=`dirname "$f"`
if [ ! -d "$dir/$name" ]; then if [ ! -d "$dir/$name" ]; then
echo "cannot find platform dir: $dir/$name for your OS:" echo "cannot find platform dir: $dir/$name for your OS:"
uname -sm uname -sm
...@@ -114,6 +135,15 @@ fi ...@@ -114,6 +135,15 @@ fi
# pick them up: # pick them up:
# #
PATH="$dir:$dir/$name:$dir/util:$PATH" PATH="$dir:$dir/$name:$dir/util:$PATH"
if echo "$dir" | grep '^/' > /dev/null; then
:
else
dir=`pwd`/$dir
PATH="$dir:$dir/$name:$dir/util:$PATH"
fi
STUNNEL_EXTRA_OPTS=${STUNNEL_EXTRA_OPTS:-"maxconn = 1"}
export STUNNEL_EXTRA_OPTS
if [ "X$1" = "X-ssl" ]; then if [ "X$1" = "X-ssl" ]; then
shift shift
...@@ -121,9 +151,13 @@ if [ "X$1" = "X-ssl" ]; then ...@@ -121,9 +151,13 @@ if [ "X$1" = "X-ssl" ]; then
exit $? exit $?
fi fi
STUNNEL_EXTRA_OPTS=${STUNNEL_EXTRA_OPTS:-"maxconn = 1"}
export STUNNEL_EXTRA_OPTS
# Force the use of tight encoding for localhost redir connection: # Force the use of tight encoding for localhost redir connection:
# #
vncviewer -encodings 'copyrect tight zrle zlib hextile' "$@" # If ours (and not doing cotvnc), force the use of tight encoding for
# the connection:
#
if [ $use_ours = 1 ]; then
"$VNCVIEWERCMD" -encodings 'copyrect tight zrle zlib hextile' "$@"
else
"$VNCVIEWERCMD" "$@"
fi
...@@ -74,7 +74,7 @@ proc help {} { ...@@ -74,7 +74,7 @@ proc help {} {
wm title .h "SSL TightVNC Viewer Help" wm title .h "SSL TightVNC Viewer Help"
set msg { set msg {
Enter the VNC host and display in the 'VNC Server' entry box. Enter the VNC host and display in the 'VNC Host:Display' entry box.
It is of the form "host:number", where "host" is the hostname of the It is of the form "host:number", where "host" is the hostname of the
machine running the VNC Server and "number" is the VNC display number; machine running the VNC Server and "number" is the VNC display number;
...@@ -153,6 +153,8 @@ proc help {} { ...@@ -153,6 +153,8 @@ proc help {} {
To set other Options, e.g. to use SSH instead of STUNNEL SSL, To set other Options, e.g. to use SSH instead of STUNNEL SSL,
click on the "Options ..." button and read the Help there. click on the "Options ..." button and read the Help there.
To load in a saved Options profile, click on the "Load" button.
See these links for more information: See these links for more information:
http://www.karlrunge.com/x11vnc/#faq-ssl-tunnel-ext http://www.karlrunge.com/x11vnc/#faq-ssl-tunnel-ext
...@@ -160,7 +162,7 @@ proc help {} { ...@@ -160,7 +162,7 @@ proc help {} {
http://www.tightvnc.com http://www.tightvnc.com
Tips: Tips and Tricks:
1) On Unix to get a 2nd GUI (e.g. for a 2nd connection) press Ctrl-N 1) On Unix to get a 2nd GUI (e.g. for a 2nd connection) press Ctrl-N
on the GUI. If only the xterm window is visible you can press on the GUI. If only the xterm window is visible you can press
...@@ -178,6 +180,13 @@ proc help {} { ...@@ -178,6 +180,13 @@ proc help {} {
is present in the entry box. If it matches cmd=KNOCKF, i.e. an is present in the entry box. If it matches cmd=KNOCKF, i.e. an
extra "F", then the port-knocking "FINISH" sequence is sent, if any. extra "F", then the port-knocking "FINISH" sequence is sent, if any.
A shortcut for this Shift-Ctrl-P as long as hostname is present. A shortcut for this Shift-Ctrl-P as long as hostname is present.
4) Pressing the "Load" button or pressing Ctrl-L or Clicking the Right
mouse button on the main GUI will invoke the Load Profile dialog.
5) If you want to do a Direct VNC connection, with *NO* SSL or SSH
encryption, use the "vnc://" prefix, e.g. vnc://far-away.east:0
} }
.h.f.t insert end $msg .h.f.t insert end $msg
...@@ -280,15 +289,15 @@ set msg { ...@@ -280,15 +289,15 @@ set msg {
for passphrase authentication, etc. On Windows the cmdline for passphrase authentication, etc. On Windows the cmdline
plink.exe program will be launched in a Windows Console window. plink.exe program will be launched in a Windows Console window.
You can set the "VNC Server" to "user@host:disp" to indicate ssh You can set the "VNC Host:Display" to "user@host:disp" to indicate
should log in as "user" on "host". NOTE: On Windows you MUST ssh should log in as "user" on "host". NOTE: On Windows you MUST
always supply the "user@" part (due to a plink deficiency). E.g.: always supply the "user@" part (due to a plink deficiency). E.g.:
fred@far-away.east:0 fred@far-away.east:0
If an intermediate gateway machine must be used (e.g. to enter If an intermediate gateway machine must be used (e.g. to enter
a firewall; the VNC Server is not running on it), put something a firewall; the VNC Server is not running on it), put something
like this in the "VNC Server" entry box: like this in the "VNC Host:Display" entry box:
workstation:0 user@gateway-host:port workstation:0 user@gateway-host:port
...@@ -368,6 +377,9 @@ set msg { ...@@ -368,6 +377,9 @@ set msg {
with Load Profile. Use the Browse... button to select with Load Profile. Use the Browse... button to select
the filename via the GUI. the filename via the GUI.
Pressing Ctrl-L or Clicking the Right mouse button on
the main GUI will invoke the Load Profile dialog.
Note: On Windows since the TightVNC Viewer will save Note: On Windows since the TightVNC Viewer will save
its own settings in the registry, some unexpected its own settings in the registry, some unexpected
behavior is possible because the viewer is nearly behavior is possible because the viewer is nearly
...@@ -1470,6 +1482,127 @@ proc set_smb_mounts {} { ...@@ -1470,6 +1482,127 @@ proc set_smb_mounts {} {
} }
} }
proc darwin_terminal_cmd {{title ""} {cmd ""} {bg 0}} {
global darwin_terminal
set tries ""
lappend tries "/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal"
if {! [info exists darwin_terminal]} {
foreach try $tries {
if [file exists $try] {
if [file executable $try] {
set darwin_terminal $try
break
}
}
}
if {! [info exists darwin_terminal]} {
set fh ""
catch {set fh [open "| find /Applications -type f -name Terminal" "r"]}
if {$fh != ""} {
while {[gets $fh line] > -1} {
if {! [file exists $line]} {
continue
}
if {[file isdirectory $line]} {
continue
}
if {! [regexp {/Terminal$} $line]} {
continue
}
if {! [file executable $line]} {
continue
}
set darwin_terminal $line
break
}
close $fh
}
}
}
if {! [info exists darwin_terminal]} {
tk_messageBox -type ok -icon error -message "Cannot find Darwin Terminal program." -title "Cannot find Terminal program"
return
}
global darwin_terminal_cnt
set tmp /tmp/darwin_terminal_cmd.[pid]
if {! [info exists darwin_terminal_cnt]} {
set darwin_terminal_cnt 0
}
incr darwin_terminal_cnt
append tmp ".$darwin_terminal_cnt"
set fh ""
catch {set fh [open $tmp w 0755]}
if {$fh == ""} {
tk_messageBox -type ok -icon error -message "Cannot open temporary file: $tmp" -title "Cannot open file"
return
}
global env
puts $fh "#!/bin/sh"
puts $fh "PATH=$env(PATH)"
puts $fh "export PATH"
puts $fh "tmp=$tmp"
puts $fh "sleep 1"
puts $fh {if [ "X$DDDBG" != "X" ]; then ps www; fi}
puts $fh {termpid=`ps www | grep -w Terminal | grep $tmp | grep -v grep | awk '{print $1}' | sort -n | tail -1`}
puts $fh {echo try-1: termpid=$termpid mypid=$$}
puts $fh {if [ "X$termpid" = "X" ]; then}
puts $fh { termpid=`ps www | grep -w Terminal | grep -v grep | awk '{print $1}' | sort -n | tail -1`}
puts $fh { echo try-2: termpid=$termpid mypid=$$}
puts $fh {fi}
puts $fh {if [ "X$termpid" = "X" ]; then}
puts $fh { termpid=$$}
puts $fh { echo termpid-find-fail: termpid=$termpid mypid=$$}
puts $fh {fi}
puts $fh {trap "rm -f $tmp; kill -TERM $termpid; kill -TERM $mypid; kill -KILL $mypid; exit 0" 0 2 15}
puts $fh "$cmd"
puts $fh "sleep 1"
puts $fh {rm -f $tmp}
puts $fh {kill -TERM $termpid}
puts $fh {kill -TERM $mypid}
puts $fh {kill -KILL $mypid}
puts $fh "exit 0"
close $fh
if {$bg} {
catch {exec $darwin_terminal $tmp &}
} else {
catch {exec $darwin_terminal $tmp}
}
}
proc unix_terminal_cmd {{geometry "+100+100"} {title "xterm-command"} {cmd "echo test"} {bg 0} {xrm1 ""} {xrm2 ""} {xrm3 ""}} {
global uname
if {$uname == "Darwin"} {
global env
set doX 0;
if [info exists env(DISPLAY)] {
if {[in_path "xterm"] != ""} {
set doX 1
}
}
if {! $doX} {
darwin_terminal_cmd $title $cmd $bg
return
}
}
if {$bg} {
if {$xrm1 == ""} {
exec xterm -geometry "$geometry" -title "$title" -e sh -c "$cmd" &
} else {
exec xterm -geometry "$geometry" -title "$title" -xrm "$xrm1" -xrm "$xrm2" -xrm "$xrm3" -e sh -c "$cmd" &
}
} else {
if {$xrm1 == ""} {
exec xterm -geometry "$geometry" -title "$title" -e sh -c "$cmd"
} else {
exec xterm -geometry "$geometry" -title "$title" -xrm "$xrm1" -xrm "$xrm2" -xrm "$xrm3" -e sh -c "$cmd"
}
}
}
proc xterm_center_geometry {} { proc xterm_center_geometry {} {
set sh [winfo screenheight .] set sh [winfo screenheight .]
set sw [winfo screenwidth .] set sw [winfo screenwidth .]
...@@ -1568,9 +1701,11 @@ proc do_unix_pre {tag proxy hp pk_hp} { ...@@ -1568,9 +1701,11 @@ proc do_unix_pre {tag proxy hp pk_hp} {
} }
} }
exec xterm -geometry "80x25+100+100" \ # exec xterm -geometry "80x25+100+100" \
-title "$title" \ # -title "$title" \
-e sh -c "set -xv; $c" & # -e sh -c "set -xv; $c" &
unix_terminal_cmd "80x25+100+100" "$title" "set -xv; $c" 1
set env(SSL_VNCVIEWER_SSH_CMD) "" set env(SSL_VNCVIEWER_SSH_CMD) ""
set env(SSL_VNCVIEWER_SSH_ONLY) "" set env(SSL_VNCVIEWER_SSH_ONLY) ""
...@@ -1612,6 +1747,37 @@ proc port_knock_only {hp {mode KNOCK}} { ...@@ -1612,6 +1747,37 @@ proc port_knock_only {hp {mode KNOCK}} {
} }
} }
proc direct_connect_msg {} {
set msg ""
globalize
if {$use_sshssl} {
append msg " - SSH + SSL tunnelling\n"
} elseif {$use_ssh} {
append msg " - SSH tunnelling\n"
} else {
append msg " - SSL tunnelling\n"
}
if {$use_smbmnt} {
append msg " - SMB Mount Port Redirection\n"
}
if {$use_sound} {
append msg " - ESD Sound Port Redirection\n"
}
if {$use_cups} {
append msg " - CUPS Port Redirection\n"
}
if {$additional_port_redirs} {
append msg " - Additional Port Redirections\n"
}
if {$mycert != "" || $svcert != "" || $crtdir != ""} {
append msg " - SSL certificate authentication\n"
}
if {$msg != ""} {
set msg "Direct connect via vnc://hostname\nThe following options will be disabled:\n\n$msg"
tk_messageBox -type ok -icon info -message $msg
}
}
proc launch_unix {hp} { proc launch_unix {hp} {
global smb_redir_0 smb_mounts env global smb_redir_0 smb_mounts env
...@@ -1632,8 +1798,16 @@ proc launch_unix {hp} { ...@@ -1632,8 +1798,16 @@ proc launch_unix {hp} {
set did_port_knock 0 set did_port_knock 0
set pk_hp "" set pk_hp ""
set skip_ssh 0
if [regexp {vnc://} $hp] {
set skip_ssh 1
direct_connect_msg
}
if {$use_ssh || $use_sshssl} { if {$use_ssh || $use_sshssl} {
if {$use_ssh} { if {$skip_ssh} {
set cmd "ssl_vncviewer"
} elseif {$use_ssh} {
set cmd "ssl_vncviewer -ssh" set cmd "ssl_vncviewer -ssh"
} else { } else {
set cmd "ssl_vncviewer -sshssl" set cmd "ssl_vncviewer -sshssl"
...@@ -1666,7 +1840,7 @@ proc launch_unix {hp} { ...@@ -1666,7 +1840,7 @@ proc launch_unix {hp} {
set do_pre 1 set do_pre 1
} }
global skip_pre global skip_pre
if {$skip_pre} { if {$skip_pre || $skip_ssh} {
set do_pre 0 set do_pre 0
set skip_pre 0 set skip_pre 0
} }
...@@ -1679,6 +1853,9 @@ proc launch_unix {hp} { ...@@ -1679,6 +1853,9 @@ proc launch_unix {hp} {
set setup_cmds [ugly_setup_scripts post $tag] set setup_cmds [ugly_setup_scripts post $tag]
if {$skip_ssh} {
set setup_cmds ""
}
if {$sshcmd == "SHELL"} { if {$sshcmd == "SHELL"} {
set env(SSL_VNCVIEWER_SSH_CMD) {$SHELL} set env(SSL_VNCVIEWER_SSH_CMD) {$SHELL}
...@@ -1703,6 +1880,9 @@ proc launch_unix {hp} { ...@@ -1703,6 +1880,9 @@ proc launch_unix {hp} {
} }
set sshargs [string trim $sshargs] set sshargs [string trim $sshargs]
if {$skip_ssh} {
set sshargs ""
}
if {$sshargs != ""} { if {$sshargs != ""} {
set cmd "$cmd -sshargs '$sshargs'" set cmd "$cmd -sshargs '$sshargs'"
set env(SSL_VNCVIEWER_USE_C) 1 set env(SSL_VNCVIEWER_USE_C) 1
...@@ -1728,14 +1908,16 @@ proc launch_unix {hp} { ...@@ -1728,14 +1908,16 @@ proc launch_unix {hp} {
if {[regexp {FINISH} $port_knocking_list]} { if {[regexp {FINISH} $port_knocking_list]} {
wm withdraw . wm withdraw .
update update
exec xterm -geometry $geometry \ # exec xterm -geometry $geometry \
-title "SHELL to $hp" -e sh -c "$cmd" # -title "SHELL to $hp" -e sh -c "$cmd"
unix_terminal_cmd $geometry "SHELL to $hp" "$cmd"
wm deiconify . wm deiconify .
update update
do_port_knock $pk_hp finish do_port_knock $pk_hp finish
} else { } else {
exec xterm -geometry $geometry \ # exec xterm -geometry $geometry \
-title "SHELL to $hp" -e sh -c "$cmd" & # -title "SHELL to $hp" -e sh -c "$cmd" &
unix_terminal_cmd $geometry "SHELL to $hp" "$cmd" 1
} }
set env(SSL_VNCVIEWER_SSH_CMD) "" set env(SSL_VNCVIEWER_SSH_CMD) ""
set env(SSL_VNCVIEWER_SSH_ONLY) "" set env(SSL_VNCVIEWER_SSH_ONLY) ""
...@@ -1767,14 +1949,27 @@ proc launch_unix {hp} { ...@@ -1767,14 +1949,27 @@ proc launch_unix {hp} {
set cmd "$cmd -grab" set cmd "$cmd -grab"
} }
global darwin_cotvnc
if {$darwin_cotvnc} {
set env(DARWIN_COTVNC) 1
}
set cmd "$cmd $hp" set cmd "$cmd $hp"
if {$use_viewonly} { if {$use_viewonly} {
if {$darwin_cotvnc} {
set cmd "$cmd --ViewOnly"
} else {
set cmd "$cmd -viewonly" set cmd "$cmd -viewonly"
} }
}
if {$use_fullscreen} { if {$use_fullscreen} {
if {$darwin_cotvnc} {
set cmd "$cmd --FullScreen"
} else {
set cmd "$cmd -fullscreen" set cmd "$cmd -fullscreen"
} }
}
if {$use_bgr233} { if {$use_bgr233} {
if {$vncviewer_realvnc4} { if {$vncviewer_realvnc4} {
set cmd "$cmd -lowcolourlevel 1" set cmd "$cmd -lowcolourlevel 1"
...@@ -1783,12 +1978,16 @@ proc launch_unix {hp} { ...@@ -1783,12 +1978,16 @@ proc launch_unix {hp} {
} }
} }
if {$use_nojpeg} { if {$use_nojpeg} {
if {! $vncviewer_realvnc4} { if {$darwin_cotvnc} {
;
} elseif {! $vncviewer_realvnc4} {
set cmd "$cmd -nojpeg" set cmd "$cmd -nojpeg"
} }
} }
if {! $use_raise_on_beep} { if {! $use_raise_on_beep} {
if {! $vncviewer_realvnc4} { if {$darwin_cotvnc} {
;
} elseif {! $vncviewer_realvnc4} {
set cmd "$cmd -noraiseonbeep" set cmd "$cmd -noraiseonbeep"
} }
} }
...@@ -1800,13 +1999,17 @@ proc launch_unix {hp} { ...@@ -1800,13 +1999,17 @@ proc launch_unix {hp} {
} }
} }
if {$use_quality != "" && $use_quality != "default"} { if {$use_quality != "" && $use_quality != "default"} {
if {! $vncviewer_realvnc4} { if {$darwin_cotvnc} {
;
} elseif {! $vncviewer_realvnc4} {
set cmd "$cmd -quality '$use_quality'" set cmd "$cmd -quality '$use_quality'"
} }
} }
if {$use_ssh || $use_sshssl} { if {$use_ssh || $use_sshssl} {
# realvnc4 -preferredencoding zrle # realvnc4 -preferredencoding zrle
if {$vncviewer_realvnc4} { if {$darwin_cotvnc} {
;
} elseif {$vncviewer_realvnc4} {
set cmd "$cmd -preferredencoding zrle" set cmd "$cmd -preferredencoding zrle"
} else { } else {
set cmd "$cmd -encodings 'copyrect tight zrle zlib hextile'" set cmd "$cmd -encodings 'copyrect tight zrle zlib hextile'"
...@@ -1853,9 +2056,16 @@ proc launch_unix {hp} { ...@@ -1853,9 +2056,16 @@ proc launch_unix {hp} {
set xrm2 "XTerm*VT100*translations:#override Shift<Btn3Down>:print()\\nCtrl<Key>N:print()" set xrm2 "XTerm*VT100*translations:#override Shift<Btn3Down>:print()\\nCtrl<Key>N:print()"
set xrm3 "*mainMenu*print*Label: New SSL_VNC_GUI" set xrm3 "*mainMenu*print*Label: New SSL_VNC_GUI"
} }
exec xterm -geometry $geometry -xrm "$xrm1" -xrm "$xrm2" -xrm "$xrm3" \ # exec xterm -geometry $geometry -xrm "$xrm1" -xrm "$xrm2" -xrm "$xrm3" \
-title "SSL VNC Viewer $hp" \ # -title "SSL VNC Viewer $hp" \
-e sh -c "set -xv; $cmd; set +xv; echo; echo Done. You Can X-out or Ctrl-C this Terminal if you like.; echo; echo sleep 15; echo; sleep 15" # -e sh -c "set -xv; $cmd; set +xv; echo; echo Done. You Can X-out or Ctrl-C this Terminal if you like.; echo; echo sleep 15; echo; sleep 15"
set m "Done. You Can X-out or Ctrl-C this Terminal if you like."
global uname
if {$uname == "Darwin"} {
regsub {X-out or } $m "" m
}
unix_terminal_cmd $geometry "SSL VNC Viewer $hp" \
"set -xv; $cmd; set +xv; echo; echo $m; echo; echo sleep 15; echo; sleep 15" 0 $xrm1 $xrm2 $xrm3
set env(SSL_VNCVIEWER_SSH_CMD) "" set env(SSL_VNCVIEWER_SSH_CMD) ""
set env(SSL_VNCVIEWER_USE_C) "" set env(SSL_VNCVIEWER_USE_C) ""
...@@ -1993,6 +2203,7 @@ proc launch {{hp ""}} { ...@@ -1993,6 +2203,7 @@ proc launch {{hp ""}} {
if {[regexp {^[ ]*$} $hp]} { if {[regexp {^[ ]*$} $hp]} {
mesg "No host:disp supplied." mesg "No host:disp supplied."
bell bell
catch {raise .}
return return
} }
if {! [regexp ":" $hp]} { if {! [regexp ":" $hp]} {
...@@ -2616,7 +2827,11 @@ emailAddress_max = 64 ...@@ -2616,7 +2827,11 @@ emailAddress_max = 64
if {$ccert(DAYS) != ""} { if {$ccert(DAYS) != ""} {
set cmd "$cmd -days $ccert(DAYS)" set cmd "$cmd -days $ccert(DAYS)"
} }
if {$is_windows} {
set cmd "$cmd -keyout {$pem} -out {$crt}" set cmd "$cmd -keyout {$pem} -out {$crt}"
} else {
set cmd "$cmd -keyout \"$pem\" -out \"$crt\""
}
if {$is_windows} { if {$is_windows} {
set emess "" set emess ""
...@@ -2654,7 +2869,8 @@ emailAddress_max = 64 ...@@ -2654,7 +2869,8 @@ emailAddress_max = 64
} else { } else {
set geometry [xterm_center_geometry] set geometry [xterm_center_geometry]
update update
eval exec xterm -geometry $geometry -title Running_OpenSSL -e $cmd # exec xterm -geometry $geometry -title "Running OpenSSL" -e sh -c "$cmd"
unix_terminal_cmd $geometry "Running OpenSSL" "$cmd"
catch {file attributes $pem -permissions go-rw} catch {file attributes $pem -permissions go-rw}
catch {file attributes $crt -permissions go-w} catch {file attributes $crt -permissions go-w}
} }
...@@ -2788,7 +3004,12 @@ proc create_cert {} { ...@@ -2788,7 +3004,12 @@ proc create_cert {} {
toplevel .ccrt toplevel .ccrt
wm title .ccrt "Create SSL Certificate" wm title .ccrt "Create SSL Certificate"
global uname
if {$uname == "Darwin"} {
scroll_text .ccrt.f 80 20
} else {
scroll_text .ccrt.f 80 30 scroll_text .ccrt.f 80 30
}
set msg { set msg {
This dialog helps you to create a simple self-signed SSL certificate. This dialog helps you to create a simple self-signed SSL certificate.
...@@ -3079,7 +3300,12 @@ proc import_cert {} { ...@@ -3079,7 +3300,12 @@ proc import_cert {} {
global scroll_text_focus global scroll_text_focus
set scroll_text_focus 0 set scroll_text_focus 0
global uname
if {$uname == "Darwin"} {
scroll_text .icrt.f 90 16
} else {
scroll_text .icrt.f 90 20 scroll_text .icrt.f 90 20
}
set scroll_text_focus 1 set scroll_text_focus 1
set msg { set msg {
...@@ -3154,7 +3380,11 @@ TCQ+tbQ/DOiTXGKx1nlcKoPdkG+QVQVJthlQcpam ...@@ -3154,7 +3380,11 @@ TCQ+tbQ/DOiTXGKx1nlcKoPdkG+QVQVJthlQcpam
$w.e configure -state disabled $w.e configure -state disabled
label .icrt.plab -anchor w -text "Paste Certificate here:" label .icrt.plab -anchor w -text "Paste Certificate here:"
if {$uname == "Darwin"} {
scroll_text .icrt.paste 90 11
} else {
scroll_text .icrt.paste 90 22 scroll_text .icrt.paste 90 22
}
button .icrt.cancel -text "Cancel" -command {destroy .icrt; catch {raise .c}} button .icrt.cancel -text "Cancel" -command {destroy .icrt; catch {raise .c}}
bind .icrt <Escape> {destroy .icrt; catch {raise .c}} bind .icrt <Escape> {destroy .icrt; catch {raise .c}}
...@@ -3425,7 +3655,7 @@ proc load_profile {} { ...@@ -3425,7 +3655,7 @@ proc load_profile {} {
} }
proc save_profile {} { proc save_profile {} {
global is_windows global is_windows uname
global vncdisplay global vncdisplay
global profdone global profdone
global include_vars defs global include_vars defs
...@@ -3437,8 +3667,9 @@ proc save_profile {} { ...@@ -3437,8 +3667,9 @@ proc save_profile {} {
set disp [string trim $vncdisplay] set disp [string trim $vncdisplay]
if {$disp != ""} { if {$disp != ""} {
regsub {[ ].*$} $disp "" disp regsub {[ ].*$} $disp "" disp
regsub -all {/} $disp "" disp
} }
if {$is_windows} { if {$is_windows || $uname == "Darwin"} {
regsub -all {:} $disp "_" disp regsub -all {:} $disp "_" disp
} }
...@@ -3872,8 +4103,8 @@ set cmd(3) { ...@@ -3872,8 +4103,8 @@ set cmd(3) {
mkdir -p $dest mkdir -p $dest
fi fi
echo "echo SMBMOUNT:" >> $smb_script echo "echo SMBMOUNT:" >> $smb_script
echo "echo smbmount $smfs $dest -o uid=$USER,ip=127.0.0.1,port=$port" >> $smb_script echo "echo smbmount $smfs $dest -o uid=$USER,ip=127.0.0.1,ttl=20000,port=$port" >> $smb_script
echo "smbmount \"$smfs\" \"$dest\" -o uid=$USER,ip=127.0.0.1,port=$port" >> $smb_script echo "smbmount \"$smfs\" \"$dest\" -o uid=$USER,ip=127.0.0.1,ttl=20000,port=$port" >> $smb_script
echo "echo; df \"$dest\"; echo" >> $smb_script echo "echo; df \"$dest\"; echo" >> $smb_script
dests="$dests $dest" dests="$dests $dest"
done done
...@@ -4169,7 +4400,13 @@ proc cups_dialog {} { ...@@ -4169,7 +4400,13 @@ proc cups_dialog {} {
global cups_local_server cups_remote_port cups_manage_rcfile global cups_local_server cups_remote_port cups_manage_rcfile
global cups_local_smb_server cups_remote_smb_port global cups_local_smb_server cups_remote_smb_port
global uname
if {$uname == "Darwin"} {
scroll_text .cups.f 80 25
} else {
scroll_text .cups.f scroll_text .cups.f
}
set msg { set msg {
CUPS Printing requires SSH be used to set up the Print service port CUPS Printing requires SSH be used to set up the Print service port
...@@ -4322,7 +4559,12 @@ proc sound_dialog {} { ...@@ -4322,7 +4559,12 @@ proc sound_dialog {} {
toplevel .snd toplevel .snd
wm title .snd "ESD/ARTSD Sound Tunnelling" wm title .snd "ESD/ARTSD Sound Tunnelling"
global uname
if {$uname == "Darwin"} {
scroll_text .snd.f 80 20
} else {
scroll_text .snd.f 80 30 scroll_text .snd.f 80 30
}
set msg { set msg {
Sound tunnelling to a sound daemon requires SSH be used to set up the Sound tunnelling to a sound daemon requires SSH be used to set up the
...@@ -5077,7 +5319,12 @@ proc smb_dialog {} { ...@@ -5077,7 +5319,12 @@ proc smb_dialog {} {
global help_font global help_font
global uname
if {$uname == "Darwin"} {
scroll_text .smb.f 80 25
} else {
scroll_text .smb.f scroll_text .smb.f
}
set msg { set msg {
Windows/Samba Filesystem mounting requires SSH be used to set up the SMB Windows/Samba Filesystem mounting requires SSH be used to set up the SMB
...@@ -5162,7 +5409,7 @@ proc smb_dialog {} { ...@@ -5162,7 +5409,7 @@ proc smb_dialog {} {
set msg2 { set msg2 {
To speed up moving to the next step, iconify the first SSH console To speed up moving to the next step, iconify the first SSH console
when you are done entering passwords, etc. and then click on the when you are done entering passwords, etc. and then click on the
main panel 'VNC Server' label. main panel 'VNC Host:Display' label.
} }
global is_windows global is_windows
...@@ -5335,8 +5582,12 @@ proc port_redir_dialog {} { ...@@ -5335,8 +5582,12 @@ proc port_redir_dialog {} {
toplevel .redirs toplevel .redirs
wm title .redirs "Additional Port Redirections" wm title .redirs "Additional Port Redirections"
global help_font global help_font uname
if {$uname == "Darwin"} {
eval text .redirs.t -width 80 -height 35 $help_font eval text .redirs.t -width 80 -height 35 $help_font
} else {
eval text .redirs.t -width 80 -height 35 $help_font
}
apply_bg .redirs.t apply_bg .redirs.t
set msg { set msg {
...@@ -5517,6 +5768,7 @@ proc do_port_knock {hp mode} { ...@@ -5517,6 +5768,7 @@ proc do_port_knock {hp mode} {
set default_delay 150 set default_delay 150
set host [string trim $hp] set host [string trim $hp]
regsub {^vnc://} $host "" host
regsub {^.*@} $host "" host regsub {^.*@} $host "" host
regsub {:.*$} $host "" host regsub {:.*$} $host "" host
set host0 [string trim $host] set host0 [string trim $host]
...@@ -5773,7 +6025,12 @@ proc port_knocking_dialog {} { ...@@ -5773,7 +6025,12 @@ proc port_knocking_dialog {} {
global help_font global help_font
global uname
if {$uname == "Darwin"} {
scroll_text .pk.f 85 25
} else {
scroll_text .pk.f 85 scroll_text .pk.f 85
}
set msg { set msg {
Port Knocking is where a network connection to a service is not provided Port Knocking is where a network connection to a service is not provided
...@@ -5804,7 +6061,7 @@ proc port_knocking_dialog {} { ...@@ -5804,7 +6061,7 @@ proc port_knocking_dialog {} {
Tip: if you just want to use the Port Knocking for an SSH shell and not Tip: if you just want to use the Port Knocking for an SSH shell and not
for a VNC tunnel, then specify something like "user@hostname cmd=SHELL" for a VNC tunnel, then specify something like "user@hostname cmd=SHELL"
(or "user@hostname cmd=PUTTY" on Windows) in the VNC Server entry box (or "user@hostname cmd=PUTTY" on Windows) in the VNC Host:Display entry box
on the main panel. This will do everything short of starting the viewer. on the main panel. This will do everything short of starting the viewer.
A shortcut for this is Ctrl-S as long as user@hostname is present. A shortcut for this is Ctrl-S as long as user@hostname is present.
...@@ -5944,7 +6201,7 @@ proc port_knocking_dialog {} { ...@@ -5944,7 +6201,7 @@ proc port_knocking_dialog {} {
Port knock only: Port knock only:
If, in the 'VNC Server' entry box, you use "user@hostname cmd=KNOCK" If, in the 'VNC Host:Display' entry, you use "user@hostname cmd=KNOCK"
then only the port-knocking is performed. A shortcut for this is then only the port-knocking is performed. A shortcut for this is
Ctrl-P as long as hostname is present in the entry box. If it Ctrl-P as long as hostname is present in the entry box. If it
matches cmd=KNOCKF, i.e. an extra "F", then the port-knocking matches cmd=KNOCKF, i.e. an extra "F", then the port-knocking
...@@ -6025,6 +6282,9 @@ proc set_advanced_options {} { ...@@ -6025,6 +6282,9 @@ proc set_advanced_options {} {
pack .oa.b$j -side top -fill x pack .oa.b$j -side top -fill x
} }
button .oa.connect -text "Connect" -command launch
pack .oa.connect -side top -fill x
frame .oa.b frame .oa.b
button .oa.b.done -text "Done" -command {destroy .oa} button .oa.b.done -text "Done" -command {destroy .oa}
bind .oa <Escape> {destroy .oa} bind .oa <Escape> {destroy .oa}
...@@ -6059,10 +6319,10 @@ proc ssh_agent_restart {} { ...@@ -6059,10 +6319,10 @@ proc ssh_agent_restart {} {
set got_ssh_agent2 0 set got_ssh_agent2 0
set got_ssh_add2 0 set got_ssh_add2 0
if [in_path "ssh-agent"] {set got_ssh_agent 1} if {[in_path "ssh-agent"] != ""} {set got_ssh_agent 1}
if [in_path "ssh-agent2"] {set got_ssh_agent2 1} if {[in_path "ssh-agent2"] != ""} {set got_ssh_agent2 1}
if [in_path "ssh-add"] {set got_ssh_add 1} if {[in_path "ssh-add"] != ""} {set got_ssh_add 1}
if [in_path "ssh-add2"] {set got_ssh_add2 1} if {[in_path "ssh-add2"] != ""} {set got_ssh_add2 1}
set ssh_agent "" set ssh_agent ""
set ssh_add "" set ssh_add ""
...@@ -6121,7 +6381,8 @@ proc ssh_agent_restart {} { ...@@ -6121,7 +6381,8 @@ proc ssh_agent_restart {} {
catch {wm withdraw .o} catch {wm withdraw .o}
catch {wm withdraw .oa} catch {wm withdraw .oa}
exec xterm -geometry +200+200 -title "Restarting with ssh-agent/ssh-add" -e sh $tmp & # exec xterm -geometry +200+200 -title "Restarting with ssh-agent/ssh-add" -e sh $tmp &
unix_terminal_cmd "+200+200" "Restarting with ssh-agent/ssh-add" "sh $tmp" 1
after 10000 after 10000
destroy . destroy .
exit exit
...@@ -6150,7 +6411,7 @@ proc set_options {} { ...@@ -6150,7 +6411,7 @@ proc set_options {} {
global use_alpha use_grab use_ssh use_sshssl use_viewonly use_fullscreen use_bgr233 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 use_nojpeg use_raise_on_beep use_compresslevel use_quality
global compresslevel_text quality_text global compresslevel_text quality_text
global env is_windows global env is_windows darwin_cotvnc
catch {destroy .o} catch {destroy .o}
toplevel .o toplevel .o
...@@ -6179,28 +6440,34 @@ proc set_options {} { ...@@ -6179,28 +6440,34 @@ proc set_options {} {
checkbutton .o.b$i -anchor w -variable use_raise_on_beep -text \ checkbutton .o.b$i -anchor w -variable use_raise_on_beep -text \
"Raise On Beep" "Raise On Beep"
if {$darwin_cotvnc} {.o.b$i configure -state disabled}
incr i incr i
checkbutton .o.b$i -anchor w -variable use_bgr233 -text \ checkbutton .o.b$i -anchor w -variable use_bgr233 -text \
"Use 8bit color (-bgr233)" "Use 8bit color (-bgr233)"
if {$darwin_cotvnc} {.o.b$i configure -state disabled}
incr i incr i
checkbutton .o.b$i -anchor w -variable use_alpha -text \ checkbutton .o.b$i -anchor w -variable use_alpha -text \
"Cursor alphablending (32bpp required)" "Cursor alphablending (32bpp required)"
if {$darwin_cotvnc} {.o.b$i configure -state disabled}
set ia $i set ia $i
incr i incr i
checkbutton .o.b$i -anchor w -variable use_grab -text \ checkbutton .o.b$i -anchor w -variable use_grab -text \
"Use XGrabServer" "Use XGrabServer"
if {$darwin_cotvnc} {.o.b$i configure -state disabled}
set ix $i set ix $i
incr i incr i
checkbutton .o.b$i -anchor w -variable use_nojpeg -text \ checkbutton .o.b$i -anchor w -variable use_nojpeg -text \
"Do not use JPEG (-nojpeg)" "Do not use JPEG (-nojpeg)"
if {$darwin_cotvnc} {.o.b$i configure -state disabled}
incr i incr i
menubutton .o.b$i -anchor w -menu .o.b$i.m -textvariable compresslevel_text menubutton .o.b$i -anchor w -menu .o.b$i.m -textvariable compresslevel_text
set compresslevel_text "Compress Level: $use_compresslevel" set compresslevel_text "Compress Level: $use_compresslevel"
if {$darwin_cotvnc} {.o.b$i configure -state disabled}
menu .o.b$i.m -tearoff 0 menu .o.b$i.m -tearoff 0
for {set j -1} {$j < 10} {incr j} { for {set j -1} {$j < 10} {incr j} {
...@@ -6218,6 +6485,7 @@ proc set_options {} { ...@@ -6218,6 +6485,7 @@ proc set_options {} {
menubutton .o.b$i -anchor w -menu .o.b$i.m -textvariable quality_text menubutton .o.b$i -anchor w -menu .o.b$i.m -textvariable quality_text
set quality_text "Quality: $use_quality" set quality_text "Quality: $use_quality"
if {$darwin_cotvnc} {.o.b$i configure -state disabled}
menu .o.b$i.m -tearoff 0 menu .o.b$i.m -tearoff 0
for {set j -1} {$j < 10} {incr j} { for {set j -1} {$j < 10} {incr j} {
...@@ -6258,12 +6526,14 @@ proc set_options {} { ...@@ -6258,12 +6526,14 @@ proc set_options {} {
button .o.s_prof -text "Save Profile ..." -command {save_profile; raise .o} button .o.s_prof -text "Save Profile ..." -command {save_profile; raise .o}
button .o.l_prof -text " Load Profile ..." -command {load_profile; raise .o} button .o.l_prof -text " Load Profile ..." -command {load_profile; raise .o}
button .o.advanced -text "Advanced ..." -command set_advanced_options button .o.advanced -text "Advanced ..." -command set_advanced_options
button .o.connect -text "Connect" -command launch
button .o.clear -text "Clear Options" -command set_defaults button .o.clear -text "Clear Options" -command set_defaults
pack .o.s_prof -side top -fill x pack .o.s_prof -side top -fill x
pack .o.l_prof -side top -fill x pack .o.l_prof -side top -fill x
#pack .o.inc -side top -fill x #pack .o.inc -side top -fill x
pack .o.clear -side top -fill x pack .o.clear -side top -fill x
pack .o.advanced -side top -fill x pack .o.advanced -side top -fill x
pack .o.connect -side top -fill x
frame .o.b frame .o.b
button .o.b.done -text "Done" -command {destroy .o} button .o.b.done -text "Done" -command {destroy .o}
...@@ -6294,6 +6564,24 @@ if {[regexp -nocase {Windows.9} $tcl_platform(os)]} { ...@@ -6294,6 +6564,24 @@ if {[regexp -nocase {Windows.9} $tcl_platform(os)]} {
set is_win9x 0 set is_win9x 0
} }
set uname ""
if {! $is_windows} {
catch {set uname [exec uname]}
}
set darwin_cotvnc 0
if {$uname == "Darwin"} {
if {! [info exists env(DISPLAY)]} {
set darwin_cotvnc 1
}
if [info exists env(HOME)] {
set t "$env(HOME)/.vnc"
if {! [file exists $t]} {
catch {file mkdir $t}
}
}
}
set putty_pw "" set putty_pw ""
global scroll_text_focus global scroll_text_focus
...@@ -6308,28 +6596,56 @@ set skip_pre 0 ...@@ -6308,28 +6596,56 @@ set skip_pre 0
set vncdisplay "" set vncdisplay ""
label .l -text "SSL TightVNC Viewer" -relief ridge label .l -text "SSL TightVNC Viewer" -relief ridge
frame .f
label .f.l -text "VNC Server:" -relief ridge set wl 21
entry .f.e -width 40 -textvariable vncdisplay set we 40
pack .f.l -side left frame .f0
pack .f.e -side left -expand 1 -fill x #label .f0.l -width $wl -anchor w -text "VNC Host:Display" -relief ridge
bind .f.e <Return> launch label .f0.l -anchor w -text "VNC Host:Display" -relief ridge
entry .f0.e -width $we -textvariable vncdisplay
pack .f0.l -side left
pack .f0.e -side left -expand 1 -fill x
bind .f0.e <Return> launch
frame .f1
label .f1.l -width $wl -anchor w -text "Proxy/Gateway:" -relief ridge
entry .f1.e -width $we -textvariable vncdisplay
pack .f1.l -side left
pack .f1.e -side left -expand 1 -fill x
frame .f2
label .f2.l -width $wl -anchor w -text "Remote SSH Command:" -relief ridge
entry .f2.e -width $we -textvariable vncdisplay
pack .f2.l -side left
pack .f2.e -side left -expand 1 -fill x
.f2.l configure -state disabled
.f2.e configure -state disabled
frame .f3
# -command
checkbutton .f3.ssl -anchor w -variable use_ssl -text "Use SSL"
checkbutton .f3.ssh -anchor w -variable use_ssh -text "Use SSH"
checkbutton .f3.sshssl -anchor w -variable use_sshssl -text "Use SSH and SSL"
set use_ssl 1
pack .f3.ssl .f3.ssh .f3.sshssl -side left -fill x
frame .b frame .b
button .b.help -text "Help" -command help button .b.help -text "Help" -command help
button .b.certs -text "Certs ..." -command getcerts button .b.certs -text "Certs ..." -command getcerts
button .b.opts -text "Options ..." -command set_options button .b.opts -text "Options ..." -command set_options
button .b.load -text "Load" -command {load_profile}
button .b.conn -text "Connect" -command launch button .b.conn -text "Connect" -command launch
button .b.exit -text "Exit" -command {destroy .; exit} button .b.exit -text "Exit" -command {destroy .; exit}
pack .b.certs .b.opts .b.conn .b.help .b.exit -side left -expand 1 -fill x pack .b.certs .b.opts .b.load .b.conn .b.help .b.exit -side left -expand 1 -fill x
pack .l .f .b -side top -fill x #pack .l .f0 .f1 .f2 .f3 .b -side top -fill x
pack .l .f0 .b -side top -fill x
if {![info exists env(SSL_VNC_GUI_CHILD)] || $env(SSL_VNC_GUI_CHILD) == ""} { if {![info exists env(SSL_VNC_GUI_CHILD)] || $env(SSL_VNC_GUI_CHILD) == ""} {
center_win . center_win .
} }
focus .f.e focus .f0.e
global system_button_face global system_button_face
set system_button_face "" set system_button_face ""
...@@ -6346,12 +6662,14 @@ bind . <Shift-Escape> "destroy .; exit" ...@@ -6346,12 +6662,14 @@ bind . <Shift-Escape> "destroy .; exit"
bind . <Control-s> "launch_shell_only" bind . <Control-s> "launch_shell_only"
bind . <Control-p> {port_knock_only "" "KNOCK"} bind . <Control-p> {port_knock_only "" "KNOCK"}
bind . <Control-P> {port_knock_only "" "FINISH"} bind . <Control-P> {port_knock_only "" "FINISH"}
bind . <Control-l> {load_profile}
bind . <B3-ButtonRelease> {load_profile}
global entered_gui_top button_gui_top global entered_gui_top button_gui_top
set entered_gui_top 0 set entered_gui_top 0
set button_gui_top 0 set button_gui_top 0
bind . <Enter> {set entered_gui_top 1} bind . <Enter> {set entered_gui_top 1}
bind .l <ButtonPress> {set button_gui_top 1} bind .l <ButtonPress> {set button_gui_top 1}
bind .f.l <ButtonPress> {set button_gui_top 1} bind .f0.l <ButtonPress> {set button_gui_top 1}
update update
...@@ -126,6 +126,7 @@ help() { ...@@ -126,6 +126,7 @@ help() {
gotalpha="" gotalpha=""
use_ssh="" use_ssh=""
use_sshssl="" use_sshssl=""
direct_connect=""
ssh_sleep=15 ssh_sleep=15
ssh_cmd="sleep $ssh_sleep" ssh_cmd="sleep $ssh_sleep"
if [ "X$SSL_VNCVIEWER_SSH_CMD" != "X" ]; then if [ "X$SSL_VNCVIEWER_SSH_CMD" != "X" ]; then
...@@ -181,6 +182,15 @@ if [ "X$use_ssh" = "X1" -a "X$use_sshssl" = "X" ]; then ...@@ -181,6 +182,15 @@ if [ "X$use_ssh" = "X1" -a "X$use_sshssl" = "X" ]; then
fi fi
fi fi
if echo "$orig" | grep '^vnc://' > /dev/null; then
orig=`echo "$orig" | sed -e 's,vnc://,,'`
verify=""
mycert=""
use_ssh=""
use_sshssl=""
direct_connect=1
fi
# play around with host:display port: # play around with host:display port:
if echo "$orig" | grep ':' > /dev/null; then if echo "$orig" | grep ':' > /dev/null; then
: :
...@@ -277,8 +287,8 @@ if [ "X$use_ssh" = "X1" ]; then ...@@ -277,8 +287,8 @@ if [ "X$use_ssh" = "X1" ]; then
proxport=`findfree 3500` proxport=`findfree 3500`
echo echo
echo "Running 1st ssh proxy:" echo "Running 1st ssh proxy:"
echo "$ssh -f -p $ssh_port1 -t -e none -L $proxport:$ssh_host2:$ssh_port2 $ssh_host1 \"sleep 30\"" echo "$ssh -f -x -p $ssh_port1 -t -e none -L $proxport:$ssh_host2:$ssh_port2 $ssh_host1 \"sleep 30\""
$ssh -f -p $ssh_port1 -t -e none -L $proxport:$ssh_host2:$ssh_port2 $ssh_host1 "sleep 30" $ssh -f -x -p $ssh_port1 -t -e none -L $proxport:$ssh_host2:$ssh_port2 $ssh_host1 "sleep 30"
ssh_args="$ssh_args -o NoHostAuthenticationForLocalhost=yes" ssh_args="$ssh_args -o NoHostAuthenticationForLocalhost=yes"
sleep 1 sleep 1
stty sane stty sane
...@@ -307,18 +317,18 @@ if [ "X$use_ssh" = "X1" ]; then ...@@ -307,18 +317,18 @@ if [ "X$use_ssh" = "X1" ]; then
fi fi
# the -t option actually speeds up typing response via VNC!! # the -t option actually speeds up typing response via VNC!!
if [ "X$SSL_VNCVIEWER_SSH_ONLY" != "X" ]; then if [ "X$SSL_VNCVIEWER_SSH_ONLY" != "X" ]; then
echo "$ssh -p $ssh_port -t $C $ssh_args $ssh_host \"$info\"" echo "$ssh -x -p $ssh_port -t $C $ssh_args $ssh_host \"$info\""
echo "" echo ""
$ssh -p $ssh_port -t $C $ssh_args $ssh_host "$ssh_cmd" $ssh -x -p $ssh_port -t $C $ssh_args $ssh_host "$ssh_cmd"
exit $? exit $?
elif [ "X$SSL_VNCVIEWER_NO_F" != "X" ]; then elif [ "X$SSL_VNCVIEWER_NO_F" != "X" ]; then
echo "$ssh -p $ssh_port -t $C -L ${use}:${vnc_host}:${port} $ssh_args $ssh_host \"$info\"" echo "$ssh -x -p $ssh_port -t $C -L ${use}:${vnc_host}:${port} $ssh_args $ssh_host \"$info\""
echo "" echo ""
$ssh -p $ssh_port -t $C -L ${use}:${vnc_host}:${port} $ssh_args $ssh_host "$ssh_cmd" $ssh -x -p $ssh_port -t $C -L ${use}:${vnc_host}:${port} $ssh_args $ssh_host "$ssh_cmd"
else else
echo "$ssh -f -p $ssh_port -t $C -L ${use}:${vnc_host}:${port} $ssh_args $ssh_host \"$info\"" echo "$ssh -x -f -p $ssh_port -t $C -L ${use}:${vnc_host}:${port} $ssh_args $ssh_host \"$info\""
echo "" echo ""
$ssh -f -p $ssh_port -t $C -L ${use}:${vnc_host}:${port} $ssh_args $ssh_host "$ssh_cmd" $ssh -x -f -p $ssh_port -t $C -L ${use}:${vnc_host}:${port} $ssh_args $ssh_host "$ssh_cmd"
fi fi
if [ "$?" != "0" ]; then if [ "$?" != "0" ]; then
echo "" echo ""
...@@ -337,9 +347,9 @@ if [ "X$use_ssh" = "X1" ]; then ...@@ -337,9 +347,9 @@ if [ "X$use_ssh" = "X1" ]; then
stty sane stty sane
if [ "X$use_sshssl" = "X" ]; then if [ "X$use_sshssl" = "X" ]; then
echo "Running viewer:" echo "Running viewer:"
echo $VNCVIEWERCMD "$@" localhost:$N echo "$VNCVIEWERCMD" "$@" localhost:$N
echo "" echo ""
$VNCVIEWERCMD "$@" localhost:$N "$VNCVIEWERCMD" "$@" localhost:$N
exit $? exit $?
else else
...@@ -408,6 +418,23 @@ print STDERR "proxy_host: $proxy_host\n"; ...@@ -408,6 +418,23 @@ print STDERR "proxy_host: $proxy_host\n";
print STDERR "proxy_port: $proxy_port\n"; print STDERR "proxy_port: $proxy_port\n";
print STDERR "proxy_connect: $connect\n"; print STDERR "proxy_connect: $connect\n";
my $listen_handle = "";
if ($ENV{SSL_VNC_LISTEN} != "") {
my $listen_sock = IO::Socket::INET->new(
Listen => 2,
LocalAddr => "localhost",
LocalPort => $ENV{SSL_VNC_LISTEN},
Proto => "tcp");
if (! $listen_sock) {
die "perl proxy: $!\n";
}
my $ip;
($listen_handle, $ip) = $listen_sock->accept();
if (! $listen_handle) {
die "perl proxy: $!\n";
}
}
my $sock = IO::Socket::INET->new( my $sock = IO::Socket::INET->new(
PeerAddr => $proxy_host, PeerAddr => $proxy_host,
PeerPort => $proxy_port, PeerPort => $proxy_port,
...@@ -462,10 +489,18 @@ if ($second ne "") { ...@@ -462,10 +489,18 @@ if ($second ne "") {
if (fork) { if (fork) {
print STDERR "parent\[$$] STDIN -> socket\n\n"; print STDERR "parent\[$$] STDIN -> socket\n\n";
if ($listen_handle) {
xfer($listen_handle, $sock);
} else {
xfer(STDIN, $sock); xfer(STDIN, $sock);
}
} else { } else {
print STDERR "child \[$$] socket -> STDOUT\n\n"; print STDERR "child \[$$] socket -> STDOUT\n\n";
if ($listen_handle) {
xfer($sock, $listen_handle);
} else {
xfer($sock, STDOUT); xfer($sock, STDOUT);
}
} }
exit; exit;
...@@ -523,6 +558,35 @@ else ...@@ -523,6 +558,35 @@ else
connect="connect = $host:$port" connect="connect = $host:$port"
fi fi
if [ "X$direct_connect" != "X" ]; then
echo ""
echo "Running viewer for direct connection:"
echo ""
echo "** NOTE: THERE WILL BE NO SSL OR SSH ENCRYPTION **"
echo ""
if type printf > /dev/null 2>&1; then
printf "Are you sure you want to continue? [y]/n "
else
echo -n "Are you sure you want to continue? [y]/n "
fi
read x
if [ "X$x" = "Xn" ]; then
exit 1
fi
echo ""
if [ "X$ptmp" != "X" ]; then
SSL_VNC_LISTEN=$use
export SSL_VNC_LISTEN
$ptmp &
sleep 2
host="localhost"
disp="$N"
fi
echo "$VNCVIEWERCMD" "$@" $host:$disp
echo ""
"$VNCVIEWERCMD" "$@" $host:$disp
exit $?
fi
##debug = 7 ##debug = 7
tmp=/tmp/ssl_vncviewer${RANDOM}.$$ tmp=/tmp/ssl_vncviewer${RANDOM}.$$
...@@ -566,9 +630,9 @@ rm -f "$tmp" ...@@ -566,9 +630,9 @@ rm -f "$tmp"
echo "" echo ""
echo "Running viewer:" echo "Running viewer:"
echo $VNCVIEWERCMD "$@" localhost:$N echo "$VNCVIEWERCMD" "$@" localhost:$N
echo "" echo ""
$VNCVIEWERCMD "$@" localhost:$N "$VNCVIEWERCMD" "$@" localhost:$N
kill $pid kill $pid
sleep 1 sleep 1
#!/bin/sh #!/bin/sh
# Notes: to customize locations, e.g. for libjpeg, set LDFLAGS_OS and/or CPPFLAGS_OS
#
# e.g. on Darwin we did:
#
# env LDFLAGS_OS="-L/Volumes/someplace/common/lib/" CPPFLAGS_OS="-I /Volumes/someplace/common/include" ./build.unix
#
# Add useful directories to PATH: # Add useful directories to PATH:
# #
PATH=$PATH:/usr/bin:/bin:/usr/local/bin:/usr/X11R6/bin:/usr/bin/X11:/usr/openwin/bin:/opt/SUNWspro/bin:/usr/sfw/bin:/usr/ccs/bin PATH=$PATH:/usr/bin:/bin:/usr/local/bin:/usr/X11R6/bin:/usr/bin/X11:/usr/openwin/bin:/opt/SUNWspro/bin:/usr/sfw/bin:/usr/ccs/bin
...@@ -17,7 +25,7 @@ fi ...@@ -17,7 +25,7 @@ fi
# #
name=$UNAME name=$UNAME
if [ "X$name" = "X" ]; then if [ "X$name" = "X" ]; then
name=`uname -sm | sed -e 's/ /./'` name=`uname -sm | sed -e 's/ /./g'`
fi fi
if [ "X$name" = "X" ]; then if [ "X$name" = "X" ]; then
echo "cannot determine platform: os.arch, e.g. Linux.i686" echo "cannot determine platform: os.arch, e.g. Linux.i686"
...@@ -25,6 +33,11 @@ if [ "X$name" = "X" ]; then ...@@ -25,6 +33,11 @@ if [ "X$name" = "X" ]; then
exit 1 exit 1
fi fi
LDD="ldd"
if [ `uname` = "Darwin" ]; then
LDD="otool -L"
fi
# Work out main destination: # Work out main destination:
# #
dest=./bin/$name dest=./bin/$name
...@@ -167,13 +180,17 @@ sync ...@@ -167,13 +180,17 @@ sync
wc $src wc $src
sum $src sum $src
sleep 2 sleep 2
echo cp -p $src $dest/vncviewer
cp -p $src $dest/vncviewer || exit 1 suff=""
if [ `uname` = "Darwin" ]; then
suff=".x11"
fi
echo cp -p $src $dest/vncviewer$suff
sleep 1 sleep 1
cp -p $src $dest/vncviewer || exit 1 cp -p $src $dest/vncviewer$suff || exit 1
ls -l $src $dest/vncviewer ls -l $src $dest/vncviewer$suff
$dest/vncviewer -h $dest/vncviewer$suff -h
ldd $dest/vncviewer $LDD $dest/vncviewer$suff
echo "" echo ""
# Do stunnel: # Do stunnel:
...@@ -237,8 +254,8 @@ sleep 1 ...@@ -237,8 +254,8 @@ sleep 1
cp -p $src $dest/stunnel || exit 1 cp -p $src $dest/stunnel || exit 1
ls -l $src $dest/stunnel ls -l $src $dest/stunnel
$dest/stunnel -help $dest/stunnel -help
ldd $dest/stunnel $LDD $dest/stunnel
echo "" echo ""
$dest/vncviewer -h $dest/vncviewer$suff -h
ldd $dest/vncviewer $LDD $dest/vncviewer$suff
#!/bin/sh #!/bin/sh
rm -rf ./src/tmp/* || exit 1 rm -rf ./src/tmp/* || exit 1
vers=1.0.5 vers=1.0.7
cd .. || exit 1 cd .. || exit 1
...@@ -24,6 +24,8 @@ rm -rf enhanced_tightvnc_viewer_windows_only-${vers}* ...@@ -24,6 +24,8 @@ rm -rf enhanced_tightvnc_viewer_windows_only-${vers}*
cp -pR enhanced_tightvnc_viewer enhanced_tightvnc_viewer_windows_only-$vers cp -pR enhanced_tightvnc_viewer enhanced_tightvnc_viewer_windows_only-$vers
rm -rf enhanced_tightvnc_viewer_windows_only-$vers/{src,bin,man}/* rm -rf enhanced_tightvnc_viewer_windows_only-$vers/{src,bin,man}/*
rm -rf enhanced_tightvnc_viewer_windows_only-$vers/bin/.linkin rm -rf enhanced_tightvnc_viewer_windows_only-$vers/bin/.linkin
rm -rf enhanced_tightvnc_viewer_windows_only-$vers/MacOSX
rm -rf enhanced_tightvnc_viewer_windows_only-$vers/Unix
cp -p enhanced_tightvnc_viewer/bin/util/ssl_tightvncviewer.tcl enhanced_tightvnc_viewer_windows_only-$vers/Windows/util cp -p enhanced_tightvnc_viewer/bin/util/ssl_tightvncviewer.tcl enhanced_tightvnc_viewer_windows_only-$vers/Windows/util
rm -f enhanced_tightvnc_viewer_windows_only-$vers.zip rm -f enhanced_tightvnc_viewer_windows_only-$vers.zip
......
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