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.)
#
# 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
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"

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

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.
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"
@ -852,28 +898,27 @@ char find_display[] =
" 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"
" 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"
" 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"
" touch $xtf 2>/dev/null\n"
" chmod 600 $xtf 2>/dev/null\n"
" if [ ! -f $xtf ]; then\n"
" exit 1\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"
" 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"
@ -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,11 +6275,18 @@ proc restart_everything {gui_mode} {
exit 1;
}
set tmp "/tmp/x11vnc[pid]"
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]} {
puts stderr "failure in restart_everything."

@ -6286,11 +6286,18 @@ char gui_code[] = "";
" exit 1;\n"
" }\n"
" set tmp \"/tmp/x11vnc[pid]\"\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"
" puts stderr \"failure in restart_everything.\"\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 */

Loading…
Cancel
Save