Commit 54237e33 authored by runge's avatar runge

x11vnc: COLUMNS=256 and other fixes to find/create scripts. More ratecheck.

parent 1df143d1
2007-09-26 Karl Runge <runge@karlrunge.com>
* x11vnc: COLUMNS=256 to find/create scripts. More ratecheck.
2007-09-14 Karl Runge <runge@karlrunge.com>
* x11vnc: Add -sshxdmsvc. Fix find_display for inetd. Improve
-allinput method; env CHECK_RATE to watch for FBUR build up
(i.e. JFVNC).
2007-09-11 Karl Runge <runge@karlrunge.com> 2007-09-11 Karl Runge <runge@karlrunge.com>
* x11vnc: fix wireframe crash under -clip. Add -redirect for * x11vnc: fix wireframe crash under -clip. Add -redirect for
VNC redir. -rawfb nullbig, randbig, solid, swirl, etc. VNC redir. -rawfb nullbig, randbig, solid, swirl, etc.
......
This diff is collapsed.
...@@ -1934,10 +1934,10 @@ void read_x11vnc_remote_prop(int nomsg) { ...@@ -1934,10 +1934,10 @@ void read_x11vnc_remote_prop(int nomsg) {
} else if (strstr(x11vnc_remote_str, "cmd=") && } else if (strstr(x11vnc_remote_str, "cmd=") &&
strstr(x11vnc_remote_str, "passwd")) { strstr(x11vnc_remote_str, "passwd")) {
rfbLog("read X11VNC_REMOTE: *\n"); rfbLog("read X11VNC_REMOTE: *\n");
} else if (strlen(x11vnc_remote_str) > 38) { } else if (strlen(x11vnc_remote_str) > 36) {
char trim[100]; char trim[100];
trim[0] = '\0'; trim[0] = '\0';
strncat(trim, x11vnc_remote_str, 38); strncat(trim, x11vnc_remote_str, 36);
rfbLog("read X11VNC_REMOTE: %s ...\n", trim); rfbLog("read X11VNC_REMOTE: %s ...\n", trim);
} else { } else {
......
...@@ -782,22 +782,42 @@ void print_help(int mode) { ...@@ -782,22 +782,42 @@ void print_help(int mode) {
" FINDCREATEDISPLAY method. This is an alias for\n" " FINDCREATEDISPLAY method. This is an alias for\n"
" \"-display WAIT:cmd=FINDCREATEDISPLAY-Xvfb\".\n" " \"-display WAIT:cmd=FINDCREATEDISPLAY-Xvfb\".\n"
"\n" "\n"
"-xdummy As in -create, except Xdummy instead of Xvfb. Implies\n" " SSH NOTE: for both -find and -create you can (should!)\n"
" FD_XDUMMY_NOROOT=1.\n" " add the \"-localhost\" option to force SSH tunnel access.\n"
"\n"
"-xdummy As in -create, except Xdummy instead of Xvfb.\n"
"-xvnc As in -create, except Xvnc instead of Xvfb.\n" "-xvnc As in -create, except Xvnc instead of Xvfb.\n"
"-xvnc_redirect As in -create, except Xvnc.redirect instead of Xvfb.\n" "-xvnc_redirect As in -create, except Xvnc.redirect instead of Xvfb.\n"
"\n" "\n"
"-svc Terminal services mode. Also \"-service\". Alias for\n" "-svc Terminal services mode based on SSL access. Alias for\n"
" -display WAIT:cmd=FINDCREATEDISPLAY-Xvfb -unixpw\n" " -display WAIT:cmd=FINDCREATEDISPLAY-Xvfb -unixpw -users\n"
" -users unixpw= -ssl SAVE\n" " unixpw= -ssl SAVE Also \"-service\".\n"
"\n" "\n"
"-svc_xdummy As -svc except Xdummy instead of Xvfb. Implies\n" "-svc_xdummy As -svc except Xdummy instead of Xvfb.\n"
" FD_XDUMMY_NOROOT=1.\n"
"-svc_xvnc As -svc except Xvnc instead of Xvfb.\n" "-svc_xvnc As -svc except Xvnc instead of Xvfb.\n"
"\n" "\n"
"-xdmsvc Terminal services mode. Also \"-xdm_service\". Alias for\n" "-xdmsvc Display manager Terminal services mode based on SSL.\n"
" -display WAIT:cmd=FINDCREATEDISPLAY-Xvfb.xdmcp -unixpw\n" " Alias for -display WAIT:cmd=FINDCREATEDISPLAY-Xvfb.xdmcp\n"
" -users unixpw= -ssl SAVE\n" " -unixpw -users unixpw= -ssl SAVE Also \"-xdm_service\".\n"
"\n"
" To create a session a user will have to first log in\n"
" to the -unixpw dialog and then log in again to the\n"
" XDM/GDM/KDM prompt. Subsequent re-connections will\n"
" only require the -unixpw password. See the discussion\n"
" under -display WAIT:... for more details about XDM,\n"
" etc configuration.\n"
"\n"
"-sshxdmsvc Display manager Terminal services mode based on SSH.\n"
" Alias for -display WAIT:cmd=FINDCREATEDISPLAY-Xvfb.xdmcp\n"
" -localhost.\n"
"\n"
" The -localhost option constrains connections to come\n"
" in via a SSH tunnel (which will require a login).\n"
" To create a session a user will also have to log into\n"
" the XDM GDM KDM prompt. Subsequent re-connections will\n"
" only only require the SSH login. See the discussion\n"
" under -display WAIT:... for more details about XDM,\n"
" etc configuration.\n"
"\n" "\n"
"-redirect port As in FINDCREATEDISPLAY-Xvnc.redirect mode except\n" "-redirect port As in FINDCREATEDISPLAY-Xvnc.redirect mode except\n"
" redirect immediately (i.e. without X session finding\n" " redirect immediately (i.e. without X session finding\n"
...@@ -948,14 +968,19 @@ void print_help(int mode) { ...@@ -948,14 +968,19 @@ void print_help(int mode) {
" actually start up an X server.\n" " actually start up an X server.\n"
"\n" "\n"
" By default FINDCREATEDISPLAY will try Xdummy and then\n" " By default FINDCREATEDISPLAY will try Xdummy and then\n"
" Xvfb. The Xdummy wrapper is part of the x11vnc source\n" " Xvfb:\n"
" code (x11vnc/misc/Xdummy) It should be available in\n" "\n"
" PATH and have run \"Xdummy -install\" once to create\n" " The Xdummy wrapper is part of the x11vnc source code\n"
" the shared library. Xdummy requires root permission and\n" " (x11vnc/misc/Xdummy) It should be available in PATH and\n"
" only works on Linux. (Note: specify FD_XDUMMY_NOROOT=1\n" " have run \"Xdummy -install\" once to create the shared\n"
" to skip a check for the root id; evidently your sudo(1)\n" " library. Xdummy requires root permission and only works\n"
" will take care of everything). Xvfb is available on\n" " on Linux. (Note: specify FD_XDUMMY_NOROOT=1 to skip\n"
" most platforms and does not require root.\n" " a check for the root id; evidently your sudo(1) will\n"
" take care of everything. The -xdummy and -svc_xdummy\n"
" options imply FD_XDUMMY_NOROOT=1).\n"
"\n"
" Xvfb is available on most platforms and does not\n"
" require root.\n"
"\n" "\n"
" When x11vnc exits (i.e. user disconnects) the X\n" " When x11vnc exits (i.e. user disconnects) the X\n"
" server session stays running in the background.\n" " server session stays running in the background.\n"
...@@ -1027,8 +1052,9 @@ void print_help(int mode) { ...@@ -1027,8 +1052,9 @@ void print_help(int mode) {
" for kdm in kdmrc: Enable=true in section [Xdmcp]\n" " for kdm in kdmrc: Enable=true in section [Xdmcp]\n"
" for xdm in xdm-config: DisplayManager.requestPort: 177\n" " for xdm in xdm-config: DisplayManager.requestPort: 177\n"
"\n" "\n"
" See the shorthand options above \"-svc\" and \"-xdmsvc\"\n" " See the shorthand options above \"-svc\", \"-xdmsvc\"\n"
" that specify the above options for some useful cases.\n" " and \"-sshxdmsvc\" that specify the above options for\n"
" some useful cases.\n"
"\n" "\n"
" If you set the env. var WAITBG=1 x11vnc will go into\n" " If you set the env. var WAITBG=1 x11vnc will go into\n"
" the background once listening in wait mode.\n" " the background once listening in wait mode.\n"
......
...@@ -710,6 +710,9 @@ char find_display[] = ...@@ -710,6 +710,9 @@ char find_display[] =
"PATH=$PATH:/bin:/usr/bin:/usr/X11R6/bin:/usr/bin/X11:/usr/openwin/bin:/usr/ucb\n" "PATH=$PATH:/bin:/usr/bin:/usr/X11R6/bin:/usr/bin/X11:/usr/openwin/bin:/usr/ucb\n"
"export PATH\n" "export PATH\n"
"\n" "\n"
"COLUMNS=256\n"
"export COLUMNS\n"
"\n"
"# -n means no xauth, -f prescribes file to use.\n" "# -n means no xauth, -f prescribes file to use.\n"
"showxauth=1\n" "showxauth=1\n"
"if [ \"X$1\" = \"X-n\" ]; then\n" "if [ \"X$1\" = \"X-n\" ]; then\n"
...@@ -833,6 +836,10 @@ char find_display[] = ...@@ -833,6 +836,10 @@ char find_display[] =
" fi\n" " fi\n"
" fi\n" " fi\n"
" done\n" " done\n"
" echo \"\" # failure\n"
" if [ \"X$showxauth\" != \"X\" ]; then\n"
" echo \"\"\n"
" fi\n"
" exit 1\n" " exit 1\n"
"fi\n" "fi\n"
"\n" "\n"
...@@ -995,7 +1002,12 @@ char find_display[] = ...@@ -995,7 +1002,12 @@ char find_display[] =
" exit\n" " exit\n"
"fi\n" "fi\n"
"if [ \"X$display\" = \"X\" ]; then\n" "if [ \"X$display\" = \"X\" ]; then\n"
" echo \"\" # failure\n" " if [ \"X$FINDDISPLAY_run\" = \"X\" ]; then\n"
" echo \"\" # failure\n"
" if [ \"X$showxauth\" != \"X\" ]; then\n"
" echo \"\"\n"
" fi\n"
" fi\n"
" exit 1\n" " exit 1\n"
"fi\n" "fi\n"
"\n" "\n"
...@@ -1046,6 +1058,9 @@ char create_display[] = ...@@ -1046,6 +1058,9 @@ char create_display[] =
" set -xv\n" " set -xv\n"
"fi\n" "fi\n"
"\n" "\n"
"COLUMNS=256\n"
"export COLUMNS\n"
"\n"
"findfree() {\n" "findfree() {\n"
" try=20\n" " try=20\n"
" n=\"\"\n" " n=\"\"\n"
...@@ -1339,18 +1354,28 @@ char create_display[] = ...@@ -1339,18 +1354,28 @@ char create_display[] =
" fi\n" " fi\n"
"\n" "\n"
" result=0\n" " result=0\n"
" ns=4\n" " #ns=4\n"
" ns=0\n"
" ns2=1\n"
" #if uname | grep SunOS > /dev/null; then\n"
" # ns=2\n"
" #fi\n"
"\n"
" if [ \"X$use_xdmcp_query\" = \"X1\" ]; then\n" " if [ \"X$use_xdmcp_query\" = \"X1\" ]; then\n"
" # we cannot use -nolisten tcp\n" " # we cannot use -nolisten tcp\n"
" echo \"$* -once -query localhost $FD_OPTS\" 1>&2\n" " echo \"$* -once -query localhost $FD_OPTS\" 1>&2\n"
" if [ \"X$have_root\" != \"X\" ]; then\n" " if [ \"X$have_root\" != \"X\" ]; then\n"
" $have_nohup $* -once -query localhost $FD_OPTS 1>&2 &\n" " $have_nohup $* -once -query localhost $FD_OPTS 1>&2 &\n"
" else\n" " else\n"
" $have_nohup sh -c \"(sleep $ns; $* -once -query localhost -auth $authfile $FD_OPTS)\" 1>&2 &\n" " if [ \"X$ns\" = \"X0\" ]; then\n"
" ns=0\n" " $have_nohup sh -c \"$* -once -query localhost -auth $authfile $FD_OPTS\" 1>&2 &\n"
" result=1\n" " else\n"
" $have_nohup sh -c \"(sleep $ns; $* -once -query localhost -auth $authfile $FD_OPTS)\" 1>&2 &\n"
" #result=1\n"
" fi\n"
" fi\n" " fi\n"
" pid=$!\n" " pid=$!\n"
" sleep 10\n"
" elif [ \"X$have_startx\" != \"X\" -o \"X$have_xinit\" != \"X\" ]; then\n" " elif [ \"X$have_startx\" != \"X\" -o \"X$have_xinit\" != \"X\" ]; then\n"
" if [ \"X$have_startx\" != \"X\" ]; then\n" " if [ \"X$have_startx\" != \"X\" ]; then\n"
" sxcmd=$have_startx\n" " sxcmd=$have_startx\n"
...@@ -1361,43 +1386,94 @@ char create_display[] = ...@@ -1361,43 +1386,94 @@ char create_display[] =
" if [ \"X$have_root\" != \"X\" ]; then\n" " if [ \"X$have_root\" != \"X\" ]; then\n"
" $sxcmd $sess -- $* -nolisten tcp -auth $authfile $FD_OPTS 1>&2 &\n" " $sxcmd $sess -- $* -nolisten tcp -auth $authfile $FD_OPTS 1>&2 &\n"
" else\n" " else\n"
" $have_nohup sh -c \"(sleep $ns; $sxcmd $sess -- $* -nolisten tcp -auth $authfile $FD_OPTS)\" 1>&2 &\n" " if [ \"X$ns\" = \"X0\" ]; then\n"
" ns=0\n" " $have_nohup sh -c \"$sxcmd $sess -- $* -nolisten tcp -auth $authfile $FD_OPTS\" 1>&2 &\n"
" result=1\n" " else\n"
" # Why did we ever sleep before starting the server??\n"
" $have_nohup sh -c \"(sleep $ns; $sxcmd $sess -- $* -nolisten tcp -auth $authfile $FD_OPTS)\" 1>&2 &\n"
" #result=1\n"
" fi\n"
" fi\n" " fi\n"
" pid=$!\n" " pid=$!\n"
" else\n" " else\n"
" # need to emulate startx/xinit ourselves...\n"
" echo \"$* -nolisten tcp -auth $authfile $FD_OPTS\" 1>&2\n" " echo \"$* -nolisten tcp -auth $authfile $FD_OPTS\" 1>&2\n"
" if [ \"X$have_root\" != \"X\" ]; then\n" " if [ \"X$have_root\" != \"X\" ]; then\n"
" $have_nohup $* -nolisten tcp -auth $authfile $FD_OPTS 1>&2 &\n" " $have_nohup $* -nolisten tcp -auth $authfile $FD_OPTS 1>&2 &\n"
" pid=$!\n" " pid=$!\n"
" sleep 2\n" " sleep 3\n"
" $have_nohup $sess 1>&2 &\n" " $have_nohup $sess 1>&2 &\n"
" else\n" " else\n"
" $have_nohup sh -c \"(sleep $ns; $* -nolisten tcp -auth $authfile $FD_OPTS)\" 1>&2 &\n" " if [ \"X$ns\" = \"X0\" ]; then\n"
" $have_nohup sh -c \"$* -nolisten tcp -auth $authfile $FD_OPTS\" 1>&2 &\n"
" else\n"
" $have_nohup sh -c \"(sleep $ns; $* -nolisten tcp -auth $authfile $FD_OPTS)\" 1>&2 &\n"
" #result=1\n"
" fi\n"
" pid=$!\n" " pid=$!\n"
" sleep 2\n" " sleep 3\n"
" $have_nohup sh -c \"(sleep $ns; $sess)\" 1>&2 &\n" " $have_nohup sh -c \"(sleep 3; $sess)\" 1>&2 &\n"
" ns=0\n"
" result=1\n"
" fi\n" " fi\n"
" fi\n" " fi\n"
" sleep $ns\n"
" if [ \"X$result\" = \"X1\" ]; then\n"
" :\n"
" elif [ -d /proc/$pid ]; then\n"
" result=1\n"
" elif kill -0 $pid; then\n"
" result=1\n"
" else\n"
" result=0\n"
" fi\n"
" if uname | grep SunOS > /dev/null; then\n" " if uname | grep SunOS > /dev/null; then\n"
" $have_nohup sh -c \"(sleep 60; rm -f $rmf)\" 1>&2 &\n" " $have_nohup sh -c \"(sleep 60; rm -f $rmf)\" 1>&2 &\n"
" else\n" " else\n"
" $have_nohup sh -c \"(sleep 60; rm -f $rmf $authfile)\" 1>&2 &\n" " $have_nohup sh -c \"(sleep 60; rm -f $rmf $authfile)\" 1>&2 &\n"
" fi\n" " fi\n"
"\n" "\n"
" t=0\n"
" tmax=5\n"
" while [ $t -lt $tmax ]\n"
" do\n"
" t=`expr $t + 1`\n"
" sleep $ns2\n"
" pid2=`head -n 1 \"/tmp/.X$N-lock\" 2>/dev/null | sed -e 's/[ ]//g' | grep '^[0-9][0-9]*$'`\n"
" if [ \"X$pid2\" = \"X\" ]; then\n"
" pid2=9999999\n"
" fi\n"
" if [ \"X$result\" = \"X1\" ]; then\n"
" break\n"
" elif [ -d /proc/$pid2 ]; then\n"
" result=1\n"
" break\n"
" elif kill -0 $pid2 2>/dev/null; then\n"
" result=1\n"
" break\n"
" elif [ -d /proc/$pid ]; then\n"
" result=1\n"
" break\n"
" elif kill -0 $pid 2>/dev/null; then\n"
" result=1\n"
" break\n"
" else\n"
" result=0\n"
" fi\n"
" if [ \"X$have_netstat\" != \"X\" ]; then\n"
" if $have_netstat -an | grep \"/tmp/.X11-unix/X$N\\$\" > /dev/null; then\n"
" result=1\n"
" fi\n"
" fi\n"
" done\n"
"\n"
"# if [ \"X$result\" = \"X1\" ]; then\n"
"# if [ \"X$use_xdmcp_query\" = \"X0\" -a \"X$have_xdpyinfo\" != \"X\" ]; then\n"
"# ok=0\n"
"# for t in 1 2 3 4\n"
"# do\n"
"# $have_xdpyinfo >/dev/null 2>&1\n"
"# if [ $? != 0 ]; then\n"
"# sleep 1\n"
"# else\n"
"# ok=1\n"
"# break;\n"
"# fi\n"
"# done\n"
"# if [ \"X$ok\" = \"X0\" ]; then\n"
"# result=0\n"
"# fi\n"
"# fi\n"
"# fi\n"
"\n"
" if [ \"X$redir_daemon\" != \"X\" -a \"X$result\" = \"X1\" ]; then\n" " if [ \"X$redir_daemon\" != \"X\" -a \"X$result\" = \"X1\" ]; then\n"
" redir_daemon=`echo \"$redir_daemon\" | sed -e 's|[^A-z0-9:,/]||g'`\n" " redir_daemon=`echo \"$redir_daemon\" | sed -e 's|[^A-z0-9:,/]||g'`\n"
" xprog=$X11VNC_PROG\n" " xprog=$X11VNC_PROG\n"
...@@ -1671,7 +1747,7 @@ char create_display[] = ...@@ -1671,7 +1747,7 @@ char create_display[] =
" p_ok=1\n" " p_ok=1\n"
"fi\n" "fi\n"
"\n" "\n"
"for prog in startx xinit xdm gdm kdm xterm Xdummy Xvfb Xvnc xauth mcookie md5sum xmodmap startkde gnome-session blackbox fvwm2 mwm openbox twm windowmaker wmaker enlightenment metacity X Xorg XFree86 Xsun Xsession dtwm netstat nohup esddsp konsole gnome-terminal\n" "for prog in startx xinit xdm gdm kdm xterm Xdummy Xvfb Xvnc xauth xdpyinfo mcookie md5sum xmodmap startkde gnome-session blackbox fvwm2 mwm openbox twm windowmaker wmaker enlightenment metacity X Xorg XFree86 Xsun Xsession dtwm netstat nohup esddsp konsole gnome-terminal perl\n"
"do\n" "do\n"
" p2=`echo \"$prog\" | sed -e 's/-/_/g'`\n" " p2=`echo \"$prog\" | sed -e 's/-/_/g'`\n"
" eval \"have_$p2=''\"\n" " eval \"have_$p2=''\"\n"
...@@ -1726,15 +1802,15 @@ char create_display[] = ...@@ -1726,15 +1802,15 @@ char create_display[] =
" curr_try=`echo \"$curr_try\" | sed -e 's/[+.-]xdmcp//'`\n" " curr_try=`echo \"$curr_try\" | sed -e 's/[+.-]xdmcp//'`\n"
" curr_try=`echo \"$curr_try\" | sed -e 's/[+.-]redirect//'`\n" " curr_try=`echo \"$curr_try\" | sed -e 's/[+.-]redirect//'`\n"
" \n" " \n"
" if echo \"$curr_try\" | grep -iw \"^Xdummy\" > /dev/null; then\n" " if echo \"$curr_try\" | grep -i '^Xdummy\\>' > /dev/null; then\n"
" try_Xdummy\n" " try_Xdummy\n"
" elif echo \"$curr_try\" | grep -iw \"^Xvfb\" > /dev/null; then\n" " elif echo \"$curr_try\" | grep -i '^Xvfb\\>' > /dev/null; then\n"
" try_Xvfb\n" " try_Xvfb\n"
" elif echo \"$curr_try\" | grep -iw \"^Xvnc\" > /dev/null; then\n" " elif echo \"$curr_try\" | grep -i '^Xvnc\\>' > /dev/null; then\n"
" try_Xvnc\n" " try_Xvnc\n"
" elif echo \"$curr_try\" | grep -iw \"^Xsrv\" > /dev/null; then\n" " elif echo \"$curr_try\" | grep -i '^Xsrv\\>' > /dev/null; then\n"
" try_Xsrv\n" " try_Xsrv\n"
" elif echo \"$curr_try\" | grep -iw \"^X\" > /dev/null; then\n" " elif echo \"$curr_try\" | grep -i '^X\\>' > /dev/null; then\n"
" try_X\n" " try_X\n"
" fi\n" " fi\n"
" if [ \"X$result\" = \"X1\" ]; then\n" " if [ \"X$result\" = \"X1\" ]; then\n"
......
...@@ -1412,6 +1412,7 @@ int wait_for_client(int *argc, char** argv, int http) { ...@@ -1412,6 +1412,7 @@ int wait_for_client(int *argc, char** argv, int http) {
if (fd >= 0) { if (fd >= 0) {
write(fd, find_display, strlen(find_display)); write(fd, find_display, strlen(find_display));
close(fd); close(fd);
set_env("FINDDISPLAY_run", "1");
sprintf(com, "/bin/sh %s -n; rm -f %s", tmp, tmp); sprintf(com, "/bin/sh %s -n; rm -f %s", tmp, tmp);
system(com); system(com);
} }
......
...@@ -404,6 +404,67 @@ double rfac(void) { ...@@ -404,6 +404,67 @@ double rfac(void) {
return f; return f;
} }
void check_allinput_rate(void) {
static double last_all_input_check = 0.0, last_all_input_start = 0.0;
static int set = 0;
if (! set) {
set = 1;
last_all_input_check = dnow();
} else {
int dt = 4;
if (x11vnc_current > last_all_input_check + dt) {
int n, nq = 0;
while ((n = rfbCheckFds(screen, 0))) {
nq += n;
}
fprintf(stderr, "nqueued: %d\n", nq);
if (0 && nq > 25 * dt) {
double rate = nq / dt;
rfbLog("Client is sending %.1f extra requests per second for the\n", rate);
rfbLog("past %d seconds! Switching to -allpinput mode. (queued: %d)\n", dt, nq);
all_input = 1;
}
set = 0;
}
}
}
static void do_allinput(long usec) {
static double last = 0.0;
static int meas = 0;
int n, f = 1, cnt = 0;
long usec0;
double now;
if (!screen || !screen->clientHead) {
return;
}
if (usec < 0) {
usec = 0;
}
usec0 = usec;
if (last == 0.0) {
last = dnow();
}
while ((n = rfbCheckFds(screen, usec)) > 0) {
if (f) {
fprintf(stderr, " *");
f = 0;
}
if (cnt++ > 30) {
break;
}
meas += n;
}
fprintf(stderr, "-%d", cnt);
now = dnow();
if (now > last + 2.0) {
double rate = meas / (now - last);
fprintf(stderr, "\n%.2f ", rate);
meas = 0;
last = dnow();
}
}
/* /*
* utility wrapper to call rfbProcessEvents * utility wrapper to call rfbProcessEvents
* checks that we are not in threaded mode. * checks that we are not in threaded mode.
...@@ -411,6 +472,7 @@ double rfac(void) { ...@@ -411,6 +472,7 @@ double rfac(void) {
#define USEC_MAX 999999 /* libvncsever assumes < 1 second */ #define USEC_MAX 999999 /* libvncsever assumes < 1 second */
void rfbPE(long usec) { void rfbPE(long usec) {
int uip0 = unixpw_in_progress; int uip0 = unixpw_in_progress;
static int check_rate = -1;
if (! screen) { if (! screen) {
return; return;
} }
...@@ -438,6 +500,22 @@ void rfbPE(long usec) { ...@@ -438,6 +500,22 @@ void rfbPE(long usec) {
; /* this is new unixpw client */ ; /* this is new unixpw client */
} }
} }
if (check_rate != 0) {
if (check_rate < 0) {
if (getenv("CHECK_RATE")) {
check_rate = 1;
} else {
check_rate = 0;
}
}
if (check_rate && !all_input && x11vnc_current < last_client + 45) {
check_allinput_rate();
}
}
if (all_input) {
do_allinput(usec);
}
} }
void rfbCFD(long usec) { void rfbCFD(long usec) {
...@@ -459,19 +537,15 @@ void rfbCFD(long usec) { ...@@ -459,19 +537,15 @@ void rfbCFD(long usec) {
(int) usec, tm - x11vnc_start); (int) usec, tm - x11vnc_start);
} }
#if 0
fprintf(stderr, "handleEventsEagerly: %d\n", screen->handleEventsEagerly);
#endif
if (! use_threads) { if (! use_threads) {
if (0 && all_input) { if (all_input) {
static int cnt = 0; do_allinput(usec);
int f = 1;
while (rfbCheckFds(screen, usec) > 0) {
if (f) {
cnt++;
f = 0;
}
fprintf(stderr, "-%d", cnt);
}
} else { } else {
/* XXX how for cmdline? */
if (all_input) { if (all_input) {
screen->handleEventsEagerly = TRUE; screen->handleEventsEagerly = TRUE;
} else { } else {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
.TH X11VNC "1" "September 2007" "x11vnc " "User Commands" .TH X11VNC "1" "September 2007" "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.3, lastmod: 2007-09-10 version: 0.9.3, lastmod: 2007-09-26
.SH SYNOPSIS .SH SYNOPSIS
.B x11vnc .B x11vnc
[OPTION]... [OPTION]...
...@@ -930,11 +930,13 @@ First try to find the user's display using FINDDISPLAY, ...@@ -930,11 +930,13 @@ First try to find the user's display using FINDDISPLAY,
if that doesn't succeed create an X session via the if that doesn't succeed create an X session via the
FINDCREATEDISPLAY method. This is an alias for FINDCREATEDISPLAY method. This is an alias for
"\fB-display\fR \fIWAIT:cmd=FINDCREATEDISPLAY-Xvfb\fR". "\fB-display\fR \fIWAIT:cmd=FINDCREATEDISPLAY-Xvfb\fR".
.IP
SSH NOTE: for both \fB-find\fR and \fB-create\fR you can (should!)
add the "\fB-localhost\fR" option to force SSH tunnel access.
.PP .PP
\fB-xdummy\fR \fB-xdummy\fR
.IP .IP
As in \fB-create,\fR except Xdummy instead of Xvfb. Implies As in \fB-create,\fR except Xdummy instead of Xvfb.
FD_XDUMMY_NOROOT=1.
.PP .PP
\fB-xvnc\fR \fB-xvnc\fR
.IP .IP
...@@ -946,14 +948,13 @@ As in \fB-create,\fR except Xvnc.redirect instead of Xvfb. ...@@ -946,14 +948,13 @@ As in \fB-create,\fR except Xvnc.redirect instead of Xvfb.
.PP .PP
\fB-svc\fR \fB-svc\fR
.IP .IP
Terminal services mode. Also "\fB-service\fR". Alias for Terminal services mode based on SSL access. Alias for
\fB-display\fR WAIT:cmd=FINDCREATEDISPLAY-Xvfb \fB-unixpw\fR \fB-display\fR WAIT:cmd=FINDCREATEDISPLAY-Xvfb \fB-unixpw\fR \fB-users\fR
\fB-users\fR unixpw= \fB-ssl\fR SAVE unixpw= \fB-ssl\fR SAVE Also "\fB-service\fR".
.PP .PP
\fB-svc_xdummy\fR \fB-svc_xdummy\fR
.IP .IP
As \fB-svc\fR except Xdummy instead of Xvfb. Implies As \fB-svc\fR except Xdummy instead of Xvfb.
FD_XDUMMY_NOROOT=1.
.PP .PP
\fB-svc_xvnc\fR \fB-svc_xvnc\fR
.IP .IP
...@@ -961,9 +962,30 @@ As \fB-svc\fR except Xvnc instead of Xvfb. ...@@ -961,9 +962,30 @@ As \fB-svc\fR except Xvnc instead of Xvfb.
.PP .PP
\fB-xdmsvc\fR \fB-xdmsvc\fR
.IP .IP
Terminal services mode. Also "\fB-xdm_service\fR". Alias for Display manager Terminal services mode based on SSL.
\fB-display\fR WAIT:cmd=FINDCREATEDISPLAY-Xvfb.xdmcp \fB-unixpw\fR Alias for \fB-display\fR WAIT:cmd=FINDCREATEDISPLAY-Xvfb.xdmcp
\fB-users\fR unixpw= \fB-ssl\fR SAVE \fB-unixpw\fR \fB-users\fR unixpw= \fB-ssl\fR SAVE Also "\fB-xdm_service\fR".
.IP
To create a session a user will have to first log in
to the \fB-unixpw\fR dialog and then log in again to the
XDM/GDM/KDM prompt. Subsequent re-connections will
only require the \fB-unixpw\fR password. See the discussion
under \fB-display\fR WAIT:... for more details about XDM,
etc configuration.
.PP
\fB-sshxdmsvc\fR
.IP
Display manager Terminal services mode based on SSH.
Alias for \fB-display\fR WAIT:cmd=FINDCREATEDISPLAY-Xvfb.xdmcp
\fB-localhost.\fR
.IP
The \fB-localhost\fR option constrains connections to come
in via a SSH tunnel (which will require a login).
To create a session a user will also have to log into
the XDM GDM KDM prompt. Subsequent re-connections will
only only require the SSH login. See the discussion
under \fB-display\fR WAIT:... for more details about XDM,
etc configuration.
.PP .PP
\fB-redirect\fR \fIport\fR \fB-redirect\fR \fIport\fR
.IP .IP
...@@ -1122,15 +1144,21 @@ for the user. This is the only time x11vnc tries to ...@@ -1122,15 +1144,21 @@ for the user. This is the only time x11vnc tries to
actually start up an X server. actually start up an X server.
.IP .IP
By default FINDCREATEDISPLAY will try Xdummy and then By default FINDCREATEDISPLAY will try Xdummy and then
Xvfb. The Xdummy wrapper is part of the x11vnc source Xvfb:
code (x11vnc/misc/Xdummy) It should be available in .IP
PATH and have run "Xdummy \fB-install"\fR once to create The Xdummy wrapper is part of the x11vnc source code
the shared library. Xdummy requires root permission and (x11vnc/misc/Xdummy) It should be available in PATH and
only works on Linux. (Note: specify FD_XDUMMY_NOROOT=1 have run "Xdummy \fB-install"\fR once to create the shared
to skip a check for the root id; evidently your library. Xdummy requires root permission and only works
on Linux. (Note: specify FD_XDUMMY_NOROOT=1 to skip
a check for the root id; evidently your
.IR sudo (1) .IR sudo (1)
will take care of everything). Xvfb is available on will
most platforms and does not require root. take care of everything. The \fB-xdummy\fR and \fB-svc_xdummy\fR
options imply FD_XDUMMY_NOROOT=1).
.IP
Xvfb is available on most platforms and does not
require root.
.IP .IP
When x11vnc exits (i.e. user disconnects) the X When x11vnc exits (i.e. user disconnects) the X
server session stays running in the background. server session stays running in the background.
...@@ -1209,8 +1237,9 @@ for gdm in gdm.conf: Enable=true in section [xdmcp] ...@@ -1209,8 +1237,9 @@ for gdm in gdm.conf: Enable=true in section [xdmcp]
for kdm in kdmrc: Enable=true in section [Xdmcp] for kdm in kdmrc: Enable=true in section [Xdmcp]
for xdm in xdm-config: DisplayManager.requestPort: 177 for xdm in xdm-config: DisplayManager.requestPort: 177
.IP .IP
See the shorthand options above "\fB-svc\fR" and "\fB-xdmsvc\fR" See the shorthand options above "\fB-svc\fR", "\fB-xdmsvc\fR"
that specify the above options for some useful cases. and "\fB-sshxdmsvc\fR" that specify the above options for
some useful cases.
.IP .IP
If you set the env. var WAITBG=1 x11vnc will go into If you set the env. var WAITBG=1 x11vnc will go into
the background once listening in wait mode. the background once listening in wait mode.
......
...@@ -1026,6 +1026,8 @@ static void watch_loop(void) { ...@@ -1026,6 +1026,8 @@ static void watch_loop(void) {
got_keyboard_calls = 0; got_keyboard_calls = 0;
urgent_update = 0; urgent_update = 0;
x11vnc_current = dnow();
if (! use_threads) { if (! use_threads) {
dtime0(&tm); dtime0(&tm);
if (! skip_pe) { if (! skip_pe) {
...@@ -2518,6 +2520,10 @@ int main(int argc, char* argv[]) { ...@@ -2518,6 +2520,10 @@ int main(int argc, char* argv[]) {
users_list = strdup("unixpw="); users_list = strdup("unixpw=");
use_openssl = 1; use_openssl = 1;
openssl_pem = strdup("SAVE"); openssl_pem = strdup("SAVE");
} else if (!strcmp(arg, "-sshxdmsvc")) {
use_dpy = strdup("WAIT:cmd=FINDCREATEDISPLAY-Xvfb.xdmcp");
allow_list = strdup("127.0.0.1");
got_localhost = 1;
#ifndef NO_SSL_OR_UNIXPW #ifndef NO_SSL_OR_UNIXPW
} else if (!strcmp(arg, "-unixpw_cmd") } else if (!strcmp(arg, "-unixpw_cmd")
|| !strcmp(arg, "-unixpw_cmd_unsafe")) { || !strcmp(arg, "-unixpw_cmd_unsafe")) {
...@@ -3880,7 +3886,7 @@ int main(int argc, char* argv[]) { ...@@ -3880,7 +3886,7 @@ int main(int argc, char* argv[]) {
/* open the X display: */ /* open the X display: */
if (auth_file) { if (auth_file) {
set_env("XAUTHORITY", auth_file); set_env("XAUTHORITY", auth_file);
fprintf(stderr, "XA: %s\n", getenv("XAUTHORITY")); if (0) fprintf(stderr, "XA: %s\n", getenv("XAUTHORITY"));
} }
#if LIBVNCSERVER_HAVE_XKEYBOARD #if LIBVNCSERVER_HAVE_XKEYBOARD
/* /*
......
...@@ -468,6 +468,7 @@ extern double last_copyrect_fix; ...@@ -468,6 +468,7 @@ extern double last_copyrect_fix;
extern double last_wireframe; extern double last_wireframe;
extern double servertime_diff; extern double servertime_diff;
extern double x11vnc_start; extern double x11vnc_start;
extern double x11vnc_current;
extern double g_now; extern double g_now;
extern double last_get_wm_frame_time; extern double last_get_wm_frame_time;
......
...@@ -15,7 +15,7 @@ int xtrap_base_event_type = 0; ...@@ -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.3 lastmod: 2007-09-10"; char lastmod[] = "0.9.3 lastmod: 2007-09-26";
/* X display info */ /* X display info */
...@@ -131,6 +131,7 @@ double last_copyrect_fix = 0.0; ...@@ -131,6 +131,7 @@ double last_copyrect_fix = 0.0;
double last_wireframe = 0.0; double last_wireframe = 0.0;
double servertime_diff = 0.0; double servertime_diff = 0.0;
double x11vnc_start = 0.0; double x11vnc_start = 0.0;
double x11vnc_current = 0.0;
double g_now = 0.0; double g_now = 0.0;
double last_get_wm_frame_time = 0.0; double last_get_wm_frame_time = 0.0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment