Commit 338301c1 authored by runge's avatar runge

x11vnc: -xrefresh, .DCOPserver bug, -unixpw_unsafe ignores SSH tunnel.

parent 0f162f1f
2007-08-03 Karl Runge <runge@karlrunge.com>
* x11vnc: add -xrefresh option, fix KDE .DCOPserver parse bug,
make sure UNIXPW_DISABLE_LOCALHOST/-unixpw_unsafe ignore
any SSH tunnel that would imply -localhost.
2007-07-04 Karl Runge <runge@karlrunge.com> 2007-07-04 Karl Runge <runge@karlrunge.com>
* x11vnc: -debug_ncache, fix big fonts in tkx11vnc. * x11vnc: -debug_ncache, fix big fonts in tkx11vnc.
......
This diff is collapsed.
...@@ -2786,6 +2786,12 @@ void print_help(int mode) { ...@@ -2786,6 +2786,12 @@ void print_help(int mode) {
" For special purpose usage where a low frame rate is\n" " For special purpose usage where a low frame rate is\n"
" acceptable and desirable, but you want the user input\n" " acceptable and desirable, but you want the user input\n"
" processed at the normal rate so you cannot use -wait.\n" " processed at the normal rate so you cannot use -wait.\n"
"-xrefresh time Floating point time in seconds to indicate how often to\n"
" do the equivalent of xrefresh(1) to force all windows\n"
" (in the viewable area if -id, -sid, or -clip is used)\n"
" to repaint themselves. Use this only if applications\n"
" misbehave by not repainting themselves properly.\n"
" See also -noxdamage.\n"
"-readtimeout n Set libvncserver rfbMaxClientWait to n seconds. On\n" "-readtimeout n Set libvncserver rfbMaxClientWait to n seconds. On\n"
" slow links that take a long time to paint the first\n" " slow links that take a long time to paint the first\n"
" screen libvncserver may hit the timeout and drop the\n" " screen libvncserver may hit the timeout and drop the\n"
...@@ -3719,6 +3725,7 @@ void print_help(int mode) { ...@@ -3719,6 +3725,7 @@ void print_help(int mode) {
" wait_bog disable -nowait_bog mode.\n" " wait_bog disable -nowait_bog mode.\n"
" nowait_bog enable -nowait_bog mode.\n" " nowait_bog enable -nowait_bog mode.\n"
" slow_fb:f set -slow_fb to f seconds.\n" " slow_fb:f set -slow_fb to f seconds.\n"
" xrefresh:f set -xrefresh to f seconds.\n"
" readtimeout:n set read timeout to n seconds.\n" " readtimeout:n set read timeout to n seconds.\n"
" nap enable -nap mode.\n" " nap enable -nap mode.\n"
" nonap disable -nap mode.\n" " nonap disable -nap mode.\n"
...@@ -3868,15 +3875,15 @@ void print_help(int mode) { ...@@ -3868,15 +3875,15 @@ void print_help(int mode) {
" nowf wireframelocal wfl nowireframelocal nowfl\n" " nowf wireframelocal wfl nowireframelocal nowfl\n"
" wirecopyrect wcr nowirecopyrect nowcr scr_area\n" " wirecopyrect wcr nowirecopyrect nowcr scr_area\n"
" scr_skip scr_inc scr_keys scr_term scr_keyrepeat\n" " scr_skip scr_inc scr_keys scr_term scr_keyrepeat\n"
" scr_parms scrollcopyrect scr noscrollcopyrect\n" " scr_parms scrollcopyrect scr noscrollcopyrect noscr\n"
" noscr fixscreen noxrecord xrecord reset_record\n" " fixscreen noxrecord xrecord reset_record pointer_mode\n"
" pointer_mode pm input_skip allinput noallinput input\n" " pm input_skip allinput noallinput input grabkbd\n"
" grabkbd nograbkbd grabptr nograbptr grabalways\n" " nograbkbd grabptr nograbptr grabalways nograbalways\n"
" nograbalways client_input ssltimeout speeds wmdt\n" " client_input ssltimeout speeds wmdt debug_pointer dp\n"
" debug_pointer dp nodebug_pointer nodp debug_keyboard\n" " nodebug_pointer nodp debug_keyboard dk nodebug_keyboard\n"
" dk nodebug_keyboard nodk deferupdate defer wait_ui\n" " nodk deferupdate defer wait_ui wait_bog nowait_bog\n"
" wait_bog nowait_bog slow_fb wait readtimeout nap nonap\n" " slow_fb xrefresh wait readtimeout nap nonap sb\n"
" sb screen_blank fbpm nofbpm dpms nodpms clientdpms\n" " screen_blank fbpm nofbpm dpms nodpms clientdpms\n"
" noclientdpms forcedpms noforcedpms noserverdpms\n" " noclientdpms forcedpms noforcedpms noserverdpms\n"
" serverdpms noultraext ultraext fs gaps grow fuzz snapfb\n" " serverdpms noultraext ultraext fs gaps grow fuzz snapfb\n"
" nosnapfb rawfb uinput_accel uinput_thresh uinput_reset\n" " nosnapfb rawfb uinput_accel uinput_thresh uinput_reset\n"
......
...@@ -345,6 +345,7 @@ int flip_byte_order = 0; /* sometimes needed when using_shm = 0 */ ...@@ -345,6 +345,7 @@ int flip_byte_order = 0; /* sometimes needed when using_shm = 0 */
int waitms = 20; int waitms = 20;
double wait_ui = 2.0; double wait_ui = 2.0;
double slow_fb = 0.0; double slow_fb = 0.0;
double xrefresh = 0.0;
int wait_bog = 1; int wait_bog = 1;
int defer_update = 20; /* deferUpdateTime ms to wait before sends. */ int defer_update = 20; /* deferUpdateTime ms to wait before sends. */
int got_defer = 0; int got_defer = 0;
......
...@@ -250,6 +250,7 @@ extern int flip_byte_order; ...@@ -250,6 +250,7 @@ extern int flip_byte_order;
extern int waitms; extern int waitms;
extern double wait_ui; extern double wait_ui;
extern double slow_fb; extern double slow_fb;
extern double xrefresh;
extern int wait_bog; extern int wait_bog;
extern int defer_update; extern int defer_update;
extern int got_defer; extern int got_defer;
......
...@@ -3598,6 +3598,20 @@ char *process_remote_cmd(char *cmd, int stringonly) { ...@@ -3598,6 +3598,20 @@ char *process_remote_cmd(char *cmd, int stringonly) {
slow_fb, w); slow_fb, w);
slow_fb = w; slow_fb = w;
} else if (strstr(p, "xrefresh") == p) {
double w;
COLON_CHECK("xrefresh:")
if (query) {
snprintf(buf, bufn, "ans=%s%s%.2f", p, co, xrefresh);
goto qry;
}
p += strlen("xrefresh:");
w = atof(p);
if (w <= 0) w = 0.0;
rfbLog("remote_cmd: setting xrefresh delay %.2f -> %.2f\n",
xrefresh, w);
xrefresh = w;
} else if (strstr(p, "wait") == p) { } else if (strstr(p, "wait") == p) {
int w; int w;
COLON_CHECK("wait:") COLON_CHECK("wait:")
......
...@@ -620,6 +620,7 @@ static char *dcop_session(void) { ...@@ -620,6 +620,7 @@ static char *dcop_session(void) {
int len; int len;
char *cmd, *host, *user = NULL; char *cmd, *host, *user = NULL;
char *out, *p, *ds, *dsn = NULL, *sess = NULL, *sess2 = NULL; char *out, *p, *ds, *dsn = NULL, *sess = NULL, *sess2 = NULL;
int db = 0;
RAWFB_RET(empty); RAWFB_RET(empty);
...@@ -650,6 +651,9 @@ static char *dcop_session(void) { ...@@ -650,6 +651,9 @@ static char *dcop_session(void) {
ds = ":0"; ds = ":0";
} }
ds = strdup(ds); ds = strdup(ds);
p = strrchr(ds, '.');
if (p) *p = '\0';
dsn = strchr(ds, ':'); dsn = strchr(ds, ':');
if (dsn) { if (dsn) {
*dsn = '_'; *dsn = '_';
...@@ -658,17 +662,31 @@ static char *dcop_session(void) { ...@@ -658,17 +662,31 @@ static char *dcop_session(void) {
ds = strdup("_0"); ds = strdup("_0");
dsn = ds; dsn = ds;
} }
if (db) fprintf(stderr, "ds: %s\n", ds);
if (db) fprintf(stderr, "dsn: %s\n", dsn);
host = this_host(); host = this_host();
if (host) {
char *h2 = (char *) malloc(strlen(host) + 2 + 1);
sprintf(h2, "_%s_", host);
free(host);
host = h2;
} else {
host = strdup("");
}
if (db) fprintf(stderr, "host: %s\n", host);
p = strtok(out, "\n"); p = strtok(out, "\n");
while (p) { while (p) {
if (db) fprintf(stderr, "p: %s\n", p);
char *q = strstr(p, ".DCOP"); char *q = strstr(p, ".DCOP");
if (q == NULL) { if (q == NULL) {
; ;
} else if (host) { } else if (host) {
if (strstr(q, host)) { if (strstr(q, host)) {
if(strstr(p, dsn)) { char *r = strstr(p, dsn);
int n = strlen(dsn);
if(r && !isalnum((int) *(r+n))) {
sess = strdup(q); sess = strdup(q);
break; break;
} else { } else {
...@@ -679,7 +697,9 @@ static char *dcop_session(void) { ...@@ -679,7 +697,9 @@ static char *dcop_session(void) {
} }
} }
} else { } else {
if(strstr(p, dsn)) { char *r = strstr(p, dsn);
int n = strlen(dsn);
if(r && !isalnum((int) *(r+n))) {
sess = strdup(q); sess = strdup(q);
break; break;
} }
...@@ -688,6 +708,7 @@ static char *dcop_session(void) { ...@@ -688,6 +708,7 @@ static char *dcop_session(void) {
} }
free(ds); free(ds);
free(out); free(out);
free(host);
if (!sess && sess2) { if (!sess && sess2) {
sess = sess2; sess = sess2;
} }
......
...@@ -400,6 +400,8 @@ Tuning ...@@ -400,6 +400,8 @@ Tuning
fuzz: fuzz:
wait_ui: wait_ui:
nowait_bog nowait_bog
slow_fb:
xrefresh:
readtimeout: readtimeout:
snapfb snapfb
threads threads
......
...@@ -411,6 +411,8 @@ char gui_code[] = ""; ...@@ -411,6 +411,8 @@ char gui_code[] = "";
" fuzz:\n" " fuzz:\n"
" wait_ui:\n" " wait_ui:\n"
" nowait_bog\n" " nowait_bog\n"
" slow_fb:\n"
" xrefresh:\n"
" readtimeout:\n" " readtimeout:\n"
" snapfb\n" " snapfb\n"
" threads\n" " threads\n"
......
.\" This file was automatically generated from x11vnc -help output. .\" This file was automatically generated from x11vnc -help output.
.TH X11VNC "1" "July 2007" "x11vnc " "User Commands" .TH X11VNC "1" "August 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-07-03 version: 0.9.3, lastmod: 2007-08-03
.SH SYNOPSIS .SH SYNOPSIS
.B x11vnc .B x11vnc
[OPTION]... [OPTION]...
...@@ -3257,6 +3257,17 @@ For special purpose usage where a low frame rate is ...@@ -3257,6 +3257,17 @@ For special purpose usage where a low frame rate is
acceptable and desirable, but you want the user input acceptable and desirable, but you want the user input
processed at the normal rate so you cannot use \fB-wait.\fR processed at the normal rate so you cannot use \fB-wait.\fR
.PP .PP
\fB-xrefresh\fR \fItime\fR
.IP
Floating point time in seconds to indicate how often to
do the equivalent of
.IR xrefresh (1)
to force all windows
(in the viewable area if \fB-id,\fR \fB-sid,\fR or \fB-clip\fR is used)
to repaint themselves. Use this only if applications
misbehave by not repainting themselves properly.
See also \fB-noxdamage.\fR
.PP
\fB-readtimeout\fR \fIn\fR \fB-readtimeout\fR \fIn\fR
.IP .IP
Set libvncserver rfbMaxClientWait to n seconds. On Set libvncserver rfbMaxClientWait to n seconds. On
...@@ -4489,6 +4500,8 @@ nowait_bog enable \fB-nowait_bog\fR mode. ...@@ -4489,6 +4500,8 @@ nowait_bog enable \fB-nowait_bog\fR mode.
.IP .IP
slow_fb:f set \fB-slow_fb\fR to f seconds. slow_fb:f set \fB-slow_fb\fR to f seconds.
.IP .IP
xrefresh:f set \fB-xrefresh\fR to f seconds.
.IP
readtimeout:n set read timeout to n seconds. readtimeout:n set read timeout to n seconds.
.IP .IP
nap enable \fB-nap\fR mode. nap enable \fB-nap\fR mode.
...@@ -4728,15 +4741,15 @@ nodebug_ncache wireframe_mode wireframe wf nowireframe ...@@ -4728,15 +4741,15 @@ nodebug_ncache wireframe_mode wireframe wf nowireframe
nowf wireframelocal wfl nowireframelocal nowfl nowf wireframelocal wfl nowireframelocal nowfl
wirecopyrect wcr nowirecopyrect nowcr scr_area wirecopyrect wcr nowirecopyrect nowcr scr_area
scr_skip scr_inc scr_keys scr_term scr_keyrepeat scr_skip scr_inc scr_keys scr_term scr_keyrepeat
scr_parms scrollcopyrect scr noscrollcopyrect scr_parms scrollcopyrect scr noscrollcopyrect noscr
noscr fixscreen noxrecord xrecord reset_record fixscreen noxrecord xrecord reset_record pointer_mode
pointer_mode pm input_skip allinput noallinput input pm input_skip allinput noallinput input grabkbd
grabkbd nograbkbd grabptr nograbptr grabalways nograbkbd grabptr nograbptr grabalways nograbalways
nograbalways client_input ssltimeout speeds wmdt client_input ssltimeout speeds wmdt debug_pointer dp
debug_pointer dp nodebug_pointer nodp debug_keyboard nodebug_pointer nodp debug_keyboard dk nodebug_keyboard
dk nodebug_keyboard nodk deferupdate defer wait_ui nodk deferupdate defer wait_ui wait_bog nowait_bog
wait_bog nowait_bog slow_fb wait readtimeout nap nonap slow_fb xrefresh wait readtimeout nap nonap sb
sb screen_blank fbpm nofbpm dpms nodpms clientdpms screen_blank fbpm nofbpm dpms nodpms clientdpms
noclientdpms forcedpms noforcedpms noserverdpms noclientdpms forcedpms noforcedpms noserverdpms
serverdpms noultraext ultraext fs gaps grow fuzz snapfb serverdpms noultraext ultraext fs gaps grow fuzz snapfb
nosnapfb rawfb uinput_accel uinput_thresh uinput_reset nosnapfb rawfb uinput_accel uinput_thresh uinput_reset
......
...@@ -1278,6 +1278,7 @@ static void print_settings(int try_http, int bg, char *gui_str) { ...@@ -1278,6 +1278,7 @@ static void print_settings(int try_http, int bg, char *gui_str) {
fprintf(stderr, " wait_ui: %.2f\n", wait_ui); fprintf(stderr, " wait_ui: %.2f\n", wait_ui);
fprintf(stderr, " nowait_bog: %d\n", !wait_bog); fprintf(stderr, " nowait_bog: %d\n", !wait_bog);
fprintf(stderr, " slow_fb: %.2f\n", slow_fb); fprintf(stderr, " slow_fb: %.2f\n", slow_fb);
fprintf(stderr, " xrefresh: %.2f\n", xrefresh);
fprintf(stderr, " readtimeout: %d\n", rfbMaxClientWait/1000); fprintf(stderr, " readtimeout: %d\n", rfbMaxClientWait/1000);
fprintf(stderr, " take_naps: %d\n", take_naps); fprintf(stderr, " take_naps: %d\n", take_naps);
fprintf(stderr, " sb: %d\n", screen_blank); fprintf(stderr, " sb: %d\n", screen_blank);
...@@ -2431,6 +2432,9 @@ int main(int argc, char* argv[]) { ...@@ -2431,6 +2432,9 @@ int main(int argc, char* argv[]) {
} else if (!strcmp(arg, "-slow_fb")) { } else if (!strcmp(arg, "-slow_fb")) {
CHECK_ARGC CHECK_ARGC
slow_fb = atof(argv[++i]); slow_fb = atof(argv[++i]);
} else if (!strcmp(arg, "-xrefresh")) {
CHECK_ARGC
xrefresh = atof(argv[++i]);
} else if (!strcmp(arg, "-readtimeout")) { } else if (!strcmp(arg, "-readtimeout")) {
CHECK_ARGC CHECK_ARGC
rfbMaxClientWait = atoi(argv[++i]) * 1000; rfbMaxClientWait = atoi(argv[++i]) * 1000;
...@@ -3010,7 +3014,11 @@ int main(int argc, char* argv[]) { ...@@ -3010,7 +3014,11 @@ int main(int argc, char* argv[]) {
use_stunnel = 0; use_stunnel = 0;
} }
if (! use_stunnel && ! use_openssl) { if (! use_stunnel && ! use_openssl) {
if (have_ssh_env()) { if (getenv("UNIXPW_DISABLE_LOCALHOST")) {
rfbLog("Skipping -ssl/-stunnel requirement"
" due to\n");
rfbLog("UNIXPW_DISABLE_LOCALHOST setting.\n");
} else if (have_ssh_env()) {
char *s = getenv("SSH_CONNECTION"); char *s = getenv("SSH_CONNECTION");
if (! s) s = getenv("SSH_CLIENT"); if (! s) s = getenv("SSH_CLIENT");
if (! s) s = "SSH_CONNECTION"; if (! s) s = "SSH_CONNECTION";
...@@ -3027,10 +3035,6 @@ int main(int argc, char* argv[]) { ...@@ -3027,10 +3035,6 @@ int main(int argc, char* argv[]) {
if (! nopw) { if (! nopw) {
usleep(2000*1000); usleep(2000*1000);
} }
} else if (getenv("UNIXPW_DISABLE_SSL")) {
rfbLog("Skipping -ssl/-stunnel requirement"
" due to\n");
rfbLog("UNIXPW_DISABLE_SSL setting.\n");
} else { } else {
if (openssl_present()) { if (openssl_present()) {
rfbLog("set -ssl in -unixpw mode.\n"); rfbLog("set -ssl in -unixpw mode.\n");
...@@ -3175,6 +3179,10 @@ int main(int argc, char* argv[]) { ...@@ -3175,6 +3179,10 @@ int main(int argc, char* argv[]) {
ncache = 0; ncache = 0;
ncache_msg = 0; ncache_msg = 0;
} }
if (subwin) {
ncache = 0;
ncache_msg = 0;
}
} }
if (raw_fb_str) { if (raw_fb_str) {
......
...@@ -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-07-03"; char lastmod[] = "0.9.3 lastmod: 2007-08-03";
/* X display info */ /* X display info */
......
...@@ -792,6 +792,7 @@ void check_xevents(int reset) { ...@@ -792,6 +792,7 @@ void check_xevents(int reset) {
static time_t last_time_sync = 0; static time_t last_time_sync = 0;
time_t now = time(NULL); time_t now = time(NULL);
static double last_request = 0.0; static double last_request = 0.0;
static double last_xrefresh = 0.0;
XErrorHandler old_handler; XErrorHandler old_handler;
if (unixpw_in_progress) return; if (unixpw_in_progress) return;
...@@ -836,6 +837,31 @@ void check_xevents(int reset) { ...@@ -836,6 +837,31 @@ void check_xevents(int reset) {
} }
} }
if (have_clients && xrefresh > 0.0 && dnow() > last_xrefresh + xrefresh) {
XSetWindowAttributes swa;
Visual visual;
Window xrf;
unsigned long mask;
swa.override_redirect = True;
swa.backing_store = NotUseful;
swa.save_under = False;
swa.background_pixmap = None;
visual.visualid = CopyFromParent;
mask = (CWOverrideRedirect|CWBackingStore|CWSaveUnder|CWBackPixmap);
xrf = XCreateWindow(dpy, window, coff_x, coff_y, dpy_x, dpy_y, 0, CopyFromParent,
InputOutput, &visual, mask, &swa);
if (xrf != None) {
if (0) fprintf(stderr, "XCreateWindow(%d, %d, %d, %d) 0x%lx\n", coff_x, coff_y, dpy_x, dpy_y, xrf);
XMapWindow(dpy, xrf);
XFlush_wr(dpy);
XDestroyWindow(dpy, xrf);
XFlush_wr(dpy);
}
last_xrefresh = dnow();
}
if (now > last_call+1) { if (now > last_call+1) {
/* we only check these once a second or so. */ /* we only check these once a second or so. */
int n = 0; int n = 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