Commit 95d7788e authored by runge's avatar runge

x11vnc: -sleepin m-n for random sleep. More mktemp and mkstemp

protections. SSL_INIT_TIMEOUT=n env. var.  Fix macosx console
X call bug.  Synchronize other projects sources.
parent d5cba7a5
......@@ -39,7 +39,8 @@
# 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. Also repeater://host:port.
# to force usage of a SOCKS proxy. Also repeater://host:port and
# sslrepeater://host:port.
#
# -showcert Only fetch the certificate using the 'openssl s_client'
# command (openssl(1) must in installed).
......@@ -284,6 +285,19 @@ fi
orig="$1"
shift
# set up special case of ultravnc single click III mode:
if echo "$proxy" | egrep "^sslrepeater://" > /dev/null; then
pstr=`echo "$proxy" | sed -e 's,sslrepeater://,,'`
pstr1=`echo "$pstr" | sed -e 's/+.*$//'`
pstr2=`echo "$pstr" | sed -e 's/^[^+]*+//'`
SSVNC_REPEATER="SCIII=$pstr2"; export SSVNC_REPEATER
orig=$pstr1
echo
echo "reset: SSVNC_REPEATER=$SSVNC_REPEATER orig=$orig proxy=''"
proxy=""
fi
# check -ssh and -mycert/-verify conflict:
if [ "X$use_ssh" = "X1" -a "X$use_sshssl" = "X" ]; then
if [ "X$mycert" != "X" -o "X$verify" != "X" ]; then
......@@ -322,6 +336,14 @@ elif echo "$orig" | grep '^vnc+ssh://' > /dev/null; then
use_ssh=1
fi
if [ "X$SSVNC_ULTRA_DSM" != "X" ]; then
verify=""
mycert=""
use_ssh=""
use_sshssl=""
direct_connect=1
fi
# (possibly) tell the vncviewer to only listen on lo:
if [ "X$reverse" != "X" -a "X$direct_connect" = "X" ]; then
VNCVIEWER_LISTEN_LOCALHOST=1
......@@ -472,6 +494,14 @@ final() {
kill -KILL "$stunnel_pid" 2>/dev/null
stunnel_pid=""
fi
if [ "X$dsm_pid" != "X" ]; then
echo "Terminating background ultravnc_dsm_helper process"
echo kill -TERM "$dsm_pid"
kill -TERM "$dsm_pid" 2>/dev/null
sleep 1
kill -KILL "$dsm_pid" 2>/dev/null
stunnel_pid=""
fi
if [ "X$tail_pid" != "X" ]; then
kill -TERM $tail_pid
fi
......@@ -517,6 +547,19 @@ fi
# a portable, but not absolutely safe, tmp file creator
mytmp() {
tf=$1
if type mktemp > /dev/null 2>&1; then
# if we have mktemp(1), use it:
tf2="$tf.XXXXXX"
tf2=`mktemp "$tf2"`
if [ "X$tf2" != "X" -a -f "$tf2" ]; then
if [ "X$DEBUG_MKTEMP" != "X" ]; then
echo "mytmp-mktemp: $tf2" 1>&2
fi
echo "$tf2"
return
fi
fi
# fallback to multiple cmds:
rm -rf "$tf" || exit 1
if [ -d "$tf" ]; then
echo "tmp file $tf still exists as a directory."
......@@ -531,6 +574,10 @@ mytmp() {
touch "$tf" || exit 1
chmod 600 "$tf" || exit 1
rchk
if [ "X$DEBUG_MKTEMP" != "X" ]; then
echo "mytmp-touch: $tf" 1>&2
fi
echo "$tf"
}
# trick for the undocumented rsh://host:port method.
......@@ -1099,8 +1146,8 @@ Kecho sproxy1_host=$sproxy1_host
Kecho sproxy1_port=$sproxy1_port
Kecho sproxy1_user=$sproxy1_user
ptmp="/tmp/ss_vncviewer${RANDOM}.$$.pl"
mytmp "$ptmp"
ptmp="/tmp/ss_vncviewer_ssh${RANDOM}.$$.pl"
ptmp=`mytmp "$ptmp"`
PPROXY_REMOVE=1; export PPROXY_REMOVE
proxy=$pproxy
port_save=$port
......@@ -1241,8 +1288,8 @@ Kecho proxy=$proxy
rc=$?
elif [ "X$getport" != "X" ]; then
tport=/tmp/tport${RANDOM}.$$
mytmp $tport
tport=/tmp/ss_vncviewer_tport${RANDOM}.$$
tport=`mytmp "$tport"`
if [ "X$rsh" != "X1" ]; then
if echo "$ssh_cmd" | grep -w sudo > /dev/null; then
......@@ -1441,7 +1488,7 @@ fi
ptmp=""
if [ "X$proxy" != "X" ]; then
ptmp="/tmp/ss_vncviewer${RANDOM}.$$.pl"
mytmp "$ptmp"
ptmp=`mytmp "$ptmp"`
PPROXY_REMOVE=1; export PPROXY_REMOVE
pcode "$ptmp"
if [ "X$showcert" != "X1" -a "X$direct_connect" = "X" ]; then
......@@ -1484,7 +1531,14 @@ if [ "X$showcert" = "X1" ]; then
fi
if [ "X$direct_connect" != "X" ]; then
if [ "X$getport" = "X" ]; then
if [ "X$SSVNC_ULTRA_DSM" != "X" ]; then
SSVNC_NO_ENC_WARN=1
echo ""
echo "Using UltraVNC DSM Plugin key for encryption:"
echo ""
echo " $SSVNC_ULTRA_DSM PORT HOST:PORT"
echo ""
elif [ "X$getport" = "X" ]; then
echo ""
echo "Running viewer for direct connection:"
echo ""
......@@ -1508,9 +1562,22 @@ if [ "X$direct_connect" != "X" ]; then
fi
echo ""
if [ "X$ptmp" != "X" ]; then
PPROXY_LISTEN=$use
export PPROXY_LISTEN
if [ "X$reverse" = "X" ]; then
PPROXY_LISTEN=$use
export PPROXY_LISTEN
else
PPROXY_REVERSE="localhost:$use"
export PPROXY_REVERSE
pps=3
if [ "X$SSVNC_EXTRA_SLEEP" != "X" ]; then
pps=`expr $pps + $SSVNC_EXTRA_SLEEP`
fi
PPROXY_SLEEP=$pps; export PPROXY_SLEEP;
PPROXY_KILLPID=+1; export PPROXY_KILLPID;
fi
$ptmp &
if [ "X$reverse" = "X" ]; then
#sleep 2
#echo T sleep 1
......@@ -1518,29 +1585,52 @@ if [ "X$direct_connect" != "X" ]; then
fi
host="localhost"
disp="$N"
port=`expr $disp + 5900`
fi
if [ "X$SSVNC_EXTRA_SLEEP" != "X" ]; then
echo "T sleep $SSVNC_EXTRA_SLEEP"
sleep $SSVNC_EXTRA_SLEEP
fi
if [ "X$reverse" = "X" ]; then
echo "$VNCVIEWERCMD" "$@" $host:$disp
hostdisp="$host:$disp"
if [ "X$SSVNC_ULTRA_DSM" != "X" ]; then
hostdisp="exec=$SSVNC_ULTRA_DSM 0 $host:$port"
fi
echo "$VNCVIEWERCMD" "$@" "$hostdisp"
trap "final" 0 2 15
echo ""
$VNCVIEWERCMD "$@" $host:$disp
$VNCVIEWERCMD "$@" "$hostdisp"
if [ $? != 0 ]; then
echo "vncviewer command failed: $?"
if [ "X$secondtry" = "X1" ]; then
sleep 2
$VNCVIEWERCMD "$@" $host:$disp
$VNCVIEWERCMD "$@" "$hostdisp"
fi
fi
else
echo ""
echo "NOTE: Press Ctrl-C to terminate viewer LISTEN mode."
echo ""
echo "$VNCVIEWERCMD" "$@" -listen $disp
trap "final" 0 2 15
if [ "X$SSVNC_ULTRA_DSM" != "X" ]; then
echo "NOTE: The ultravnc_dsm_helper only runs once. So after the first LISTEN"
echo " ends, you will have to Press Ctrl-C and restart for a new connection."
echo ""
dport=`expr 5500 + $disp`
cmd="$SSVNC_ULTRA_DSM $dport localhost:$use"
echo "Running:"
echo
echo "$cmd &"
echo
$cmd &
dsm_pid=$!
sleep 2
disp=$use
if [ $disp -ge 5500 ]; then
disp=`expr $disp - 5500`
fi
fi
echo "$VNCVIEWERCMD" "$@" -listen $disp
echo ""
$VNCVIEWERCMD "$@" -listen $disp
fi
......@@ -1548,12 +1638,13 @@ if [ "X$direct_connect" != "X" ]; then
fi
tmp_cfg=/tmp/ss_vncviewer${RANDOM}.$$
mytmp "$tmp_cfg"
tmp_cfg=`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}.$$"
tcert="/tmp/ss_vnc_viewer_tcert${RANDOM}.$$"
tcert=`mytmp "$tcert"`
cat > $tcert <<END
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAvkfXxb0wcxgrjV2ziFikjII+ze8iKcTBt47L0GM/c21efelN
......@@ -1617,7 +1708,7 @@ fi
if [ "X$reverse" = "X" ]; then
if echo "$proxy" | grep repeater:// > /dev/null; then
if echo "$proxy" | grep "^repeater://" > /dev/null; then
if [ "X$cert" = "XBUILTIN" ]; then
ttcert=`make_tcert`
cert="cert = $ttcert"
......
2008-09-14 Karl Runge <runge@karlrunge.com>
* x11vnc: -sleepin m-n for random sleep. More mktemp and mkstemp
protections. SSL_INIT_TIMEOUT=n env. var. Fix macosx console
X call bug. Synchronize other projects sources.
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
......
This diff is collapsed.
......@@ -667,24 +667,22 @@ void do_gui(char *opts, int sleep) {
pid_t parent = getpid();
if (icon_mode) {
char tf[100];
double dn = dnow();
char tf[] = "/tmp/x11vnc.tray.XXXXXX";
int fd;
struct stat sbuf;
/* FIXME */
dn = dn - ((int) dn);
sprintf(tf, "/tmp/x11vnc.tray%d%d", (int) (1000000*dn),
(int) getpid());
unlink(tf);
/* race begins.. */
if (stat(tf, &sbuf) == 0) {
fd = mkstemp(tf);
if (fd < 0) {
icon_mode = 0;
} else {
close(fd);
icon_mode_fh = fopen(tf, "w");
if (! icon_mode_fh) {
icon_mode = 0;
} else {
chmod(tf, 0400);
icon_mode_file = strdup(tf);
rfbLog("icon_mode_file=%s\n", icon_mode_file);
fprintf(icon_mode_fh, "none\n");
fprintf(icon_mode_fh, "none\n");
fflush(icon_mode_fh);
......
......@@ -360,9 +360,14 @@ void print_help(int mode) {
"\n"
"-timeout n Exit unless a client connects within the first n seconds\n"
" after startup.\n"
"\n"
"-sleepin n At startup sleep n seconds before proceeding (e.g. to\n"
" allow redirs and listening clients to start up)\n"
"\n"
" If a range is given: '-sleepin min-max', a random value\n"
" between min and max is slept. E.g. '-sleepin 0-20' and\n"
" '-sleepin 10-30'. Floats are allowed too.\n"
"\n"
"-inetd Launched by inetd(8): stdio instead of listening socket.\n"
" Note: if you are not redirecting stderr to a log file\n"
" (via shell 2> or -o option) you MUST also specify the -q\n"
......@@ -1296,6 +1301,10 @@ void print_help(int mode) {
" Set to zero to poll forever. Set to a negative value\n"
" to use the builtin setting.\n"
"\n"
" Note that this value does not apply to the *initial* ssl\n"
" init connection. The default timeout for that is 20sec.\n"
" Use -env SSL_INIT_TIMEOUT=n to modify it.\n"
"\n"
"-sslnofail Exit at the first SSL connection failure. Useful when\n"
" scripting SSL connections (e.g. x11vnc is started via\n"
" ssh) and you do not want x11vnc waiting around for more\n"
......@@ -2197,6 +2206,9 @@ void print_help(int mode) {
" where a Keysym is bound to multiple keys (e.g. \"<\" + \">\"\n"
" and \",\" + \"<\" keys). Default: %s\n"
"\n"
" If you are having trouble with with keys and -xkb or\n"
" -noxkb, and similar things don't help, try -nomodtweak.\n"
"\n"
" On some HP-UX systems it is been noted that they have\n"
" an odd keymapping where a single keycode will have a\n"
" keysym, e.g. \"#\", up to three times. You can check\n"
......
......@@ -129,6 +129,9 @@ The enhanced TightVNC viewer features are:
- Support for UltraVNC Single Click operation. (both unencrypted:
SC I, and SSL encrypted: SC III)
- Support for UltraVNC DSM Encryption Plugin mode. (ARC4 and
AESV2, but not MSRC4 yet)
- 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.
......
......@@ -39,7 +39,8 @@
# 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. Also repeater://host:port.
# to force usage of a SOCKS proxy. Also repeater://host:port and
# sslrepeater://host:port.
#
# -showcert Only fetch the certificate using the 'openssl s_client'
# command (openssl(1) must in installed).
......@@ -284,6 +285,19 @@ fi
orig="$1"
shift
# set up special case of ultravnc single click III mode:
if echo "$proxy" | egrep "^sslrepeater://" > /dev/null; then
pstr=`echo "$proxy" | sed -e 's,sslrepeater://,,'`
pstr1=`echo "$pstr" | sed -e 's/+.*$//'`
pstr2=`echo "$pstr" | sed -e 's/^[^+]*+//'`
SSVNC_REPEATER="SCIII=$pstr2"; export SSVNC_REPEATER
orig=$pstr1
echo
echo "reset: SSVNC_REPEATER=$SSVNC_REPEATER orig=$orig proxy=''"
proxy=""
fi
# check -ssh and -mycert/-verify conflict:
if [ "X$use_ssh" = "X1" -a "X$use_sshssl" = "X" ]; then
if [ "X$mycert" != "X" -o "X$verify" != "X" ]; then
......@@ -322,6 +336,14 @@ elif echo "$orig" | grep '^vnc+ssh://' > /dev/null; then
use_ssh=1
fi
if [ "X$SSVNC_ULTRA_DSM" != "X" ]; then
verify=""
mycert=""
use_ssh=""
use_sshssl=""
direct_connect=1
fi
# (possibly) tell the vncviewer to only listen on lo:
if [ "X$reverse" != "X" -a "X$direct_connect" = "X" ]; then
VNCVIEWER_LISTEN_LOCALHOST=1
......@@ -472,6 +494,14 @@ final() {
kill -KILL "$stunnel_pid" 2>/dev/null
stunnel_pid=""
fi
if [ "X$dsm_pid" != "X" ]; then
echo "Terminating background ultravnc_dsm_helper process"
echo kill -TERM "$dsm_pid"
kill -TERM "$dsm_pid" 2>/dev/null
sleep 1
kill -KILL "$dsm_pid" 2>/dev/null
stunnel_pid=""
fi
if [ "X$tail_pid" != "X" ]; then
kill -TERM $tail_pid
fi
......@@ -517,6 +547,19 @@ fi
# a portable, but not absolutely safe, tmp file creator
mytmp() {
tf=$1
if type mktemp > /dev/null 2>&1; then
# if we have mktemp(1), use it:
tf2="$tf.XXXXXX"
tf2=`mktemp "$tf2"`
if [ "X$tf2" != "X" -a -f "$tf2" ]; then
if [ "X$DEBUG_MKTEMP" != "X" ]; then
echo "mytmp-mktemp: $tf2" 1>&2
fi
echo "$tf2"
return
fi
fi
# fallback to multiple cmds:
rm -rf "$tf" || exit 1
if [ -d "$tf" ]; then
echo "tmp file $tf still exists as a directory."
......@@ -531,6 +574,10 @@ mytmp() {
touch "$tf" || exit 1
chmod 600 "$tf" || exit 1
rchk
if [ "X$DEBUG_MKTEMP" != "X" ]; then
echo "mytmp-touch: $tf" 1>&2
fi
echo "$tf"
}
# trick for the undocumented rsh://host:port method.
......@@ -1099,8 +1146,8 @@ Kecho sproxy1_host=$sproxy1_host
Kecho sproxy1_port=$sproxy1_port
Kecho sproxy1_user=$sproxy1_user
ptmp="/tmp/ss_vncviewer${RANDOM}.$$.pl"
mytmp "$ptmp"
ptmp="/tmp/ss_vncviewer_ssh${RANDOM}.$$.pl"
ptmp=`mytmp "$ptmp"`
PPROXY_REMOVE=1; export PPROXY_REMOVE
proxy=$pproxy
port_save=$port
......@@ -1241,8 +1288,8 @@ Kecho proxy=$proxy
rc=$?
elif [ "X$getport" != "X" ]; then
tport=/tmp/tport${RANDOM}.$$
mytmp $tport
tport=/tmp/ss_vncviewer_tport${RANDOM}.$$
tport=`mytmp "$tport"`
if [ "X$rsh" != "X1" ]; then
if echo "$ssh_cmd" | grep -w sudo > /dev/null; then
......@@ -1441,7 +1488,7 @@ fi
ptmp=""
if [ "X$proxy" != "X" ]; then
ptmp="/tmp/ss_vncviewer${RANDOM}.$$.pl"
mytmp "$ptmp"
ptmp=`mytmp "$ptmp"`
PPROXY_REMOVE=1; export PPROXY_REMOVE
pcode "$ptmp"
if [ "X$showcert" != "X1" -a "X$direct_connect" = "X" ]; then
......@@ -1484,7 +1531,14 @@ if [ "X$showcert" = "X1" ]; then
fi
if [ "X$direct_connect" != "X" ]; then
if [ "X$getport" = "X" ]; then
if [ "X$SSVNC_ULTRA_DSM" != "X" ]; then
SSVNC_NO_ENC_WARN=1
echo ""
echo "Using UltraVNC DSM Plugin key for encryption:"
echo ""
echo " $SSVNC_ULTRA_DSM PORT HOST:PORT"
echo ""
elif [ "X$getport" = "X" ]; then
echo ""
echo "Running viewer for direct connection:"
echo ""
......@@ -1508,9 +1562,22 @@ if [ "X$direct_connect" != "X" ]; then
fi
echo ""
if [ "X$ptmp" != "X" ]; then
PPROXY_LISTEN=$use
export PPROXY_LISTEN
if [ "X$reverse" = "X" ]; then
PPROXY_LISTEN=$use
export PPROXY_LISTEN
else
PPROXY_REVERSE="localhost:$use"
export PPROXY_REVERSE
pps=3
if [ "X$SSVNC_EXTRA_SLEEP" != "X" ]; then
pps=`expr $pps + $SSVNC_EXTRA_SLEEP`
fi
PPROXY_SLEEP=$pps; export PPROXY_SLEEP;
PPROXY_KILLPID=+1; export PPROXY_KILLPID;
fi
$ptmp &
if [ "X$reverse" = "X" ]; then
#sleep 2
#echo T sleep 1
......@@ -1518,29 +1585,52 @@ if [ "X$direct_connect" != "X" ]; then
fi
host="localhost"
disp="$N"
port=`expr $disp + 5900`
fi
if [ "X$SSVNC_EXTRA_SLEEP" != "X" ]; then
echo "T sleep $SSVNC_EXTRA_SLEEP"
sleep $SSVNC_EXTRA_SLEEP
fi
if [ "X$reverse" = "X" ]; then
echo "$VNCVIEWERCMD" "$@" $host:$disp
hostdisp="$host:$disp"
if [ "X$SSVNC_ULTRA_DSM" != "X" ]; then
hostdisp="exec=$SSVNC_ULTRA_DSM 0 $host:$port"
fi
echo "$VNCVIEWERCMD" "$@" "$hostdisp"
trap "final" 0 2 15
echo ""
$VNCVIEWERCMD "$@" $host:$disp
$VNCVIEWERCMD "$@" "$hostdisp"
if [ $? != 0 ]; then
echo "vncviewer command failed: $?"
if [ "X$secondtry" = "X1" ]; then
sleep 2
$VNCVIEWERCMD "$@" $host:$disp
$VNCVIEWERCMD "$@" "$hostdisp"
fi
fi
else
echo ""
echo "NOTE: Press Ctrl-C to terminate viewer LISTEN mode."
echo ""
echo "$VNCVIEWERCMD" "$@" -listen $disp
trap "final" 0 2 15
if [ "X$SSVNC_ULTRA_DSM" != "X" ]; then
echo "NOTE: The ultravnc_dsm_helper only runs once. So after the first LISTEN"
echo " ends, you will have to Press Ctrl-C and restart for a new connection."
echo ""
dport=`expr 5500 + $disp`
cmd="$SSVNC_ULTRA_DSM $dport localhost:$use"
echo "Running:"
echo
echo "$cmd &"
echo
$cmd &
dsm_pid=$!
sleep 2
disp=$use
if [ $disp -ge 5500 ]; then
disp=`expr $disp - 5500`
fi
fi
echo "$VNCVIEWERCMD" "$@" -listen $disp
echo ""
$VNCVIEWERCMD "$@" -listen $disp
fi
......@@ -1548,12 +1638,13 @@ if [ "X$direct_connect" != "X" ]; then
fi
tmp_cfg=/tmp/ss_vncviewer${RANDOM}.$$
mytmp "$tmp_cfg"
tmp_cfg=`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}.$$"
tcert="/tmp/ss_vnc_viewer_tcert${RANDOM}.$$"
tcert=`mytmp "$tcert"`
cat > $tcert <<END
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAvkfXxb0wcxgrjV2ziFikjII+ze8iKcTBt47L0GM/c21efelN
......@@ -1617,7 +1708,7 @@ fi
if [ "X$reverse" = "X" ]; then
if echo "$proxy" | grep repeater:// > /dev/null; then
if echo "$proxy" | grep "^repeater://" > /dev/null; then
if [ "X$cert" = "XBUILTIN" ]; then
ttcert=`make_tcert`
cert="cert = $ttcert"
......
......@@ -55,7 +55,7 @@ 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
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.
......
......@@ -194,6 +194,9 @@ 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.
This is the same as -multilisten described below. Set
SSVNC_MULTIPLE_LISTEN=MAX:n to allow no more than "n"
simultaneous reverse connections.
.TP
Note: If the host:port is specified as "exec=command args..."
then instead of making a TCP/IP socket connection to the
......@@ -206,6 +209,14 @@ This mode does not work for -listen reverse connections.
Note: If the host:port contains a '/' it is interpreted as a
unix-domain socket (AF_LOCAL insead of AF_INET)
.TP
\fB\-multilisten\fR
As in -listen (reverse connection listening) except
allow more than one incoming VNC server to be connected
at a time. The default for -listen of only one at a
time tries to play it safe by not allowing anyone on
the network to put (many) desktops on your screen over
a long window of time. Use -multilisten for no limit.
.TP
\fB\-use64\fR
In \fB\-bgr233\fR mode, use 64 colors instead of 256.
.TP
......@@ -290,8 +301,8 @@ Disable use of MIT shared memory extension (not recommended)
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
\fB\-unixpw\fR \fIstr\fR
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
......@@ -313,17 +324,45 @@ 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
\fB-repeater\fR \fIstr\fR
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
Use, e.g., '-repeater SCIII=ID:3210' if the repeater is a
Single Click III (SSL) repeater (repeater_SSL.exe) and you
are passing the SSL part of the connection through stunnel, socat, etc.
This way the magic UltraVNC string 'testB' needed to work with the
repeater is sent to it.
.TP
\fB-rfbversion\fR \fIstr\fR
Set the advertised RFB version. E.g.: -rfbversion 3.6 For some
servers, e.g. UltraVNC this needs to be done.
.TP
\fB-ultradsm\fR
UltraVNC has symmetric private encryption DSM plugins. See
http://www.uvnc.com/features/encryption.html. It is assumed
you are using a unix program (e.g. our ultravnc_dsm_helper) to
encrypt and decrypt the UltraVNC DSM stream. IN ADDITION TO
THAT supply -ultradsm to tell THIS viewer to modify the RFB
data sent so as to work with the UltraVNC Server. For some
reason, each RFB msg type must be sent twice under DSM.
.TP
\fB-env\fR \fIVAR=VALUE\fR
To save writing a shell script to set environment
variables, specify as many as you need on the command line. For example,
-env SSVNC_MULTIPLE_LISTEN=MAX:5 -env EDITOR=vi
.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.
......@@ -568,8 +607,8 @@ local TCP port number;
.B %R
remote TCP port number.
.SH SEE ALSO
\fBvncserver\fR(1), \fBXvnc\fR(1), \fBvncpasswd\fR(1),
\fBvncconnect\fR(1), \fBssh\fR(1)
\fBvncserver\fR(1), \fBx11vnc\fR(1), \fBssvnc\fR(1), \fBXvnc\fR(1), \fBvncpasswd\fR(1),
\fBvncconnect\fR(1), \fBssh\fR(1), http://www.karlrunge.com/x11vnc, http://www.karlrunge.com/x11vnc/ssvnc.html
.SH AUTHORS
Original VNC was developed in AT&T Laboratories Cambridge. TightVNC
additions was implemented by Constantin Kaplinsky. Many other people
......@@ -584,3 +623,5 @@ Terran Melconian <terran@consistent.org>,
Tim Waugh <twaugh@redhat.com>,
.br
Constantin Kaplinsky <const@ce.cctpu.edu.ru>
.br
Karl Runge <runge@karlrunge.com>
......@@ -62,7 +62,10 @@ zip -9 -r ssvnc-$vers.zip ssvnc -x '*.zip' '*.tar.gz'
tar cvf - --exclude='*.zip' --exclude='*.tar.gz' ssvnc | gzip -9 > ssvnc-$vers.tar.gz
tar cvf - --exclude='*.zip' --exclude='*.tar.gz' --exclude='*.dll' --exclude='*.exe' --exclude ssvnc/Windows/util ssvnc | gzip -9 > ssvnc_no_windows-$vers.tar.gz
echo
ls -l ssvnc*-$vers.*
echo
###########################################
dest=./t.windows_only
......@@ -84,3 +87,18 @@ rm -f $zip
ls -l $zip
rm -rf $dest
sync
echo
for g in ssvnc*-$vers*.gz
do
md5sum $g
gzip -t $g || (tput bel; sleep 2)
done
for g in ssvnc*-$vers*.zip
do
md5sum $g
done
sleep 3
echo
......@@ -2041,6 +2041,9 @@ static int ssl_init(int s_in, int s_out) {
if (getenv("SSL_DEBUG")) {
db = atoi(getenv("SSL_DEBUG"));
}
if (getenv("SSL_INIT_TIMEOUT")) {
timeout = atoi(getenv("SSL_INIT_TIMEOUT"));
}
if (db) fprintf(stderr, "ssl_init: %d/%d\n", s_in, s_out);
ssl = SSL_new(ctx);
......
......@@ -830,6 +830,52 @@ char find_display[] =
" pslist=`echo \"$psout\" | awk '{print $2}'`\n"
"fi\n"
"\n"
"rchk() {\n"
" rr=rr \n"
"}\n"
"\n"
"dL=\"-L\"\n"
"if uname -sr | egrep 'SunOS 5\\.[5-8]' > /dev/null; then\n"
" dL=\"-h\"\n"
"fi\n"
"\n"
"# a portable, but not absolutely safe, tmp file creator\n"
"mytmp() {\n"
" tf=$1\n"
" if type mktemp > /dev/null 2>&1; then\n"
" # if we have mktemp(1), use it:\n"
" tf2=\"$tf.XXXXXX\"\n"
" tf2=`mktemp \"$tf2\"`\n"
" if [ \"X$tf2\" != \"X\" -a -f \"$tf2\" ]; then\n"
" if [ \"X$DEBUG_MKTEMP\" != \"X\" ]; then\n"
" echo \"mytmp-mktemp: $tf2\" 1>&2\n"
" fi\n"
" echo \"$tf2\"\n"
" return\n"
" fi\n"
" fi\n"
" # fallback to multiple cmds:\n"
" rm -rf \"$tf\" || exit 1\n"
" if [ -d \"$tf\" ]; then\n"
" echo \"tmp file $tf still exists as a directory.\"\n"
" exit 1\n"
" elif [ $dL \"$tf\" ]; then\n"
" echo \"tmp file $tf still exists as a symlink.\"\n"
" exit 1\n"
" elif [ -f \"$tf\" ]; then\n"
" echo \"tmp file $tf still exists.\"\n"
" exit 1\n"
" fi\n"
" touch \"$tf\" || exit 1\n"
" chmod 600 \"$tf\" || exit 1\n"
" rchk\n"
" if [ \"X$DEBUG_MKTEMP\" != \"X\" ]; then\n"
" echo \"mytmp-touch: $tf\" 1>&2\n"
" fi\n"
" echo \"$tf\"\n"
"}\n"
"\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"
......@@ -845,39 +891,38 @@ char find_display[] =
" #\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"
" if [ $? != 0 ]; then\n"
" 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"
" if [ -f $tf ]; then\n"
" env XAUTHORITY=/dev/null xdpyinfo -display \"$da\" >/dev/null 2>&1\n"
" if [ $? != 0 ]; then\n"
" 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"
" xtf=$HOME/.xat.$$\n"
" xtf=`mytmp \"$xtf\"`\n"
" if [ ! -f $xtf ]; then\n"
" xtf=/tmp/.xat.$$\n"
" xtf=`mytmp \"$xtf\"`\n"
" fi\n"
" if [ ! -f $xtf ]; then\n"
" xtf=/tmp/.xatb.$$\n"
" rm -f $xtf\n"
" if [ -f $xtf ]; then\n"
" exit 1\n"
" fi\n"
" touch $tf 2>/dev/null\n"
" chmod 600 $tf 2>/dev/null\n"
" if [ ! -f $tf ]; then\n"
" tf=/tmp/.xat.$$\n"
" rm -f $tf\n"
" if [ -f $tf ]; then\n"
" exit 1\n"
" fi\n"
" touch $tf 2>/dev/null\n"
" chmod 600 $tf 2>/dev/null\n"
" if [ ! -f $tf ]; then\n"
" exit 1\n"
" fi\n"
" touch $xtf 2>/dev/null\n"
" chmod 600 $xtf 2>/dev/null\n"
" if [ ! -f $xtf ]; then\n"
" exit 1\n"
" fi\n"
" xauth -f $tf add \"$da\" . $cook\n"
" xauth -f $tf extract - \"$da\" 2>/dev/null\n"
" rm -f $tf\n"
" fi\n"
" # DONE\n"
" exit 0\n"
" xauth -f $xtf add \"$da\" . $cook\n"
" xauth -f $xtf extract - \"$da\" 2>/dev/null\n"
" rm -f $xtf\n"
" fi\n"
" # DONE\n"
" exit 0\n"
" fi\n"
" fi\n"
" fi\n"
" done\n"
......@@ -1459,6 +1504,51 @@ char create_display[] =
" redir_daemon=`echo \"$redir_daemon\" | sed -e 's/^,*//'`\n"
"}\n"
"\n"
"rchk() {\n"
" rr=rr\n"
"}\n"
"\n"
"dL=\"-L\"\n"
"if uname -sr | egrep 'SunOS 5\\.[5-8]' > /dev/null; then\n"
" dL=\"-h\"\n"
"fi\n"
"\n"
"# a portable, but not absolutely safe, tmp file creator\n"
"mytmp() {\n"
" tf=$1\n"
" if type mktemp > /dev/null 2>&1; then\n"
" # if we have mktemp(1), use it:\n"
" tf2=\"$tf.XXXXXX\"\n"
" tf2=`mktemp \"$tf2\"`\n"
" if [ \"X$tf2\" != \"X\" -a -f \"$tf2\" ]; then\n"
" if [ \"X$DEBUG_MKTEMP\" != \"X\" ]; then\n"
" echo \"mytmp-mktemp: $tf2\" 1>&2\n"
" fi\n"
" echo \"$tf2\"\n"
" return\n"
" fi\n"
" fi\n"
" # fallback to multiple cmds:\n"
" rm -rf \"$tf\" || exit 1\n"
" if [ -d \"$tf\" ]; then\n"
" echo \"tmp file $tf still exists as a directory.\"\n"
" exit 1\n"
" elif [ $dL \"$tf\" ]; then\n"
" echo \"tmp file $tf still exists as a symlink.\"\n"
" exit 1\n"
" elif [ -f \"$tf\" ]; then\n"
" echo \"tmp file $tf still exists.\"\n"
" exit 1\n"
" fi\n"
" touch \"$tf\" || exit 1\n"
" chmod 600 \"$tf\" || exit 1\n"
" rchk\n"
" if [ \"X$DEBUG_MKTEMP\" != \"X\" ]; then\n"
" echo \"mytmp-touch: $tf\" 1>&2\n"
" fi\n"
" echo \"$tf\"\n"
"}\n"
"\n"
"server() {\n"
" authfile=`auth`\n"
" sess=`findsession`\n"
......@@ -1475,10 +1565,7 @@ char create_display[] =
" rmf=\"/nosuch\"\n"
" if echo \"$sess\" | grep '[ ]' > /dev/null; then\n"
" stmp=/tmp/.cd$$`random`\n"
" rm -f $stmp\n"
" if [ -f $stmp ]; then\n"
" exit 1\n"
" fi\n"
" stmp=`mytmp \"$stmp\"`\n"
" touch $stmp\n"
" chmod 755 $stmp || exit 1\n"
" echo \"#!/bin/sh\" > $stmp\n"
......@@ -1490,10 +1577,7 @@ char create_display[] =
" fi\n"
" if [ \"X$have_root\" != \"X\" -a \"X$USER\" != \"Xroot\" ]; then\n"
" ctmp=/tmp/.xat$$`random`\n"
" rm -f $ctmp\n"
" if [ -f $ctmp ]; then\n"
" exit 1\n"
" fi\n"
" ctmp=`mytmp \"$ctmp\"`\n"
" touch $ctmp\n"
" chmod 644 $ctmp || exit 1\n"
" $have_xauth -f $authfile nextract - :$N > $ctmp\n"
......@@ -1799,10 +1883,7 @@ char create_display[] =
" exit 1\n"
" fi\n"
" tmp=/tmp/.xas$$`random`\n"
" rm -f $tmp\n"
" if [ -f $tmp ]; then\n"
" exit 1\n"
" fi\n"
" tmp=`mytmp \"$tmp\"`\n"
" touch $tmp\n"
" chmod 600 $tmp || exit 1\n"
" if [ ! -f $tmp ]; then\n"
......
......@@ -6275,10 +6275,17 @@ proc restart_everything {gui_mode} {
exit 1;
}
set tmp "/tmp/x11vnc[pid]"
file delete -force $tmp
if {[file exists $tmp]} {
puts stderr "failure in restart_everything."
exit 1;
append tmp [clock clicks]
set tmp2 ""
catch {set tmp2 [exec mktemp $tmp.XXXXXX 2>/dev/null]}
if {$tmp2 != "" && [file exists $tmp2]} {
set tmp $tmp2
} else {
file delete -force $tmp
if {[file exists $tmp]} {
puts stderr "failure in restart_everything."
exit 1;
}
}
set fh [open $tmp "a"]
if {![file owned $tmp]} {
......
......@@ -6286,10 +6286,17 @@ char gui_code[] = "";
" exit 1;\n"
" }\n"
" set tmp \"/tmp/x11vnc[pid]\"\n"
" file delete -force $tmp\n"
" if {[file exists $tmp]} {\n"
" puts stderr \"failure in restart_everything.\"\n"
" exit 1;\n"
" append tmp [clock clicks]\n"
" set tmp2 \"\"\n"
" catch {set tmp2 [exec mktemp $tmp.XXXXXX 2>/dev/null]}\n"
" if {$tmp2 != \"\" && [file exists $tmp2]} {\n"
" set tmp $tmp2\n"
" } else {\n"
" file delete -force $tmp\n"
" if {[file exists $tmp]} {\n"
" puts stderr \"failure in restart_everything.\"\n"
" exit 1;\n"
" }\n"
" }\n"
" set fh [open $tmp \"a\"]\n"
" if {![file owned $tmp]} {\n"
......
......@@ -7656,6 +7656,10 @@ void xselectinput(Window w, unsigned long evmask, int sync) {
XErrorHandler old_handler1;
XIOErrorHandler old_handler2;
if (macosx_console || !dpy) {
return;
}
old_handler1 = XSetErrorHandler(trap_xerror);
old_handler2 = XSetIOErrorHandler(trap_xioerror);
trapped_xerror = 0;
......@@ -8812,7 +8816,7 @@ if (ncdb) fprintf(stderr, "*VIS BS_save: 0x%lx %d %d %d\n", win, cache_list[i].
last_sched_bs = dnow();
}
#if !NO_X11
if (atom_XROOTPMAP_ID == None && now > last_pixmap + 5.0) {
if (dpy && atom_XROOTPMAP_ID == None && now > last_pixmap + 5.0) {
atom_XROOTPMAP_ID = XInternAtom(dpy, "_XROOTPMAP_ID", True);
last_pixmap = now;
}
......
......@@ -399,8 +399,23 @@ double rnow(void) {
}
double rfac(void) {
double f = (double) rand();
double f;
static int first = 1;
if (first) {
unsigned int s;
if (getenv("RAND_SEED")) {
s = (unsigned int) atoi(getenv("RAND_SEED"));
} else {
s = (unsigned int) ((int) getpid() + 100000 * rnow());
}
srand(s);
first = 0;
}
f = (double) rand();
f = f / ((double) RAND_MAX);
return f;
}
......
......@@ -2,7 +2,7 @@
.TH X11VNC "1" "September 2008" "x11vnc " "User Commands"
.SH NAME
x11vnc - allow VNC connections to real X11 displays
version: 0.9.4, lastmod: 2008-09-06
version: 0.9.4, lastmod: 2008-09-14
.SH SYNOPSIS
.B x11vnc
[OPTION]...
......@@ -423,6 +423,10 @@ after startup.
.IP
At startup sleep n seconds before proceeding (e.g. to
allow redirs and listening clients to start up)
.IP
If a range is given: '-sleepin min-max', a random value
between min and max is slept. E.g. '-sleepin 0-20' and
\'-sleepin 10-30'. Floats are allowed too.
.PP
\fB-inetd\fR
.IP
......@@ -1485,6 +1489,10 @@ talking and the connection is dropped after the default
timeout (25s for about the first minute, 43200s later).
Set to zero to poll forever. Set to a negative value
to use the builtin setting.
.IP
Note that this value does not apply to the *initial* ssl
init connection. The default timeout for that is 20sec.
Use \fB-env\fR SSL_INIT_TIMEOUT=n to modify it.
.PP
\fB-sslnofail\fR
.IP
......@@ -2528,6 +2536,9 @@ identical keyboards). Also useful in resolving cases
where a Keysym is bound to multiple keys (e.g. "<" + ">"
and "," + "<" keys). Default: \fB-modtweak\fR
.IP
If you are having trouble with with keys and \fB-xkb\fR or
\fB-noxkb,\fR and similar things don't help, try \fB-nomodtweak.\fR
.IP
On some HP-UX systems it is been noted that they have
an odd keymapping where a single keycode will have a
keysym, e.g. "#", up to three times. You can check
......
......@@ -2293,6 +2293,38 @@ char msg2[] =
&& !query_cmd && !remote_cmd && !unixpw && !got_gui_pw \
&& ! ssl_verify && !inetd && !terminal_services_daemon)
static void do_sleepin(char *sleep) {
int n1, n2, nt;
double f1, f2, ft;
if (strchr(sleep, '-')) {
double s = atof(strchr(sleep, '-')+1);
if (sscanf(sleep, "%d-%d", &n1, &n2) == 2) {
if (n1 > n2) {
nt = n1;
n1 = n2;
n2 = nt;
}
s = n1 + rfac() * (n2 - n1);
} else if (sscanf(sleep, "%lf-%lf", &f1, &f2) == 2) {
if (f1 > f2) {
ft = f1;
f1 = f2;
f2 = ft;
}
s = f1 + rfac() * (f2 - f1);
}
if (getenv("DEBUG_SLEEPIN")) fprintf(stderr, "sleepin: %f secs\n", s);
usleep( (int) (1000*1000*s) );
} else {
n1 = atoi(sleep);
if (getenv("DEBUG_SLEEPIN")) fprintf(stderr, "sleepin: %d secs\n", n1);
if (n1 > 0) {
usleep(1000*1000*n1);
}
}
}
extern int dragum(void);
int main(int argc, char* argv[]) {
......@@ -2581,10 +2613,7 @@ int main(int argc, char* argv[]) {
} else if (!strcmp(arg, "-sleepin")) {
int n;
CHECK_ARGC
n = atoi(argv[++i]);
if (n > 0) {
usleep(1000*1000*n);
}
do_sleepin(argv[++i]);
} else if (!strcmp(arg, "-users")) {
CHECK_ARGC
users_list = strdup(argv[++i]);
......
......@@ -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-09-06";
char lastmod[] = "0.9.4 lastmod: 2008-09-14";
/* X display info */
......
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