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.
pull/1/head
runge 16 years ago
parent d5cba7a574
commit 95d7788eb0

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -39,7 +39,8 @@
# and then a 2nd CONNECT to the destination VNC server.) # and then a 2nd CONNECT to the destination VNC server.)
# #
# Use socks://host:port, socks4://host:port, or socks5://host,port # Use socks://host:port, socks4://host:port, or socks5://host,port
# to force usage of a SOCKS proxy. 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' # -showcert Only fetch the certificate using the 'openssl s_client'
# command (openssl(1) must in installed). # command (openssl(1) must in installed).
@ -284,6 +285,19 @@ fi
orig="$1" orig="$1"
shift 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: # check -ssh and -mycert/-verify conflict:
if [ "X$use_ssh" = "X1" -a "X$use_sshssl" = "X" ]; then if [ "X$use_ssh" = "X1" -a "X$use_sshssl" = "X" ]; then
if [ "X$mycert" != "X" -o "X$verify" != "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 use_ssh=1
fi 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: # (possibly) tell the vncviewer to only listen on lo:
if [ "X$reverse" != "X" -a "X$direct_connect" = "X" ]; then if [ "X$reverse" != "X" -a "X$direct_connect" = "X" ]; then
VNCVIEWER_LISTEN_LOCALHOST=1 VNCVIEWER_LISTEN_LOCALHOST=1
@ -472,6 +494,14 @@ final() {
kill -KILL "$stunnel_pid" 2>/dev/null kill -KILL "$stunnel_pid" 2>/dev/null
stunnel_pid="" stunnel_pid=""
fi 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 if [ "X$tail_pid" != "X" ]; then
kill -TERM $tail_pid kill -TERM $tail_pid
fi fi
@ -517,6 +547,19 @@ fi
# a portable, but not absolutely safe, tmp file creator # a portable, but not absolutely safe, tmp file creator
mytmp() { mytmp() {
tf=$1 tf=$1
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 rm -rf "$tf" || exit 1
if [ -d "$tf" ]; then if [ -d "$tf" ]; then
echo "tmp file $tf still exists as a directory." echo "tmp file $tf still exists as a directory."
@ -531,6 +574,10 @@ mytmp() {
touch "$tf" || exit 1 touch "$tf" || exit 1
chmod 600 "$tf" || exit 1 chmod 600 "$tf" || exit 1
rchk rchk
if [ "X$DEBUG_MKTEMP" != "X" ]; then
echo "mytmp-touch: $tf" 1>&2
fi
echo "$tf"
} }
# trick for the undocumented rsh://host:port method. # trick for the undocumented rsh://host:port method.
@ -1099,8 +1146,8 @@ Kecho sproxy1_host=$sproxy1_host
Kecho sproxy1_port=$sproxy1_port Kecho sproxy1_port=$sproxy1_port
Kecho sproxy1_user=$sproxy1_user Kecho sproxy1_user=$sproxy1_user
ptmp="/tmp/ss_vncviewer${RANDOM}.$$.pl" ptmp="/tmp/ss_vncviewer_ssh${RANDOM}.$$.pl"
mytmp "$ptmp" ptmp=`mytmp "$ptmp"`
PPROXY_REMOVE=1; export PPROXY_REMOVE PPROXY_REMOVE=1; export PPROXY_REMOVE
proxy=$pproxy proxy=$pproxy
port_save=$port port_save=$port
@ -1241,8 +1288,8 @@ Kecho proxy=$proxy
rc=$? rc=$?
elif [ "X$getport" != "X" ]; then elif [ "X$getport" != "X" ]; then
tport=/tmp/tport${RANDOM}.$$ tport=/tmp/ss_vncviewer_tport${RANDOM}.$$
mytmp $tport tport=`mytmp "$tport"`
if [ "X$rsh" != "X1" ]; then if [ "X$rsh" != "X1" ]; then
if echo "$ssh_cmd" | grep -w sudo > /dev/null; then if echo "$ssh_cmd" | grep -w sudo > /dev/null; then
@ -1441,7 +1488,7 @@ fi
ptmp="" ptmp=""
if [ "X$proxy" != "X" ]; then if [ "X$proxy" != "X" ]; then
ptmp="/tmp/ss_vncviewer${RANDOM}.$$.pl" ptmp="/tmp/ss_vncviewer${RANDOM}.$$.pl"
mytmp "$ptmp" ptmp=`mytmp "$ptmp"`
PPROXY_REMOVE=1; export PPROXY_REMOVE PPROXY_REMOVE=1; export PPROXY_REMOVE
pcode "$ptmp" pcode "$ptmp"
if [ "X$showcert" != "X1" -a "X$direct_connect" = "X" ]; then if [ "X$showcert" != "X1" -a "X$direct_connect" = "X" ]; then
@ -1484,7 +1531,14 @@ if [ "X$showcert" = "X1" ]; then
fi fi
if [ "X$direct_connect" != "X" ]; then 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 ""
echo "Running viewer for direct connection:" echo "Running viewer for direct connection:"
echo "" echo ""
@ -1508,9 +1562,22 @@ if [ "X$direct_connect" != "X" ]; then
fi fi
echo "" echo ""
if [ "X$ptmp" != "X" ]; then if [ "X$ptmp" != "X" ]; then
PPROXY_LISTEN=$use if [ "X$reverse" = "X" ]; then
export PPROXY_LISTEN 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 & $ptmp &
if [ "X$reverse" = "X" ]; then if [ "X$reverse" = "X" ]; then
#sleep 2 #sleep 2
#echo T sleep 1 #echo T sleep 1
@ -1518,29 +1585,52 @@ if [ "X$direct_connect" != "X" ]; then
fi fi
host="localhost" host="localhost"
disp="$N" disp="$N"
port=`expr $disp + 5900`
fi fi
if [ "X$SSVNC_EXTRA_SLEEP" != "X" ]; then if [ "X$SSVNC_EXTRA_SLEEP" != "X" ]; then
echo "T sleep $SSVNC_EXTRA_SLEEP" echo "T sleep $SSVNC_EXTRA_SLEEP"
sleep $SSVNC_EXTRA_SLEEP sleep $SSVNC_EXTRA_SLEEP
fi fi
if [ "X$reverse" = "X" ]; then if [ "X$reverse" = "X" ]; then
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 trap "final" 0 2 15
echo "" echo ""
$VNCVIEWERCMD "$@" $host:$disp $VNCVIEWERCMD "$@" "$hostdisp"
if [ $? != 0 ]; then if [ $? != 0 ]; then
echo "vncviewer command failed: $?" echo "vncviewer command failed: $?"
if [ "X$secondtry" = "X1" ]; then if [ "X$secondtry" = "X1" ]; then
sleep 2 sleep 2
$VNCVIEWERCMD "$@" $host:$disp $VNCVIEWERCMD "$@" "$hostdisp"
fi fi
fi fi
else else
echo "" echo ""
echo "NOTE: Press Ctrl-C to terminate viewer LISTEN mode." echo "NOTE: Press Ctrl-C to terminate viewer LISTEN mode."
echo "" echo ""
echo "$VNCVIEWERCMD" "$@" -listen $disp
trap "final" 0 2 15 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 "" echo ""
$VNCVIEWERCMD "$@" -listen $disp $VNCVIEWERCMD "$@" -listen $disp
fi fi
@ -1548,12 +1638,13 @@ if [ "X$direct_connect" != "X" ]; then
fi fi
tmp_cfg=/tmp/ss_vncviewer${RANDOM}.$$ 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 no longer invoked via the ssvnc gui (Listen mode).
# make_tcert is for testing only now via -mycert BUILTIN # make_tcert is for testing only now via -mycert BUILTIN
make_tcert() { make_tcert() {
tcert="/tmp/tcert${RANDOM}.$$" tcert="/tmp/ss_vnc_viewer_tcert${RANDOM}.$$"
tcert=`mytmp "$tcert"`
cat > $tcert <<END cat > $tcert <<END
-----BEGIN RSA PRIVATE KEY----- -----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAvkfXxb0wcxgrjV2ziFikjII+ze8iKcTBt47L0GM/c21efelN MIIEowIBAAKCAQEAvkfXxb0wcxgrjV2ziFikjII+ze8iKcTBt47L0GM/c21efelN
@ -1617,7 +1708,7 @@ fi
if [ "X$reverse" = "X" ]; then 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 if [ "X$cert" = "XBUILTIN" ]; then
ttcert=`make_tcert` ttcert=`make_tcert`
cert="cert = $ttcert" cert="cert = $ttcert"

@ -121,7 +121,7 @@ diff -Naur JavaViewer.orig/ButtonPanel.java JavaViewer/ButtonPanel.java
} }
diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
--- JavaViewer.orig/FTPFrame.java 2005-03-15 23:53:14.000000000 -0500 --- JavaViewer.orig/FTPFrame.java 2005-03-15 23:53:14.000000000 -0500
+++ JavaViewer/FTPFrame.java 2008-08-31 14:46:16.000000000 -0400 +++ JavaViewer/FTPFrame.java 2008-09-07 21:12:11.000000000 -0400
@@ -24,8 +24,13 @@ @@ -24,8 +24,13 @@
import java.io.*; import java.io.*;
import java.util.ArrayList; import java.util.ArrayList;
@ -283,11 +283,11 @@ diff -Naur JavaViewer.orig/FTPFrame.java JavaViewer/FTPFrame.java
+ } + }
+ } + }
+ } else { + } else {
+ if (C_drive > 0) { + if (C_drive >= 0) {
+ remoteDrivesComboBox.setSelectedIndex(C_drive); + remoteDrivesComboBox.setSelectedIndex(C_drive);
bFound = true; bFound = true;
+System.out.println("ComboBox: C_drive index: " + C_drive); +System.out.println("ComboBox: C_drive index: " + C_drive);
+ } else if (O_drive > 0) { + } else if (O_drive >= 0) {
+ remoteDrivesComboBox.setSelectedIndex(O_drive); + remoteDrivesComboBox.setSelectedIndex(O_drive);
+ bFound = true; + bFound = true;
+System.out.println("ComboBox: Other_drive index: " + O_drive); +System.out.println("ComboBox: Other_drive index: " + O_drive);
@ -1593,7 +1593,7 @@ diff -Naur JavaViewer.orig/OptionsFrame.java JavaViewer/OptionsFrame.java
choices[shareDesktopIndex].select("Yes"); choices[shareDesktopIndex].select("Yes");
diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
--- JavaViewer.orig/RfbProto.java 2006-05-24 15:14:40.000000000 -0400 --- JavaViewer.orig/RfbProto.java 2006-05-24 15:14:40.000000000 -0400
+++ JavaViewer/RfbProto.java 2008-09-06 21:36:14.000000000 -0400 +++ JavaViewer/RfbProto.java 2008-09-14 10:50:33.000000000 -0400
@@ -31,6 +31,7 @@ @@ -31,6 +31,7 @@
import java.net.Socket; import java.net.Socket;
import java.util.*; import java.util.*;
@ -1738,7 +1738,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
if (contentParam == rfbADrivesList) if (contentParam == rfbADrivesList)
{ {
readFTPMsgDriveList(); readFTPMsgDriveList();
@@ -688,11 +737,11 @@ @@ -688,21 +737,31 @@
// Internally used. Write an Rfb message to the server // Internally used. Write an Rfb message to the server
void writeRfbFileTransferMsg( void writeRfbFileTransferMsg(
@ -1755,7 +1755,16 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
{ {
byte b[] = new byte[12]; byte b[] = new byte[12];
@@ -702,7 +751,10 @@ + if (viewer.dsmActive) {
+ // need to send the rfbFileTransfer msg type twice for the plugin...
+ byte b2[] = new byte[1];
+ b2[0] = (byte) rfbFileTransfer;
+ os.write(b2);
+ }
+
b[0] = (byte) rfbFileTransfer;
b[1] = (byte) contentType;
b[2] = (byte) contentParam;
byte by = 0; byte by = 0;
long c = 0; long c = 0;
@ -1767,7 +1776,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
c = size & 0xFF000000; c = size & 0xFF000000;
by = (byte) (c >>> 24); by = (byte) (c >>> 24);
b[4] = by; b[4] = by;
@@ -729,6 +781,8 @@ @@ -729,6 +788,8 @@
by = (byte) c; by = (byte) c;
b[11] = by; b[11] = by;
os.write(b); os.write(b);
@ -1776,7 +1785,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
if (text != null) if (text != null)
@@ -746,12 +800,12 @@ @@ -746,12 +807,12 @@
//Internally used. Write an rfb message to the server for sending files ONLY //Internally used. Write an rfb message to the server for sending files ONLY
int writeRfbFileTransferMsgForSendFile( int writeRfbFileTransferMsgForSendFile(
@ -1795,7 +1804,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
{ {
File f = new File(source); File f = new File(source);
fis = new FileInputStream(f); fis = new FileInputStream(f);
@@ -768,50 +822,47 @@ @@ -768,50 +829,47 @@
while (bytesRead!=-1) while (bytesRead!=-1)
{ {
@ -1887,7 +1896,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
} }
writeRfbFileTransferMsg(fError ? rfbAbortFileTransfer : rfbEndOfFile, 0, 0, 0, null); writeRfbFileTransferMsg(fError ? rfbAbortFileTransfer : rfbEndOfFile, 0, 0, 0, null);
@@ -831,24 +882,30 @@ @@ -831,24 +889,30 @@
{ {
System.out.print((char) is.readUnsignedByte()); System.out.print((char) is.readUnsignedByte());
} }
@ -1926,7 +1935,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
} }
viewer.ftp.historyComboBox.setSelectedIndex(0); viewer.ftp.historyComboBox.setSelectedIndex(0);
viewer.ftp.enableButtons(); viewer.ftp.enableButtons();
@@ -907,7 +964,7 @@ @@ -907,7 +971,7 @@
//Handles acknowledgement that the file has been deleted on the server //Handles acknowledgement that the file has been deleted on the server
void deleteRemoteFileFeedback() throws IOException void deleteRemoteFileFeedback() throws IOException
{ {
@ -1935,7 +1944,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
int length = is.readInt(); int length = is.readInt();
String f = ""; String f = "";
for (int i = 0; i < length; i++) for (int i = 0; i < length; i++)
@@ -916,7 +973,11 @@ @@ -916,7 +980,11 @@
} }
viewer.ftp.refreshRemoteLocation(); viewer.ftp.refreshRemoteLocation();
@ -1948,7 +1957,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
viewer.ftp.historyComboBox.setSelectedIndex(0); viewer.ftp.historyComboBox.setSelectedIndex(0);
} }
@@ -926,12 +987,7 @@ @@ -926,12 +994,7 @@
try try
{ {
String temp = text; String temp = text;
@ -1962,7 +1971,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
} }
catch (IOException e) catch (IOException e)
{ {
@@ -943,7 +999,7 @@ @@ -943,7 +1006,7 @@
// Handles acknowledgement that the directory has been created on the server // Handles acknowledgement that the directory has been created on the server
void createRemoteDirectoryFeedback() throws IOException void createRemoteDirectoryFeedback() throws IOException
{ {
@ -1971,7 +1980,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
int length = is.readInt(); int length = is.readInt();
String f=""; String f="";
for (int i = 0; i < length; i++) for (int i = 0; i < length; i++)
@@ -951,7 +1007,11 @@ @@ -951,7 +1014,11 @@
f += (char)is.readUnsignedByte(); f += (char)is.readUnsignedByte();
} }
viewer.ftp.refreshRemoteLocation(); viewer.ftp.refreshRemoteLocation();
@ -1984,7 +1993,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
viewer.ftp.historyComboBox.setSelectedIndex(0); viewer.ftp.historyComboBox.setSelectedIndex(0);
} }
@@ -961,12 +1021,7 @@ @@ -961,12 +1028,7 @@
try try
{ {
String temp = text; String temp = text;
@ -1998,7 +2007,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
} }
catch (IOException e) catch (IOException e)
{ {
@@ -979,15 +1034,13 @@ @@ -979,15 +1041,13 @@
{ {
try try
{ {
@ -2018,7 +2027,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
} }
catch (IOException e) catch (IOException e)
{ {
@@ -1004,6 +1057,9 @@ @@ -1004,6 +1064,9 @@
viewer.ftp.disableButtons(); viewer.ftp.disableButtons();
int size = is.readInt(); int size = is.readInt();
int length = is.readInt(); int length = is.readInt();
@ -2028,7 +2037,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
String tempName = ""; String tempName = "";
for (int i = 0; i < length; i++) for (int i = 0; i < length; i++)
@@ -1011,6 +1067,15 @@ @@ -1011,6 +1074,15 @@
tempName += (char) is.readUnsignedByte(); tempName += (char) is.readUnsignedByte();
} }
@ -2044,7 +2053,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
// sf@2004 - Read the high part of file size (not yet in rfbFileTransferMsg for // sf@2004 - Read the high part of file size (not yet in rfbFileTransferMsg for
// backward compatibility reasons...) // backward compatibility reasons...)
int sizeH = is.readInt(); int sizeH = is.readInt();
@@ -1021,7 +1086,16 @@ @@ -1021,7 +1093,16 @@
fileSize=0; fileSize=0;
fileChunkCounter = 0; fileChunkCounter = 0;
String fileName = receivePath; String fileName = receivePath;
@ -2062,7 +2071,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
writeRfbFileTransferMsg(rfbFileHeader, 0, 0, 0, null); writeRfbFileTransferMsg(rfbFileHeader, 0, 0, 0, null);
} }
@@ -1085,7 +1159,13 @@ @@ -1085,7 +1166,13 @@
fAbort = false; fAbort = false;
fFileReceptionError = true; fFileReceptionError = true;
writeRfbFileTransferMsg(rfbAbortFileTransfer, 0, 0, 0, null); writeRfbFileTransferMsg(rfbAbortFileTransfer, 0, 0, 0, null);
@ -2077,7 +2086,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
} }
// sf@2004 - For old FT protocole only // sf@2004 - For old FT protocole only
/* /*
@@ -1104,7 +1184,7 @@ @@ -1104,7 +1191,7 @@
int length = is.readInt(); int length = is.readInt();
fileSize=0; fileSize=0;
fos.close(); fos.close();
@ -2086,7 +2095,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
viewer.ftp.refreshLocalLocation(); viewer.ftp.refreshLocalLocation();
if (fReceptionOk && !fFileReceptionError) if (fReceptionOk && !fFileReceptionError)
{ {
@@ -1132,12 +1212,7 @@ @@ -1132,12 +1219,7 @@
try try
{ {
String temp = text; String temp = text;
@ -2100,7 +2109,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
} }
catch (IOException e) catch (IOException e)
{ {
@@ -1197,11 +1272,80 @@ @@ -1197,11 +1279,80 @@
str += temp; str += temp;
} }
} }
@ -2181,7 +2190,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
//Internally used to receive directory content from server //Internally used to receive directory content from server
//Here, the server sends one file/directory with it's attributes //Here, the server sends one file/directory with it's attributes
void readFTPMsgDirectoryListContent() throws IOException void readFTPMsgDirectoryListContent() throws IOException
@@ -1217,17 +1361,25 @@ @@ -1217,17 +1368,25 @@
dwReserved0, dwReserved0,
dwReserved1; dwReserved1;
long ftCreationTime, ftLastAccessTime, ftLastWriteTime; long ftCreationTime, ftLastAccessTime, ftLastWriteTime;
@ -2210,7 +2219,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
length -= 8; length -= 8;
nFileSizeHigh = is.readInt(); nFileSizeHigh = is.readInt();
length -= 4; length -= 4;
@@ -1253,7 +1405,9 @@ @@ -1253,7 +1412,9 @@
cAlternateFileName = (char) is.readUnsignedByte(); cAlternateFileName = (char) is.readUnsignedByte();
length--; length--;
} }
@ -2221,7 +2230,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
|| dwFileAttributes == 369098752 || dwFileAttributes == 369098752
|| dwFileAttributes == 285212672 || dwFileAttributes == 285212672
|| dwFileAttributes == 271056896 || dwFileAttributes == 271056896
@@ -1263,11 +1417,74 @@ @@ -1263,11 +1424,74 @@
|| dwFileAttributes == 369623040) || dwFileAttributes == 369623040)
{ {
fileName = " [" + fileName + "]"; fileName = " [" + fileName + "]";
@ -2301,7 +2310,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
} }
// a.add(fileName); // a.add(fileName);
@@ -1282,14 +1499,31 @@ @@ -1282,14 +1506,31 @@
// sf@2004 // sf@2004
a.clear(); a.clear();
@ -2336,7 +2345,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
} }
//Internally used to signify the drive requested is not ready //Internally used to signify the drive requested is not ready
@@ -1299,6 +1533,8 @@ @@ -1299,6 +1540,8 @@
System.out.println("Remote Drive unavailable"); System.out.println("Remote Drive unavailable");
viewer.ftp.connectionStatus.setText(" > WARNING - Remote Drive unavailable (possibly restricted access or media not present)"); viewer.ftp.connectionStatus.setText(" > WARNING - Remote Drive unavailable (possibly restricted access or media not present)");
viewer.ftp.remoteStatus.setText("WARNING: Remote Drive unavailable"); viewer.ftp.remoteStatus.setText("WARNING: Remote Drive unavailable");
@ -2345,7 +2354,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
} }
//Call this method to request the list of drives on the server. //Call this method to request the list of drives on the server.
@@ -1306,12 +1542,11 @@ @@ -1306,12 +1549,11 @@
{ {
try try
{ {
@ -2363,7 +2372,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
} }
catch (IOException e) catch (IOException e)
{ {
@@ -1355,21 +1590,21 @@ @@ -1355,21 +1597,21 @@
int h, int h,
boolean incremental) boolean incremental)
throws IOException { throws IOException {
@ -3983,7 +3992,7 @@ diff -Naur JavaViewer.orig/VncCanvas.java JavaViewer/VncCanvas.java
result = 0; // Transparent pixel result = 0; // Transparent pixel
diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
--- JavaViewer.orig/VncViewer.java 2006-05-24 15:14:40.000000000 -0400 --- JavaViewer.orig/VncViewer.java 2006-05-24 15:14:40.000000000 -0400
+++ JavaViewer/VncViewer.java 2008-08-27 10:46:27.000000000 -0400 +++ JavaViewer/VncViewer.java 2008-09-14 10:36:37.000000000 -0400
@@ -80,11 +80,11 @@ @@ -80,11 +80,11 @@
GridBagLayout gridbag; GridBagLayout gridbag;
ButtonPanel buttonPanel; ButtonPanel buttonPanel;
@ -4007,7 +4016,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
String passwordParam; String passwordParam;
String encPasswordParam; String encPasswordParam;
boolean showControls; boolean showControls;
@@ -115,28 +115,66 @@ @@ -115,28 +115,67 @@
int i; int i;
// mslogon support 2 end // mslogon support 2 end
@ -4027,6 +4036,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
+boolean delayAuthPanel; +boolean delayAuthPanel;
+boolean ftpOnly; +boolean ftpOnly;
+boolean graftFtp; +boolean graftFtp;
+boolean dsmActive;
+ +
+boolean gotAuth; +boolean gotAuth;
+int authGot; +int authGot;
@ -4080,7 +4090,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
// authenticator = new AuthPanel(false); // mslogon support : go to connectAndAuthenticate() // authenticator = new AuthPanel(false); // mslogon support : go to connectAndAuthenticate()
if (RecordingFrame.checkSecurity()) if (RecordingFrame.checkSecurity())
rec = new RecordingFrame(this); rec = new RecordingFrame(this);
@@ -147,10 +185,11 @@ @@ -147,10 +186,11 @@
cursorUpdatesDef = null; cursorUpdatesDef = null;
eightBitColorsDef = null; eightBitColorsDef = null;
@ -4094,7 +4104,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
rfbThread = new Thread(this); rfbThread = new Thread(this);
rfbThread.start(); rfbThread.start();
} }
@@ -186,6 +225,30 @@ @@ -186,6 +226,30 @@
gbc.weightx = 1.0; gbc.weightx = 1.0;
gbc.weighty = 1.0; gbc.weighty = 1.0;
@ -4125,7 +4135,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
// Add ScrollPanel to applet mode // Add ScrollPanel to applet mode
// Create a panel which itself is resizeable and can hold // Create a panel which itself is resizeable and can hold
@@ -286,6 +349,24 @@ @@ -286,6 +350,24 @@
void connectAndAuthenticate() throws Exception { void connectAndAuthenticate() throws Exception {
@ -4150,7 +4160,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
// If "ENCPASSWORD" parameter is set, decrypt the password into // If "ENCPASSWORD" parameter is set, decrypt the password into
// the passwordParam string. // the passwordParam string.
@@ -336,7 +417,22 @@ @@ -336,7 +418,22 @@
// //
@ -4174,7 +4184,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
authenticator = new AuthPanel(mslogon); authenticator = new AuthPanel(mslogon);
@@ -390,6 +486,10 @@ @@ -390,6 +487,10 @@
break; break;
//mslogon support end //mslogon support end
@ -4185,7 +4195,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
// Retry on authentication failure. // Retry on authentication failure.
authenticator.retry(); authenticator.retry();
} }
@@ -405,9 +505,11 @@ @@ -405,9 +506,11 @@
void prologueDetectAuthProtocol() throws Exception { void prologueDetectAuthProtocol() throws Exception {
@ -4199,7 +4209,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
System.out.println("RFB server supports protocol version " + System.out.println("RFB server supports protocol version " +
rfb.serverMajor + "." + rfb.serverMinor); rfb.serverMajor + "." + rfb.serverMinor);
@@ -431,16 +533,36 @@ @@ -431,16 +534,36 @@
boolean tryAuthenticate(String us, String pw) throws Exception { boolean tryAuthenticate(String us, String pw) throws Exception {
@ -4242,7 +4252,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
switch (authScheme) { switch (authScheme) {
@@ -629,6 +751,10 @@ @@ -629,6 +752,10 @@
void doProtocolInitialisation() throws IOException { void doProtocolInitialisation() throws IOException {
@ -4253,7 +4263,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
rfb.writeClientInit(); rfb.writeClientInit();
rfb.readServerInit(); rfb.readServerInit();
@@ -775,8 +901,25 @@ @@ -775,8 +902,25 @@
} }
} }
@ -4281,7 +4291,7 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
if (inAnApplet) { if (inAnApplet) {
str = readParameter("Open New Window", false); str = readParameter("Open New Window", false);
@@ -804,6 +947,90 @@ @@ -804,6 +948,95 @@
deferScreenUpdates = readIntParameter("Defer screen updates", 20); deferScreenUpdates = readIntParameter("Defer screen updates", 20);
deferCursorUpdates = readIntParameter("Defer cursor updates", 10); deferCursorUpdates = readIntParameter("Defer cursor updates", 10);
deferUpdateRequests = readIntParameter("Defer update requests", 50); deferUpdateRequests = readIntParameter("Defer update requests", 50);
@ -4363,6 +4373,11 @@ diff -Naur JavaViewer.orig/VncViewer.java JavaViewer/VncViewer.java
+ if (str != null && str.equalsIgnoreCase("Yes")) { + if (str != null && str.equalsIgnoreCase("Yes")) {
+ graftFtp = true; + graftFtp = true;
+ } + }
+ dsmActive = false;
+ str = readParameter("dsmActive", false);
+ if (str != null && str.equalsIgnoreCase("Yes")) {
+ dsmActive = true;
+ }
+ delayAuthPanel = false; + delayAuthPanel = false;
+ str = readParameter("delayAuthPanel", false); + str = readParameter("delayAuthPanel", false);
+ if (str != null && str.equalsIgnoreCase("Yes")) { + if (str != null && str.equalsIgnoreCase("Yes")) {

@ -1,3 +1,8 @@
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> 2008-09-06 Karl Runge <runge@karlrunge.com>
* x11vnc: kill gui_pid on exit in -connect/-connect_or_exit mode. * x11vnc: kill gui_pid on exit in -connect/-connect_or_exit mode.
-grablocal n experiment (not compiled by default). -macuskbd -grablocal n experiment (not compiled by default). -macuskbd

File diff suppressed because it is too large Load Diff

@ -667,24 +667,22 @@ void do_gui(char *opts, int sleep) {
pid_t parent = getpid(); pid_t parent = getpid();
if (icon_mode) { if (icon_mode) {
char tf[100]; char tf[] = "/tmp/x11vnc.tray.XXXXXX";
double dn = dnow(); int fd;
struct stat sbuf; struct stat sbuf;
/* FIXME */
dn = dn - ((int) dn); fd = mkstemp(tf);
sprintf(tf, "/tmp/x11vnc.tray%d%d", (int) (1000000*dn), if (fd < 0) {
(int) getpid());
unlink(tf);
/* race begins.. */
if (stat(tf, &sbuf) == 0) {
icon_mode = 0; icon_mode = 0;
} else { } else {
close(fd);
icon_mode_fh = fopen(tf, "w"); icon_mode_fh = fopen(tf, "w");
if (! icon_mode_fh) { if (! icon_mode_fh) {
icon_mode = 0; icon_mode = 0;
} else { } else {
chmod(tf, 0400); chmod(tf, 0400);
icon_mode_file = strdup(tf); 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");
fprintf(icon_mode_fh, "none\n"); fprintf(icon_mode_fh, "none\n");
fflush(icon_mode_fh); fflush(icon_mode_fh);

@ -360,9 +360,14 @@ void print_help(int mode) {
"\n" "\n"
"-timeout n Exit unless a client connects within the first n seconds\n" "-timeout n Exit unless a client connects within the first n seconds\n"
" after startup.\n" " after startup.\n"
"\n"
"-sleepin n At startup sleep n seconds before proceeding (e.g. to\n" "-sleepin n At startup sleep n seconds before proceeding (e.g. to\n"
" allow redirs and listening clients to start up)\n" " allow redirs and listening clients to start up)\n"
"\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" "-inetd Launched by inetd(8): stdio instead of listening socket.\n"
" Note: if you are not redirecting stderr to a log file\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" " (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" " Set to zero to poll forever. Set to a negative value\n"
" to use the builtin setting.\n" " to use the builtin setting.\n"
"\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" "-sslnofail Exit at the first SSL connection failure. Useful when\n"
" scripting SSL connections (e.g. x11vnc is started via\n" " scripting SSL connections (e.g. x11vnc is started via\n"
" ssh) and you do not want x11vnc waiting around for more\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" " where a Keysym is bound to multiple keys (e.g. \"<\" + \">\"\n"
" and \",\" + \"<\" keys). Default: %s\n" " and \",\" + \"<\" keys). Default: %s\n"
"\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" " On some HP-UX systems it is been noted that they have\n"
" an odd keymapping where a single keycode will have a\n" " an odd keymapping where a single keycode will have a\n"
" keysym, e.g. \"#\", up to three times. You can check\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: - Support for UltraVNC Single Click operation. (both unencrypted:
SC I, and SSL encrypted: SC III) 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..." - Instead of hostname:display one can also supply "exec=command args..."
to connect the viewer to the stdio of an external command to connect the viewer to the stdio of an external command
(e.g. stunnel or socat) rather than using a TCP/IP socket. (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.) # and then a 2nd CONNECT to the destination VNC server.)
# #
# Use socks://host:port, socks4://host:port, or socks5://host,port # Use socks://host:port, socks4://host:port, or socks5://host,port
# to force usage of a SOCKS proxy. 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' # -showcert Only fetch the certificate using the 'openssl s_client'
# command (openssl(1) must in installed). # command (openssl(1) must in installed).
@ -284,6 +285,19 @@ fi
orig="$1" orig="$1"
shift 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: # check -ssh and -mycert/-verify conflict:
if [ "X$use_ssh" = "X1" -a "X$use_sshssl" = "X" ]; then if [ "X$use_ssh" = "X1" -a "X$use_sshssl" = "X" ]; then
if [ "X$mycert" != "X" -o "X$verify" != "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 use_ssh=1
fi 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: # (possibly) tell the vncviewer to only listen on lo:
if [ "X$reverse" != "X" -a "X$direct_connect" = "X" ]; then if [ "X$reverse" != "X" -a "X$direct_connect" = "X" ]; then
VNCVIEWER_LISTEN_LOCALHOST=1 VNCVIEWER_LISTEN_LOCALHOST=1
@ -472,6 +494,14 @@ final() {
kill -KILL "$stunnel_pid" 2>/dev/null kill -KILL "$stunnel_pid" 2>/dev/null
stunnel_pid="" stunnel_pid=""
fi 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 if [ "X$tail_pid" != "X" ]; then
kill -TERM $tail_pid kill -TERM $tail_pid
fi fi
@ -517,6 +547,19 @@ fi
# a portable, but not absolutely safe, tmp file creator # a portable, but not absolutely safe, tmp file creator
mytmp() { mytmp() {
tf=$1 tf=$1
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 rm -rf "$tf" || exit 1
if [ -d "$tf" ]; then if [ -d "$tf" ]; then
echo "tmp file $tf still exists as a directory." echo "tmp file $tf still exists as a directory."
@ -531,6 +574,10 @@ mytmp() {
touch "$tf" || exit 1 touch "$tf" || exit 1
chmod 600 "$tf" || exit 1 chmod 600 "$tf" || exit 1
rchk rchk
if [ "X$DEBUG_MKTEMP" != "X" ]; then
echo "mytmp-touch: $tf" 1>&2
fi
echo "$tf"
} }
# trick for the undocumented rsh://host:port method. # trick for the undocumented rsh://host:port method.
@ -1099,8 +1146,8 @@ Kecho sproxy1_host=$sproxy1_host
Kecho sproxy1_port=$sproxy1_port Kecho sproxy1_port=$sproxy1_port
Kecho sproxy1_user=$sproxy1_user Kecho sproxy1_user=$sproxy1_user
ptmp="/tmp/ss_vncviewer${RANDOM}.$$.pl" ptmp="/tmp/ss_vncviewer_ssh${RANDOM}.$$.pl"
mytmp "$ptmp" ptmp=`mytmp "$ptmp"`
PPROXY_REMOVE=1; export PPROXY_REMOVE PPROXY_REMOVE=1; export PPROXY_REMOVE
proxy=$pproxy proxy=$pproxy
port_save=$port port_save=$port
@ -1241,8 +1288,8 @@ Kecho proxy=$proxy
rc=$? rc=$?
elif [ "X$getport" != "X" ]; then elif [ "X$getport" != "X" ]; then
tport=/tmp/tport${RANDOM}.$$ tport=/tmp/ss_vncviewer_tport${RANDOM}.$$
mytmp $tport tport=`mytmp "$tport"`
if [ "X$rsh" != "X1" ]; then if [ "X$rsh" != "X1" ]; then
if echo "$ssh_cmd" | grep -w sudo > /dev/null; then if echo "$ssh_cmd" | grep -w sudo > /dev/null; then
@ -1441,7 +1488,7 @@ fi
ptmp="" ptmp=""
if [ "X$proxy" != "X" ]; then if [ "X$proxy" != "X" ]; then
ptmp="/tmp/ss_vncviewer${RANDOM}.$$.pl" ptmp="/tmp/ss_vncviewer${RANDOM}.$$.pl"
mytmp "$ptmp" ptmp=`mytmp "$ptmp"`
PPROXY_REMOVE=1; export PPROXY_REMOVE PPROXY_REMOVE=1; export PPROXY_REMOVE
pcode "$ptmp" pcode "$ptmp"
if [ "X$showcert" != "X1" -a "X$direct_connect" = "X" ]; then if [ "X$showcert" != "X1" -a "X$direct_connect" = "X" ]; then
@ -1484,7 +1531,14 @@ if [ "X$showcert" = "X1" ]; then
fi fi
if [ "X$direct_connect" != "X" ]; then 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 ""
echo "Running viewer for direct connection:" echo "Running viewer for direct connection:"
echo "" echo ""
@ -1508,9 +1562,22 @@ if [ "X$direct_connect" != "X" ]; then
fi fi
echo "" echo ""
if [ "X$ptmp" != "X" ]; then if [ "X$ptmp" != "X" ]; then
PPROXY_LISTEN=$use if [ "X$reverse" = "X" ]; then
export PPROXY_LISTEN 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 & $ptmp &
if [ "X$reverse" = "X" ]; then if [ "X$reverse" = "X" ]; then
#sleep 2 #sleep 2
#echo T sleep 1 #echo T sleep 1
@ -1518,29 +1585,52 @@ if [ "X$direct_connect" != "X" ]; then
fi fi
host="localhost" host="localhost"
disp="$N" disp="$N"
port=`expr $disp + 5900`
fi fi
if [ "X$SSVNC_EXTRA_SLEEP" != "X" ]; then if [ "X$SSVNC_EXTRA_SLEEP" != "X" ]; then
echo "T sleep $SSVNC_EXTRA_SLEEP" echo "T sleep $SSVNC_EXTRA_SLEEP"
sleep $SSVNC_EXTRA_SLEEP sleep $SSVNC_EXTRA_SLEEP
fi fi
if [ "X$reverse" = "X" ]; then if [ "X$reverse" = "X" ]; then
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 trap "final" 0 2 15
echo "" echo ""
$VNCVIEWERCMD "$@" $host:$disp $VNCVIEWERCMD "$@" "$hostdisp"
if [ $? != 0 ]; then if [ $? != 0 ]; then
echo "vncviewer command failed: $?" echo "vncviewer command failed: $?"
if [ "X$secondtry" = "X1" ]; then if [ "X$secondtry" = "X1" ]; then
sleep 2 sleep 2
$VNCVIEWERCMD "$@" $host:$disp $VNCVIEWERCMD "$@" "$hostdisp"
fi fi
fi fi
else else
echo "" echo ""
echo "NOTE: Press Ctrl-C to terminate viewer LISTEN mode." echo "NOTE: Press Ctrl-C to terminate viewer LISTEN mode."
echo "" echo ""
echo "$VNCVIEWERCMD" "$@" -listen $disp
trap "final" 0 2 15 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 "" echo ""
$VNCVIEWERCMD "$@" -listen $disp $VNCVIEWERCMD "$@" -listen $disp
fi fi
@ -1548,12 +1638,13 @@ if [ "X$direct_connect" != "X" ]; then
fi fi
tmp_cfg=/tmp/ss_vncviewer${RANDOM}.$$ 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 no longer invoked via the ssvnc gui (Listen mode).
# make_tcert is for testing only now via -mycert BUILTIN # make_tcert is for testing only now via -mycert BUILTIN
make_tcert() { make_tcert() {
tcert="/tmp/tcert${RANDOM}.$$" tcert="/tmp/ss_vnc_viewer_tcert${RANDOM}.$$"
tcert=`mytmp "$tcert"`
cat > $tcert <<END cat > $tcert <<END
-----BEGIN RSA PRIVATE KEY----- -----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAvkfXxb0wcxgrjV2ziFikjII+ze8iKcTBt47L0GM/c21efelN MIIEowIBAAKCAQEAvkfXxb0wcxgrjV2ziFikjII+ze8iKcTBt47L0GM/c21efelN
@ -1617,7 +1708,7 @@ fi
if [ "X$reverse" = "X" ]; then 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 if [ "X$cert" = "XBUILTIN" ]; then
ttcert=`make_tcert` ttcert=`make_tcert`
cert="cert = $ttcert" cert="cert = $ttcert"

File diff suppressed because it is too large Load Diff

@ -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. run \fBssvnc\fR and use the GUI that starts up.
However, as shortcuts you can supply a VNC host:display (or host:port) 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" 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 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. automatically load that profile and then connect to its server.

@ -194,6 +194,9 @@ Note: F9 is shortcut to Toggle FullScreen mode.
.TP .TP
Note: In -listen mode set the env var. SSVNC_MULTIPLE_LISTEN=1 Note: In -listen mode set the env var. SSVNC_MULTIPLE_LISTEN=1
to allow more than one incoming VNC server at a time. 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 .TP
Note: If the host:port is specified as "exec=command args..." Note: If the host:port is specified as "exec=command args..."
then instead of making a TCP/IP socket connection to the 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 Note: If the host:port contains a '/' it is interpreted as a
unix-domain socket (AF_LOCAL insead of AF_INET) unix-domain socket (AF_LOCAL insead of AF_INET)
.TP .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 \fB\-use64\fR
In \fB\-bgr233\fR mode, use 64 colors instead of 256. In \fB\-bgr233\fR mode, use 64 colors instead of 256.
.TP .TP
@ -290,8 +301,8 @@ Disable use of MIT shared memory extension (not recommended)
Do the UltraVNC chat in the terminal vncviewer is in Do the UltraVNC chat in the terminal vncviewer is in
instead of in an independent window. instead of in an independent window.
.TP .TP
\fB\-unixpw\fR \fB\-unixpw\fR \fIstr\fR
str Useful for logging into x11vnc in \fB\-unixpw\fR mode. "str" is a Useful for logging into x11vnc in \fB\-unixpw\fR mode. "str" is a
string that allows many ways to enter the Unix Username string that allows many ways to enter the Unix Username
and Unix Password. These characters: username, newline, and Unix Password. These characters: username, newline,
password, newline are sent to the VNC server after any VNC 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 it is taken as username@password. Otherwise, the program
exits with an error. Got all that? exits with an error. Got all that?
.TP .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" here: http://www.uvnc.com/addons/repeater.html. The "str"
is the ID string to be sent to the repeater. E.g. ID:1234 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 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 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 using -repeater, the host:dpy on the cmdline is the repeater
server, NOT the VNC server. The repeater will connect you. server, NOT the VNC server. The repeater will connect you.
Example: vncviewer ... -repeater ID:3333 repeat.host:5900 Example: vncviewer ... -repeater ID:3333 repeat.host:5900
Example: vncviewer ... -repeater vhost:0 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 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 keybindings and Popup menu) Then point to the file via
XENVIRONMENT or XAPPLRESDIR. XENVIRONMENT or XAPPLRESDIR.
@ -568,8 +607,8 @@ local TCP port number;
.B %R .B %R
remote TCP port number. remote TCP port number.
.SH SEE ALSO .SH SEE ALSO
\fBvncserver\fR(1), \fBXvnc\fR(1), \fBvncpasswd\fR(1), \fBvncserver\fR(1), \fBx11vnc\fR(1), \fBssvnc\fR(1), \fBXvnc\fR(1), \fBvncpasswd\fR(1),
\fBvncconnect\fR(1), \fBssh\fR(1) \fBvncconnect\fR(1), \fBssh\fR(1), http://www.karlrunge.com/x11vnc, http://www.karlrunge.com/x11vnc/ssvnc.html
.SH AUTHORS .SH AUTHORS
Original VNC was developed in AT&T Laboratories Cambridge. TightVNC Original VNC was developed in AT&T Laboratories Cambridge. TightVNC
additions was implemented by Constantin Kaplinsky. Many other people additions was implemented by Constantin Kaplinsky. Many other people
@ -584,3 +623,5 @@ Terran Melconian <terran@consistent.org>,
Tim Waugh <twaugh@redhat.com>, Tim Waugh <twaugh@redhat.com>,
.br .br
Constantin Kaplinsky <const@ce.cctpu.edu.ru> 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' 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 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.* ls -l ssvnc*-$vers.*
echo
########################################### ###########################################
dest=./t.windows_only dest=./t.windows_only
@ -84,3 +87,18 @@ rm -f $zip
ls -l $zip ls -l $zip
rm -rf $dest 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")) { if (getenv("SSL_DEBUG")) {
db = atoi(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); if (db) fprintf(stderr, "ssl_init: %d/%d\n", s_in, s_out);
ssl = SSL_new(ctx); ssl = SSL_new(ctx);

@ -830,6 +830,52 @@ char find_display[] =
" pslist=`echo \"$psout\" | awk '{print $2}'`\n" " pslist=`echo \"$psout\" | awk '{print $2}'`\n"
"fi\n" "fi\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"
"\n"
"# this mode is to try to grab a display manager (gdm, kdm, xdm...) display\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" "# 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" "# -auth line in the X/Xorg commandline.\n"
@ -845,39 +891,38 @@ char find_display[] =
" #\n" " #\n"
" env XAUTHORITY=\"$xa\" xdpyinfo -display \"$da\" >/dev/null 2>&1\n" " env XAUTHORITY=\"$xa\" xdpyinfo -display \"$da\" >/dev/null 2>&1\n"
" if [ $? = 0 ]; then\n" " if [ $? = 0 ]; then\n"
" env XAUTHORITY=/dev/null xdpyinfo -display \"$da\" >/dev/null 2>&1\n" " env XAUTHORITY=/dev/null xdpyinfo -display \"$da\" >/dev/null 2>&1\n"
" if [ $? != 0 ]; then\n" " if [ $? != 0 ]; then\n"
" y=`prdpy $da`\n" " y=`prdpy $da`\n"
" echo \"DISPLAY=$y\"\n" " echo \"DISPLAY=$y\"\n"
" if [ \"X$showxauth\" != \"X\" ]; then\n" " if [ \"X$showxauth\" != \"X\" ]; then\n"
" # copy the cookie:\n" " # copy the cookie:\n"
" cook=`xauth -f \"$xa\" list | head -n 1 | awk '{print $NF}'`\n" " cook=`xauth -f \"$xa\" list | head -n 1 | awk '{print $NF}'`\n"
" tf=$HOME/.xat.$$\n" " xtf=$HOME/.xat.$$\n"
" rm -f $tf\n" " xtf=`mytmp \"$xtf\"`\n"
" if [ -f $tf ]; then\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" " exit 1\n"
" fi\n" " fi\n"
" touch $tf 2>/dev/null\n" " touch $xtf 2>/dev/null\n"
" chmod 600 $tf 2>/dev/null\n" " chmod 600 $xtf 2>/dev/null\n"
" if [ ! -f $tf ]; then\n" " if [ ! -f $xtf ]; then\n"
" tf=/tmp/.xat.$$\n" " exit 1\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"
" fi\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" " fi\n"
" # DONE\n" " xauth -f $xtf add \"$da\" . $cook\n"
" exit 0\n" " xauth -f $xtf extract - \"$da\" 2>/dev/null\n"
" rm -f $xtf\n"
" fi\n" " fi\n"
" # DONE\n"
" exit 0\n"
" fi\n"
" fi\n" " fi\n"
" fi\n" " fi\n"
" done\n" " done\n"
@ -1459,6 +1504,51 @@ char create_display[] =
" redir_daemon=`echo \"$redir_daemon\" | sed -e 's/^,*//'`\n" " redir_daemon=`echo \"$redir_daemon\" | sed -e 's/^,*//'`\n"
"}\n" "}\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" "server() {\n"
" authfile=`auth`\n" " authfile=`auth`\n"
" sess=`findsession`\n" " sess=`findsession`\n"
@ -1475,10 +1565,7 @@ char create_display[] =
" rmf=\"/nosuch\"\n" " rmf=\"/nosuch\"\n"
" if echo \"$sess\" | grep '[ ]' > /dev/null; then\n" " if echo \"$sess\" | grep '[ ]' > /dev/null; then\n"
" stmp=/tmp/.cd$$`random`\n" " stmp=/tmp/.cd$$`random`\n"
" rm -f $stmp\n" " stmp=`mytmp \"$stmp\"`\n"
" if [ -f $stmp ]; then\n"
" exit 1\n"
" fi\n"
" touch $stmp\n" " touch $stmp\n"
" chmod 755 $stmp || exit 1\n" " chmod 755 $stmp || exit 1\n"
" echo \"#!/bin/sh\" > $stmp\n" " echo \"#!/bin/sh\" > $stmp\n"
@ -1490,10 +1577,7 @@ char create_display[] =
" fi\n" " fi\n"
" if [ \"X$have_root\" != \"X\" -a \"X$USER\" != \"Xroot\" ]; then\n" " if [ \"X$have_root\" != \"X\" -a \"X$USER\" != \"Xroot\" ]; then\n"
" ctmp=/tmp/.xat$$`random`\n" " ctmp=/tmp/.xat$$`random`\n"
" rm -f $ctmp\n" " ctmp=`mytmp \"$ctmp\"`\n"
" if [ -f $ctmp ]; then\n"
" exit 1\n"
" fi\n"
" touch $ctmp\n" " touch $ctmp\n"
" chmod 644 $ctmp || exit 1\n" " chmod 644 $ctmp || exit 1\n"
" $have_xauth -f $authfile nextract - :$N > $ctmp\n" " $have_xauth -f $authfile nextract - :$N > $ctmp\n"
@ -1799,10 +1883,7 @@ char create_display[] =
" exit 1\n" " exit 1\n"
" fi\n" " fi\n"
" tmp=/tmp/.xas$$`random`\n" " tmp=/tmp/.xas$$`random`\n"
" rm -f $tmp\n" " tmp=`mytmp \"$tmp\"`\n"
" if [ -f $tmp ]; then\n"
" exit 1\n"
" fi\n"
" touch $tmp\n" " touch $tmp\n"
" chmod 600 $tmp || exit 1\n" " chmod 600 $tmp || exit 1\n"
" if [ ! -f $tmp ]; then\n" " if [ ! -f $tmp ]; then\n"

@ -6275,10 +6275,17 @@ proc restart_everything {gui_mode} {
exit 1; exit 1;
} }
set tmp "/tmp/x11vnc[pid]" set tmp "/tmp/x11vnc[pid]"
file delete -force $tmp append tmp [clock clicks]
if {[file exists $tmp]} { set tmp2 ""
puts stderr "failure in restart_everything." catch {set tmp2 [exec mktemp $tmp.XXXXXX 2>/dev/null]}
exit 1; 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"] set fh [open $tmp "a"]
if {![file owned $tmp]} { if {![file owned $tmp]} {

@ -6286,10 +6286,17 @@ char gui_code[] = "";
" exit 1;\n" " exit 1;\n"
" }\n" " }\n"
" set tmp \"/tmp/x11vnc[pid]\"\n" " set tmp \"/tmp/x11vnc[pid]\"\n"
" file delete -force $tmp\n" " append tmp [clock clicks]\n"
" if {[file exists $tmp]} {\n" " set tmp2 \"\"\n"
" puts stderr \"failure in restart_everything.\"\n" " catch {set tmp2 [exec mktemp $tmp.XXXXXX 2>/dev/null]}\n"
" exit 1;\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" " }\n"
" set fh [open $tmp \"a\"]\n" " set fh [open $tmp \"a\"]\n"
" if {![file owned $tmp]} {\n" " if {![file owned $tmp]} {\n"

@ -7656,6 +7656,10 @@ void xselectinput(Window w, unsigned long evmask, int sync) {
XErrorHandler old_handler1; XErrorHandler old_handler1;
XIOErrorHandler old_handler2; XIOErrorHandler old_handler2;
if (macosx_console || !dpy) {
return;
}
old_handler1 = XSetErrorHandler(trap_xerror); old_handler1 = XSetErrorHandler(trap_xerror);
old_handler2 = XSetIOErrorHandler(trap_xioerror); old_handler2 = XSetIOErrorHandler(trap_xioerror);
trapped_xerror = 0; 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(); last_sched_bs = dnow();
} }
#if !NO_X11 #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); atom_XROOTPMAP_ID = XInternAtom(dpy, "_XROOTPMAP_ID", True);
last_pixmap = now; last_pixmap = now;
} }

@ -399,8 +399,23 @@ double rnow(void) {
} }
double rfac(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); f = f / ((double) RAND_MAX);
return f; return f;
} }

@ -2,7 +2,7 @@
.TH X11VNC "1" "September 2008" "x11vnc " "User Commands" .TH X11VNC "1" "September 2008" "x11vnc " "User Commands"
.SH NAME .SH NAME
x11vnc - allow VNC connections to real X11 displays 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 .SH SYNOPSIS
.B x11vnc .B x11vnc
[OPTION]... [OPTION]...
@ -423,6 +423,10 @@ after startup.
.IP .IP
At startup sleep n seconds before proceeding (e.g. to At startup sleep n seconds before proceeding (e.g. to
allow redirs and listening clients to start up) 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 .PP
\fB-inetd\fR \fB-inetd\fR
.IP .IP
@ -1485,6 +1489,10 @@ talking and the connection is dropped after the default
timeout (25s for about the first minute, 43200s later). timeout (25s for about the first minute, 43200s later).
Set to zero to poll forever. Set to a negative value Set to zero to poll forever. Set to a negative value
to use the builtin setting. 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 .PP
\fB-sslnofail\fR \fB-sslnofail\fR
.IP .IP
@ -2528,6 +2536,9 @@ identical keyboards). Also useful in resolving cases
where a Keysym is bound to multiple keys (e.g. "<" + ">" where a Keysym is bound to multiple keys (e.g. "<" + ">"
and "," + "<" keys). Default: \fB-modtweak\fR and "," + "<" keys). Default: \fB-modtweak\fR
.IP .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 On some HP-UX systems it is been noted that they have
an odd keymapping where a single keycode will have a an odd keymapping where a single keycode will have a
keysym, e.g. "#", up to three times. You can check keysym, e.g. "#", up to three times. You can check

@ -2293,6 +2293,38 @@ char msg2[] =
&& !query_cmd && !remote_cmd && !unixpw && !got_gui_pw \ && !query_cmd && !remote_cmd && !unixpw && !got_gui_pw \
&& ! ssl_verify && !inetd && !terminal_services_daemon) && ! 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); extern int dragum(void);
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
@ -2581,10 +2613,7 @@ int main(int argc, char* argv[]) {
} else if (!strcmp(arg, "-sleepin")) { } else if (!strcmp(arg, "-sleepin")) {
int n; int n;
CHECK_ARGC CHECK_ARGC
n = atoi(argv[++i]); do_sleepin(argv[++i]);
if (n > 0) {
usleep(1000*1000*n);
}
} else if (!strcmp(arg, "-users")) { } else if (!strcmp(arg, "-users")) {
CHECK_ARGC CHECK_ARGC
users_list = strdup(argv[++i]); users_list = strdup(argv[++i]);

@ -15,7 +15,7 @@ int xtrap_base_event_type = 0;
int xdamage_base_event_type = 0; int xdamage_base_event_type = 0;
/* date +'lastmod: %Y-%m-%d' */ /* 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 */ /* X display info */

Loading…
Cancel
Save