Huge number of changes, see x11vnc/ChangeLog

pull/1/head
runge 15 years ago
parent 169ef3a042
commit 3129ef668a

@ -73,8 +73,8 @@ diff -x VncCanvas.java -Naur vnc_javasrc.orig/RfbProto.java vnc_javasrc/RfbProto
serverMajor = (b[4] - '0') * 100 + (b[5] - '0') * 10 + (b[6] - '0');
diff -x VncCanvas.java -Naur vnc_javasrc.orig/SSLSocketToMe.java vnc_javasrc/SSLSocketToMe.java
--- vnc_javasrc.orig/SSLSocketToMe.java 1969-12-31 19:00:00.000000000 -0500
+++ vnc_javasrc/SSLSocketToMe.java 2009-06-19 10:23:50.000000000 -0400
@@ -0,0 +1,1726 @@
+++ vnc_javasrc/SSLSocketToMe.java 2009-08-13 09:16:42.000000000 -0400
@@ -0,0 +1,1727 @@
+/*
+ * SSLSocketToMe.java: add SSL encryption to Java VNC Viewer.
+ *
@ -83,7 +83,8 @@ diff -x VncCanvas.java -Naur vnc_javasrc.orig/SSLSocketToMe.java vnc_javasrc/SSL
+ *
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

@ -1,3 +1,37 @@
2009-10-08 Karl Runge <runge@karlrunge.com>
* x11vnc: bcx_xattach/x2x desktop switching facility.
More remote control features: grab_state, ping:mystring,
grablocal, resend_cutbuffer, resend_clipboard, resend_primary,
keycode, keysym, ptr, sleep, get_xprop, set_xprop, wininfo,
pointer_pos, mouse_xy, noop, guess_dbus Add DIRECT: for
remote control w/o server. X11VNC_NO_CHECK_PM for more
quiet DIRECT: usage. Options -query_retries, -remote_prefix,
and X11VNC_SYNC_TIMEOUT for remote control. Add scripting
to remote control. ping clients during in unixpw login.
Option -unixpw_system_greeter as shortcut to XDM/GDM/etc panel.
Add clear_all, viewonly, nodisplay, to unixpw username:opts.
F1 help for options (including smaller console font).
Document FD_TAG. Eat multiple property change events in one
sitting (also PROP_DBG=1). Support more -ssl features (special
cert names, single port, client certs, etc.) in -stunnel
external SSL helper mode. Reorganize openssl code to allow
integration with stunnel features if not compiled with openssl.
X11VNC_HTTPS_VS_VNC_TIMEOUT Fix dbus session address for -solid
in gnome. Use dbus-launch in -create mode if available.
X11VNC_SKIP_DISPLAY=all in -find/-create mode. let noxauth
unset XAUTHORITY for use with su - $USER. CREATE_DISPLAY_EXEC
debugging. Add x_terminal_emulator to -create cmd search.
Option -extra_fbur to tune fb update requests tracking; make
default tracking more aggressive. RATE_VERB/CHECK_RATE env. for
fbur rate. Env. vars to set Tk gui fonts. Catch closed
socket reads/writes. Try to detect 'crazy' xdamage insertion,
e.g. from some xscreensavers (needs work.). Don't switch
on server autorepeat if any keys are pressed down to work
around Xorg server and/or gnome bug. If PATH is empty, set
it to minimal one. Fix bug with -bg and -dp/-dk printout if
logfile present.
* classes/ssl: license statement.
2009-06-18 Karl Runge <runge@karlrunge.com>
* classes/ssl: java viewer now handles auth-basic proxy logins.
* misc/enhanced_tightvnc_viewer: update ssvnc.

File diff suppressed because it is too large Load Diff

@ -48,9 +48,11 @@ so, delete this exception statement from your version.
#include "sslhelper.h"
#include "xwrappers.h"
#include "xevents.h"
#include "win_utils.h"
#include "macosx.h"
#include "macosxCG.h"
#include "userinput.h"
#include "pointer.h"
/*
* routines for handling incoming, outgoing, etc connections
@ -93,6 +95,11 @@ int run_user_command(char *cmd, rfbClientPtr client, char *mode, char *input,
int len, FILE *output);
int check_access(char *addr);
void client_set_net(rfbClientPtr client);
char *get_xprop(char *prop, Window win);
int set_xprop(char *prop, Window win, char *value);
char *bcx_xattach(char *str, int *pg_init, int *kg_init);
void grab_state(int *ptr_grabbed, int *kbd_grabbed);
char *wininfo(Window win, int show_children);
static rfbClientPtr *client_match(char *str);
static void free_client_data(rfbClientPtr client);
@ -606,7 +613,7 @@ int run_user_command(char *cmd, rfbClientPtr client, char *mode, char *input,
int j, k = -1;
if (0) fprintf(stderr, "line: %s", line);
/* take care to handle embedded nulls */
for (j=0; j < sizeof(line); j++) {
for (j=0; j < (int) sizeof(line); j++) {
if (line[j] != '\0') {
k = j;
}
@ -2756,6 +2763,503 @@ void read_x11vnc_remote_prop(int nomsg) {
#endif /* NO_X11 */
}
void grab_state(int *ptr_grabbed, int *kbd_grabbed) {
int rcp, rck;
double t0, t1;
double ta, tb, tc;
*ptr_grabbed = -1;
*kbd_grabbed = -1;
if (!dpy) {
return;
}
*ptr_grabbed = 0;
*kbd_grabbed = 0;
#if !NO_X11
X_LOCK;
XSync(dpy, False);
ta = t0 = dnow();
rcp = XGrabPointer(dpy, window, False, 0, GrabModeAsync, GrabModeAsync, None, None, CurrentTime);
XUngrabPointer(dpy, CurrentTime);
tb = dnow();
rck = XGrabKeyboard(dpy, window, False, GrabModeAsync, GrabModeAsync, CurrentTime);
XUngrabKeyboard(dpy, CurrentTime);
tc = dnow();
XSync(dpy, False);
t1 = dnow();
X_UNLOCK;
if (rcp == AlreadyGrabbed || rcp == GrabFrozen) {
*ptr_grabbed = 1;
}
if (rck == AlreadyGrabbed || rck == GrabFrozen) {
*kbd_grabbed = 1;
}
rfbLog("grab_state: checked %d,%d in %.6f sec (%.6f %.6f)\n",
*ptr_grabbed, *kbd_grabbed, t1-t0, tb-ta, tc-tb);
#endif
}
static void pmove(int x, int y) {
if (x < 0 || y < 0) {
rfbLog("pmove: skipping negative x or y: %d %d\n", x, y);
return;
}
rfbLog("pmove: x y: %d %d\n", x, y);
pointer(0, x, y, NULL);
XFlush_wr(dpy);
}
char *bcx_xattach(char *str, int *pg_init, int *kg_init) {
int grab_check = 1;
int shift = 20;
int final_x = 30, final_y = 30;
int extra_x = -1, extra_y = -1;
int t1, t2, dt = 40 * 1000;
int ifneeded = 0;
char *dir = "none", *flip = "none", *q;
int pg1, kg1, pg2, kg2;
char _bcx_res[128];
/* str:[up,down,left,right]+nograbcheck+shift=n+final=x+y+extra_move=x+y+[master_to_slave,slave_to_master,M2S,S2M]+dt=n+retry=n+ifneeded */
if (strstr(str, "up")) {
dir = "up";
} else if (strstr(str, "down")) {
dir = "down";
} else if (strstr(str, "left")) {
dir = "left";
} else if (strstr(str, "right")) {
dir = "right";
} else {
return strdup("FAIL,NO_DIRECTION_SPECIFIED");
}
if (strstr(str, "master_to_slave") || strstr(str, "M2S")) {
flip = "M2S";
} else if (strstr(str, "slave_to_master") || strstr(str, "S2M")) {
flip = "S2M";
} else {
return strdup("FAIL,NO_MODE_CHANGE_SPECIFIED");
}
if (strstr(str, "nograbcheck")) {
grab_check = 0;
}
if (strstr(str, "ifneeded")) {
ifneeded = 1;
}
q = strstr(str, "shift=");
if (q && sscanf(q, "shift=%d", &t1) == 1) {
shift = t1;
}
q = strstr(str, "final=");
if (q && sscanf(q, "final=%d+%d", &t1, &t2) == 2) {
final_x = t1;
final_y = t2;
}
q = strstr(str, "extra_move=");
if (q && sscanf(q, "extra_move=%d+%d", &t1, &t2) == 2) {
extra_x = t1;
extra_y = t2;
}
q = strstr(str, "dt=");
if (q && sscanf(q, "dt=%d", &t1) == 1) {
dt = t1 * 1000;
}
if (grab_check) {
int read_init = 0;
if (*pg_init >=0 && *kg_init >=0) {
pg1 = *pg_init;
kg1 = *kg_init;
read_init = 1;
} else {
grab_state(&pg1, &kg1);
read_init = 0;
}
if (!strcmp(flip, "M2S")) {
if (ifneeded && pg1 == 1 && kg1 == 1) {
rfbLog("bcx_xattach: M2S grab state is already what we want, skipping moves: %d,%d\n", pg1, kg1);
return strdup("DONE,GRAB_OK");
}
} else if (!strcmp(flip, "S2M")) {
if (ifneeded && pg1 == 0 && kg1 == 0) {
rfbLog("bcx_xattach: S2M grab state is already what we want, skipping moves: %d,%d\n", pg1, kg1);
return strdup("DONE,GRAB_OK");
}
}
if (read_init) {
;
} else if (!strcmp(flip, "M2S")) {
if (pg1 != 0 || kg1 != 0) {
rfbLog("bcx_xattach: M2S init grab state incorrect: %d,%d\n", pg1, kg1);
usleep(2*dt);
grab_state(&pg1, &kg1);
rfbLog("bcx_xattach: slept and retried, grab is now: %d,%d\n", pg1, kg1);
}
} else if (!strcmp(flip, "S2M")) {
if (pg1 != 1 || kg1 != 1) {
rfbLog("bcx_xattach: S2M init grab state incorrect: %d,%d\n", pg1, kg1);
usleep(2*dt);
grab_state(&pg1, &kg1);
rfbLog("bcx_xattach: slept and retried, grab is now: %d,%d\n", pg1, kg1);
}
}
if (!read_init) {
*pg_init = pg1;
*kg_init = kg1;
}
}
/*
* A guide for BARCO xattach:
*
* For -cursor_rule 'b(0):%:t(1),t(1):%:b(0)'
* down+M2S up+S2M
* For -cursor_rule 'r(0):%:l(1),l(1):%:r(0)'
* right+M2S left+S2M
*
* For -cursor_rule 't(0):%:b(1),b(1):%:t(0)'
* up+M2S down+S2M
* For -cursor_rule 'l(0):%:r(1),r(1):%:l(0)'
* left+M2S right+S2M
* For -cursor_rule 'l(0):%:r(1),r(1):%:l(0),r(0):%:l(1),l(1):%:r(0)'
* left+M2S right+S2M (we used to do both 'right')
*/
if (!strcmp(flip, "M2S")) {
if (!strcmp(dir, "up")) {
pmove(shift, 0); /* go to top edge */
usleep(dt);
pmove(shift+1, 0); /* move 1 for MotionNotify */
} else if (!strcmp(dir, "down")) {
pmove(shift, dpy_y-1); /* go to bottom edge */
usleep(dt);
pmove(shift+1, dpy_y-1); /* move 1 for MotionNotify */
} else if (!strcmp(dir, "left")) {
pmove(0, shift); /* go to left edge */
usleep(dt);
pmove(0, shift+1); /* move 1 for MotionNotify */
} else if (!strcmp(dir, "right")) {
pmove(dpy_x-1, shift); /* go to right edge */
usleep(dt);
pmove(dpy_x-1, shift+1); /* move 1 for Motion Notify */
}
} else if (!strcmp(flip, "S2M")) {
int dts = dt/2;
if (!strcmp(dir, "up")) {
pmove(shift, 2); /* Approach top edge in 3 moves. 1st move */
usleep(dts);
pmove(shift, 1); /* 2nd move */
usleep(dts);
pmove(shift, 0); /* 3rd move */
usleep(dts);
pmove(shift+1, 0); /* move 1 for MotionNotify */
usleep(dts);
pmove(shift+1, dpy_y-2); /* go to height-2 for extra pixel (slave y now == 0?) */
usleep(dts);
pmove(shift, dpy_y-2); /* move 1 for MotionNotify */
usleep(dts);
pmove(shift, 1); /* go to 1 to be sure slave y == 0 */
usleep(dts);
pmove(shift+1, 1); /* move 1 for MotionNotify */
} else if (!strcmp(dir, "down")) {
pmove(shift, dpy_y-3); /* Approach bottom edge in 3 moves. 1st move */
usleep(dts);
pmove(shift, dpy_y-2); /* 2nd move */
usleep(dts);
pmove(shift, dpy_y-1); /* 3rd move */
usleep(dts);
pmove(shift+1, dpy_y-1); /* move 1 for MotionNotify */
usleep(dts);
pmove(shift+1, 1); /* go to 1 for extra pixel (slave y now == dpy_y-1?) */
usleep(dts);
pmove(shift, 1); /* move 1 for MotionNotify */
usleep(dts);
pmove(shift, dpy_y-2); /* go to dpy_y-2 to be sure slave y == dpy_y-1 */
usleep(dts);
pmove(shift+1, dpy_y-2); /* move 1 for MotionNotify */
} else if (!strcmp(dir, "left")) {
pmove(2, shift); /* Approach left edge in 3 moves. 1st move */
usleep(dts);
pmove(1, shift); /* 2nd move */
usleep(dts);
pmove(0, shift); /* 3rd move */
usleep(dts);
pmove(0, shift+1); /* move 1 for MotionNotify */
usleep(dts);
pmove(dpy_x-2, shift+1); /* go to width-2 for extra pixel (slave x now == 0?) */
usleep(dts);
pmove(dpy_x-2, shift); /* move 1 for MotionNotify */
usleep(dts);
pmove(1, shift); /* go to 1 to be sure slave x == 0 */
usleep(dts);
pmove(1, shift+1); /* move 1 for MotionNotify */
} else if (!strcmp(dir, "right")) {
pmove(dpy_x-3, shift); /* Approach right edge in 3 moves. 1st move */
usleep(dts);
pmove(dpy_x-2, shift); /* 2nd move */
usleep(dts);
pmove(dpy_x-1, shift); /* 3rd move */
usleep(dts);
pmove(dpy_x-1, shift+1); /* move 1 for MotionNotify */
usleep(dts);
pmove(1, shift+1); /* go to 1 to extra pixel (slave x now == dpy_x-1?) */
usleep(dts);
pmove(1, shift); /* move 1 for MotionNotify */
usleep(dts);
pmove(dpy_x-2, shift); /* go to dpy_x-2 to be sure slave x == dpy_x-1 */
usleep(dts);
pmove(dpy_x-2, shift+1); /* move 1 for MotionNotify */
}
}
usleep(dt);
pmove(final_x, final_y);
usleep(dt);
if (extra_x >= 0 && extra_y >= 0) {
pmove(extra_x, extra_y);
usleep(dt);
}
strcpy(_bcx_res, "DONE");
if (grab_check) {
char st[64];
usleep(3*dt);
grab_state(&pg2, &kg2);
if (!strcmp(flip, "M2S")) {
if (pg2 != 1 || kg2 != 1) {
rfbLog("bcx_xattach: M2S fini grab state incorrect: %d,%d\n", pg2, kg2);
usleep(2*dt);
grab_state(&pg2, &kg2);
rfbLog("bcx_xattach: slept and retried, grab is now: %d,%d\n", pg2, kg2);
}
} else if (!strcmp(flip, "S2M")) {
if (pg2 != 0 || kg2 != 0) {
rfbLog("bcx_xattach: S2M fini grab state incorrect: %d,%d\n", pg2, kg2);
usleep(2*dt);
grab_state(&pg2, &kg2);
rfbLog("bcx_xattach: slept and retried, grab is now: %d,%d\n", pg2, kg2);
}
}
sprintf(st, ":%d,%d-%d,%d", pg1, kg1, pg2, kg2);
if (getenv("GRAB_CHECK_LOOP")) {
int i, n = atoi(getenv("GRAB_CHECK_LOOP"));
rfbLog("grab st: %s\n", st);
for (i=0; i < n; i++) {
usleep(dt);
grab_state(&pg2, &kg2);
sprintf(st, ":%d,%d-%d,%d", pg1, kg1, pg2, kg2);
rfbLog("grab st: %s\n", st);
}
}
if (!strcmp(flip, "M2S")) {
if (pg1 == 0 && kg1 == 0 && pg2 == 1 && kg2 == 1) {
strcat(_bcx_res, ",GRAB_OK");
} else {
rfbLog("bcx_xattach: M2S grab state incorrect: %d,%d -> %d,%d\n", pg1, kg1, pg2, kg2);
strcat(_bcx_res, ",GRAB_FAIL");
if (pg2 == 1 && kg2 == 1) {
strcat(_bcx_res, "_INIT");
} else if (pg1 == 0 && kg1 == 0) {
strcat(_bcx_res, "_FINAL");
}
strcat(_bcx_res, st);
}
} else if (!strcmp(flip, "S2M")) {
if (pg1 == 1 && kg1 == 1 && pg2 == 0 && kg2 == 0) {
strcat(_bcx_res, ",GRAB_OK");
} else {
rfbLog("bcx_xattach: S2M grab state incorrect: %d,%d -> %d,%d\n", pg1, kg1, pg2, kg2);
strcat(_bcx_res, ",GRAB_FAIL");
if (pg2 == 0 && kg2 == 0) {
strcat(_bcx_res, "_INIT");
} else if (pg1 == 1 && kg1 == 1) {
strcat(_bcx_res, "_FINAL");
}
strcat(_bcx_res, st);
}
}
}
return strdup(_bcx_res);
}
int set_xprop(char *prop, Window win, char *value) {
int rc = -1;
#if !NO_X11
Atom aprop;
RAWFB_RET(rc)
if (!prop || !value) {
return rc;
}
if (win == None) {
win = rootwin;
}
aprop = XInternAtom(dpy, prop, False);
rc = XChangeProperty(dpy, win, aprop, XA_STRING, 8,
PropModeReplace, (unsigned char *)value, strlen(value));
return rc;
#else
RAWFB_RET(rc)
if (!prop || !win || !value) {}
return rc;
#endif /* NO_X11 */
}
char *get_xprop(char *prop, Window win) {
#if NO_X11
RAWFB_RET(NULL)
if (!prop || !win) {}
return NULL;
#else
Atom type, aprop;
int format, slen, dlen;
unsigned long nitems = 0, bytes_after = 0;
unsigned char* data = NULL;
char get_str[VNC_CONNECT_MAX+1];
RAWFB_RET(NULL)
if (prop == NULL || !strcmp(prop, "")) {
return NULL;
}
if (win == None) {
win = rootwin;
}
aprop = XInternAtom(dpy, prop, True);
if (aprop == None) {
return NULL;
}
get_str[0] = '\0';
slen = 0;
/* read the property value into get_str: */
do {
if (XGetWindowProperty(dpy, win, aprop, nitems/4,
VNC_CONNECT_MAX/16, False, AnyPropertyType, &type,
&format, &nitems, &bytes_after, &data) == Success) {
dlen = nitems * (format/8);
if (slen + dlen > VNC_CONNECT_MAX) {
/* too big */
rfbLog("get_xprop: warning: truncating large '%s'"
" string > %d bytes.\n", prop, VNC_CONNECT_MAX);
XFree_wr(data);
break;
}
memcpy(get_str+slen, data, dlen);
slen += dlen;
get_str[slen] = '\0';
XFree_wr(data);
}
} while (bytes_after > 0);
get_str[VNC_CONNECT_MAX] = '\0';
rfbLog("get_prop: read: '%s' = '%s'\n", prop, get_str);
return strdup(get_str);
#endif /* NO_X11 */
}
static char _win_fmt[1000];
static char *win_fmt(Window win, XWindowAttributes a) {
memset(_win_fmt, 0, sizeof(_win_fmt));
sprintf(_win_fmt, "0x%lx:%dx%dx%d+%d+%d-map:%d-bw:%d-cl:%d-vis:%d-bs:%d/%d",
win, a.width, a.height, a.depth, a.x, a.y, a.map_state, a.border_width, a.class,
(int) ((a.visual)->visualid), a.backing_store, a.save_under);
return _win_fmt;
}
char *wininfo(Window win, int show_children) {
#if NO_X11
RAWFB_RET(NULL)
if (!win || !show_children) {}
return NULL;
#else
XWindowAttributes attr;
int n, size = X11VNC_REMOTE_MAX;
char get_str[X11VNC_REMOTE_MAX+1];
unsigned int nchildren;
Window rr, pr, *children;
RAWFB_RET(NULL)
if (win == None) {
return strdup("None");
}
X_LOCK;
if (!valid_window(win, &attr, 1)) {
X_UNLOCK;
return strdup("Invalid");
}
get_str[0] = '\0';
if (show_children) {
XQueryTree_wr(dpy, win, &rr, &pr, &children, &nchildren);
} else {
nchildren = 1;
children = (Window *) calloc(2 * sizeof(Window), 1);
children[0] = win;
}
for (n=0; n < nchildren; n++) {
char tmp[32];
char *str = "Invalid";
Window w = children[n];
if (valid_window(w, &attr, 1)) {
if (!show_children) {
str = win_fmt(w, attr);
} else {
sprintf(tmp, "0x%lx", w);
str = tmp;
}
}
if (strlen(get_str) + 1 + strlen(str) >= size) {
break;
}
if (n > 0) {
strcat(get_str, ",");
}
strcat(get_str, str);
}
get_str[size] = '\0';
if (!show_children) {
free(children);
} else if (nchildren) {
XFree_wr(children);
}
rfbLog("wininfo computed: %s\n", get_str);
X_UNLOCK;
return strdup(get_str);
#endif /* NO_X11 */
}
/*
* check if client_connect has been set, if so make the reverse connections.
*/
@ -3082,6 +3586,8 @@ enum rfbNewClientAction new_client(rfbClientPtr client) {
return(RFB_CLIENT_REFUSE);
}
/* We will RFB_CLIENT_ACCEPT or RFB_CLIENT_ON_HOLD from here on. */
if (passwdfile) {
if (strstr(passwdfile, "read:") == passwdfile ||
strstr(passwdfile, "cmd:") == passwdfile) {
@ -3137,7 +3643,7 @@ enum rfbNewClientAction new_client(rfbClientPtr client) {
cd->cmp_bytes_sent = 0;
cd->raw_bytes_sent = 0;
rfbLog("incr accepted_client for %s:%d.\n", client->host, get_remote_port(client->sock));
rfbLog("incr accepted_client for %s:%d sock=%d\n", client->host, get_remote_port(client->sock), client->sock);
accepted_client++;
last_client = time(NULL);
@ -3204,7 +3710,7 @@ enum rfbNewClientAction new_client(rfbClientPtr client) {
unixpw_login_viewonly = 1;
client->viewOnly = FALSE;
}
unixpw_last_try_time = time(NULL);
unixpw_last_try_time = time(NULL) + 10;
unixpw_screen(1);
unixpw_keystroke(0, 0, 1);
@ -3403,11 +3909,16 @@ void check_new_clients(void) {
int run_after_accept = 0;
if (unixpw_in_progress) {
static double lping = 0.0;
if (lping < dnow() + 5) {
mark_rect_as_modified(0, 0, 1, 1, 1);
lping = dnow();
}
if (unixpw_client && unixpw_client->viewOnly) {
unixpw_login_viewonly = 1;
unixpw_client->viewOnly = FALSE;
}
if (time(NULL) > unixpw_last_try_time + 25) {
if (time(NULL) > unixpw_last_try_time + 45) {
rfbLog("unixpw_deny: timed out waiting for reply.\n");
unixpw_deny();
}

@ -72,5 +72,10 @@ extern int run_user_command(char *cmd, rfbClientPtr client, char *mode, char *in
int len, FILE *output);
extern int check_access(char *addr);
extern void client_set_net(rfbClientPtr client);
extern char *get_xprop(char *prop, Window win);
extern int set_xprop(char *prop, Window win, char *value);
extern char *bcx_xattach(char *str, int *pg_init, int *kg_init);
extern void grab_state(int *ptr_grabbed, int *kbd_grabbed);
extern char *wininfo(Window win, int show_children);
#endif /* _X11VNC_CONNECTIONS_H */

@ -71,7 +71,8 @@ so, delete this exception statement from your version.
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
* the Free Software Foundation; version 2 of the License, or (at
* your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of

@ -793,7 +793,7 @@ void print_help(int mode) {
" presented to the user on a black screen inside the\n"
" vncviewer. The connection is dropped if the user fails\n"
" to supply the correct password in 3 tries or does not\n"
" send one before a 25 second timeout. Existing clients\n"
" send one before a 45 second timeout. Existing clients\n"
" are view-only during this period.\n"
"\n"
" If the first character received is \"Escape\" then the\n"
@ -1052,6 +1052,10 @@ void print_help(int mode) {
" under -display WAIT:... for more details about XDM,\n"
" etc configuration.\n"
"\n"
" Remember to enable XDMCP in the xdm-config, gdm.conf,\n"
" or kdmrc configuration file. See -display WAIT: for\n"
" more info.\n"
"\n"
"-sshxdmsvc Display manager Terminal services mode based on SSH.\n"
" Alias for -display WAIT:cmd=FINDCREATEDISPLAY-Xvfb.xdmcp\n"
" -localhost.\n"
@ -1064,6 +1068,48 @@ void print_help(int mode) {
" under -display WAIT:... for more details about XDM,\n"
" etc configuration.\n"
"\n"
" Remember to enable XDMCP in the xdm-config, gdm.conf,\n"
" or kdmrc configuration file. See -display WAIT: for\n"
" more info.\n"
"\n"
"-unixpw_system_greeter Present a \"Press 'Escape' for System Greeter\" option\n"
" to the connecting VNC client in combined -unixpw\n"
" and xdmcp FINDCREATEDISPLAY modes (e.g. -xdmsvc).\n"
"\n"
" Normally in a -unixpw mode the VNC client must\n"
" supply a valid username and password to gain access.\n"
" However, if -unixpw_system_greeter is supplied AND\n"
" the FINDCREATEDISPLAY command matches 'xdmcp', then\n"
" the user has the option to press Escape and then get a\n"
" XDM/GDM/KDM login/greeter panel instead. They will then\n"
" supply a username and password directly to the greeter.\n"
"\n"
" Otherwise, in xdmcp FINDCREATEDISPLAY mode the user\n"
" must supply his username and password TWICE. First to\n"
" the initial unixpw login dialog, and second to the\n"
" subsequent XDM/GDM/KDM greeter. Note that if the user\n"
" re-connects and supplies his username and password in\n"
" the unixpw dialog the xdmcp greeter is skipped and\n"
" he is connected directly to his existing X session.\n"
" So the -unixpw_system_greeter option avoids the extra\n"
" password at X session creation time.\n"
"\n"
" Example: x11vnc -xdmsvc -unixpw_system_greeter\n"
" See -unixpw and -display WAIT:... for more info.\n"
"\n"
" The special options after a colon at the end of the\n"
" username (e.g. user:solid) described under -display\n"
" WAIT: are also applied in this mode if they are typed\n"
" in before the user hits Escape. The username is ignored\n"
" but the colon options are not.\n"
"\n"
" If the user pressed Escape the FINDCREATEDISPLAY command\n"
" will be run with the env. var. X11VNC_XDM_ONLY=1.\n"
"\n"
" Remember to enable XDMCP in the xdm-config, gdm.conf,\n"
" or kdmrc configuration file. See -display WAIT: for\n"
" more info.\n"
"\n"
"-redirect port As in FINDCREATEDISPLAY-Xvnc.redirect mode except\n"
" redirect immediately (i.e. without X session finding\n"
" or creation) to a VNC server listening on port. You\n"
@ -1135,12 +1181,13 @@ void print_help(int mode) {
" Also in the case of -unixpw, the user logging in can\n"
" place a colon at the end of her username and supply\n"
" a few options: scale=, scale_cursor= (or sc=), solid\n"
" (or so), id=, clear_mods (or cm), clear_keys (or ck),\n"
" repeat, speeds= (or sp=), readtimeout= (or rd=),\n"
" rotate= (or ro=), or noncache (or nc), all separated by\n"
" commas if there is more than one. After the user logs\n"
" in successfully, these options will be applied to the\n"
" VNC screen. For example,\n"
" (or so), id=, clear_mods (or cm), clear_keys (or\n"
" ck), clear_all (or ca), repeat, speeds= (or sp=),\n"
" readtimeout= (or rd=), viewonly (or vo), nodisplay=\n"
" (or nd=), rotate= (or ro=), or noncache (or nc),\n"
" all separated by commas if there is more than one.\n"
" After the user logs in successfully, these options will\n"
" be applied to the VNC screen. For example,\n"
"\n"
" login: fred:scale=3/4,sc=1,repeat\n"
" Password: ...\n"
@ -1152,6 +1199,9 @@ void print_help(int mode) {
" your long \"login:\" line press the Up arrow once\n"
" (before typing anything else).\n"
"\n"
" In the login panel, press F1 to get a list of the\n"
" available options that you can add after the username.\n"
"\n"
" Another option is \"geom=WxH\" or \"geom=WxHxD\" (or\n"
" ge=). This only has an effect in FINDCREATEDISPLAY\n"
" mode when a virtual X server such as Xvfb is going\n"
@ -1226,7 +1276,9 @@ void print_help(int mode) {
" ignore in the finding process. The \":\" is optional.\n"
" Ranges n-m e.g. 0-20 can also be supplied. This string\n"
" can also be set by the connecting user via \"nd=\"\n"
" using \"+\" instead of \",\"\n"
" using \"+\" instead of \",\" If \"nd=all\" or you set\n"
" X11VNC_SKIP_DISPLAY=all then all display finding fails\n"
" as if you set X11VNC_FINDDISPLAY_ALWAYS_FAILS=1 (below.)\n"
"\n"
" Automatic Creation of User X Sessions:\n"
"\n"
@ -1282,6 +1334,8 @@ void print_help(int mode) {
" If for some reason you do not want x11vnc to ever\n"
" try to find an existing display set the env. var\n"
" X11VNC_FINDDISPLAY_ALWAYS_FAILS=1 (also -env ...)\n"
" This is the same as setting X11VNC_SKIP_DISPLAY=all or\n"
" supplying \"nd=all\" after \"username:\"\n"
"\n"
" Use WAIT:cmd=FINDCREATEDISPLAY-print to print out the\n"
" script that is used for this.\n"
@ -1310,12 +1364,15 @@ void print_help(int mode) {
" be the full path to the session/windowmanager program.\n"
"\n"
" More FD tricks: FD_CUPS=port or FD_CUPS=host:port\n"
" will set the cups printing environment. Similarly\n"
" for FD_ESD=port or FD_ESD=host:port for esddsp sound\n"
" redirection. FD_XDUMMY_NOROOT means the Xdummy server\n"
" does not need to be started as root (e.g. it will sudo\n"
" automatically). Set FD_EXTRA to a command to be run\n"
" a few seconds after the X server starts up.\n"
" will set the cups printing environment. Similarly for\n"
" FD_ESD=port or FD_ESD=host:port for esddsp sound\n"
" redirection. FD_XDUMMY_NOROOT means the Xdummy\n"
" server does not need to be started as root (e.g. it\n"
" will sudo automatically). Set FD_EXTRA to a command\n"
" to be run a few seconds after the X server starts up.\n"
" Set FD_TAG to be a unique name for the session, it is\n"
" set as an X property, that makes FINDDISPLAY only find\n"
" sessions with that tag value.\n"
"\n"
" If you want the FINDCREATEDISPLAY session to contact an\n"
" XDMCP login manager (xdm/gdm/kdm) on the same machine,\n"
@ -1395,8 +1452,9 @@ void print_help(int mode) {
" Otherwise in -unixpw mode the normal login panel is\n"
" provided.\n"
"\n"
" You *MUST* supply the -ssl option for VeNCrypt to be\n"
" active. This option only fine-tunes its operation.\n"
" You *MUST* supply the -ssl option for VeNCrypt to\n"
" be active. The -vencrypt option only fine-tunes its\n"
" operation.\n"
"\n"
"-anontls mode The ANONTLS extension to the VNC protocol allows\n"
" encrypted SSL/TLS connections. If the -ssl mode is\n"
@ -1431,8 +1489,9 @@ void print_help(int mode) {
"\n"
" Long example: -anontls newdh:plain:support\n"
"\n"
" You *MUST* supply the -ssl option for ANONTLS to be\n"
" active. This option only fine-tunes its operation.\n"
" You *MUST* supply the -ssl option for ANONTLS to\n"
" be active. The -anontls option only fine-tunes its\n"
" operation.\n"
"\n"
"-sslonly Same as: \"-vencrypt never -anontls never\" i.e. it\n"
" disables the VeNCrypt and ANONTLS encryption methods\n"
@ -1456,16 +1515,17 @@ void print_help(int mode) {
"\n"
"-ssl [pem] Use the openssl library (www.openssl.org) to provide a\n"
" built-in encrypted SSL/TLS tunnel between VNC viewers\n"
" and x11vnc. This requires libssl support to be compiled\n"
" into x11vnc at build time. If x11vnc is not built\n"
" with libssl support it will exit immediately when -ssl\n"
" is prescribed.\n"
" and x11vnc. This requires libssl support to be\n"
" compiled into x11vnc at build time. If x11vnc is not\n"
" built with libssl support it will exit immediately when\n"
" -ssl is prescribed. See the -stunnel option below for\n"
" an alternative.\n"
"\n"
" The VNC Viewer-side needs to support SSL/TLS as well.\n"
" See this URL and also the discussion below for\n"
" ideas on how to enable SSL support for the viewer:\n"
" http://www.karlrunge.com/x11vnc/faq.html#faq-ssl-tun\n"
" nel-viewers x11vnc provides an SSL enabled Java\n"
" nel-viewers . x11vnc provides an SSL enabled Java\n"
" viewer applet in the classes/ssl directory (-http or\n"
" -httpdir options.) The SSVNC viewer package supports\n"
" SSL tunnels too.\n"
@ -1555,6 +1615,11 @@ void print_help(int mode) {
" See -ssldir below to use a directory besides the\n"
" default ~/.vnc/certs\n"
"\n"
" If your x11vnc binary was not compiled with OpenSSL\n"
" library support, use of the -ssl option will induce an\n"
" immediate failure and exit. For such binaries, consider\n"
" using the -stunnel option for SSL encrypted connections.\n"
"\n"
" Misc Info: In temporary cert creation mode \"TMP\", set\n"
" the env. var. X11VNC_SHOW_TMP_PEM=1 to have x11vnc print\n"
" out the entire certificate, including the PRIVATE KEY\n"
@ -1657,7 +1722,7 @@ void print_help(int mode) {
"\n"
"\n"
" NOTE: the following utilities, -sslGenCA, -sslGenCert,\n"
" -sslEncKey, and -sslCertInfo are provided for\n"
" -sslEncKey, -sslCertInfo, and -sslCRL are provided for\n"
" completeness, but for casual usage they are overkill.\n"
"\n"
" They provide VNC Certificate Authority (CA) key creation\n"
@ -1708,8 +1773,9 @@ void print_help(int mode) {
" the ss_vncviewer example script in the FAQ and SSVNC.)\n"
"\n"
"-sslCRL path Set the Certificate Revocation Lists (CRL) to \"path\".\n"
" This setting applies for both -ssl and -stunnel modes.\n"
"\n"
" If path is a file, the file contains one more more CRLs\n"
" If path is a file, the file contains one or more CRLs\n"
" in PEM format. If path is a directory, it contains\n"
" hash named files of CRLs in the usual OpenSSL manner.\n"
" See the OpenSSL and stunnel(8) documentation for\n"
@ -1721,6 +1787,10 @@ void print_help(int mode) {
" The -sslCRL setting will be ignored when -sslverify is\n"
" not specified.\n"
"\n"
" Note that if a CRL's expiration date has passed, all\n"
" SSL connections will fail regardless of if they are\n"
" related to the subject of the CRL or not.\n"
"\n"
" Only rarely will one's x11vnc -ssl infrastructure be so\n"
" large that this option would be useful (since normally\n"
" maintaining the contents of the -sslverify file or\n"
@ -1832,11 +1902,13 @@ void print_help(int mode) {
"\n"
" Similar to -sslGenCA, you will be prompted to fill\n"
" in some information that will be recorded in the\n"
" certificate when it is created. Tip: if you know\n"
" the fully-qualified hostname other people will be\n"
" connecting to you can use that as the CommonName \"CN\"\n"
" to avoid some applications (e.g. web browsers and java\n"
" plugin) complaining it does not match the hostname.\n"
" certificate when it is created.\n"
"\n"
" Tip: if you know the fully-qualified hostname other\n"
" people will be connecting to, you can use that as the\n"
" CommonName \"CN\" to avoid some applications (e.g. web\n"
" browsers and java plugin) complaining that it does not\n"
" match the hostname.\n"
"\n"
" You will also need to supply the CA private key\n"
" passphrase to unlock the private key created from\n"
@ -1860,14 +1932,14 @@ void print_help(int mode) {
" the cert and private key. The <name>.crt contains the\n"
" certificate only.\n"
"\n"
" NOTE: It is very important to know one should always\n"
" NOTE: It is very important to know one should\n"
" generate new keys with a passphrase. Otherwise if an\n"
" untrusted user steals the key file he could use it to\n"
" masquerade as the x11vnc server (or VNC viewer client).\n"
" You will be prompted whether to encrypt the key with\n"
" a passphrase or not. It is recommended that you do.\n"
" One inconvenience to a passphrase is that it must\n"
" be suppled every time x11vnc or the client app is\n"
" be typed in EVERY time x11vnc or the client app is\n"
" started up.\n"
"\n"
" Examples:\n"
@ -1964,16 +2036,30 @@ void print_help(int mode) {
"\n"
" This external tunnel method was implemented prior to the\n"
" integrated -ssl encryption described above. It still\n"
" works well. This requires stunnel to be installed\n"
" on the system and available via PATH (n.b. stunnel is\n"
" often installed in sbin directories). Version 4.x of\n"
" stunnel is assumed (but see -stunnel3 below.)\n"
" works well and avoids the requirement of linking with\n"
" the OpenSSL libraries. This mode requires stunnel\n"
" to be installed on the system and available via PATH\n"
" (n.b. stunnel is often installed in sbin directories).\n"
" Version 4.x of stunnel is assumed (but see -stunnel3\n"
" below.)\n"
"\n"
" [pem] is optional, use \"-stunnel /path/to/stunnel.pem\"\n"
" to specify a PEM certificate file to pass to stunnel.\n"
" Whether one is needed or not depends on your stunnel\n"
" configuration. stunnel often generates one at install\n"
" time. See the stunnel documentation for details.\n"
" See the -ssl option for more info on certificate files.\n"
"\n"
" Whether or not your stunnel has its own certificate\n"
" depends on your stunnel configuration; stunnel often\n"
" generates one at install time. See your stunnel\n"
" documentation for details. In any event, if you want to\n"
" use this certificate you must supply the full path to it\n"
" as [pem]. Note: the file may only be readable by root.\n"
"\n"
" [pem] may also be the special strings \"TMP\", \"SAVE\",\n"
" and \"SAVE...\" as described in the -ssl option.\n"
" If [pem] is not supplied, \"SAVE\" is assumed.\n"
"\n"
" Note that the VeNCrypt, ANONTLS, and \"ANON\" modes\n"
" are not supported in -stunnel mode.\n"
"\n"
" stunnel is started up as a child process of x11vnc and\n"
" any SSL connections stunnel receives are decrypted and\n"
@ -1981,22 +2067,37 @@ void print_help(int mode) {
" \"The SSL VNC desktop is ...\" and \"SSLPORT=...\"\n"
" are printed out at startup to indicate this.\n"
"\n"
" The -localhost option is enforced by default\n"
" to avoid people routing around the SSL channel.\n"
" Set STUNNEL_DISABLE_LOCALHOST=1 before starting x11vnc\n"
" to disable the requirement.\n"
" The -localhost option is enforced by default to avoid\n"
" people routing around the SSL channel. Use -env\n"
" STUNNEL_DISABLE_LOCALHOST=1 to disable this security\n"
" requirement.\n"
"\n"
" Set -env STUNNEL_DEBUG=1 for more debugging printout.\n"
"\n"
" Your VNC viewer will also need to be able to connect\n"
" via SSL. Unfortunately not too many do this. See the\n"
" information about SSL viewers under the -ssl option.\n"
"\n"
" Your VNC viewer will also need to be able to connect via\n"
" SSL. Unfortunately not too many do this. UltraVNC has\n"
" an encryption plugin but it does not seem to be SSL.\n"
" Also, in the x11vnc distribution, patched TightVNC\n"
" and UltraVNC Java applet jar files are provided in\n"
" the classes/ssl directory that do SSL connections.\n"
" Enable serving them with the -http, -http_ssl, -https,\n"
" or -httpdir (see the option descriptions for more info.)\n"
"\n"
" Also, in the x11vnc distribution, a patched TightVNC\n"
" Java applet is provided in classes/ssl that does SSL\n"
" connections (only).\n"
" Note that for the Java viewer applet usage the\n"
" \"?PORT=xxxx\" in the various URLs printed at startup\n"
" will need to be supplied to the web browser to connect\n"
" properly.\n"
"\n"
" It is also not too difficult to set up an stunnel or\n"
" other SSL tunnel on the viewer side. A simple example\n"
" on Unix using stunnel 3.x is:\n"
" Currently the automatic \"single port\" HTTPS mode of\n"
" -ssl is not fully supported in -stunnel mode. However,\n"
" it can be emulated via:\n"
"\n"
" %% x11vnc -stunnel -http_ssl -http_oneport ...\n"
"\n"
" In general, it is also not too difficult to set up\n"
" an stunnel or other SSL tunnel on the viewer side.\n"
" A simple example on Unix using stunnel 3.x is:\n"
"\n"
" %% stunnel -c -d localhost:5901 -r remotehost:5900\n"
" %% vncviewer localhost:1\n"
@ -2006,7 +2107,8 @@ void print_help(int mode) {
" and SSVNC for more examples.\n"
"\n"
"-stunnel3 [pem] Use version 3.x stunnel command line syntax instead of\n"
" version 4.x\n"
" version 4.x. The -http/-httpdir Java applet serving\n"
" is currently not available in this mode.\n"
"\n"
"-enc cipher:keyfile Use symmetric encryption with cipher \"cipher\"\n"
" and secret key data in \"keyfile\". If keyfile is\n"
@ -2025,7 +2127,7 @@ void print_help(int mode) {
" Note that this mode will NOT work with the UltraVNC DSM\n"
" plugins because they alter the RFB protocol in addition\n"
" to tunnelling with the symmetric cipher (an unfortunate\n"
" choice of implementation).\n"
" choice of implementation...)\n"
"\n"
" cipher can be one of: arc4, aesv2, aes-cfb, blowfish,\n"
" aes256, or 3des. See the OpenSSL documentation for\n"
@ -2098,9 +2200,9 @@ void print_help(int mode) {
" For both ways of using the viewer, you can specify the\n"
" salt,ivec sizes (in GUI or, e.g. arc4@8,16).\n"
"\n"
"-https [port] Use a special, separate HTTPS port (-ssl mode only)\n"
" for HTTPS Java viewer applet downloading. I.e. not 5900\n"
" and not 5800 (the defaults.)\n"
"-https [port] Use a special, separate HTTPS port (-ssl and\n"
" -stunnel modes only) for HTTPS Java viewer applet\n"
" downloading. I.e. not 5900 and not 5800 (the defaults.)\n"
"\n"
" BACKGROUND: In -ssl mode, it turns out you can use the\n"
" single VNC port (e.g. 5900) for both VNC and HTTPS\n"
@ -2120,6 +2222,8 @@ void print_help(int mode) {
" or VNC Viewer applet. That's right 3 separate \"Are\n"
" you sure you want to connect?\" dialogs!)\n"
"\n"
" END OF BACKGROUND.\n"
"\n"
" USAGE: So use the -https option to provide a separate,\n"
" more reliable HTTPS port that x11vnc will listen on. If\n"
" [port] is not provided (or is 0), one is autoselected.\n"
@ -2153,7 +2257,9 @@ void print_help(int mode) {
" to include the PORT= in the browser URL, simply supply\n"
" \"-httpsredir\" to x11vnc.\n"
"\n"
"-http_oneport For un-encrypted connections mode (i.e. no -ssl,\n"
" This options does not work in -stunnel mode.\n"
"\n"
"-http_oneport For UN-encrypted connections mode (i.e. no -ssl,\n"
" -stunnel, or -enc options), allow the Java VNC Viewer\n"
" applet to be downloaded thru the VNC port via HTTP.\n"
"\n"
@ -3537,10 +3643,21 @@ void print_help(int mode) {
" Same as -dp and -dk, respectively. Use multiple\n"
" times for more output.\n"
"\n"
"-defer time Time in ms to wait for updates before sending to client\n"
"-defer time Time in ms to delay sending updates to connected clients\n"
" (deferUpdateTime) Default: %d\n"
"\n"
"-wait time Time in ms to pause between screen polls. Used to cut\n"
" down on load. Default: %d\n"
"\n"
"-extra_fbur n Perform extra FrameBufferUpdateRequests checks to\n"
" try to be in better sync with the client's requests.\n"
" What this does is perform extra polls of the client\n"
" socket at critical times (before '-defer' and '-wait'\n"
" calls.) The default is n=1. Set to a larger number to\n"
" insert more checks or set to n=0 to disable. A downside\n"
" of these extra calls is that more mouse input may be\n"
" processed than desired.\n"
"\n"
"-wait_ui factor Factor by which to cut the -wait time if there\n"
" has been recent user input (pointer or keyboard).\n"
" Improves response, but increases the load whenever you\n"
@ -4350,6 +4467,28 @@ void print_help(int mode) {
" x11vnc server as long as X permissions, etc. permit\n"
" communication between the two.\n"
"\n"
" FONTS: On some systems the tk fonts can be too small,\n"
" jagged, or otherwise unreadable. There are 4 env vars\n"
" you can set to be the tk font you prefer:\n"
"\n"
" X11VNC_FONT_BOLD main font for menus and buttons.\n"
" X11VNC_FONT_FIXED font for fixed width text.\n"
"\n"
" X11VNC_FONT_BOLD_SMALL tray icon font.\n"
" X11VNC_FONT_REG_SMALL tray icon menu font.\n"
"\n"
" The last two only apply for the tray icon mode.\n"
"\n"
" Here are some examples:\n"
"\n"
" -env X11VNC_FONT_BOLD='Helvetica -16 bold'\n"
" -env X11VNC_FONT_FIXED='Courier -14'\n"
" -env X11VNC_FONT_REG_SMALL='Helvetica -12'\n"
"\n"
" You can put the lines like the above (without the\n"
" quotes) in your ~/.x11vncrc file to avoid having to\n"
" specify them on the x11vnc command line.\n"
"\n"
"-remote command Remotely control some aspects of an already running\n"
" x11vnc server. \"-R\" and \"-r\" are aliases for\n"
" \"-remote\". After the remote control command is\n"
@ -4373,12 +4512,26 @@ void print_help(int mode) {
" 'x11vnc -R shared' will enable shared connections, and\n"
" 'x11vnc -R scale:3/4' will rescale the desktop.\n"
"\n"
" To run a bunch of commands in a sequence use something\n"
" like: x11vnc -R 'script:firstcmd;secondcmd;...'\n"
"\n"
" Use x11vnc -R script:file=/path/to/file to read commands\n"
" from a file (can be multi-line and use the comment '#'\n"
" character in the normal way. The ';' separator must\n"
" still be used to separate each command.)\n"
"\n"
" To not try to contact another x11vnc process and instead\n"
" just run the command (or query) directly, prefix the\n"
" command with the string \"DIRECT:\"\n"
"\n"
" The following -remote/-R commands are supported:\n"
"\n"
" stop terminate the server, same as \"quit\"\n"
" \"exit\" or \"shutdown\".\n"
" ping see if the x11vnc server responds.\n"
" Return is: ans=ping:<xdisplay>\n"
" return is: ans=ping:<display>\n"
" ping:mystring as above, but use your own unique string.\n"
" return is: ans=ping:mystring:<xdisplay>\n"
" blacken try to push a black fb update to all\n"
" clients (due to timings a client\n"
" could miss it). Same as \"zero\", also\n"
@ -4473,6 +4626,7 @@ void print_help(int mode) {
" nograbptr disable -grabptr mode.\n"
" grabalways enable -grabalways mode.\n"
" nograbalways disable -grabalways mode.\n"
" grablocal:n set -grablocal to n.\n"
" client_input:str set the K, M, B -input on a per-client\n"
" basis. select which client as for\n"
" disconnect, e.g. client_input:host:MB\n"
@ -4558,6 +4712,9 @@ void print_help(int mode) {
" nosetclipboard enable -nosetclipboard mode.\n"
" setclipboard disable -nosetclipboard mode.\n"
" seldir:str set -seldir to \"str\"\n"
" resend_cutbuffer resend the most recent CUTBUFFER0 copy\n"
" resend_clipboard resend the most recent CLIPBOARD copy\n"
" resend_primary resend the most recent PRIMARY copy\n"
" cursor:mode enable -cursor \"mode\".\n"
" show_cursor enable showing a cursor.\n"
" noshow_cursor disable showing a cursor. (same as\n"
@ -4630,8 +4787,25 @@ void print_help(int mode) {
" nodebug_pointer disable -debug_pointer, same as \"nodp\"\n"
" debug_keyboard enable -debug_keyboard, same as \"dk\"\n"
" nodebug_keyboard disable -debug_keyboard, same as \"nodk\"\n"
" keycode:n inject keystroke 'keycode' (xmodmap -pk)\n"
" keycode:n,down inject 'keycode' (down=0,1)\n"
" keysym:str inject keystroke 'keysym' (number/name)\n"
" keysym:str,down inject 'keysym' (down=0,1)\n"
" ptr:x,y,mask inject pointer event x, y, button-mask\n"
" sleep:t sleep floating point time t.\n"
" get_xprop:p get X property named 'p'.\n"
" set_xprop:p:val set X property named 'p' to 'val'.\n"
" p -> id=NNN:p for hex/dec window id.\n"
" wininfo:id get info about X window id. use 'root'\n"
" for root window, use +id for children.\n"
" grab_state get state of pointer and keyboard grab.\n"
" pointer_pos print XQueryPointer x,y cursor position.\n"
" mouse_x print x11vnc's idea of cursor position.\n"
" mouse_y print x11vnc's idea of cursor position.\n"
" noop do nothing.\n"
" defer:n set -defer to n ms,same as deferupdate:n\n"
" wait:n set -wait to n ms.\n"
" extra_fbur:n set -extra_fbur to n.\n"
" wait_ui:f set -wait_ui factor to f.\n"
" setdefer:n set -setdefer to -2,-1,0,1, or 2.\n"
" wait_bog disable -nowait_bog mode.\n"
@ -4670,6 +4844,7 @@ void print_help(int mode) {
" nosnapfb disable -snapfb mode.\n"
" rawfb:str set -rawfb mode to \"str\".\n"
" uinput_accel:f set uinput_accel to f.\n"
" uinput_thresh:n set uinput_thresh to n.\n"
" uinput_reset:n set uinput_reset to n ms.\n"
" uinput_always:n set uinput_always to 1/0.\n"
" progressive:n set libvncserver -progressive slice\n"
@ -4687,7 +4862,9 @@ void print_help(int mode) {
" macresize disable -macnoresize mode.\n"
" maciconanim:n set -maciconanim to n.\n"
" macmenu enable -macmenu mode.\n"
" macnomenu disable -macnmenu mode.\n"
" macnomenu disable -macmenu mode.\n"
" macuskbd enable -macuskbd mode.\n"
" macnouskbd disable -macuskbd mode.\n"
/* access */
" httpport:n set -httpport to n.\n"
" httpdir:dir set -httpdir to dir (and enable http).\n"
@ -4724,6 +4901,100 @@ void print_help(int mode) {
" noremote disable the -remote command processing,\n"
" it cannot be turned back on.\n"
"\n"
" bcx_xattach:str This remote control command is for\n"
" use with the BARCO xattach program or the x2x program.\n"
" Both of these programs are for 'pointer and keyboard'\n"
" sharing between separate X displays. In general the\n"
" two displays are usually nearby, e.g. on the same desk,\n"
" and this allows the user to share a single pointer and\n"
" keyboard between them. The user moves the mouse to\n"
" an edge and then the mouse pointer appears to 'jump'\n"
" to the other display screen. Thus it emulates what a\n"
" single X server would do for two screens (e.g. :0.0 and\n"
" :0.1) The illusion of a single Xserver with multiple\n"
" screens is achieved by forwarding events to the 2nd\n"
" one via the XTEST extension.\n"
"\n"
" What the x11vnc bcx_xattach command does is to perform\n"
" some pointer movements to try to INDUCE xattach/x2x\n"
" to 'jump' to the other display. In what follows the\n"
" 'master' display refers to the one that when it has\n"
" 'focus' it is basically doing nothing besides watching\n"
" for the mouse to go over an edge. The 'slave'\n"
" display refers to the one to which the mouse and\n"
" keyboard is redirected to once an edge in the master\n"
" has been crossed. Note that the x11vnc executing the\n"
" bcx_xattach command MUST be the one connected to the\n"
" *master* display.\n"
"\n"
" Also note that when input is being redirected (via\n"
" XTEST) from the master display to the slave display,\n"
" the master display's pointer and keyboard are *grabbed*\n"
" by xattach/x2x. x11vnc can use this info to verify that\n"
" the master/slave mode change has taken place correctly.\n"
" If you specify the \"ifneeded\" option (see below)\n"
" and the initial grab state is that of the desired\n"
" final state, then no pointer movements are injected\n"
" and \"DONE,GRAB_OK\" is returned.\n"
"\n"
" \"str\" must contain one of \"up\", \"down\", \"left\",\n"
" or \"right\" to indicate the direction of the 'jump'.\n"
" \"str\" must also contain one of \"master_to_slave\"\n"
" or \"slave_to_master\" to indicate the type of mode\n"
" change induced by the jump. Use \"M2S\" and \"S2M\"\n"
" as shorter aliases.\n"
"\n"
" \"str\" may be a \"+\" separated list of additional\n"
" tuning options. The \"shift=n\" option indicates an\n"
" offset shift position away from (0,0) (default 20).\n"
" \"final=x+y\" specifies the final position of the cursor\n"
" at the end of the normal move sequence; default 30+30.\n"
" \"extra_move=x+y\" means to do one more pointer move\n"
" after \"final\" to x+y. \"dt=n\" sets the sleep time\n"
" in milliseconds between pointer moves (default: 40ms)\n"
" \"retry=n\" specifies the maximum number of retries if\n"
" the grab state change fails. \"ifneeded\" means to not\n"
" apply the pointer movements if the initial grab state is\n"
" that of the desired final state. \"nograbcheck\" means\n"
" to not check if the grab state changed as expected and\n"
" only apply the pointer movements (default is to check\n"
" the grab states.)\n"
"\n"
" If you do not specify \"up\", etc., to bcx_xattach\n"
" nothing will be attempted and the command returns\n"
" the string FAIL,NO_DIRECTION_SPECIFIED. If you do\n"
" not specify \"master_to_slave\" or \"M2S\", etc., to\n"
" bcx_xattach nothing will be attempted and the command\n"
" returns the string FAIL,NO_MODE_CHANGE_SPECIFIED.\n"
"\n"
" Otherwise, the returned string will contain \"DONE\".\n"
" It will be \"DONE,GRAB_OK\" if the grab state changed\n"
" as expected (or if \"ifneeded\" was supplied and\n"
" the initial grab state was already the desired\n"
" one.) If the initial grab state was incorrect,\n"
" but the final grab state was correct then it is\n"
" \"DONE,GRAB_FAIL_INIT\". If the initial grab state\n"
" was correct, but the final grab state was incorrect\n"
" then it is \"DONE,GRAB_FAIL_FINAL\". If both are\n"
" incorrect it will be \"DONE,GRAB_FAIL\". Under grab\n"
" failure the string will be followed by \":p1,k1-p2,k2\"\n"
" where p1,k1 indicates the initial pointer and keyboard\n"
" grab states and p2,k2 the final ones. If GRAB_FAIL or\n"
" GRAB_FAIL_FINAL occurs, the action will be retried up\n"
" to 3 times; trying to reset the state and sleeping a\n"
" bit between each try. Set retry=n to adjust the number\n"
" of retries, zero to disable retries.\n"
"\n"
" Examples:\n"
" -R bcx_xattach:down+M2S\n"
" -R bcx_xattach:up+S2M\n"
" -R bcx_xattach:up+S2M+nograbcheck+dt=30\n"
" -R bcx_xattach:down+M2S+extra_move=100+100\n"
"\n"
" or use -Q instead of -R to retrieve the result text.\n"
"\n"
" End of the bcx_xattach:str description.\n"
"\n"
" The vncconnect(1) command from standard VNC\n"
" distributions may also be used if string is prefixed\n"
" with \"cmd=\" E.g. 'vncconnect cmd=stop'. Under some\n"
@ -4752,7 +5023,8 @@ void print_help(int mode) {
" query straight to the X11VNC_REMOTE property or connect\n"
" file use \"qry=...\" instead of \"cmd=...\"\n"
"\n"
" ans= stop quit exit shutdown ping blacken zero\n"
" ans= stop quit exit shutdown ping resend_cutbuffer\n"
" resend_clipboard resend_primary blacken zero\n"
" refresh reset close disconnect id sid waitmapped\n"
" nowaitmapped clip flashcmap noflashcmap shiftcmap\n"
" truecolor notruecolor overlay nooverlay overlay_cursor\n"
@ -4763,7 +5035,7 @@ void print_help(int mode) {
" once timeout tightfilexfer notightfilexfer ultrafilexfer\n"
" noultrafilexfer rfbversion deny lock nodeny unlock\n"
" avahi mdns zeroconf noavahi nomdns nozeroconf connect\n"
" proxy allowonce allow localhost nolocalhost listen\n"
" proxy allowonce allow localhost nolocalhost listen\n"
" lookup nolookup accept afteraccept gone shm noshm\n"
" flipbyteorder noflipbyteorder onetile noonetile\n"
" solid_color solid nosolid blackout xinerama noxinerama\n"
@ -4773,10 +5045,10 @@ void print_help(int mode) {
" sloppy_keys nosloppy_keys skip_dups noskip_dups\n"
" add_keysyms noadd_keysyms clear_mods noclear_mods\n"
" clear_keys noclear_keys clear_all clear_locks keystate\n"
" remap repeat norepeat fb nofb bell nobell sel nosel\n"
" primary noprimary setprimary nosetprimary clipboard\n"
" noclipboard setclipboard nosetclipboard seldir\n"
" cursorshape nocursorshape cursorpos nocursorpos\n"
" remap repeat norepeat fb nofb bell nobell sendbell\n"
" sel nosel primary noprimary setprimary nosetprimary\n"
" clipboard noclipboard setclipboard nosetclipboard\n"
" seldir cursorshape nocursorshape cursorpos nocursorpos\n"
" cursor_drag nocursor_drag cursor show_cursor\n"
" noshow_cursor nocursor arrow xfixes noxfixes xdamage\n"
" noxdamage xd_area xd_mem alphacut alphafrac alpharemove\n"
@ -4792,16 +5064,18 @@ void print_help(int mode) {
" nowireframe nowf wireframelocal wfl nowireframelocal\n"
" nowfl wirecopyrect wcr nowirecopyrect nowcr scr_area\n"
" scr_skip scr_inc scr_keys scr_term scr_keyrepeat\n"
" scr_parms scrollcopyrect scr noscrollcopyrect noscr\n"
" fixscreen noxrecord xrecord reset_record pointer_mode pm\n"
" input_skip allinput noallinput input grabkbd nograbkbd\n"
" grabptr nograbptr grabalways nograbalways grablocal\n"
" client_input ssltimeout speeds wmdt debug_pointer dp\n"
" nodebug_pointer nodp debug_keyboard dk nodebug_keyboard\n"
" nodk keycode deferupdate defer setdefer wait_ui\n"
" wait_bog nowait_bog slow_fb xrefresh wait readtimeout\n"
" nap nonap sb screen_blank fbpm nofbpm dpms nodpms\n"
" clientdpms noclientdpms forcedpms noforcedpms\n"
" scr_parms scrollcopyrect scr noscrollcopyrect\n"
" noscr fixscreen noxrecord xrecord reset_record\n"
" pointer_mode pm input_skip allinput noallinput input\n"
" grabkbd nograbkbd grabptr nograbptr grabalways\n"
" nograbalways grablocal client_input ssltimeout\n"
" speeds wmdt debug_pointer dp nodebug_pointer nodp\n"
" debug_keyboard dk nodebug_keyboard nodk keycode\n"
" keysym ptr sleep get_xprop set_xprop wininfo\n"
" bcx_xattach deferupdate defer setdefer extra_fbur\n"
" wait_ui wait_bog nowait_bog slow_fb xrefresh wait\n"
" readtimeout nap nonap sb screen_blank fbpm nofbpm dpms\n"
" nodpms clientdpms noclientdpms forcedpms noforcedpms\n"
" noserverdpms serverdpms noultraext ultraext chatwindow\n"
" nochatwindow chaton chatoff fs gaps grow fuzz snapfb\n"
" nosnapfb rawfb uinput_accel uinput_thresh uinput_reset\n"
@ -4819,21 +5093,23 @@ void print_help(int mode) {
" macnoresize macresize nomacnoresize maciconanim macmenu\n"
" macnomenu nomacmenu macuskbd nomacuskbd noremote\n"
"\n"
" aro= noop display vncdisplay desktopname guess_desktop\n"
" http_url auth xauth users rootshift clipshift scale_str\n"
" scaled_x scaled_y scale_numer scale_denom scale_fac_x\n"
" aro= noop display vncdisplay autoport loop loopbg\n"
" desktopname guess_desktop http_url auth xauth\n"
" users rootshift clipshift scale_str scaled_x\n"
" scaled_y scale_numer scale_denom scale_fac_x\n"
" scale_fac_y scaling_blend scaling_nomult4 scaling_pad\n"
" scaling_interpolate inetd privremote unsafe safer\n"
" nocmds passwdfile unixpw unixpw_nis unixpw_list ssl\n"
" ssl_pem sslverify stunnel stunnel_pem https httpsredir\n"
" usepw using_shm logfile o flag rc norc h help V version\n"
" lastmod bg sigpipe threads readrate netrate netlatency\n"
" pipeinput clients client_count pid ext_xtest ext_xtrap\n"
" ext_xrecord ext_xkb ext_xshm ext_xinerama ext_overlay\n"
" ext_xfixes ext_xdamage ext_xrandr rootwin num_buttons\n"
" button_mask mouse_x mouse_y bpp depth indexed_color\n"
" dpy_x dpy_y wdpy_x wdpy_y off_x off_y cdpy_x cdpy_y\n"
" coff_x coff_y rfbauth passwd viewpasswd\n"
" usepw using_shm logfile o flag rmflag rc norc h help\n"
" V version lastmod bg sigpipe threads readrate netrate\n"
" netlatency pipeinput clients client_count pid ext_xtest\n"
" ext_xtrap ext_xrecord ext_xkb ext_xshm ext_xinerama\n"
" ext_overlay ext_xfixes ext_xdamage ext_xrandr rootwin\n"
" num_buttons button_mask mouse_x mouse_y grab_state\n"
" pointer_pos bpp depth indexed_color dpy_x dpy_y wdpy_x\n"
" wdpy_y off_x off_y cdpy_x cdpy_y coff_x coff_y rfbauth\n"
" passwd viewpasswd\n"
"\n"
"-QD variable Just like -query variable, but returns the default\n"
" value for that parameter (no running x11vnc server\n"
@ -4853,10 +5129,43 @@ void print_help(int mode) {
" the -query request is processed in the normal way.\n"
" This allows for a reliable way to see if the -remote\n"
" command was processed by querying for any new settings.\n"
" Note however that there is timeout of a few seconds so\n"
" if the x11vnc takes longer than that to process the\n"
" requests the requester will think that a failure has\n"
" taken place.\n"
" Note however that there is timeout of a few seconds\n"
" (see the next paragraph) so if the x11vnc takes longer\n"
" than that to process the requests the requester will\n"
" think that a failure has taken place.\n"
"\n"
" The default is to wait 3.5 seconds. Or if cmd=stop\n"
" only 1.0 seconds. If cmd matches 'script:' then it\n"
" will wait up to 10.0 seconds. Set X11VNC_SYNC_TIMEOUT\n"
" to the number of seconds you want it to wait.\n"
"\n"
"-query_retries str If a query fails to get a response from an x11vnc\n"
" server, retry up to n times. \"str\" is specified as\n"
" n[:t][/match] Optionally the delay between tries may\n"
" be specified by \"t\" a floating point time (default\n"
" 0.5 seconds.) Note: the response is not checked for\n"
" validity or whether it corresponds to the query sent.\n"
" The query \"ping:mystring\" may be used to help uniquely\n"
" identify the query. Optionally, a matching string after\n"
" a \"/\" will be used to check the result text. Up to\n"
" n retries will take place until the matching string is\n"
" found in the output text. If the match string is never\n"
" found the program's exit code is 1; if the match is\n"
" found it exits with 0. Note that there may be stdout\n"
" printed for each retry (i.e. multiple lines printed\n"
" out to stdout.)\n"
" Example: -query_retries 4:1.5/grab_state\n"
"\n"
"-remote_prefix str Enable a remote-control communication channel for\n"
" connected VNC clients. str is a non-empty string. If a\n"
" VNC client sends rfbCutText having the prefix \"str\"\n"
" then the part after it is processed as though it were\n"
" sent via 'x11vnc -remote ...'. If it begins with\n"
" neither 'cmd=' nor 'qry=' then 'qry=' is assumed.\n"
" Any corresponding output text for that remote control\n"
" command is sent back to all client as rfbCutText.\n"
" The returned output is also prefixed with \"str\".\n"
" Example: -remote_prefix DO_THIS:\n"
"\n"
"-noremote Do not process any remote control commands or queries.\n"
"-yesremote Do process remote control commands or queries.\n"
@ -4936,6 +5245,7 @@ void print_help(int mode) {
int w = 23;
char tmp[100];
if (p[0] == '-') {
memset(tmp, 0, sizeof(tmp));
strncpy(tmp, p, w);
fprintf(stderr, " %s", tmp);
l++;
@ -4981,8 +5291,8 @@ void print_help(int mode) {
waitms,
wait_ui,
take_naps ? "take naps":"no naps",
rfbMaxClientWait/1000,
screen_blank,
rfbMaxClientWait/1000,
watch_fbpm ? "-nofbpm":"-fbpm",
watch_dpms ? "-nodpms":"-dpms",
xdamage_max_area, NSCAN, xdamage_memory,

@ -2045,7 +2045,7 @@ static void xkb_tweak_keyboard(rfbBool down, rfbKeySym keysym,
* why nothing needs to be done with the modifier, see below.
*
* sentmods[] is the corresponding keycode to use
* to acheive the needmods[] requirement for the bit.
* to achieve the needmods[] requirement for the bit.
*/
for (i=0; i<8; i++) {
@ -2780,6 +2780,11 @@ void get_allowed_input(rfbClientPtr client, allowed_input_t *input) {
input->files = 0;
if (! client) {
input->keystroke = 1;
input->motion = 1;
input->button = 1;
input->clipboard = 1;
input->files = 1;
return;
}

@ -55,6 +55,8 @@ int unixpw = 0; /* -unixpw */
int unixpw_nis = 0; /* -unixpw_nis */
char *unixpw_list = NULL;
char *unixpw_cmd = NULL;
int unixpw_system_greeter = 0;
int unixpw_system_greeter_active = 0;
int use_stunnel = 0; /* -stunnel */
int stunnel_port = 0;
char *stunnel_pem = NULL;
@ -70,6 +72,8 @@ int vencrypt_enable_plain_login = 0;
int anontls_mode = ANONTLS_SUPPORT;
int create_fresh_dhparams = 0;
char *dhparams_file = NULL;
int http_try_it = 0;
int stunnel_http_port = 0;
int https_port_num = -1;
int https_port_redir = 0;
char *ssl_verify = NULL;
@ -112,6 +116,8 @@ int deny_all = 0; /* global locking of new clients */
#define REMOTE_DEFAULT 1
#endif
int accept_remote_cmds = REMOTE_DEFAULT; /* -noremote */
char *remote_prefix = NULL;
int remote_direct = 0;
int query_default = 0;
int safe_remote_only = 1; /* -unsafe */
int priv_remote = 0; /* -privremote */
@ -402,6 +408,7 @@ double wait_ui = 2.0;
double slow_fb = 0.0;
double xrefresh = 0.0;
int wait_bog = 1;
int extra_fbur = 1;
int defer_update = 20; /* deferUpdateTime ms to wait before sends. */
int set_defer = 1;
int got_defer = 0;

@ -55,6 +55,8 @@ extern int unixpw;
extern int unixpw_nis;
extern char *unixpw_list;
extern char *unixpw_cmd;
extern int unixpw_system_greeter;
extern int unixpw_system_greeter_active;
extern int use_stunnel;
extern int stunnel_port;
extern char *stunnel_pem;
@ -70,6 +72,8 @@ extern int vencrypt_enable_plain_login;
extern int anontls_mode;
extern int create_fresh_dhparams;
extern char *dhparams_file;
extern int http_try_it;
extern int stunnel_http_port;
extern int https_port_num;
extern int https_port_redir;
extern char *ssl_verify;
@ -100,6 +104,8 @@ extern int connect_once;
extern int got_connect_once;
extern int deny_all;
extern int accept_remote_cmds;
extern char *remote_prefix;
extern int remote_direct;
extern int query_default;
extern int safe_remote_only;
extern int priv_remote;
@ -307,6 +313,7 @@ extern double wait_ui;
extern double slow_fb;
extern double xrefresh;
extern int wait_bog;
extern int extra_fbur;
extern int defer_update;
extern int set_defer;
extern int got_defer;

@ -63,8 +63,8 @@ so, delete this exception statement from your version.
#define FB_REQ 0x4
#define VNC_CONNECT_MAX 16384
#define X11VNC_REMOTE_MAX 16384
#define PROP_MAX (131072L)
#define X11VNC_REMOTE_MAX 65536
#define PROP_MAX (262144L)
#define MAXN 256

@ -76,6 +76,7 @@ static void if_8bpp_do_new_fb(void);
static void reset_httpport(int old, int new);
static void reset_rfbport(int old, int new) ;
char *query_result = NULL;
/*
* for the wild-n-crazy -remote/-R interface.
@ -83,6 +84,11 @@ static void reset_rfbport(int old, int new) ;
int send_remote_cmd(char *cmd, int query, int wait) {
FILE *in = NULL;
if (query_result != NULL) {
free(query_result);
query_result = NULL;
}
if (client_connect_file) {
umask(077);
in = fopen(client_connect_file, "w");
@ -118,13 +124,26 @@ int send_remote_cmd(char *cmd, int query, int wait) {
if (query || wait) {
char line[X11VNC_REMOTE_MAX];
int rc=1, i=0, max=70, ms_sl=50;
int rc=1, i=0, max=140, ms_sl=25;
if (!strcmp(cmd, "cmd=stop")) {
max = 20;
max = 40;
}
if (strstr(cmd, "script:")) {
max = 400;
}
if (strstr(cmd, "bcx_xattach:")) {
max = 400;
}
if (getenv("X11VNC_SYNC_TIMEOUT")) {
max = (int) ((1000. * atof(getenv("X11VNC_SYNC_TIMEOUT")))/ms_sl);
}
for (i=0; i<max; i++) {
usleep(ms_sl * 1000);
if (i==0) {
usleep(10 * 1000);
} else {
usleep(ms_sl * 1000);
}
if (client_connect_file) {
char *q;
in = fopen(client_connect_file, "r");
@ -147,8 +166,9 @@ int send_remote_cmd(char *cmd, int query, int wait) {
strncpy(line, x11vnc_remote_str,
X11VNC_REMOTE_MAX);
}
if (strcmp(cmd, line)){
if (query) {
if (strcmp(cmd, line)) {
if (query || wait) {
query_result = strdup(line);
fprintf(stdout, "%s\n", line);
fflush(stdout);
}
@ -170,12 +190,20 @@ int send_remote_cmd(char *cmd, int query, int wait) {
int do_remote_query(char *remote_cmd, char *query_cmd, int remote_sync,
int qdefault) {
char *rcmd = NULL, *qcmd = NULL;
int rc = 1;
int rc = 1, direct = 0;
if (qdefault && !query_cmd) {
query_cmd = remote_cmd;
remote_cmd = NULL;
}
if (remote_cmd && strstr(remote_cmd, "DIRECT:") == remote_cmd) {
direct = 1;
remote_cmd += strlen("DIRECT:");
}
if (query_cmd && strstr(query_cmd, "DIRECT:") == query_cmd) {
direct = 1;
query_cmd += strlen("DIRECT:");
}
if (remote_cmd) {
rcmd = (char *) malloc(strlen(remote_cmd) + 5);
@ -187,6 +215,19 @@ int do_remote_query(char *remote_cmd, char *query_cmd, int remote_sync,
strcpy(qcmd, "qry=");
strcat(qcmd, query_cmd);
}
if (direct) {
char *res;
if (rcmd) {
res = process_remote_cmd(rcmd, 1);
fprintf(stdout, "%s\n", res);
}
if (qcmd) {
res = process_remote_cmd(qcmd, 1);
fprintf(stdout, "%s\n", res);
}
fflush(stdout);
return 0;
}
if (qdefault) {
char *res;
if (!qcmd) {
@ -366,13 +407,17 @@ int check_httpdir(void) {
len = strlen(prog) + 21 + 1;
*q = '\0';
httpdir = (char *) malloc(len);
if (!enc_str && (use_openssl || use_stunnel || http_ssl)) {
if (use_stunnel && http_ssl) {
snprintf(httpdir, len, "%s/../share/x11vnc/classes/ssl", prog);
} else if (!enc_str && (use_openssl || use_stunnel || http_ssl)) {
snprintf(httpdir, len, "%s/../share/x11vnc/classes/ssl", prog);
} else {
snprintf(httpdir, len, "%s/../share/x11vnc/classes", prog);
}
if (stat(httpdir, &sbuf) != 0) {
if (!enc_str && (use_openssl || use_stunnel || http_ssl)) {
if (use_stunnel && http_ssl) {
snprintf(httpdir, len, "%s/../classes/ssl", prog);
} else if (!enc_str && (use_openssl || use_stunnel || http_ssl)) {
snprintf(httpdir, len, "%s/../classes/ssl", prog);
} else {
snprintf(httpdir, len, "%s/../classes", prog);
@ -400,7 +445,9 @@ int check_httpdir(void) {
"/usr/share/x11vnc/classes/ssl",
NULL
};
if (!enc_str && (use_openssl || use_stunnel || http_ssl)) {
if (use_stunnel && http_ssl) {
use = ssllist;
} else if (!enc_str && (use_openssl || use_stunnel || http_ssl)) {
use = ssllist;
} else {
use = list;
@ -445,6 +492,10 @@ void http_connections(int on) {
if (check_httpdir()) {
screen->httpDir = http_dir;
rfbHttpInitSockets(screen);
if (screen->httpPort != 0 && screen->httpListenSock < 0) {
rfbLog("http_connections: failed to listen on http port: %d\n", screen->httpPort);
clean_up_exit(1);
}
}
} else {
rfbLog("http_connections: turning off http service.\n");
@ -474,6 +525,9 @@ static void reset_httpport(int old, int new) {
rfbLog("reset_httpport: setting httpport %d -> %d.\n",
old == -1 ? hp : old, hp);
rfbHttpInitSockets(screen);
if (screen->httpPort != 0 && screen->httpListenSock < 0) {
rfbLog("reset_httpport: failed to listen on http port: %d\n", screen->httpPort);
}
}
}
@ -699,16 +753,95 @@ char *process_remote_cmd(char *cmd, int stringonly) {
}
}
strcpy(buf, "");
if (strstr(cmd, "cmd=") == cmd) {
p += strlen("cmd=");
if (strstr(p, "script:") == p) {
char *s, *q, **pieces, tmp[1024];
int k = 0, n = 0, dp = 1;
p += strlen("script:");
if (strstr(p, "file=") == p) {
FILE *f;
struct stat sbuf;
p += strlen("file=");
rfbLog("reading script from file '%s'\n", p);
if (stat(p, &sbuf) != 0) {
rfbLogPerror("stat");
return NULL;
}
f = fopen(p, "r");
if (f == NULL) {
rfbLogPerror("fopen");
return NULL;
}
p = (char *) calloc(sbuf.st_size + 1, 1);
dp = 0;
while (fgets(tmp, 1024, f) != NULL) {
char *c = strchr(tmp, '#');
if (c) *c = '\0';
if (strlen(p) + strlen(tmp) > sbuf.st_size) {
break;
}
strcat(p, tmp);
}
fclose(f);
}
pieces = (char **) malloc(strlen(p) * sizeof(char *));
if (dp) {
s = strdup(p);
} else {
s = p;
}
q = strtok(s, ";");
while (q) {
char *t = lblanks(q);
if (strstr(t, "cmd=") != t && strstr(t, "qry=") != t) {
strcpy(tmp, "cmd=");
} else {
strcpy(tmp, "");
}
strncat(tmp, t, 1000);
pieces[n] = strdup(tmp);
n++;
q = strtok(NULL, ";");
}
free(s);
for (k=0; k < n; k++) {
char *c = pieces[k];
char *t = c + strlen(c) - 1; /* shortest is "cmd=" */
while (isspace((unsigned char) (*t))) {
*t = '\0';
if (t <= c) break;
t--;
}
if (k < n - 1) {
process_remote_cmd(c, 1);
} else {
process_remote_cmd(c, 0);
}
}
for (k=0; k<n; k++) {
free(pieces[k]);
}
free(pieces);
return NULL;
}
} else if (strstr(cmd, "qry=") == cmd) {
query = 1;
if (strchr(cmd, ',')) {
/* comma separated batch mode */
char *s, *q, *res;
char tmp[512];
char **pieces;
char *s, *q, *res, **pieces, tmp[1024];
int k = 0, n = 0;
pieces = (char **) malloc(strlen(cmd) * sizeof(char *));
@ -717,7 +850,7 @@ char *process_remote_cmd(char *cmd, int stringonly) {
while (q) {
strcpy(tmp, "qry=");
strncat(tmp, q, 500);
strncat(tmp, q, 1000);
pieces[n] = strdup(tmp);
n++;
q = strtok(NULL, ",");
@ -725,7 +858,7 @@ char *process_remote_cmd(char *cmd, int stringonly) {
free(s);
strcpy(buf, "");
for (k=0; k<n; k++) {
for (k=0; k < n; k++) {
res = process_remote_cmd(pieces[k], 1);
if (res && strlen(buf)+strlen(res)
>= X11VNC_REMOTE_MAX - 1) {
@ -797,6 +930,11 @@ char *process_remote_cmd(char *cmd, int stringonly) {
/*
* Maybe add: passwdfile logfile bg rfbauth passwd...
*/
if (!strcmp(p, "")) { /* skip-cmd-list */
NOTAPP
rfbLog("remote_cmd: empty command.\n");
goto done;
}
if (strstr(p, "CR:") == p) { /* skip-cmd-list */
/* CR:WxH+X+Y,dx,dy */
int w, h, x, y, dx, dy;
@ -829,7 +967,8 @@ char *process_remote_cmd(char *cmd, int stringonly) {
close_all_clients();
goto done;
}
if (!strcmp(p, "ping")) {
if (!strcmp(p, "ping")
|| strstr(p, "ping:") == p) { /* skip-cmd-list */
query = 1;
if (rfb_desktop_name) {
snprintf(buf, bufn, "ans=%s:%s", p, rfb_desktop_name);
@ -839,6 +978,21 @@ char *process_remote_cmd(char *cmd, int stringonly) {
goto qry;
goto done;
}
if (!strcmp(p, "resend_cutbuffer")) {
NOTAPP
resend_selection("cutbuffer");
goto done;
}
if (!strcmp(p, "resend_clipboard")) {
NOTAPP
resend_selection("clipboard");
goto done;
}
if (!strcmp(p, "resend_primary")) {
NOTAPP
resend_selection("primary");
goto done;
}
if (!strcmp(p, "blacken") || !strcmp(p, "zero")) {
NOTAPP
push_black_screen(4);
@ -911,7 +1065,7 @@ char *process_remote_cmd(char *cmd, int stringonly) {
goto qry;
}
p += strlen("id:");
if (*p == '\0' || !strcmp("root", p)) {
if (*p == '\0' || !strcmp("root", p)) { /* skip-cmd-list */
/* back to root win */
twin = 0x0;
ok = 1;
@ -953,7 +1107,7 @@ char *process_remote_cmd(char *cmd, int stringonly) {
goto qry;
}
p += strlen("sid:");
if (*p == '\0' || !strcmp("root", p)) {
if (*p == '\0' || !strcmp("root", p)) { /* skip-cmd-list */
/* back to root win */
twin = 0x0;
ok = 1;
@ -1513,7 +1667,7 @@ char *process_remote_cmd(char *cmd, int stringonly) {
free(connect_proxy);
connect_proxy = NULL;
}
if (!strcmp(p, "") || !strcasecmp(p, "none")) {
if (!strcmp(p, "") || !strcasecmp(p, "none")) { /* skip-cmd-list */
rfbLog("remote_cmd: disabled -proxy\n");
} else {
connect_proxy = strdup(p);
@ -3749,7 +3903,7 @@ char *process_remote_cmd(char *cmd, int stringonly) {
goto qry;
}
p += strlen("input:");
if (allowed_input_str && !strcmp(p, allowed_input_str)) {
if (allowed_input_str && !strcmp(p, allowed_input_str)) { /* skip-cmd-list */
doit = 0;
}
rfbLog("remote_cmd: setting input %s\n", p);
@ -3957,28 +4111,260 @@ char *process_remote_cmd(char *cmd, int stringonly) {
goto done;
}
if (strstr(p, "keycode") == p) {
int kc;
int kc, down = -1;
char *c;
NOTAPP
COLON_CHECK("keycode:")
p += strlen("keycode:");
kc = atoi(p);
if (kc < 0) kc = 0;
kc = kc % 256;
rfbLog("remote_cmd: insert keycode %d\n", kc);
c = strchr(p, ',');
if (c) down = atoi(c+1);
rfbLog("remote_cmd: insert keycode %d down=%d\n", kc, down);
if (macosx_console) {
#ifdef MACOSX
macosxCG_keycode_inject(1, kc);
usleep(100*1000);
macosxCG_keycode_inject(0, kc);
if (down == -1) {
macosxCG_keycode_inject(1, kc);
usleep(50*1000);
macosxCG_keycode_inject(0, kc);
} else {
macosxCG_keycode_inject(down, kc);
}
#endif
} else {
XTestFakeKeyEvent_wr(dpy, kc, 1, CurrentTime);
usleep(100*1000);
XTestFakeKeyEvent_wr(dpy, kc, 0, CurrentTime);
if (down == -1) {
XTestFakeKeyEvent_wr(dpy, kc, 1, CurrentTime);
usleep(50*1000);
XTestFakeKeyEvent_wr(dpy, kc, 0, CurrentTime);
} else {
XTestFakeKeyEvent_wr(dpy, kc, down, CurrentTime);
}
}
goto done;
}
if (strstr(p, "keysym") == p) {
int down = -1;
unsigned int in;
KeySym ks;
char *c, *str;
NOTAPP
COLON_CHECK("keysym:")
p += strlen("keysym:");
c = strchr(p, ',');
if (c) {
down = atoi(c+1);
*c = '\0';
}
if (sscanf(p, "0x%x", &in) == 1) {
ks = (KeySym) in;
} else if (sscanf(p, "%u", &in) == 1) {
ks = (KeySym) in;
} else if ((ks = XStringToKeysym(p)) != NoSymbol) {
;
} else {
rfbLog("remote_cmd: bad keysym: %s\n", p);
goto done;
}
str = XKeysymToString(ks);
str = str ? str : "NoSymbol";
rfbLog("remote_cmd: insert keysym %s 0x%x '%s' down=%d\n", p, ks, str, down);
if (down == -1) {
keyboard(1, ks, NULL);
usleep(50*1000);
keyboard(0, ks, NULL);
} else {
keyboard(down, ks, NULL);
}
goto done;
}
if (strstr(p, "ptr") == p) {
int x, y, m = 0;
NOTAPP
COLON_CHECK("ptr:")
p += strlen("ptr:");
rfbLog("remote_cmd: insert pointer event: %s\n", p);
if (sscanf(p, "%d,%d,%d", &x, &y, &m) == 3) {
pointer(m, x, y, NULL);
} else if (sscanf(p, "%d,%d", &x, &y) == 2) {
pointer(m, x, y, NULL);
} else {
rfbLog("remote_cmd: bad ptr:x,y,mask\n");
}
goto done;
}
if (strstr(p, "sleep") == p) {
NOTAPP
COLON_CHECK("sleep:")
p += strlen("sleep:");
rfbLog("remote_cmd: sleeping: %s\n", p);
usleep((int) (1.0e+6 * atof(p)));
rfbLog("remote_cmd: done sleeping.\n");
goto done;
}
if (strstr(p, "get_xprop") == p) {
char *res;
unsigned long id;
Window win = None; /* None implies root in get_xprop() */
/* note we force query and assume the colon is there. */
query = 1;
if (strstr(p, "get_xprop:") != p) { /* skip-cmd-list */
snprintf(buf, bufn, "ans=%s:N/A", p);
goto qry;
}
p += strlen("get_xprop:");
if (strstr(p, "id=") == p) { /* skip-cmd-list */
p += strlen("id=");
if (scan_hexdec(p, &id)) {
win = (Window) id;
}
if (strchr(p, ':')) {
p = strchr(p, ':') + 1;
}
}
res = get_xprop(p, win);
if (res == NULL) {
res = strdup("NULL");
}
snprintf(buf, bufn, "ans=get_xprop:%s:%s", p, res);
free(res);
goto qry;
}
if (strstr(p, "set_xprop") == p) {
char *q;
int rc = -2;
unsigned long id;
Window win = None; /* None implies root in set_xprop() */
/* note we force query and assume the colon is there. */
query = 1;
if (strstr(p, "set_xprop:") != p) { /* skip-cmd-list */
snprintf(buf, bufn, "ans=%s:N/A", p);
goto qry;
}
p += strlen("set_xprop:");
if (strstr(p, "id=") == p) { /* skip-cmd-list */
p += strlen("id=");
if (scan_hexdec(p, &id)) {
win = (Window) id;
}
if (strchr(p, ':')) {
p = strchr(p, ':') + 1;
}
}
q = strchr(p, ':');
if (q) {
*q = '\0';
rc = set_xprop(p, win, q+1);
*q = ':';
}
snprintf(buf, bufn, "ans=set_xprop:%s:%d", p, rc);
goto qry;
}
if (strstr(p, "wininfo") == p) {
char *res, *t = "";
unsigned long id;
Window win = None;
int show_children = 0;
/* note we force query and assume the colon is there. */
query = 1;
if (strstr(p, "wininfo:") != p) { /* skip-cmd-list */
snprintf(buf, bufn, "ans=%s:N/A", p);
goto qry;
}
p += strlen("wininfo:");
if (p[0] == '+') {
show_children = 1;
t = "+";
p++;
}
if (!strcmp(p, "root")) { /* skip-cmd-list */
win = rootwin;
} else if (scan_hexdec(p, &id)) {
win = (Window) id;
}
res = wininfo(win, show_children);
if (res == NULL) {
res = strdup("NULL");
}
snprintf(buf, bufn, "ans=wininfo:%s%s:%s", t, p, res);
free(res);
goto qry;
}
if (strstr(p, "bcx_xattach") == p) {
char *res;
int pg_init = -1, kg_init = -1;
int try = 0, max_tries = 4;
/* note we force query and assume the colon is there. */
query = 1;
if (strstr(p, "bcx_xattach:") != p) { /* skip-cmd-list */
snprintf(buf, bufn, "ans=%s:N/A", p);
goto qry;
}
p += strlen("bcx_xattach:");
if (strstr(p, "retry=")) { /* skip-cmd-list */
int n;
char *q = strstr(p, "retry="); /* skip-cmd-list */
if (sscanf(q, "retry=%d", &n) == 1) {
if (n < 0) n = 0;
max_tries = 1 + n;
}
}
try_again:
res = bcx_xattach(p, &pg_init, &kg_init);
try++;
if (res == NULL) {
res = strdup("NULL");
} else if (strstr(res, "GRAB_FAIL_INIT")) {
rfbLog("bcx_xattach: failed grab check for '%s': %s. Final state OK, not Retrying.\n", p, res);
} else if (strstr(res, "GRAB_FAIL") && try < max_tries) {
rfbLog("bcx_xattach: failed grab check for '%s': %s. Retrying[%d]...\n", p, res, try);
free(res);
pointer(0, dpy_x/2 + try, dpy_y/2 + try, NULL);
XFlush_wr(dpy);
#if !NO_X11
if (dpy) {
if (try == 2) {
XSync(dpy, False);
} else if (try == 3) {
XSync(dpy, True);
}
}
#endif
if (try == 1) {
usleep(250*1000);
} else if (try <= 4) {
usleep(try*400*1000);
} else {
usleep(4*500*1000);
}
goto try_again;
}
snprintf(buf, bufn, "ans=bcx_xattach:%s:%s", p, res);
free(res);
goto qry;
}
if (strstr(p, "deferupdate") == p) {
int d;
COLON_CHECK("deferupdate:")
@ -4032,6 +4418,17 @@ char *process_remote_cmd(char *cmd, int stringonly) {
rfbLog("remote_cmd: setting set_defer to %d\n", set_defer);
goto done;
}
if (strstr(p, "extra_fbur") == p) {
COLON_CHECK("extra_fbur:")
if (query) {
snprintf(buf, bufn, "ans=%s%s%d", p, co, extra_fbur);
goto qry;
}
p += strlen("extra_fbur:");
extra_fbur = atoi(p);
rfbLog("remote_cmd: setting extra_fbur to %d\n", extra_fbur);
goto done;
}
if (strstr(p, "wait_ui") == p) {
double w;
COLON_CHECK("wait_ui:")
@ -5169,6 +5566,11 @@ char *process_remote_cmd(char *cmd, int stringonly) {
NONUL(guess_desktop()));
goto qry;
}
if (!strcmp(p, "guess_dbus")) {
snprintf(buf, bufn, "aro=%s:%s", p,
NONUL(dbus_session()));
goto qry;
}
if (!strcmp(p, "http_url")) {
if (!screen) {
snprintf(buf, bufn, "aro=%s:", p);
@ -5448,6 +5850,38 @@ char *process_remote_cmd(char *cmd, int stringonly) {
snprintf(buf, bufn, "aro=%s:%d", p, cursor_y);
goto qry;
}
if (!strcmp(p, "grab_state")) {
int ptr_grabbed, kbd_grabbed;
grab_state(&ptr_grabbed, &kbd_grabbed);
snprintf(buf, bufn, "aro=%s:%d,%d", p, ptr_grabbed, kbd_grabbed);
rfbLog("remote_cmd: ptr,kbd: %s\n", buf);
goto qry;
}
if (!strcmp(p, "pointer_pos")) {
int px = -1, py = -1;
int wx, wy;
unsigned int m;
Window r, c;
snprintf(buf, bufn, "aro=%s:%d,%d", p, px, py);
if (!dpy) {
goto qry;
}
#if NO_X11
goto qry;
#else
X_LOCK;
XQueryPointer_wr(dpy, rootwin, &r, &c, &px, &py, &wx, &wy, &m);
X_UNLOCK;
#endif
snprintf(buf, bufn, "aro=%s:%d,%d", p, px, py);
rfbLog("remote_cmd: pointer_pos: %s\n", buf);
goto qry;
}
if (!strcmp(p, "bpp")) {
snprintf(buf, bufn, "aro=%s:%d", p, bpp);
goto qry;

@ -44,4 +44,7 @@ extern void http_connections(int on);
extern int remote_control_access_ok(void);
extern char *process_remote_cmd(char *cmd, int stringonly);
extern char *query_result;
#endif /* _X11VNC_REMOTE_H */

@ -1179,6 +1179,8 @@ static char* vnc_reflect_get_password(rfbClient* client) {
char *q, *p, *str = getenv("X11VNC_REFLECT_PASSWORD");
int len = 110;
if (client) {}
if (str) {
len += 2*strlen(str);
}
@ -2846,11 +2848,17 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
/* n.b. samplesPerPixel (set = 1 here) seems to be unused. */
if (create_screen) {
if (use_openssl) {
openssl_init(0);
} else if (use_stunnel) {
if (use_stunnel) {
setup_stunnel(0, argc, argv);
}
if (use_openssl) {
if (use_stunnel && enc_str && !strcmp(enc_str, "none")) {
/* emulating HTTPS oneport */
;
} else {
openssl_init(0);
}
}
screen = rfbGetScreen(argc, argv, width, height,
bits_per_color, 1, fb_bpp/8);
if (screen && http_dir) {
@ -3367,6 +3375,10 @@ void announce(int lport, int ssl, char *iface) {
char *host = this_host();
char *tvdt;
if (remote_direct) {
return;
}
if (! ssl) {
tvdt = "The VNC desktop is: ";
} else {
@ -3422,12 +3434,12 @@ void announce(int lport, int ssl, char *iface) {
}
}
static void announce_http(int lport, int ssl, char *iface) {
static void announce_http(int lport, int ssl, char *iface, char *extra) {
char *host = this_host();
char *jvu;
if (enc_str && !strcmp(enc_str, "none")) {
if (enc_str && !strcmp(enc_str, "none") && !use_stunnel) {
jvu = "Java viewer URL: http";
} else if (ssl == 1) {
jvu = "Java SSL viewer URL: https";
@ -3442,44 +3454,91 @@ static void announce_http(int lport, int ssl, char *iface) {
}
if (host != NULL) {
if (! inetd) {
fprintf(stderr, "%s://%s:%d/\n", jvu, host, lport);
if (screen && enc_str && !strcmp(enc_str, "none")) {
fprintf(stderr, "%s://%s:%d/\n", jvu, host, screen->port);
fprintf(stderr, "%s://%s:%d/%s\n", jvu, host, lport, extra);
}
}
}
void do_announce_http(void) {
if (!screen) {
return;
}
if (remote_direct) {
return;
}
if (screen->httpListenSock > -1 && screen->httpPort) {
int enc_none = (enc_str && !strcmp(enc_str, "none"));
char *SPORT = " (single port)";
if (use_openssl && ! enc_none) {
announce_http(screen->port, 1, listen_str, SPORT);
if (https_port_num >= 0) {
announce_http(https_port_num, 1,
listen_str, "");
}
announce_http(screen->httpPort, 2, listen_str, "");
} else if (use_stunnel) {
char pmsg[100];
pmsg[0] = '\0';
if (stunnel_port) {
sprintf(pmsg, "?PORT=%d", stunnel_port);
}
announce_http(screen->httpPort, 2, listen_str, pmsg);
if (stunnel_http_port > 0) {
announce_http(stunnel_http_port, 1, NULL, pmsg);
}
if (enc_none) {
strcat(pmsg, SPORT);
announce_http(stunnel_port, 1, NULL, pmsg);
}
} else {
announce_http(screen->httpPort, 0, listen_str, "");
if (enc_none) {
announce_http(screen->port, 1, NULL, SPORT);
}
}
}
}
void do_mention_java_urls(void) {
if (! quiet && screen) {
if (screen->httpListenSock > -1 && screen->httpPort) {
rfbLog("\n");
rfbLog("The URLs printed out below ('Java ... viewer URL') can\n");
rfbLog("be used for Java enabled Web browser connections.\n");
if (!stunnel_port && enc_str && !strcmp(enc_str, "none")) {
;
} else if (use_openssl || stunnel_port) {
rfbLog("Here are some additional possibilities:\n");
rfbLog("\n");
rfbLog("https://host:port/proxy.vnc (MUST be used if Web Proxy used)\n");
rfbLog("\n");
rfbLog("https://host:port/ultra.vnc (Use UltraVNC Java Viewer)\n");
rfbLog("https://host:port/ultraproxy.vnc (Web Proxy with UltraVNC)\n");
rfbLog("https://host:port/ultrasigned.vnc (Signed UltraVNC Filexfer)\n");
rfbLog("\n");
rfbLog("Where you replace \"host:port\" with that printed below, or\n");
rfbLog("whatever is needed to reach the host e.g. Internet IP number\n");
rfbLog("\n");
rfbLog("Append ?GET=1 to a URL for faster loading.\n");
}
}
rfbLog("\n");
}
}
void set_vnc_desktop_name(void) {
sprintf(vnc_desktop_name, "unknown");
if (inetd) {
sprintf(vnc_desktop_name, "%s/inetd-no-further-clients",
this_host());
}
if (remote_direct) {
return;
}
if (screen->port) {
if (! quiet) {
if (screen->httpListenSock > -1 && screen->httpPort) {
rfbLog("\n");
rfbLog("The URLs printed out below ('Java ... viewer URL') can\n");
rfbLog("be used for Java enabled Web browser connections.\n");
if (enc_str && !strcmp(enc_str, "none")) {
;
} else if (use_openssl || stunnel_port) {
rfbLog("Here are some additional possibilities:\n");
rfbLog("\n");
rfbLog("https://host:port/proxy.vnc (MUST be used if Web Proxy used)\n");
rfbLog("\n");
rfbLog("https://host:port/ultra.vnc (Use UltraVNC Java Viewer)\n");
rfbLog("https://host:port/ultraproxy.vnc (Web Proxy with UltraVNC)\n");
rfbLog("https://host:port/ultrasigned.vnc (Signed UltraVNC Filexfer)\n");
rfbLog("\n");
rfbLog("Where you replace \"host:port\" with that printed below, or\n");
rfbLog("whatever is needed to reach the host e.g. Internet IP number\n");
}
}
rfbLog("\n");
}
do_mention_java_urls();
if (use_openssl) {
announce(screen->port, 1, listen_str);
@ -3489,24 +3548,8 @@ void set_vnc_desktop_name(void) {
if (stunnel_port) {
announce(stunnel_port, 1, NULL);
}
if (screen->httpListenSock > -1 && screen->httpPort) {
if (use_openssl) {
if (enc_str && !strcmp(enc_str, "none")) {
;
} else {
announce_http(screen->port, 1, listen_str);
}
if (https_port_num >= 0) {
announce_http(https_port_num, 1,
listen_str);
}
announce_http(screen->httpPort, 2, listen_str);
} else if (use_stunnel) {
announce_http(screen->httpPort, 2, listen_str);
} else {
announce_http(screen->httpPort, 0, listen_str);
}
}
do_announce_http();
fflush(stderr);
if (inetd) {
@ -3954,13 +3997,19 @@ void watch_loop(void) {
* see quickly (just 1 rfbPE will likely
* only process the subsequent "up" event)
*/
if (tm < last_keyboard_time + 0.16) {
if (tm < last_keyboard_time + 0.20) {
rfbPE(0);
rfbPE(0);
rfbPE(-1);
rfbPE(0);
rfbPE(0);
} else {
if (extra_fbur > 0) {
int i;
for (i=0; i < extra_fbur; i++) {
rfbPE(0);
}
}
rfbPE(-1);
}
if (x11vnc_current < last_new_client + 0.5) {
@ -4126,6 +4175,7 @@ void watch_loop(void) {
} else {
static double last_dt = 0.0;
double xdamage_thrash = 0.4;
static int tilecut = -1;
check_cursor_changes();
@ -4176,8 +4226,15 @@ void watch_loop(void) {
last_dt = dt;
}
if (tilecut < 0) {
if (getenv("TILECUT")) {
tilecut = atoi(getenv("TILECUT"));
}
if (tilecut < 0) tilecut = 4;
}
if ((debug_tiles || debug_scroll > 1 || debug_wireframe > 1)
&& (tile_diffs > 4 || debug_tiles > 1)) {
&& (tile_diffs > tilecut || debug_tiles > 1)) {
double rate = (tile_x * tile_y * bpp/8 * tile_diffs) / dt;
fprintf(stderr, "============================= TILES: %d dt: %.4f"
" t: %.4f %.2f MB/s nap_ok: %d\n", tile_diffs, dt,
@ -4188,13 +4245,33 @@ void watch_loop(void) {
/* sleep a bit to lessen load */
wait = choose_delay(dt);
if (urgent_update) {
;
} else if (wait > 2*waitms) {
/* bog case, break it up */
nap_sleep(wait, 10);
} else {
double t1, t2;
int idt;
if (extra_fbur > 0) {
int i;
for (i=0; i <= extra_fbur; i++) {
int r = rfbPE(0);
if (!r) break;
}
}
/* sometimes the sleep is too short, so measure it: */
t1 = dnow();
usleep(wait * 1000);
t2 = dnow();
idt = (int) (1000. * (t2 - t1));
if (idt > 0 && idt < wait) {
/* try to sleep the remainder */
usleep((wait - idt) * 1000);
}
}
cnt++;

@ -64,6 +64,7 @@ void selection_request(XEvent *ev, char *type);
int check_sel_direction(char *dir, char *label, char *sel, int len);
void cutbuffer_send(void);
void selection_send(XEvent *ev);
void resend_selection(char *type);
/*
@ -76,6 +77,9 @@ void selection_send(XEvent *ev);
static char cutbuffer_str[PROP_MAX+1];
static char primary_str[PROP_MAX+1];
static char clipboard_str[PROP_MAX+1];
static int cutbuffer_len = 0;
static int primary_len = 0;
static int clipboard_len = 0;
/*
* An X11 (not VNC) client on the local display has requested the selection
@ -346,7 +350,7 @@ void cutbuffer_send(void) {
if (!screen) {
return;
}
len = strlen(cutbuffer_str);
cutbuffer_len = len = strlen(cutbuffer_str);
if (check_sel_direction("send", "cutbuffer_send", cutbuffer_str, len)) {
rfbSendServerCutText(screen, cutbuffer_str, len);
}
@ -492,6 +496,49 @@ if (debug_sel) fprintf(stderr, "selection_send: data: '%s' dlen: %d nitems: %lu
}
len = newlen;
if (ev->xselection.selection == XA_PRIMARY) {
primary_len = len;
} else if (clipboard_atom && ev->xselection.selection == clipboard_atom) {
clipboard_len = len;
}
if (check_sel_direction("send", "selection_send", selection_str, len)) {
rfbSendServerCutText(screen, selection_str, len);
}
#endif /* NO_X11 */
}
void resend_selection(char *type) {
#if NO_X11
RAWFB_RET_VOID
if (!type) {}
return;
#else
char *selection_str = "";
int len = 0;
RAWFB_RET_VOID
if (! all_clients_initialized()) {
rfbLog("selection_send: no send: uninitialized clients\n");
return; /* some clients initializing, cannot send */
}
if (unixpw_in_progress) {
return;
}
if (!screen) {
return;
}
if (!strcmp(type, "cutbuffer")) {
selection_str = cutbuffer_str;
len = cutbuffer_len;
} else if (!strcmp(type, "clipboard")) {
selection_str = clipboard_str;
len = clipboard_len;
} else if (!strcmp(type, "primary")) {
selection_str = primary_str;
len = primary_len;
}
if (check_sel_direction("send", "selection_send", selection_str, len)) {
rfbSendServerCutText(screen, selection_str, len);
}

@ -50,5 +50,6 @@ extern void selection_request(XEvent *ev, char *type);
extern int check_sel_direction(char *dir, char *label, char *sel, int len);
extern void cutbuffer_send(void);
extern void selection_send(XEvent *ev);
extern void resend_selection(char *type);
#endif /* _X11VNC_SELECTION_H */

@ -37,9 +37,11 @@ so, delete this exception statement from your version.
#include "xwrappers.h"
#include "connections.h"
#include "cleanup.h"
#include "xevents.h"
char *guess_desktop(void);
void solid_bg(int restore);
char *dbus_session(void);
static void usr_bin_path(int restore);
@ -550,31 +552,104 @@ static void solid_cde(char *color) {
#endif /* NO_X11 */
}
static char _dbus_str[1100];
char *dbus_session(void) {
char *dbus_env = getenv("DBUS_SESSION_BUS_ADDRESS");
char tmp[1000];
if (dbus_env != NULL && strlen(dbus_env) > 0) {
return "";
}
#if NO_X11
return "";
#else
{
Atom dbus_prop;
Window r, w, *children;
unsigned int ui;
int rc, i;
memset(_dbus_str, 0, sizeof(_dbus_str));
X_LOCK;
dbus_prop = XInternAtom(dpy, "_DBUS_SESSION_BUS_ADDRESS", True);
X_UNLOCK;
if (dbus_prop == None) {
return "";
}
X_LOCK;
memset(tmp, 0, sizeof(tmp));
get_prop(tmp, sizeof(tmp)-1, dbus_prop, None);
X_UNLOCK;
if (strcmp(tmp, "")) {
if (!strchr(tmp, '\'')) {
sprintf(_dbus_str, "env DBUS_SESSION_BUS_ADDRESS='%s'", tmp);
return _dbus_str;
}
}
X_LOCK;
rc = XQueryTree_wr(dpy, rootwin, &r, &w, &children, &ui);
X_UNLOCK;
if (!rc || children == NULL || ui == 0) {
return "";
}
for (i=0; i < ui; i++) {
X_LOCK;
memset(tmp, 0, sizeof(tmp));
get_prop(tmp, sizeof(tmp)-1, dbus_prop, children[i]);
X_UNLOCK;
if (strcmp(tmp, "")) {
if (!strchr(tmp, '\'')) {
sprintf(_dbus_str, "env DBUS_SESSION_BUS_ADDRESS='%s'", tmp);
break;
}
}
}
X_LOCK;
XFree_wr(children);
X_UNLOCK;
return _dbus_str;
}
#endif
}
static void solid_gnome(char *color) {
#if NO_X11
RAWFB_RET_VOID
if (!color) {}
return;
#else
char get_color[] = "gconftool-2 --get "
char get_color[] = "%s gconftool-2 --get "
"/desktop/gnome/background/primary_color";
char set_color[] = "gconftool-2 --set "
"/desktop/gnome/background/primary_color --type string '%s'";
char get_option[] = "gconftool-2 --get "
char set_color[] = "%s gconftool-2 --set --type string "
"/desktop/gnome/background/primary_color '%s'";
char get_option[] = "%s gconftool-2 --get "
"/desktop/gnome/background/picture_options";
char set_option[] = "gconftool-2 --set "
"/desktop/gnome/background/picture_options --type string '%s'";
char set_option[] = "%s gconftool-2 --set --type string "
"/desktop/gnome/background/picture_options '%s'";
#if 0
char get_filename[] = "gconftool-2 --get "
char get_shading[] = "%s gconftool-2 --get "
"/desktop/gnome/background/color_shading_type";
char set_shading[] = "%s gconftool-2 --set --type string "
"/desktop/gnome/background/color_shading_type '%s'";
char get_filename[] = "%s gconftool-2 --get "
"/desktop/gnome/background/picture_filename";
char set_filename[] = "gconftool-2 --set "
"/desktop/gnome/background/picture_filename --type string '%s'";
char set_filename[] = "%s gconftool-2 --set --type string "
"/desktop/gnome/background/picture_filename '%s'";
#endif
static char *orig_color = NULL;
static char *orig_option = NULL;
char *cmd;
char *cmd, *dbus = "";
RAWFB_RET_VOID
dbus = dbus_session();
rfbLog("guessed dbus: %s\n", dbus);
if (! color) {
if (! orig_color) {
@ -591,14 +666,12 @@ static void solid_gnome(char *color) {
rfbLog("invalid option: %s\n", orig_option);
return;
}
cmd = (char *) malloc(strlen(set_option) - 2 +
strlen(orig_option) + 1);
sprintf(cmd, set_option, orig_option);
cmd = (char *) malloc(strlen(set_option) - 2 + strlen(orig_option) + strlen(dbus) + 1);
sprintf(cmd, set_option, dbus, orig_option);
dt_cmd(cmd);
free(cmd);
cmd = (char *) malloc(strlen(set_color) - 2 +
strlen(orig_color) + 1);
sprintf(cmd, set_color, orig_color);
cmd = (char *) malloc(strlen(set_color) - 2 + strlen(orig_color) + strlen(dbus) + 1);
sprintf(cmd, set_color, dbus, orig_color);
dt_cmd(cmd);
free(cmd);
return;
@ -607,7 +680,10 @@ static void solid_gnome(char *color) {
if (! orig_color) {
char *q;
if (cmd_ok("dt")) {
orig_color = strdup(cmd_output(get_color));
cmd = (char *) malloc(strlen(get_color) + strlen(dbus) + 1);
sprintf(cmd, get_color, dbus);
orig_color = strdup(cmd_output(cmd));
free(cmd);
} else {
orig_color = "";
}
@ -621,7 +697,10 @@ static void solid_gnome(char *color) {
if (! orig_option) {
char *q;
if (cmd_ok("dt")) {
orig_option = strdup(cmd_output(get_option));
cmd = (char *) malloc(strlen(get_option) + strlen(dbus) + 1);
sprintf(cmd, get_option, dbus);
orig_option = strdup(cmd_output(cmd));
free(cmd);
} else {
orig_color = "";
}
@ -636,19 +715,19 @@ static void solid_gnome(char *color) {
rfbLog("invalid color: %s\n", color);
return;
}
cmd = (char *) malloc(strlen(set_color) + strlen(color) + 1);
sprintf(cmd, set_color, color);
cmd = (char *) malloc(strlen(set_color) + strlen(color) + strlen(dbus) + 1);
sprintf(cmd, set_color, dbus, color);
dt_cmd(cmd);
free(cmd);
cmd = (char *) malloc(strlen(set_option) + strlen("none") + 1);
sprintf(cmd, set_option, "none");
cmd = (char *) malloc(strlen(set_option) + strlen("none") + strlen(dbus) + 1);
sprintf(cmd, set_option, dbus, "none");
dt_cmd(cmd);
free(cmd);
#if 0
cmd = (char *) malloc(strlen(set_filename) + strlen("none") + 1);
sprintf(cmd, set_filename, "none");
sprintf(cmd, set_filename, dbus, "none");
dt_cmd(cmd);
free(cmd);
#endif

@ -39,6 +39,7 @@ extern char *guess_desktop(void);
extern unsigned long get_pixel(char *color);
extern XImage *solid_image(char *color);
extern void solid_bg(int restore);
extern char *dbus_session(void);
extern XImage *solid_root(char *color);
extern void kde_no_animate(int restore);
extern void gnome_no_animate(void);

@ -49,7 +49,7 @@ so, delete this exception statement from your version.
void check_stunnel(void);
int start_stunnel(int stunnel_port, int x11vnc_port);
int start_stunnel(int stunnel_port, int x11vnc_port, int hport, int x11vnc_hport);
void stop_stunnel(void);
void setup_stunnel(int rport, int *argc, char **argv);
char *get_Cert_dir(char *cdir_in, char **tmp_in);
@ -86,14 +86,14 @@ void check_stunnel(void) {
}
}
int start_stunnel(int stunnel_port, int x11vnc_port) {
int start_stunnel(int stunnel_port, int x11vnc_port, int hport, int x11vnc_hport) {
#ifdef SSLCMDS
char extra[] = ":/usr/sbin:/usr/local/sbin:/dist/sbin";
char *path, *p, *exe;
char *stunnel_path = NULL;
struct stat verify_buf;
struct stat crl_buf;
int status;
int status, tmp_pem = 0;
if (stunnel_pid) {
stop_stunnel();
@ -167,9 +167,33 @@ int start_stunnel(int stunnel_port, int x11vnc_port) {
" saved PEM.\n");
clean_up_exit(1);
}
} else if (!stunnel_pem) {
stunnel_pem = create_tmp_pem(NULL, 0);
if (! stunnel_pem) {
rfbLog("start_stunnel: could not create temporary,"
" self-signed PEM.\n");
clean_up_exit(1);
}
tmp_pem = 1;
if (getenv("X11VNC_SHOW_TMP_PEM")) {
FILE *in = fopen(stunnel_pem, "r");
if (in != NULL) {
char line[128];
fprintf(stderr, "\n");
while (fgets(line, 128, in) != NULL) {
fprintf(stderr, "%s", line);
}
fprintf(stderr, "\n");
fclose(in);
}
}
}
if (ssl_verify) {
char *file = get_ssl_verify_file(ssl_verify);
if (file) {
ssl_verify = file;
}
if (stat(ssl_verify, &verify_buf) != 0) {
rfbLog("stunnel: %s does not exist.\n", ssl_verify);
clean_up_exit(1);
@ -245,6 +269,7 @@ int start_stunnel(int stunnel_port, int x11vnc_port) {
if (! in) {
exit(1);
}
fprintf(in, "foreground = yes\n");
fprintf(in, "pid =\n");
if (stunnel_pem) {
@ -263,7 +288,6 @@ int start_stunnel(int stunnel_port, int x11vnc_port) {
} else {
fprintf(in, "CAfile = %s\n", ssl_verify);
}
/* XXX double check -v 2 */
fprintf(in, "verify = 2\n");
}
fprintf(in, ";debug = 7\n\n");
@ -271,8 +295,24 @@ int start_stunnel(int stunnel_port, int x11vnc_port) {
fprintf(in, "accept = %d\n", stunnel_port);
fprintf(in, "connect = %d\n", x11vnc_port);
if (hport > 0 && x11vnc_hport > 0) {
fprintf(in, "\n[x11vnc_http]\n");
fprintf(in, "accept = %d\n", hport);
fprintf(in, "connect = %d\n", x11vnc_hport);
}
fflush(in);
rewind(in);
if (getenv("STUNNEL_DEBUG")) {
char line[1000];
fprintf(stderr, "\nstunnel config contents:\n\n");
while (fgets(line, sizeof(line), in) != NULL) {
fprintf(stderr, "%s", line);
}
fprintf(stderr, "\n");
rewind(in);
}
sprintf(fd, "%d", fileno(in));
execlp(stunnel_path, stunnel_path, "-fd", fd, (char *) NULL);
@ -280,9 +320,21 @@ int start_stunnel(int stunnel_port, int x11vnc_port) {
}
free(exe);
usleep(500 * 1000);
usleep(750 * 1000);
waitpid(stunnel_pid, &status, WNOHANG);
if (ssl_verify && strstr(ssl_verify, "/sslverify-tmp-load-")) {
/* temporary file */
usleep(1000 * 1000);
unlink(ssl_verify);
}
if (tmp_pem) {
/* temporary cert */
usleep(1500 * 1000);
unlink(stunnel_pem);
}
if (kill(stunnel_pid, 0) != 0) {
waitpid(stunnel_pid, &status, WNOHANG);
stunnel_pid = 0;
@ -315,13 +367,13 @@ void stop_stunnel(void) {
}
void setup_stunnel(int rport, int *argc, char **argv) {
int i, xport = 0;
int i, xport = 0, hport = 0, xhport = 0;
if (! rport && argc && argv) {
for (i=0; i< *argc; i++) {
if (argv[i] && !strcmp(argv[i], "-rfbport")) {
if (i < *argc - 1) {
rport = atoi(argv[i+1]);
break;
}
}
}
@ -340,7 +392,36 @@ void setup_stunnel(int rport, int *argc, char **argv) {
goto stunnel_fail;
}
if (start_stunnel(rport, xport)) {
if (https_port_num > 0) {
hport = https_port_num;
}
if (! hport && argc && argv) {
for (i=0; i< *argc; i++) {
if (argv[i] && !strcmp(argv[i], "-httpport")) {
if (i < *argc - 1) {
hport = atoi(argv[i+1]);
}
}
}
}
if (! hport && http_try_it) {
hport = find_free_port(rport-100, rport-1);
if (! hport) {
goto stunnel_fail;
}
}
if (hport) {
xhport = find_free_port(5850, 5899);
if (! xhport) {
goto stunnel_fail;
}
stunnel_http_port = hport;
}
if (start_stunnel(rport, xport, hport, xhport)) {
int tweaked = 0;
char tmp[30];
sprintf(tmp, "%d", xport);

@ -36,7 +36,7 @@ so, delete this exception statement from your version.
/* -- sslcmds.h -- */
extern void check_stunnel(void);
extern int start_stunnel(int stunnel_port, int x11vnc_port);
extern int start_stunnel(int stunnel_port, int x11vnc_port, int hport, int x11vnc_hport);
extern void stop_stunnel(void);
extern void setup_stunnel(int rport, int *argc, char **argv);
extern char *get_Cert_dir(char *cdir_in, char **tmp_in);

File diff suppressed because it is too large Load Diff

@ -62,6 +62,8 @@ extern void ssl_helper_pid(pid_t pid, int sock);
extern void accept_openssl(int mode, int presock);
extern char *find_openssl_bin(void);
extern char *get_saved_pem(char *string, int create);
extern char *get_ssl_verify_file(char *str_in);
extern char *create_tmp_pem(char *path, int prompt);
#endif /* _X11VNC_SSLHELPER_H */

@ -271,13 +271,13 @@ char genCA[] =
" -keyout \"$DIR/CA/private/cakey.pem\" \\\n"
" -out \"$DIR/CA/cacert.pem\"\n"
"\n"
"chmod go-rwx \"$DIR/CA/private/cakey.pem\"\n"
"\n"
"if [ $? != 0 ]; then\n"
" echo \"openssl failed.\"\n"
" exit 1\n"
"fi\n"
"\n"
"chmod go-rwx \"$DIR/CA/private/cakey.pem\"\n"
"\n"
"echo \"\"\n"
"echo \"----------------------------------------------------------------------\"\n"
"echo \"Your public x11vnc CA cert is:\"\n"
@ -785,6 +785,10 @@ char find_display[] =
" set -xv\n"
"fi\n"
"\n"
"if [ \"X$X11VNC_SKIP_DISPLAY\" = \"Xall\" ]; then\n"
" exit 1\n"
"fi\n"
"\n"
"PATH=$PATH:/bin:/usr/bin:/usr/X11R6/bin:/usr/bin/X11:/usr/openwin/bin:/usr/ucb\n"
"export PATH\n"
"\n"
@ -1439,7 +1443,11 @@ char create_display[] =
" return\n"
" fi\n"
" if [ \"X$have_gnome_session\" != \"X\" -a \"X$FD_SESS\" = \"Xgnome\" ]; then\n"
" echo \"$have_gnome_session\"\n"
" if [ \"X$have_dbus_launch\" != \"X\" ]; then\n"
" echo \"$have_dbus_launch --exit-with-session $have_gnome_session\"\n"
" else\n"
" echo \"$have_gnome_session\"\n"
" fi\n"
" return\n"
" elif [ \"X$have_startkde\" != \"X\" -a \"X$FD_SESS\" = \"Xkde\" ]; then\n"
" echo \"$have_startkde\"\n"
@ -1692,8 +1700,10 @@ char create_display[] =
" DISPLAY=:$N\n"
" export DISPLAY\n"
" stmp=\"\"\n"
" noxauth=\"\"\n"
" if [ \"X$have_root\" != \"X\" -a \"X$USER\" != \"Xroot\" ]; then\n"
" sess=\"env DISPLAY=:$N $sess\"\n"
" noxauth=\"1\"\n"
" fi\n"
"\n"
" redir_daemon=\"\"\n"
@ -1706,27 +1716,34 @@ char create_display[] =
" touch $stmp\n"
" chmod 755 $stmp || exit 1\n"
" echo \"#!/bin/sh\" > $stmp\n"
" #echo \"(id; env; env | grep XAUTHORITY | sed -e 's/XAUTHORITY=//' | xargs ls -l) > /tmp/ENV.OUT.$$\" >> $stmp\n"
" if [ \"X$noxauth\" = \"X1\" ]; then\n"
" echo \"unset XAUTHORITY\" >> $stmp\n"
" fi\n"
" echo \"$sess\" >> $stmp\n"
" echo \"sleep 1\" >> $stmp\n"
" echo \"rm -f $stmp\" >> $stmp\n"
" sess=$stmp\n"
" rmf=\"$stmp\"\n"
" fi\n"
"\n"
" if [ \"X$have_root\" != \"X\" -a \"X$USER\" != \"Xroot\" ]; then\n"
" ctmp=/tmp/.xat$$`random`\n"
" ctmp=`mytmp \"$ctmp\"`\n"
" touch $ctmp\n"
" chmod 644 $ctmp || exit 1\n"
" $have_xauth -f $authfile nextract - :$N > $ctmp\n"
" su - $USER -c \"$have_xauth nmerge - < $ctmp\" 1>&2\n"
" $have_xauth -f $authfile nextract - `hostname`:$N > $ctmp\n"
" su - $USER -c \"$have_xauth nmerge - < $ctmp\" 1>&2\n"
" rm -f $ctmp\n"
" ctmp1=/tmp/.xat1_$$`random`\n"
" ctmp1=`mytmp \"$ctmp1\"`\n"
" ctmp2=/tmp/.xat2_$$`random`\n"
" ctmp2=`mytmp \"$ctmp2\"`\n"
" touch $ctmp1 $ctmp2\n"
" $have_xauth -f $authfile nextract - :$N > $ctmp1\n"
" $have_xauth -f $authfile nextract - `hostname`:$N > $ctmp2\n"
" chown $USER $ctmp1 $ctmp2\n"
" (unset XAUTHORITY; su - $USER -c \"$have_xauth nmerge - < $ctmp1\" 1>&2)\n"
" (unset XAUTHORITY; su - $USER -c \"$have_xauth nmerge - < $ctmp2\" 1>&2)\n"
" rm -f $ctmp1 $ctmp2\n"
" XAUTHORITY=$authfile\n"
" export XAUTHORITY\n"
" sess=\"/bin/su - $USER -c $sess\"\n"
" else\n"
" $have_xauth -f $authfile nextract - :$N | $have_xauth nmerge -\n"
" $have_xauth -f $authfile nextract - :$N | $have_xauth nmerge -\n"
" $have_xauth -f $authfile nextract - `hostname`:$N | $have_xauth nmerge -\n"
" fi\n"
"\n"
@ -1742,7 +1759,12 @@ char create_display[] =
" # we cannot use -nolisten tcp\n"
" echo \"$* -once -query localhost $FD_OPTS\" 1>&2\n"
" if [ \"X$have_root\" != \"X\" ]; then\n"
" $have_nohup $* -once -query localhost $FD_OPTS 1>&2 &\n"
" if [ -r $authfile ]; then\n"
" $have_nohup $* -once -query localhost -auth $authfile $FD_OPTS 1>&2 &\n"
" else\n"
" # why did we have this?\n"
" $have_nohup $* -once -query localhost $FD_OPTS 1>&2 &\n"
" fi\n"
" else\n"
" if [ \"X$ns\" = \"X0\" ]; then\n"
" $have_nohup sh -c \"$* -once -query localhost -auth $authfile $FD_OPTS\" 1>&2 &\n"
@ -1754,10 +1776,10 @@ char create_display[] =
" pid=$!\n"
" sleep 10\n"
" elif [ \"X$have_startx\" != \"X\" -o \"X$have_xinit\" != \"X\" ]; then\n"
" if [ \"X$have_startx\" != \"X\" ]; then\n"
" sxcmd=$have_startx\n"
" else\n"
" if [ \"X$have_xinit\" != \"X\" ]; then\n"
" sxcmd=$have_xinit\n"
" else\n"
" sxcmd=$have_startx\n"
" fi\n"
" echo \"$sxcmd $sess -- $* $nolisten -auth $authfile $FD_OPTS\" 1>&2\n"
" if [ \"X$have_root\" != \"X\" ]; then\n"
@ -1924,12 +1946,18 @@ char create_display[] =
" sarg=\"screen\"\n"
" fi\n"
" fi\n"
" # remember to put server args after sarg ... to work on Solaris 9 and 10.\n"
" margs=\"+kb\"\n"
"\n"
" # currently not enabled in Xvfb's we see.\n"
"# if $have_Xvfb -extension MOOMOO 2>&1 | grep -w RANDR >/dev/null; then\n"
"# margs=\"$margs +extension RANDR\"\n"
"# fi\n"
"\n"
" if [ $depth -ge 16 ]; then\n"
" server $have_Xvfb :$N $sarg 0 ${geom}x${depth} +kb -cc 4\n"
" else\n"
" server $have_Xvfb :$N $sarg 0 ${geom}x${depth} +kb\n"
" # avoid DirectColor for default visual:\n"
" margs=\"$margs -cc 4\"\n"
" fi\n"
" server $have_Xvfb :$N $sarg 0 ${geom}x${depth} $margs\n"
"\n"
" if [ \"X$result\" = \"X1\" -a \"X$have_xmodmap\" != \"X\" ]; then\n"
" if [ \"X$have_root\" = \"X\" ]; then\n"
@ -2030,6 +2058,10 @@ char create_display[] =
" cook=`cookie`\n"
" $have_xauth -f $tmp add :$N . $cook 1>&2\n"
" $have_xauth -f $tmp add `hostname`:$N . $cook 1>&2\n"
" if [ \"X$CREATE_DISPLAY_EXEC\" != \"X\" ]; then\n"
" ls -l $tmp 1>&2\n"
" $have_xauth -f $tmp list 1>&2\n"
" fi\n"
" echo \"$tmp\"\n"
"}\n"
"\n"
@ -2117,7 +2149,7 @@ char create_display[] =
" USER=`whoami`\n"
"fi\n"
"\n"
"PATH=$PATH:/usr/X11R6/bin:/usr/bin/X11:/usr/openwin/bin:/usr/dt/bin:/opt/kde3/bin:/opt/gnome/bin:/usr/bin:/bin:/usr/sfw/bin\n"
"PATH=$PATH:/usr/X11R6/bin:/usr/bin/X11:/usr/openwin/bin:/usr/dt/bin:/opt/kde4/bin:/opt/kde3/bin:/opt/gnome/bin:/usr/bin:/bin:/usr/sfw/bin\n"
"\n"
"have_root=\"\"\n"
"id0=`id`\n"
@ -2130,7 +2162,7 @@ char create_display[] =
" p_ok=1\n"
"fi\n"
"\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 startxfce4 startxfce\n"
"for prog in startx xinit xdm gdm kdm xterm Xdummy Xvfb Xvnc xauth xdpyinfo mcookie md5sum xmodmap startkde dbus-launch gnome-session blackbox fvwm2 mwm openbox twm windowmaker wmaker enlightenment metacity X Xorg XFree86 Xsun Xsession dtwm netstat nohup esddsp konsole gnome-terminal x-terminal-emulator perl startxfce4 startxfce\n"
"do\n"
" p2=`echo \"$prog\" | sed -e 's/-/_/g'`\n"
" eval \"have_$p2=''\"\n"
@ -2148,10 +2180,12 @@ char create_display[] =
" fi\n"
"done\n"
"if [ \"X$have_xterm\" = \"X\" ]; then\n"
" if [ \"X$have_konsole\" != \"X\" ]; then\n"
" have_xterm=$have_konsole\n"
" elif [ \"X$have_gnome_terminal\" != \"X\" ]; then\n"
" if [ \"X$have_gnome_terminal\" != \"X\" ]; then\n"
" have_xterm=$have_gnome_terminal\n"
" elif [ \"X$have_konsole\" != \"X\" ]; then\n"
" have_xterm=$have_konsole\n"
" elif [ \"X$have_x_terminal_emulator\" != \"X\" ]; then\n"
" have_xterm=$have_x_terminal_emulator\n"
" fi\n"
"fi\n"
"\n"
@ -2182,9 +2216,15 @@ char create_display[] =
" if echo \"$curr_try\" | egrep '[+.-]xdmcp' > /dev/null; then\n"
" use_xdmcp_query=1\n"
" fi\n"
"\n"
" if [ \"X$X11VNC_XDM_ONLY\" = \"X1\" -a \"X$use_xdmcp_query\" = \"X0\" ]; then\n"
" echo \"SKIPPING NON-XDMCP item '$curr_try' in X11VNC_XDM_ONLY=1 mode.\" 1>&2\n"
" continue\n"
" fi\n"
" \n"
" curr_try=`echo \"$curr_try\" | sed -e 's/[+.-]xdmcp//'`\n"
" curr_try=`echo \"$curr_try\" | sed -e 's/[+.-]redirect//'`\n"
" \n"
"\n"
" if echo \"$curr_try\" | grep -i '^Xdummy\\>' > /dev/null; then\n"
" try_Xdummy\n"
" elif echo \"$curr_try\" | grep -i '^Xvfb\\>' > /dev/null; then\n"

@ -413,6 +413,7 @@ Tuning
gaps:
grow:
fuzz:
extra_fbur:
wait_ui:
setdefer:
nowait_bog
@ -749,7 +750,8 @@ more) via Properties -> Advanced -> Actions -> Quit
non-standard listening port use \"host:port\".
Pressing \"OK\" will initiate the reverse
connection. Use a blank hostname to skip it.
connection. Use a blank hostname to skip it, or
delete (\"X-out\") the window.
"
@ -2985,7 +2987,12 @@ proc all_query_vars {} {
}
set cache_all_query_vars $qry
#puts $qry
global env
if [info exists env(TKX11VNC_PRINT_ALL_VARS)] {
puts "--------------- BEGIN ALL VARS ---------------"
puts $qry
puts "--------------- END ALL VARS ---------------"
}
return $qry
}
@ -6261,11 +6268,11 @@ proc run_remote_cmd_via_sock {opts} {
}
if {$db} {puts stderr "run_remote_cmd_via_sock: $docmd \"$str\""}
puts $client_sock $str
catch {puts $client_sock $str}
if {$db} {puts stderr "run_remote_cmd_via_sock: flush"}
flush $client_sock
catch {flush $client_sock}
if {$db} {puts stderr "run_remote_cmd_via_sock: gets"}
gets $client_sock res
catch {gets $client_sock res}
if {$db} {puts stderr "run_remote_cmd_via_sock: \"$res\""}
set res [string trim $res]
@ -6535,18 +6542,18 @@ proc do_port_prompt {} {
} else {
frame .pp.f -bd 1 -relief ridge -pady 2
}
label .pp.f.l -text "Port: "
entry .pp.f.e -width 8 -textvariable port_set
label .pp.f.l -text "Port: " -font $bfont
entry .pp.f.e -width 8 -textvariable port_set -font $ffont
global enable_ssl; set enable_ssl 0
if [info exists env(X11VNC_SSL_ENABLED)] {
set enable_ssl 1
}
checkbutton .pp.f.ssl -relief raised -pady 3 -padx 3 -text "Enable SSL" -variable enable_ssl
checkbutton .pp.f.ssl -relief raised -pady 3 -padx 3 -text "Enable SSL" -variable enable_ssl -font $bfont
global localhost; set localhost 0
if [info exists env(X11VNC_LOCALHOST_ENABLED)] {
set localhost 1
}
checkbutton .pp.f.loc -relief raised -pady 3 -padx 3 -text "Listen on localhost" -variable localhost
checkbutton .pp.f.loc -relief raised -pady 3 -padx 3 -text "Listen on localhost" -variable localhost -font $bfont
pack .pp.f.l .pp.f.e -side left
pack .pp.f.loc .pp.f.ssl -side right
@ -6559,15 +6566,15 @@ proc do_port_prompt {} {
if [info exists env(X11VNC_FILETRANSFER_ENABLED)] {
set file_transfer $env(X11VNC_FILETRANSFER_ENABLED)
}
label .pp.t.l -text "File Transfer: "
radiobutton .pp.t.none -text "None" -variable file_transfer -value "none"
radiobutton .pp.t.ultra -text "UltraVNC" -variable file_transfer -value "ultra"
radiobutton .pp.t.tight -text "TightVNC" -variable file_transfer -value "tight"
label .pp.t.l -text "File Transfer: " -font $bfont
radiobutton .pp.t.none -text "None" -variable file_transfer -value "none" -font $bfont
radiobutton .pp.t.ultra -text "UltraVNC" -variable file_transfer -value "ultra" -font $bfont
radiobutton .pp.t.tight -text "TightVNC" -variable file_transfer -value "tight" -font $bfont
pack .pp.t.l .pp.t.none .pp.t.ultra .pp.t.tight -side left
frame .pp.o -bd 1 -relief ridge
button .pp.o.ok -text "OK" -command "set port_reply 1; destroy .pp"
button .pp.o.cancel -text "Cancel" -command "set port_reply 0; destroy .pp"
button .pp.o.ok -text "OK" -command "set port_reply 1; destroy .pp" -font $bfont
button .pp.o.cancel -text "Cancel" -command "set port_reply 0; destroy .pp" -font $bfont
pack .pp.o.ok .pp.o.cancel -side left -fill x -expand 1
pack .pp.m -side top -fill x -expand 1
pack .pp.f .pp.t .pp.o -side top -fill x
@ -6794,6 +6801,24 @@ set sfont "-adobe-helvetica-bold-r-*-*-*-100-*-*-*-*-*-*"
set snfont "-adobe-helvetica-medium-r-*-*-*-100-*-*-*-*-*-*"
set ffont "fixed"
set got_helv 0
catch {
foreach fam [font families] {
if {$fam == "helvetica"} {
set got_helv 1
}
if {$fam == "Helvetica"} {
set got_helv 1
}
}
}
if {$got_helv} {
set bfont "Helvetica -12 bold"
set sfont "Helvetica -10 bold"
set snfont "Helvetica -10"
}
set ls ""
catch {set ls [font metrics $bfont -linespace]}
if {$ls != "" && $ls > 14} {
@ -6914,11 +6939,6 @@ if {"$argv" == "-spit"} {
puts ";"
exit 0
}
if {"$argv" == "-portprompt"} {
do_port_prompt
exit 0
}
set_view_variable "full"
@ -6977,6 +6997,19 @@ if {[info exists env(X11VNC_GUI_PARAMS)]} {
set x11vnc_gui_params ""
}
if {[info exists env(X11VNC_FONT_BOLD)]} {
set bfont $env(X11VNC_FONT_BOLD)
}
if {[info exists env(X11VNC_FONT_BOLD_SMALL)]} {
set sfont $env(X11VNC_FONT_BOLD_SMALL)
}
if {[info exists env(X11VNC_FONT_REG_SMALL)]} {
set snfont $env(X11VNC_FONT_REG_SMALL)
}
if {[info exists env(X11VNC_FONT_FIXED)]} {
set ffont $env(X11VNC_FONT_FIXED)
}
if {[info exists env(X11VNC_CONNECT_FILE)]} {
set x11vnc_connect_file $env(X11VNC_CONNECT_FILE);
} else {
@ -7086,6 +7119,11 @@ if {[regexp -nocase {Darwin} $osname]} {
set bfont {system}
}
if {"$argv" == "-portprompt"} {
do_port_prompt
exit 0
}
#puts [exec env]
#puts "x11vnc_xdisplay: $x11vnc_xdisplay"

@ -424,6 +424,7 @@ char gui_code[] = "";
" gaps:\n"
" grow:\n"
" fuzz:\n"
" extra_fbur:\n"
" wait_ui:\n"
" setdefer:\n"
" nowait_bog\n"
@ -760,7 +761,8 @@ char gui_code[] = "";
" non-standard listening port use \\\"host:port\\\".\n"
"\n"
" Pressing \\\"OK\\\" will initiate the reverse\n"
" connection. Use a blank hostname to skip it.\n"
" connection. Use a blank hostname to skip it, or\n"
" delete (\\\"X-out\\\") the window.\n"
" \n"
"\"\n"
"\n"
@ -2996,7 +2998,12 @@ char gui_code[] = "";
" }\n"
" set cache_all_query_vars $qry\n"
"\n"
"#puts $qry\n"
" global env\n"
" if [info exists env(TKX11VNC_PRINT_ALL_VARS)] {\n"
" puts \"--------------- BEGIN ALL VARS ---------------\"\n"
" puts $qry\n"
" puts \"--------------- END ALL VARS ---------------\"\n"
" }\n"
"\n"
" return $qry\n"
"}\n"
@ -6272,11 +6279,11 @@ char gui_code[] = "";
" }\n"
"\n"
" if {$db} {puts stderr \"run_remote_cmd_via_sock: $docmd \\\"$str\\\"\"}\n"
" puts $client_sock $str\n"
" catch {puts $client_sock $str}\n"
" if {$db} {puts stderr \"run_remote_cmd_via_sock: flush\"}\n"
" flush $client_sock\n"
" catch {flush $client_sock}\n"
" if {$db} {puts stderr \"run_remote_cmd_via_sock: gets\"}\n"
" gets $client_sock res\n"
" catch {gets $client_sock res}\n"
" if {$db} {puts stderr \"run_remote_cmd_via_sock: \\\"$res\\\"\"}\n"
" set res [string trim $res]\n"
"\n"
@ -6546,18 +6553,18 @@ char gui_code[] = "";
" } else {\n"
" frame .pp.f -bd 1 -relief ridge -pady 2\n"
" }\n"
" label .pp.f.l -text \"Port: \"\n"
" entry .pp.f.e -width 8 -textvariable port_set\n"
" label .pp.f.l -text \"Port: \" -font $bfont\n"
" entry .pp.f.e -width 8 -textvariable port_set -font $ffont\n"
" global enable_ssl; set enable_ssl 0\n"
" if [info exists env(X11VNC_SSL_ENABLED)] {\n"
" set enable_ssl 1\n"
" }\n"
" checkbutton .pp.f.ssl -relief raised -pady 3 -padx 3 -text \"Enable SSL\" -variable enable_ssl\n"
" checkbutton .pp.f.ssl -relief raised -pady 3 -padx 3 -text \"Enable SSL\" -variable enable_ssl -font $bfont\n"
" global localhost; set localhost 0\n"
" if [info exists env(X11VNC_LOCALHOST_ENABLED)] {\n"
" set localhost 1\n"
" }\n"
" checkbutton .pp.f.loc -relief raised -pady 3 -padx 3 -text \"Listen on localhost\" -variable localhost\n"
" checkbutton .pp.f.loc -relief raised -pady 3 -padx 3 -text \"Listen on localhost\" -variable localhost -font $bfont\n"
" pack .pp.f.l .pp.f.e -side left\n"
" pack .pp.f.loc .pp.f.ssl -side right\n"
"\n"
@ -6570,15 +6577,15 @@ char gui_code[] = "";
" if [info exists env(X11VNC_FILETRANSFER_ENABLED)] {\n"
" set file_transfer $env(X11VNC_FILETRANSFER_ENABLED)\n"
" }\n"
" label .pp.t.l -text \"File Transfer: \"\n"
" radiobutton .pp.t.none -text \"None\" -variable file_transfer -value \"none\"\n"
" radiobutton .pp.t.ultra -text \"UltraVNC\" -variable file_transfer -value \"ultra\"\n"
" radiobutton .pp.t.tight -text \"TightVNC\" -variable file_transfer -value \"tight\"\n"
" label .pp.t.l -text \"File Transfer: \" -font $bfont\n"
" radiobutton .pp.t.none -text \"None\" -variable file_transfer -value \"none\" -font $bfont\n"
" radiobutton .pp.t.ultra -text \"UltraVNC\" -variable file_transfer -value \"ultra\" -font $bfont\n"
" radiobutton .pp.t.tight -text \"TightVNC\" -variable file_transfer -value \"tight\" -font $bfont\n"
" pack .pp.t.l .pp.t.none .pp.t.ultra .pp.t.tight -side left\n"
"\n"
" frame .pp.o -bd 1 -relief ridge\n"
" button .pp.o.ok -text \"OK\" -command \"set port_reply 1; destroy .pp\"\n"
" button .pp.o.cancel -text \"Cancel\" -command \"set port_reply 0; destroy .pp\"\n"
" button .pp.o.ok -text \"OK\" -command \"set port_reply 1; destroy .pp\" -font $bfont\n"
" button .pp.o.cancel -text \"Cancel\" -command \"set port_reply 0; destroy .pp\" -font $bfont\n"
" pack .pp.o.ok .pp.o.cancel -side left -fill x -expand 1\n"
" pack .pp.m -side top -fill x -expand 1 \n"
" pack .pp.f .pp.t .pp.o -side top -fill x\n"
@ -6805,6 +6812,24 @@ char gui_code[] = "";
"set snfont \"-adobe-helvetica-medium-r-*-*-*-100-*-*-*-*-*-*\"\n"
"set ffont \"fixed\"\n"
"\n"
"set got_helv 0\n"
"catch {\n"
" foreach fam [font families] {\n"
" if {$fam == \"helvetica\"} {\n"
" set got_helv 1\n"
" }\n"
" if {$fam == \"Helvetica\"} {\n"
" set got_helv 1\n"
" }\n"
" }\n"
"}\n"
"\n"
"if {$got_helv} {\n"
" set bfont \"Helvetica -12 bold\"\n"
" set sfont \"Helvetica -10 bold\"\n"
" set snfont \"Helvetica -10\"\n"
"}\n"
"\n"
"set ls \"\"\n"
"catch {set ls [font metrics $bfont -linespace]}\n"
"if {$ls != \"\" && $ls > 14} {\n"
@ -6925,11 +6950,6 @@ char gui_code[] = "";
" puts \";\"\n"
" exit 0\n"
"}\n"
"if {\"$argv\" == \"-portprompt\"} {\n"
" do_port_prompt\n"
" exit 0\n"
"}\n"
"\n"
"\n"
"set_view_variable \"full\"\n"
"\n"
@ -6988,6 +7008,19 @@ char gui_code[] = "";
" set x11vnc_gui_params \"\"\n"
"}\n"
"\n"
"if {[info exists env(X11VNC_FONT_BOLD)]} {\n"
" set bfont $env(X11VNC_FONT_BOLD)\n"
"}\n"
"if {[info exists env(X11VNC_FONT_BOLD_SMALL)]} {\n"
" set sfont $env(X11VNC_FONT_BOLD_SMALL)\n"
"}\n"
"if {[info exists env(X11VNC_FONT_REG_SMALL)]} {\n"
" set snfont $env(X11VNC_FONT_REG_SMALL)\n"
"}\n"
"if {[info exists env(X11VNC_FONT_FIXED)]} {\n"
" set ffont $env(X11VNC_FONT_FIXED)\n"
"}\n"
"\n"
"if {[info exists env(X11VNC_CONNECT_FILE)]} {\n"
" set x11vnc_connect_file $env(X11VNC_CONNECT_FILE);\n"
"} else {\n"
@ -7097,6 +7130,11 @@ char gui_code[] = "";
" set bfont {system}\n"
"}\n"
"\n"
"if {\"$argv\" == \"-portprompt\"} {\n"
" do_port_prompt\n"
" exit 0\n"
"}\n"
"\n"
"#puts [exec env]\n"
"#puts \"x11vnc_xdisplay: $x11vnc_xdisplay\"\n"
"\n"

@ -96,7 +96,7 @@ void unixpw_accept(char *user);
void unixpw_deny(void);
void unixpw_msg(char *msg, int delay);
int su_verify(char *user, char *pass, char *cmd, char *rbuf, int *rbuf_size, int nodisp);
int unixpw_cmd_run(char *user, char *pass, char *cmd, char *line, int *n, int nodisp);
int unixpw_cmd_run(char *user, char *pass, char *cmd, char *line, int *n);
int crypt_verify(char *user, char *pass);
int cmd_verify(char *user, char *pass);
void unixpw_verify_screen(char *user, char *pass);
@ -119,6 +119,237 @@ char *keep_unixpw_user = NULL;
char *keep_unixpw_pass = NULL;
char *keep_unixpw_opts = NULL;
///////
static unsigned char default6x13FontData[2899]={
0x00,0x00,0xA8,0x00,0x88,0x00,0x88,0x00,0x88,0x00,0xA8,0x00,0x00, /* 0 */
0x00,0x00,0x00,0x00,0x20,0x70,0xF8,0x70,0x20,0x00,0x00,0x00,0x00, /* 1 */
0xA8,0x54,0xA8,0x54,0xA8,0x54,0xA8,0x54,0xA8,0x54,0xA8,0x54,0xA8, /* 2 */
0x00,0x00,0xA0,0xA0,0xE0,0xA0,0xA0,0x38,0x10,0x10,0x10,0x00,0x00, /* 3 */
0x00,0x00,0xE0,0x80,0xC0,0x80,0xB8,0x20,0x30,0x20,0x20,0x00,0x00, /* 4 */
0x00,0x00,0x60,0x80,0x80,0x60,0x30,0x28,0x30,0x28,0x28,0x00,0x00, /* 5 */
0x00,0x00,0x80,0x80,0x80,0xE0,0x38,0x20,0x30,0x20,0x20,0x00,0x00, /* 6 */
0x00,0x00,0x30,0x48,0x48,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 7 */
0x00,0x00,0x00,0x20,0x20,0xF8,0x20,0x20,0x00,0xF8,0x00,0x00,0x00, /* 8 */
0x00,0x00,0x90,0xD0,0xB0,0x90,0x20,0x20,0x20,0x20,0x38,0x00,0x00, /* 9 */
0x00,0x00,0xA0,0xA0,0xA0,0x40,0x40,0x38,0x10,0x10,0x10,0x00,0x00, /* 10 */
0x20,0x20,0x20,0x20,0x20,0x20,0xE0,0x00,0x00,0x00,0x00,0x00,0x00, /* 11 */
0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x20,0x20,0x20,0x20,0x20,0x20, /* 12 */
0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x20,0x20,0x20,0x20,0x20,0x20, /* 13 */
0x20,0x20,0x20,0x20,0x20,0x20,0x3C,0x00,0x00,0x00,0x00,0x00,0x00, /* 14 */
0x20,0x20,0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0x20,0x20, /* 15 */
0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 16 */
0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 17 */
0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00, /* 18 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x00,0x00,0x00, /* 19 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC, /* 20 */
0x20,0x20,0x20,0x20,0x20,0x20,0x3C,0x20,0x20,0x20,0x20,0x20,0x20, /* 21 */
0x20,0x20,0x20,0x20,0x20,0x20,0xE0,0x20,0x20,0x20,0x20,0x20,0x20, /* 22 */
0x20,0x20,0x20,0x20,0x20,0x20,0xFC,0x00,0x00,0x00,0x00,0x00,0x00, /* 23 */
0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x20,0x20,0x20,0x20,0x20,0x20, /* 24 */
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, /* 25 */
0x00,0x00,0x00,0x18,0x60,0x80,0x60,0x18,0x00,0xF8,0x00,0x00,0x00, /* 26 */
0x00,0x00,0x00,0xC0,0x30,0x08,0x30,0xC0,0x00,0xF8,0x00,0x00,0x00, /* 27 */
0x00,0x00,0x00,0x00,0x00,0xF8,0x50,0x50,0x50,0x50,0x50,0x00,0x00, /* 28 */
0x00,0x00,0x00,0x00,0x00,0x08,0xF8,0x20,0xF8,0x80,0x00,0x00,0x00, /* 29 */
0x00,0x00,0x30,0x48,0x40,0x40,0xE0,0x40,0x40,0x48,0xB0,0x00,0x00, /* 30 */
0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00, /* 31 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 32 */
0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, /* 33 */
0x00,0x00,0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 34 */
0x00,0x00,0x00,0x50,0x50,0xF8,0x50,0xF8,0x50,0x50,0x00,0x00,0x00, /* 35 */
0x00,0x00,0x20,0x78,0xA0,0xA0,0x70,0x28,0x28,0xF0,0x20,0x00,0x00, /* 36 */
0x00,0x00,0x48,0xA8,0x50,0x10,0x20,0x40,0x50,0xA8,0x90,0x00,0x00, /* 37 */
0x00,0x00,0x00,0x40,0xA0,0xA0,0x40,0xA0,0x98,0x90,0x68,0x00,0x00, /* 38 */
0x00,0x00,0x20,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 39 */
0x00,0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10,0x00, /* 40 */
0x00,0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40,0x00, /* 41 */
0x00,0x00,0x00,0x20,0xA8,0xF8,0x70,0xF8,0xA8,0x20,0x00,0x00,0x00, /* 42 */
0x00,0x00,0x00,0x00,0x20,0x20,0xF8,0x20,0x20,0x00,0x00,0x00,0x00, /* 43 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x20,0x40,0x00, /* 44 */
0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, /* 45 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x70,0x20,0x00, /* 46 */
0x00,0x00,0x08,0x08,0x10,0x10,0x20,0x40,0x40,0x80,0x80,0x00,0x00, /* 47 */
0x00,0x00,0x20,0x50,0x88,0x88,0x88,0x88,0x88,0x50,0x20,0x00,0x00, /* 48 */
0x00,0x00,0x20,0x60,0xA0,0x20,0x20,0x20,0x20,0x20,0xF8,0x00,0x00, /* 49 */
0x00,0x00,0x70,0x88,0x88,0x08,0x10,0x20,0x40,0x80,0xF8,0x00,0x00, /* 50 */
0x00,0x00,0xF8,0x08,0x10,0x20,0x70,0x08,0x08,0x88,0x70,0x00,0x00, /* 51 */
0x00,0x00,0x10,0x10,0x30,0x50,0x50,0x90,0xF8,0x10,0x10,0x00,0x00, /* 52 */
0x00,0x00,0xF8,0x80,0x80,0xB0,0xC8,0x08,0x08,0x88,0x70,0x00,0x00, /* 53 */
0x00,0x00,0x70,0x88,0x80,0x80,0xF0,0x88,0x88,0x88,0x70,0x00,0x00, /* 54 */
0x00,0x00,0xF8,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x00,0x00, /* 55 */
0x00,0x00,0x70,0x88,0x88,0x88,0x70,0x88,0x88,0x88,0x70,0x00,0x00, /* 56 */
0x00,0x00,0x70,0x88,0x88,0x88,0x78,0x08,0x08,0x88,0x70,0x00,0x00, /* 57 */
0x00,0x00,0x00,0x00,0x20,0x70,0x20,0x00,0x00,0x20,0x70,0x20,0x00, /* 58 */
0x00,0x00,0x00,0x00,0x20,0x70,0x20,0x00,0x00,0x30,0x20,0x40,0x00, /* 59 */
0x00,0x00,0x08,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x08,0x00,0x00, /* 60 */
0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0xF8,0x00,0x00,0x00,0x00, /* 61 */
0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x80,0x00,0x00, /* 62 */
0x00,0x00,0x70,0x88,0x88,0x08,0x10,0x20,0x20,0x00,0x20,0x00,0x00, /* 63 */
0x00,0x00,0x70,0x88,0x88,0x98,0xA8,0xA8,0xB0,0x80,0x78,0x00,0x00, /* 64 */
0x00,0x00,0x20,0x50,0x88,0x88,0x88,0xF8,0x88,0x88,0x88,0x00,0x00, /* 65 */
0x00,0x00,0xF0,0x48,0x48,0x48,0x70,0x48,0x48,0x48,0xF0,0x00,0x00, /* 66 */
0x00,0x00,0x70,0x88,0x80,0x80,0x80,0x80,0x80,0x88,0x70,0x00,0x00, /* 67 */
0x00,0x00,0xF0,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0xF0,0x00,0x00, /* 68 */
0x00,0x00,0xF8,0x80,0x80,0x80,0xF0,0x80,0x80,0x80,0xF8,0x00,0x00, /* 69 */
0x00,0x00,0xF8,0x80,0x80,0x80,0xF0,0x80,0x80,0x80,0x80,0x00,0x00, /* 70 */
0x00,0x00,0x70,0x88,0x80,0x80,0x80,0x98,0x88,0x88,0x70,0x00,0x00, /* 71 */
0x00,0x00,0x88,0x88,0x88,0x88,0xF8,0x88,0x88,0x88,0x88,0x00,0x00, /* 72 */
0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, /* 73 */
0x00,0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x90,0x60,0x00,0x00, /* 74 */
0x00,0x00,0x88,0x88,0x90,0xA0,0xC0,0xA0,0x90,0x88,0x88,0x00,0x00, /* 75 */
0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xF8,0x00,0x00, /* 76 */
0x00,0x00,0x88,0x88,0xD8,0xA8,0xA8,0x88,0x88,0x88,0x88,0x00,0x00, /* 77 */
0x00,0x00,0x88,0xC8,0xC8,0xA8,0xA8,0x98,0x98,0x88,0x88,0x00,0x00, /* 78 */
0x00,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, /* 79 */
0x00,0x00,0xF0,0x88,0x88,0x88,0xF0,0x80,0x80,0x80,0x80,0x00,0x00, /* 80 */
0x00,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x88,0xA8,0x70,0x08,0x00, /* 81 */
0x00,0x00,0xF0,0x88,0x88,0x88,0xF0,0xA0,0x90,0x88,0x88,0x00,0x00, /* 82 */
0x00,0x00,0x70,0x88,0x80,0x80,0x70,0x08,0x08,0x88,0x70,0x00,0x00, /* 83 */
0x00,0x00,0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00, /* 84 */
0x00,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, /* 85 */
0x00,0x00,0x88,0x88,0x88,0x88,0x50,0x50,0x50,0x20,0x20,0x00,0x00, /* 86 */
0x00,0x00,0x88,0x88,0x88,0x88,0xA8,0xA8,0xA8,0xA8,0x50,0x00,0x00, /* 87 */
0x00,0x00,0x88,0x88,0x50,0x50,0x20,0x50,0x50,0x88,0x88,0x00,0x00, /* 88 */
0x00,0x00,0x88,0x88,0x50,0x50,0x20,0x20,0x20,0x20,0x20,0x00,0x00, /* 89 */
0x00,0x00,0xF8,0x08,0x10,0x10,0x20,0x40,0x40,0x80,0xF8,0x00,0x00, /* 90 */
0x00,0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x70,0x00, /* 91 */
0x00,0x00,0x80,0x80,0x40,0x40,0x20,0x10,0x10,0x08,0x08,0x00,0x00, /* 92 */
0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70,0x00, /* 93 */
0x00,0x00,0x20,0x50,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 94 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x00, /* 95 */
0x00,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 96 */
0x00,0x00,0x00,0x00,0x00,0x70,0x08,0x78,0x88,0x98,0x68,0x00,0x00, /* 97 */
0x00,0x00,0x80,0x80,0x80,0xF0,0x88,0x88,0x88,0x88,0xF0,0x00,0x00, /* 98 */
0x00,0x00,0x00,0x00,0x00,0x70,0x88,0x80,0x80,0x88,0x70,0x00,0x00, /* 99 */
0x00,0x00,0x08,0x08,0x08,0x78,0x88,0x88,0x88,0x88,0x78,0x00,0x00, /* 100 */
0x00,0x00,0x00,0x00,0x00,0x70,0x88,0xF8,0x80,0x88,0x70,0x00,0x00, /* 101 */
0x00,0x00,0x30,0x48,0x40,0x40,0xF0,0x40,0x40,0x40,0x40,0x00,0x00, /* 102 */
0x00,0x00,0x00,0x00,0x00,0x70,0x88,0x88,0x88,0x78,0x08,0x88,0x70, /* 103 */
0x00,0x00,0x80,0x80,0x80,0xB0,0xC8,0x88,0x88,0x88,0x88,0x00,0x00, /* 104 */
0x00,0x00,0x00,0x20,0x00,0x60,0x20,0x20,0x20,0x20,0x70,0x00,0x00, /* 105 */
0x00,0x00,0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x90,0x90,0x60, /* 106 */
0x00,0x00,0x80,0x80,0x80,0x90,0xA0,0xC0,0xA0,0x90,0x88,0x00,0x00, /* 107 */
0x00,0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, /* 108 */
0x00,0x00,0x00,0x00,0x00,0xD0,0xA8,0xA8,0xA8,0xA8,0x88,0x00,0x00, /* 109 */
0x00,0x00,0x00,0x00,0x00,0xB0,0xC8,0x88,0x88,0x88,0x88,0x00,0x00, /* 110 */
0x00,0x00,0x00,0x00,0x00,0x70,0x88,0x88,0x88,0x88,0x70,0x00,0x00, /* 111 */
0x00,0x00,0x00,0x00,0x00,0xF0,0x88,0x88,0x88,0xF0,0x80,0x80,0x80, /* 112 */
0x00,0x00,0x00,0x00,0x00,0x78,0x88,0x88,0x88,0x78,0x08,0x08,0x08, /* 113 */
0x00,0x00,0x00,0x00,0x00,0xB0,0xC8,0x80,0x80,0x80,0x80,0x00,0x00, /* 114 */
0x00,0x00,0x00,0x00,0x00,0x70,0x88,0x60,0x10,0x88,0x70,0x00,0x00, /* 115 */
0x00,0x00,0x00,0x40,0x40,0xF0,0x40,0x40,0x40,0x48,0x30,0x00,0x00, /* 116 */
0x00,0x00,0x00,0x00,0x00,0x88,0x88,0x88,0x88,0x98,0x68,0x00,0x00, /* 117 */
0x00,0x00,0x00,0x00,0x00,0x88,0x88,0x88,0x50,0x50,0x20,0x00,0x00, /* 118 */
0x00,0x00,0x00,0x00,0x00,0x88,0x88,0xA8,0xA8,0xA8,0x50,0x00,0x00, /* 119 */
0x00,0x00,0x00,0x00,0x00,0x88,0x50,0x20,0x20,0x50,0x88,0x00,0x00, /* 120 */
0x00,0x00,0x00,0x00,0x00,0x88,0x88,0x88,0x98,0x68,0x08,0x88,0x70, /* 121 */
0x00,0x00,0x00,0x00,0x00,0xF8,0x10,0x20,0x40,0x80,0xF8,0x00,0x00, /* 122 */
0x00,0x18,0x20,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x20,0x18,0x00, /* 123 */
0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00, /* 124 */
0x00,0xC0,0x20,0x20,0x20,0x20,0x18,0x20,0x20,0x20,0x20,0xC0,0x00, /* 125 */
0x00,0x00,0x48,0xA8,0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 126 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 160 */
0x00,0x00,0x20,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00, /* 161 */
0x00,0x00,0x20,0x70,0xA8,0xA0,0xA0,0xA8,0x70,0x20,0x00,0x00,0x00, /* 162 */
0x00,0x00,0x30,0x48,0x40,0x40,0xE0,0x40,0x40,0x48,0xB0,0x00,0x00, /* 163 */
0x00,0x00,0x00,0x00,0x88,0x70,0x50,0x50,0x70,0x88,0x00,0x00,0x00, /* 164 */
0x00,0x00,0x88,0x88,0x50,0x50,0xF8,0x20,0xF8,0x20,0x20,0x00,0x00, /* 165 */
0x00,0x00,0x20,0x20,0x20,0x20,0x00,0x20,0x20,0x20,0x20,0x00,0x00, /* 166 */
0x00,0x30,0x48,0x40,0x30,0x48,0x48,0x30,0x08,0x48,0x30,0x00,0x00, /* 167 */
0x00,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 168 */
0x00,0x70,0x88,0xA8,0xD8,0xC8,0xD8,0xA8,0x88,0x70,0x00,0x00,0x00, /* 169 */
0x00,0x00,0x70,0x08,0x78,0x88,0x78,0x00,0xF8,0x00,0x00,0x00,0x00, /* 170 */
0x00,0x00,0x00,0x00,0x28,0x50,0xA0,0xA0,0x50,0x28,0x00,0x00,0x00, /* 171 */
0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x08,0x08,0x00,0x00,0x00,0x00, /* 172 */
0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00, /* 173 */
0x00,0x70,0x88,0xE8,0xD8,0xD8,0xE8,0xD8,0x88,0x70,0x00,0x00,0x00, /* 174 */
0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 175 */
0x00,0x00,0x30,0x48,0x48,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 176 */
0x00,0x00,0x00,0x20,0x20,0xF8,0x20,0x20,0x00,0xF8,0x00,0x00,0x00, /* 177 */
0x00,0x40,0xA0,0x20,0x40,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 178 */
0x00,0x40,0xA0,0x40,0x20,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 179 */
0x00,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 180 */
0x00,0x00,0x00,0x00,0x00,0x88,0x88,0x88,0x88,0x98,0xE8,0x80,0x80, /* 181 */
0x00,0x00,0x78,0xE8,0xE8,0xE8,0xE8,0x68,0x28,0x28,0x28,0x00,0x00, /* 182 */
0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00, /* 183 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x20, /* 184 */
0x00,0x40,0xC0,0x40,0x40,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 185 */
0x00,0x00,0x70,0x88,0x88,0x88,0x70,0x00,0xF8,0x00,0x00,0x00,0x00, /* 186 */
0x00,0x00,0x00,0x00,0xA0,0x50,0x28,0x28,0x50,0xA0,0x00,0x00,0x00, /* 187 */
0x00,0x40,0xC0,0x40,0x40,0xE0,0x08,0x18,0x28,0x38,0x08,0x00,0x00, /* 188 */
0x00,0x40,0xC0,0x40,0x40,0xE0,0x10,0x28,0x08,0x10,0x38,0x00,0x00, /* 189 */
0x00,0x40,0xA0,0x40,0x20,0xA0,0x48,0x18,0x28,0x38,0x08,0x00,0x00, /* 190 */
0x00,0x00,0x20,0x00,0x20,0x20,0x40,0x80,0x88,0x88,0x70,0x00,0x00, /* 191 */
0x00,0x40,0x20,0x00,0x20,0x50,0x88,0x88,0xF8,0x88,0x88,0x00,0x00, /* 192 */
0x00,0x10,0x20,0x00,0x20,0x50,0x88,0x88,0xF8,0x88,0x88,0x00,0x00, /* 193 */
0x00,0x30,0x48,0x00,0x20,0x50,0x88,0x88,0xF8,0x88,0x88,0x00,0x00, /* 194 */
0x00,0x28,0x50,0x00,0x20,0x50,0x88,0x88,0xF8,0x88,0x88,0x00,0x00, /* 195 */
0x00,0x50,0x50,0x00,0x20,0x50,0x88,0x88,0xF8,0x88,0x88,0x00,0x00, /* 196 */
0x00,0x20,0x50,0x20,0x20,0x50,0x88,0x88,0xF8,0x88,0x88,0x00,0x00, /* 197 */
0x00,0x00,0x58,0xA0,0xA0,0xA0,0xB0,0xE0,0xA0,0xA0,0xB8,0x00,0x00, /* 198 */
0x00,0x00,0x70,0x88,0x80,0x80,0x80,0x80,0x80,0x88,0x70,0x20,0x40, /* 199 */
0x00,0x40,0x20,0x00,0xF8,0x80,0x80,0xF0,0x80,0x80,0xF8,0x00,0x00, /* 200 */
0x00,0x10,0x20,0x00,0xF8,0x80,0x80,0xF0,0x80,0x80,0xF8,0x00,0x00, /* 201 */
0x00,0x30,0x48,0x00,0xF8,0x80,0x80,0xF0,0x80,0x80,0xF8,0x00,0x00, /* 202 */
0x00,0x50,0x50,0x00,0xF8,0x80,0x80,0xF0,0x80,0x80,0xF8,0x00,0x00, /* 203 */
0x00,0x40,0x20,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, /* 204 */
0x00,0x10,0x20,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, /* 205 */
0x00,0x30,0x48,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, /* 206 */
0x00,0x50,0x50,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, /* 207 */
0x00,0x00,0xF0,0x48,0x48,0x48,0xE8,0x48,0x48,0x48,0xF0,0x00,0x00, /* 208 */
0x00,0x28,0x50,0x00,0x88,0x88,0xC8,0xA8,0x98,0x88,0x88,0x00,0x00, /* 209 */
0x00,0x40,0x20,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, /* 210 */
0x00,0x10,0x20,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, /* 211 */
0x00,0x30,0x48,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, /* 212 */
0x00,0x28,0x50,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, /* 213 */
0x00,0x50,0x50,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, /* 214 */
0x00,0x00,0x00,0x00,0x00,0x88,0x50,0x20,0x50,0x88,0x00,0x00,0x00, /* 215 */
0x00,0x08,0x70,0x98,0x98,0xA8,0xA8,0xA8,0xC8,0xC8,0x70,0x80,0x00, /* 216 */
0x00,0x40,0x20,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, /* 217 */
0x00,0x10,0x20,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, /* 218 */
0x00,0x30,0x48,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, /* 219 */
0x00,0x50,0x50,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, /* 220 */
0x00,0x10,0x20,0x00,0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x00,0x00, /* 221 */
0x00,0x00,0x80,0xF0,0x88,0x88,0x88,0xF0,0x80,0x80,0x80,0x00,0x00, /* 222 */
0x00,0x00,0x60,0x90,0x90,0xA0,0xA0,0x90,0x88,0x88,0xB0,0x00,0x00, /* 223 */
0x00,0x00,0x40,0x20,0x00,0x70,0x08,0x78,0x88,0x98,0x68,0x00,0x00, /* 224 */
0x00,0x00,0x10,0x20,0x00,0x70,0x08,0x78,0x88,0x98,0x68,0x00,0x00, /* 225 */
0x00,0x00,0x30,0x48,0x00,0x70,0x08,0x78,0x88,0x98,0x68,0x00,0x00, /* 226 */
0x00,0x00,0x28,0x50,0x00,0x70,0x08,0x78,0x88,0x98,0x68,0x00,0x00, /* 227 */
0x00,0x00,0x50,0x50,0x00,0x70,0x08,0x78,0x88,0x98,0x68,0x00,0x00, /* 228 */
0x00,0x30,0x48,0x30,0x00,0x70,0x08,0x78,0x88,0x98,0x68,0x00,0x00, /* 229 */
0x00,0x00,0x00,0x00,0x00,0x70,0x28,0x70,0xA0,0xA8,0x50,0x00,0x00, /* 230 */
0x00,0x00,0x00,0x00,0x00,0x70,0x88,0x80,0x80,0x88,0x70,0x20,0x40, /* 231 */
0x00,0x00,0x40,0x20,0x00,0x70,0x88,0xF8,0x80,0x88,0x70,0x00,0x00, /* 232 */
0x00,0x00,0x10,0x20,0x00,0x70,0x88,0xF8,0x80,0x88,0x70,0x00,0x00, /* 233 */
0x00,0x00,0x30,0x48,0x00,0x70,0x88,0xF8,0x80,0x88,0x70,0x00,0x00, /* 234 */
0x00,0x00,0x50,0x50,0x00,0x70,0x88,0xF8,0x80,0x88,0x70,0x00,0x00, /* 235 */
0x00,0x00,0x40,0x20,0x00,0x60,0x20,0x20,0x20,0x20,0x70,0x00,0x00, /* 236 */
0x00,0x00,0x10,0x20,0x00,0x60,0x20,0x20,0x20,0x20,0x70,0x00,0x00, /* 237 */
0x00,0x00,0x30,0x48,0x00,0x60,0x20,0x20,0x20,0x20,0x70,0x00,0x00, /* 238 */
0x00,0x00,0x50,0x50,0x00,0x60,0x20,0x20,0x20,0x20,0x70,0x00,0x00, /* 239 */
0x00,0x50,0x20,0x60,0x10,0x70,0x88,0x88,0x88,0x88,0x70,0x00,0x00, /* 240 */
0x00,0x00,0x28,0x50,0x00,0xB0,0xC8,0x88,0x88,0x88,0x88,0x00,0x00, /* 241 */
0x00,0x00,0x40,0x20,0x00,0x70,0x88,0x88,0x88,0x88,0x70,0x00,0x00, /* 242 */
0x00,0x00,0x10,0x20,0x00,0x70,0x88,0x88,0x88,0x88,0x70,0x00,0x00, /* 243 */
0x00,0x00,0x30,0x48,0x00,0x70,0x88,0x88,0x88,0x88,0x70,0x00,0x00, /* 244 */
0x00,0x00,0x28,0x50,0x00,0x70,0x88,0x88,0x88,0x88,0x70,0x00,0x00, /* 245 */
0x00,0x00,0x50,0x50,0x00,0x70,0x88,0x88,0x88,0x88,0x70,0x00,0x00, /* 246 */
0x00,0x00,0x00,0x20,0x20,0x00,0xF8,0x00,0x20,0x20,0x00,0x00,0x00, /* 247 */
0x00,0x00,0x00,0x00,0x08,0x70,0x98,0xA8,0xA8,0xC8,0x70,0x80,0x00, /* 248 */
0x00,0x00,0x40,0x20,0x00,0x88,0x88,0x88,0x88,0x98,0x68,0x00,0x00, /* 249 */
0x00,0x00,0x10,0x20,0x00,0x88,0x88,0x88,0x88,0x98,0x68,0x00,0x00, /* 250 */
0x00,0x00,0x30,0x48,0x00,0x88,0x88,0x88,0x88,0x98,0x68,0x00,0x00, /* 251 */
0x00,0x00,0x50,0x50,0x00,0x88,0x88,0x88,0x88,0x98,0x68,0x00,0x00, /* 252 */
0x00,0x00,0x10,0x20,0x00,0x88,0x88,0x88,0x98,0x68,0x08,0x88,0x70, /* 253 */
0x00,0x00,0x00,0x80,0x80,0xB0,0xC8,0x88,0x88,0xC8,0xB0,0x80,0x80, /* 254 */
0x00,0x00,0x50,0x50,0x00,0x88,0x88,0x88,0x98,0x68,0x08,0x88,0x70, /* 255 */
};
static int default6x13FontMetaData[256*5]={
0,6,13,0,-2,13,6,13,0,-2,26,6,13,0,-2,39,6,13,0,-2,52,6,13,0,-2,65,6,13,0,-2,78,6,13,0,-2,91,6,13,0,-2,104,6,13,0,-2,117,6,13,0,-2,130,6,13,0,-2,143,6,13,0,-2,156,6,13,0,-2,169,6,13,0,-2,182,6,13,0,-2,195,6,13,0,-2,208,6,13,0,-2,221,6,13,0,-2,234,6,13,0,-2,247,6,13,0,-2,260,6,13,0,-2,273,6,13,0,-2,286,6,13,0,-2,299,6,13,0,-2,312,6,13,0,-2,325,6,13,0,-2,338,6,13,0,-2,351,6,13,0,-2,364,6,13,0,-2,377,6,13,0,-2,390,6,13,0,-2,403,6,13,0,-2,416,6,13,0,-2,429,6,13,0,-2,442,6,13,0,-2,455,6,13,0,-2,468,6,13,0,-2,481,6,13,0,-2,494,6,13,0,-2,507,6,13,0,-2,520,6,13,0,-2,533,6,13,0,-2,546,6,13,0,-2,559,6,13,0,-2,572,6,13,0,-2,585,6,13,0,-2,598,6,13,0,-2,611,6,13,0,-2,624,6,13,0,-2,637,6,13,0,-2,650,6,13,0,-2,663,6,13,0,-2,676,6,13,0,-2,689,6,13,0,-2,702,6,13,0,-2,715,6,13,0,-2,728,6,13,0,-2,741,6,13,0,-2,754,6,13,0,-2,767,6,13,0,-2,780,6,13,0,-2,793,6,13,0,-2,806,6,13,0,-2,819,6,13,0,-2,832,6,13,0,-2,845,6,13,0,-2,858,6,13,0,-2,871,6,13,0,-2,884,6,13,0,-2,897,6,13,0,-2,910,6,13,0,-2,923,6,13,0,-2,936,6,13,0,-2,949,6,13,0,-2,962,6,13,0,-2,975,6,13,0,-2,988,6,13,0,-2,1001,6,13,0,-2,1014,6,13,0,-2,1027,6,13,0,-2,1040,6,13,0,-2,1053,6,13,0,-2,1066,6,13,0,-2,1079,6,13,0,-2,1092,6,13,0,-2,1105,6,13,0,-2,1118,6,13,0,-2,1131,6,13,0,-2,1144,6,13,0,-2,1157,6,13,0,-2,1170,6,13,0,-2,1183,6,13,0,-2,1196,6,13,0,-2,1209,6,13,0,-2,1222,6,13,0,-2,1235,6,13,0,-2,1248,6,13,0,-2,1261,6,13,0,-2,1274,6,13,0,-2,1287,6,13,0,-2,1300,6,13,0,-2,1313,6,13,0,-2,1326,6,13,0,-2,1339,6,13,0,-2,1352,6,13,0,-2,1365,6,13,0,-2,1378,6,13,0,-2,1391,6,13,0,-2,1404,6,13,0,-2,1417,6,13,0,-2,1430,6,13,0,-2,1443,6,13,0,-2,1456,6,13,0,-2,1469,6,13,0,-2,1482,6,13,0,-2,1495,6,13,0,-2,1508,6,13,0,-2,1521,6,13,0,-2,1534,6,13,0,-2,1547,6,13,0,-2,1560,6,13,0,-2,1573,6,13,0,-2,1586,6,13,0,-2,1599,6,13,0,-2,1612,6,13,0,-2,1625,6,13,0,-2,1638,6,13,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1651,6,13,0,-2,1664,6,13,0,-2,1677,6,13,0,-2,1690,6,13,0,-2,1703,6,13,0,-2,1716,6,13,0,-2,1729,6,13,0,-2,1742,6,13,0,-2,1755,6,13,0,-2,1768,6,13,0,-2,1781,6,13,0,-2,1794,6,13,0,-2,1807,6,13,0,-2,1820,6,13,0,-2,1833,6,13,0,-2,1846,6,13,0,-2,1859,6,13,0,-2,1872,6,13,0,-2,1885,6,13,0,-2,1898,6,13,0,-2,1911,6,13,0,-2,1924,6,13,0,-2,1937,6,13,0,-2,1950,6,13,0,-2,1963,6,13,0,-2,1976,6,13,0,-2,1989,6,13,0,-2,2002,6,13,0,-2,2015,6,13,0,-2,2028,6,13,0,-2,2041,6,13,0,-2,2054,6,13,0,-2,2067,6,13,0,-2,2080,6,13,0,-2,2093,6,13,0,-2,2106,6,13,0,-2,2119,6,13,0,-2,2132,6,13,0,-2,2145,6,13,0,-2,2158,6,13,0,-2,2171,6,13,0,-2,2184,6,13,0,-2,2197,6,13,0,-2,2210,6,13,0,-2,2223,6,13,0,-2,2236,6,13,0,-2,2249,6,13,0,-2,2262,6,13,0,-2,2275,6,13,0,-2,2288,6,13,0,-2,2301,6,13,0,-2,2314,6,13,0,-2,2327,6,13,0,-2,2340,6,13,0,-2,2353,6,13,0,-2,2366,6,13,0,-2,2379,6,13,0,-2,2392,6,13,0,-2,2405,6,13,0,-2,2418,6,13,0,-2,2431,6,13,0,-2,2444,6,13,0,-2,2457,6,13,0,-2,2470,6,13,0,-2,2483,6,13,0,-2,2496,6,13,0,-2,2509,6,13,0,-2,2522,6,13,0,-2,2535,6,13,0,-2,2548,6,13,0,-2,2561,6,13,0,-2,2574,6,13,0,-2,2587,6,13,0,-2,2600,6,13,0,-2,2613,6,13,0,-2,2626,6,13,0,-2,2639,6,13,0,-2,2652,6,13,0,-2,2665,6,13,0,-2,2678,6,13,0,-2,2691,6,13,0,-2,2704,6,13,0,-2,2717,6,13,0,-2,2730,6,13,0,-2,2743,6,13,0,-2,2756,6,13,0,-2,2769,6,13,0,-2,2782,6,13,0,-2,2795,6,13,0,-2,2808,6,13,0,-2,2821,6,13,0,-2,2834,6,13,0,-2,2847,6,13,0,-2,2860,6,13,0,-2,2873,6,13,0,-2,2886,6,13,0,-2,};
static rfbFontData default6x13Font={default6x13FontData, default6x13FontMetaData};
///////
static int in_login = 0, in_passwd = 0, tries = 0;
static int char_row = 0, char_col = 0;
static int char_x = 0, char_y = 0, char_w = 8, char_h = 16;
@ -146,6 +377,35 @@ int white_pixel(void) {
}
}
int black_pixel(void) {
static unsigned long black_pix = 0, white_pix = 1, set = 0;
RAWFB_RET(0x000000)
if (depth <= 8 && ! set) {
X_LOCK;
black_pix = BlackPixel(dpy, scr);
white_pix = WhitePixel(dpy, scr);
X_UNLOCK;
set = 1;
}
if (depth <= 8) {
return (int) black_pix;
} else if (depth < 24) {
return 0x0000;
} else {
return 0x000000;
}
}
static void unixpw_mark(void) {
if (scaling) {
mark_rect_as_modified(0, 0, scaled_x, scaled_y, 1);
} else {
mark_rect_as_modified(0, 0, dpy_x, dpy_y, 0);
}
}
static int text_x(void) {
return char_x + char_col * char_w;
}
@ -157,6 +417,8 @@ static int text_y(void) {
static rfbScreenInfo fscreen;
static rfbScreenInfoPtr pscreen;
static int f1_help = 0;
void unixpw_screen(int init) {
if (unixpw_cmd) {
; /* OK */
@ -180,7 +442,7 @@ void unixpw_screen(int init) {
mark_rect_as_modified(0, 0, dpy_x, dpy_y, 0);
x = nfix(dpy_x / 2 - strlen(log) * char_w, dpy_x);
y = dpy_y / 4;
y = (int) (dpy_y / 3.5);
if (scaling) {
x = (int) (x * scale_fac_x);
@ -198,6 +460,21 @@ void unixpw_screen(int init) {
pscreen = screen;
}
if (pscreen && pscreen->width >= 640) {
rfbDrawString(pscreen, &default6x13Font, 8, 2+1*13, "F1-Help:", white_pixel());
}
f1_help = 0;
if (unixpw_system_greeter) {
unixpw_system_greeter_active = 0;
if (use_dpy && strstr(use_dpy, "xdmcp")) {
char moo[] = "Press 'Escape' for System Greeter";
set_env("X11VNC_XDM_ONLY", "0");
unixpw_system_greeter_active = 1;
rfbDrawString(pscreen, &default8x16Font, x-90, y-30, moo, white_pixel());
}
}
rfbDrawString(pscreen, &default8x16Font, x, y, log, white_pixel());
char_x = x;
@ -208,11 +485,7 @@ void unixpw_screen(int init) {
set_warrow_cursor();
}
if (scaling) {
mark_rect_as_modified(0, 0, scaled_x, scaled_y, 1);
} else {
mark_rect_as_modified(0, 0, dpy_x, dpy_y, 0);
}
unixpw_mark();
}
@ -531,7 +804,7 @@ int crypt_verify(char *user, char *pass) {
#endif /* UNIXPW_CRYPT */
}
int unixpw_cmd_run(char *user, char *pass, char *cmd, char *line, int *n, int nodisp) {
int unixpw_cmd_run(char *user, char *pass, char *cmd, char *line, int *n) {
int i, len, rc;
char *str;
FILE *out;
@ -1218,11 +1491,7 @@ if (db) fprintf(stderr, "unixpw_verify: '%s' '%s'\n", user, db > 1 ? pass : "***
char_col = strlen(log);
if (scaling) {
mark_rect_as_modified(0, 0, scaled_x, scaled_y, 1);
} else {
mark_rect_as_modified(0, 0, dpy_x, dpy_y, 0);
}
unixpw_mark();
unixpw_last_try_time = time(NULL);
unixpw_keystroke(0, 0, 2);
@ -1246,6 +1515,11 @@ void unixpw_keystroke(rfbBool down, rfbKeySym keysym, int init) {
static int echo = 1;
char keystr[100];
char *str;
static int skip_it = 0;
if (skip_it) {
return;
}
if (first) {
set_db();
@ -1328,6 +1602,68 @@ void unixpw_keystroke(rfbBool down, rfbKeySym keysym, int init) {
} else if (! down) {
return;
}
if (keysym == XK_F1 && pscreen && pscreen->width >= 640) {
char h1[] = "F1-Help: For 'login:' type in the username and press Enter, then for 'Password:' type in the password.";
char h2[] = " Specify options after a ':' like this: username:opt,opt=val,... Where an opt may be any of:";
char h3[] = " scale=... (n/m); scale_cursor=... (sc=); solid (so); id=; repeat; clear_mods (cm); clear_keys (ck);";
char h4[] = " clear_all (ca); speeds=... (sp=); readtimeout=... (rd=) rotate=... (ro=); noncache (nc) (nc=n);";
char h5[] = " geom=WxHxD (ge=); nodisplay=... (nd=); viewonly (vo); gnome kde twm fvwm mwm dtwm wmaker xfce";
char h6[] = " enlightenment Xsession failsafe. Examples: fred:3/4,so,cm wilma:geom=1024x768x16,kde";
int ch = 13, p;
if (f1_help) {
p = black_pixel();
f1_help = 0;
} else {
p = white_pixel();
f1_help = 1;
unixpw_last_try_time = time(NULL) + 45;
}
rfbDrawString(pscreen, &default6x13Font, 8, 2+1*ch, h1, p);
rfbDrawString(pscreen, &default6x13Font, 8, 2+2*ch, h2, p);
rfbDrawString(pscreen, &default6x13Font, 8, 2+3*ch, h3, p);
rfbDrawString(pscreen, &default6x13Font, 8, 2+4*ch, h4, p);
rfbDrawString(pscreen, &default6x13Font, 8, 2+5*ch, h5, p);
rfbDrawString(pscreen, &default6x13Font, 8, 2+6*ch, h6, p);
if (!f1_help) {
rfbDrawString(pscreen, &default6x13Font, 8, 2+1*ch, "F1-Help:", white_pixel());
}
unixpw_mark();
return;
}
if (unixpw_system_greeter_active && keysym == XK_Escape) {
char *u = get_user_name();
if (keep_unixpw) {
char *colon = strchr(user, ':');
keep_unixpw_user = strdup(u);
keep_unixpw_pass = strdup("");
if (colon) {
keep_unixpw_opts = strdup(colon+1);
} else {
keep_unixpw_opts = strdup("");
}
}
unixpw_system_greeter_active = 2;
set_env("X11VNC_XDM_ONLY", "1");
rfbLog("unixpw_system_greeter: VNC client pressed 'Escape'. Allowing\n");
rfbLog("unixpw_system_greeter: a *FREE* (no password) connection to\n");
rfbLog("unixpw_system_greeter: the system XDM/GDM/KDM login greeter.\n");
if (1) {
char msg[] = " Please wait... ";
rfbDrawString(pscreen, &default8x16Font,
text_x(), text_y(), msg, white_pixel());
unixpw_mark();
skip_it = 1;
rfbPE(-1);
rfbPE(-1);
rfbPE(-1);
skip_it = 0;
usleep(10*1000);
}
unixpw_accept(u);
free(u);
return;
}
if (in_login && keysym == XK_Escape && u_cnt == 0) {
echo = 0;
rfbLog("unixpw_keystroke: echo off.\n");
@ -1389,13 +1725,7 @@ void unixpw_keystroke(rfbBool down, rfbKeySym keysym, int init) {
white_pixel());
char_col = strlen(pw);
if (scaling) {
mark_rect_as_modified(0, 0, scaled_x,
scaled_y, 1);
} else {
mark_rect_as_modified(0, 0, dpy_x, dpy_y, 0);
}
unixpw_mark();
return;
}
@ -1428,7 +1758,6 @@ void unixpw_keystroke(rfbBool down, rfbKeySym keysym, int init) {
char_col++;
usleep(10*1000);
}
return;
}
@ -1493,6 +1822,19 @@ if (db && db <= 2) fprintf(stderr, "u_cnt: %d %d/%d ks: 0x%x '%s'\n", u_cnt, x,
return;
}
if (1) {
char msg[] = " Please wait... ";
rfbDrawString(pscreen, &default8x16Font,
text_x(), text_y(), msg, white_pixel());
unixpw_mark();
skip_it = 1;
rfbPE(-1);
rfbPE(-1);
rfbPE(-1);
skip_it = 0;
usleep(10*1000);
}
in_login = 0;
in_passwd = 0;
@ -1630,7 +1972,9 @@ static void apply_opts (char *user) {
void unixpw_accept(char *user) {
apply_opts(user);
ssl_helper_pid(0, -2); /* waitall */
if (!use_stunnel) {
ssl_helper_pid(0, -2); /* waitall */
}
if (accept_cmd && strstr(accept_cmd, "popup") == accept_cmd) {
if (use_dpy && strstr(use_dpy, "WAIT:") == use_dpy &&
@ -1711,13 +2055,10 @@ void unixpw_deny(void) {
y = char_y + char_row * char_h;
rfbDrawString(pscreen, &default8x16Font, x, y, pd, white_pixel());
if (scaling) {
mark_rect_as_modified(0, 0, scaled_x, scaled_y, 1);
} else {
mark_rect_as_modified(0, 0, dpy_x, dpy_y, 0);
}
unixpw_mark();
for (i=0; i<5; i++) {
rfbPE(-1);
rfbPE(-1);
usleep(500 * 1000);
}
@ -1750,13 +2091,10 @@ void unixpw_msg(char *msg, int delay) {
y = char_y + char_row * char_h;
rfbDrawString(pscreen, &default8x16Font, x, y, msg, white_pixel());
if (scaling) {
mark_rect_as_modified(0, 0, scaled_x, scaled_y, 1);
} else {
mark_rect_as_modified(0, 0, dpy_x, dpy_y, 0);
}
unixpw_mark();
for (i=0; i<5; i++) {
rfbPE(-1);
rfbPE(-1);
usleep(500 * 1000);
if (i >= delay) {

@ -42,7 +42,7 @@ extern void unixpw_accept(char *user);
extern void unixpw_deny(void);
extern void unixpw_msg(char *msg, int delay);
extern int su_verify(char *user, char *pass, char *cmd, char *rbuf, int *rbuf_size, int nodisp);
extern int unixpw_cmd_run(char *user, char *pass, char *cmd, char *line, int *n, int nodisp);
extern int unixpw_cmd_run(char *user, char *pass, char *cmd, char *line, int *n);
extern int crypt_verify(char *user, char *pass);
extern int cmd_verify(char *user, char *pass);
extern int unixpw_verify(char *user, char *pass);

@ -1291,13 +1291,13 @@ void user_supplied_opts(char *opts) {
if (scale_str) free(scale_str);
scale_str = strdup(p);
} else if (ok) {
if (strstr(p, "display=") == p) {
if (0 && strstr(p, "display=") == p) {
if (use_dpy) free(use_dpy);
use_dpy = strdup(p + strlen("display="));
} else if (strstr(p, "auth=") == p) {
} else if (0 && strstr(p, "auth=") == p) {
if (auth_file) free(auth_file);
auth_file = strdup(p + strlen("auth="));
} else if (!strcmp(p, "shared")) {
} else if (0 && !strcmp(p, "shared")) {
shared = 1;
} else if (strstr(p, "scale=") == p) {
if (scale_str) free(scale_str);
@ -1443,8 +1443,16 @@ static void setup_fake_fb(XImage* fb_image, int w, int h, int b) {
off_y = 0;
}
void do_announce_http(void);
void do_mention_java_urls(void);
static void setup_service(void) {
if (remote_direct) {
return;
}
if (!inetd) {
do_mention_java_urls();
do_announce_http();
if (!use_openssl) {
announce(screen->port, use_openssl, NULL);
fprintf(stdout, "PORT=%d\n", screen->port);
@ -1564,9 +1572,12 @@ static void loop_for_connect(int did_client_connect) {
goto screen_check;
}
}
if (use_openssl && !inetd) {
check_openssl();
check_https();
if ((use_openssl || use_stunnel) && !inetd) {
int enc_none = (enc_str && !strcmp(enc_str, "none"));
if (!use_stunnel || enc_none) {
check_openssl();
check_https();
}
/*
* This is to handle an initial verify cert from viewer,
* they disconnect right after fetching the cert.
@ -1655,6 +1666,15 @@ static void do_unixpw_loop(void) {
unixpw_in_rfbPE = 0;
}
if (unixpw_in_progress) {
static double lping = 0.0;
if (lping < dnow() + 5) {
mark_rect_as_modified(0, 0, 1, 1, 1);
lping = dnow();
}
if (time(NULL) > unixpw_last_try_time + 45) {
rfbLog("unixpw_deny: timed out waiting for reply.\n");
unixpw_deny();
}
usleep(20 * 1000);
continue;
}
@ -2000,7 +2020,7 @@ static char *build_create_cmd(char *cmd, int *saw_xdmcp, char *usslpeer, char *t
p++;
}
if (ok && strlen(q) < 32) {
sprintf(fdgeom, q);
sprintf(fdgeom, "%s", q);
if (!quiet) {
rfbLog("set create display geom: %s\n", fdgeom);
}
@ -2203,6 +2223,12 @@ static void check_nodisplay(char **nd) {
}
}
}
if (unixpw_system_greeter_active == 2) {
if (!keep_unixpw_user) {
clean_up_exit(1);
}
*nd = strdup("all");
}
}
static char *get_usslpeer() {
@ -2242,6 +2268,10 @@ static char *get_usslpeer() {
}
static void do_try_switch(char *usslpeer, char *users_list_save) {
if (unixpw_system_greeter_active == 2) {
rfbLog("unixpw_system_greeter: not trying switch to user '%s'\n", usslpeer ? usslpeer : "");
return;
}
if (usslpeer) {
char *u = (char *) malloc(strlen(usslpeer+2));
sprintf(u, "+%s", usslpeer);
@ -2365,11 +2395,14 @@ static int do_run_cmd(char *cmd, char *create_cmd, char *users_list_save, int cr
memset(line, 0, 18000);
if (keep_unixpw_user && keep_unixpw_pass) {
if (unixpw_system_greeter_active == 2) {
rfbLog("unixpw_system_greeter: forcing find display failure.\n");
res = 0;
} else if (keep_unixpw_user && keep_unixpw_pass) {
n = 18000;
if (unixpw_cmd != NULL) {
res = unixpw_cmd_run(keep_unixpw_user,
keep_unixpw_pass, cmd, line, &n, nodisp);
keep_unixpw_pass, cmd, line, &n);
} else {
res = su_verify(keep_unixpw_user,
keep_unixpw_pass, cmd, line, &n, nodisp);
@ -2378,7 +2411,7 @@ static int do_run_cmd(char *cmd, char *create_cmd, char *users_list_save, int cr
if (db) {fprintf(stderr, "line: "); write(2, line, n); write(2, "\n", 1); fprintf(stderr, "res=%d n=%d\n", res, n);}
if (! res) {
rfbLog("wait_for_client: find display cmd failed\n");
rfbLog("wait_for_client: find display cmd failed.\n");
}
if (! res && create_cmd) {
@ -2398,8 +2431,8 @@ if (db) {fprintf(stderr, "line: "); write(2, line, n); write(2, "\n", 1); fprint
n = 18000;
close_exec_fds();
res = unixpw_cmd_run(keep_unixpw_user,
keep_unixpw_pass, create_cmd, line, &n, nodisp);
} else if (getuid() != 0) {
keep_unixpw_pass, create_cmd, line, &n);
} else if (getuid() != 0 && unixpw_system_greeter_active != 2) {
/* if not root, run as the other user... */
n = 18000;
close_exec_fds();
@ -2410,6 +2443,10 @@ if (db) fprintf(stderr, "c-res=%d n=%d line: '%s'\n", res, n, line);
} else {
FILE *p;
close_exec_fds();
if (unixpw_system_greeter_active == 2) {
rfbLog("unixpw_system_greeter: not trying su_verify() to run\n");
rfbLog("unixpw_system_greeter: create display command.\n");
}
rfbLog("wait_for_client: running: %s\n", create_cmd);
p = popen(create_cmd, "r");
if (! p) {
@ -2432,7 +2469,7 @@ if (db) fprintf(stderr, "line1: '%s'\n", line1);
}
}
}
if (res && saw_xdmcp) {
if (res && saw_xdmcp && unixpw_system_greeter_active != 2) {
xdmcp_insert = strdup(keep_unixpw_user);
}
}
@ -2533,7 +2570,7 @@ if (db) fprintf(stderr, "\n");
rc = pclose(p);
if (rc != 0) {
rfbLog("wait_for_client: find display cmd failed\n");
rfbLog("wait_for_client: find display cmd failed.\n");
}
if (create_cmd && rc != 0) {
@ -2844,6 +2881,18 @@ int wait_for_client(int *argc, char** argv, int http) {
initialize_screen(argc, argv, fb_image);
if (! inetd && ! use_openssl) {
if (! screen->port || screen->listenSock < 0) {
if (got_rfbport && got_rfbport_val == 0) {
;
} else {
rfbLogEnable(1);
rfbLog("Error: could not obtain listening port.\n");
clean_up_exit(1);
}
}
}
initialize_signals();
if (ssh_str != NULL) {

@ -75,7 +75,7 @@ double dnowx(void);
double rnow(void);
double rfac(void);
void rfbPE(long usec);
int rfbPE(long usec);
void rfbCFD(long usec);
double rect_overlap(int x1, int y1, int x2, int y2, int X1, int Y1,
@ -173,6 +173,26 @@ void strzero(char *str) {
}
}
int is_decimal(char *str) {
char *p = str;
if (p != NULL) {
int first = 1;
while (*p != '\0') {
if (first && *p == '-') {
;
} else if (isdigit((int) *p)) {
;
} else {
return 0;
}
first = 0;
p++;
}
return 1;
}
return 0;
}
int scan_hexdec(char *str, unsigned long *num) {
if (sscanf(str, "0x%lx", num) != 1) {
if (sscanf(str, "%lu", num) != 1) {
@ -450,26 +470,34 @@ double rfac(void) {
void check_allinput_rate(void) {
static double last_all_input_check = 0.0;
static int set = 0;
static int set = 0, verb = -1;
if (use_threads) {
return;
}
if (verb < 0) {
verb = 0;
if (getenv("RATE_VERB")) verb = 1;
}
if (! set) {
set = 1;
last_all_input_check = dnow();
} else {
int dt = 4;
int dt = 5;
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) {
if (verb) fprintf(stderr, "nqueued: %d\n", nq);
if (getenv("CHECK_RATE") && nq > 18 * 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;
if (verb) rfbLog("check_allinput_rate:\n");
if (verb) rfbLog("Client is sending %.1f extra requests per second for the\n", rate);
if (verb) rfbLog("past %d seconds! (queued: %d)\n", dt, nq);
if (strstr(getenv("CHECK_RATE"), "allinput") && !all_input) {
rfbLog("Switching to -allpinput mode.\n");
all_input = 1;
}
}
set = 0;
}
@ -478,8 +506,8 @@ void check_allinput_rate(void) {
static void do_allinput(long usec) {
static double last = 0.0;
static int meas = 0;
int n, f = 1, cnt = 0;
static int meas = 0, verb = -1;
int n, f = 1, cnt = 0, m = 0;
long usec0;
double now;
if (!screen || !screen->clientHead) {
@ -495,21 +523,26 @@ static void do_allinput(long usec) {
if (last == 0.0) {
last = dnow();
}
if (verb < 0) {
verb = 0;
if (getenv("RATE_VERB")) verb = 1;
}
while ((n = rfbCheckFds(screen, usec)) > 0) {
if (f) {
fprintf(stderr, " *");
if (verb) fprintf(stderr, " *");
f = 0;
}
if (cnt++ > 30) {
break;
}
meas += n;
m += n;
}
fprintf(stderr, "-%d", cnt);
if (verb) fprintf(stderr, "+%d/%d", cnt, m);
now = dnow();
if (now > last + 2.0) {
double rate = meas / (now - last);
fprintf(stderr, "\n%.2f ", rate);
if (verb) fprintf(stderr, "\n allinput rate: %.2f ", rate);
meas = 0;
last = dnow();
}
@ -520,15 +553,16 @@ static void do_allinput(long usec) {
* checks that we are not in threaded mode.
*/
#define USEC_MAX 999999 /* libvncsever assumes < 1 second */
void rfbPE(long usec) {
int rfbPE(long usec) {
int uip0 = unixpw_in_progress;
static int check_rate = -1;
int res = 0;
if (! screen) {
return;
return res;
}
if (unixpw && unixpw_in_progress && !unixpw_in_rfbPE) {
rfbLog("unixpw_in_rfbPE: skipping rfbPE\n");
return;
return res;
}
if (debug_tiles > 2) {
@ -541,7 +575,11 @@ void rfbPE(long usec) {
usec = USEC_MAX;
}
if (! use_threads) {
rfbProcessEvents(screen, usec);
rfbBool r;
r = rfbProcessEvents(screen, usec);
if (r) {
res = 1;
}
}
if (unixpw && unixpw_in_progress && !uip0) {
@ -566,6 +604,7 @@ void rfbPE(long usec) {
if (all_input) {
do_allinput(usec);
}
return res;
}
void rfbCFD(long usec) {

@ -63,7 +63,7 @@ extern double dnowx(void);
extern double rnow(void);
extern double rfac(void);
extern void rfbPE(long usec);
extern int rfbPE(long usec);
extern void rfbCFD(long usec);
extern double rect_overlap(int x1, int y1, int x2, int y2, int X1, int Y1,
int X2, int Y2);

@ -1,8 +1,8 @@
.\" This file was automatically generated from x11vnc -help output.
.TH X11VNC "1" "August 2009" "x11vnc " "User Commands"
.TH X11VNC "1" "October 2009" "x11vnc " "User Commands"
.SH NAME
x11vnc - allow VNC connections to real X11 displays
version: 0.9.9, lastmod: 2009-08-10
version: 0.9.9, lastmod: 2009-10-07
.SH SYNOPSIS
.B x11vnc
[OPTION]...
@ -884,7 +884,7 @@ A familiar "login:" and "Password:" dialog is
presented to the user on a black screen inside the
vncviewer. The connection is dropped if the user fails
to supply the correct password in 3 tries or does not
send one before a 25 second timeout. Existing clients
send one before a 45 second timeout. Existing clients
are view-only during this period.
.IP
If the first character received is "Escape" then the
@ -1192,6 +1192,10 @@ 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.
.IP
Remember to enable XDMCP in the xdm-config, gdm.conf,
or kdmrc configuration file. See \fB-display\fR WAIT: for
more info.
.PP
\fB-sshxdmsvc\fR
.IP
@ -1206,6 +1210,50 @@ 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.
.IP
Remember to enable XDMCP in the xdm-config, gdm.conf,
or kdmrc configuration file. See \fB-display\fR WAIT: for
more info.
.PP
\fB-unixpw_system_greeter\fR
.IP
Present a "Press 'Escape' for System Greeter" option
to the connecting VNC client in combined \fB-unixpw\fR
and xdmcp FINDCREATEDISPLAY modes (e.g. \fB-xdmsvc).\fR
.IP
Normally in a \fB-unixpw\fR mode the VNC client must
supply a valid username and password to gain access.
However, if \fB-unixpw_system_greeter\fR is supplied AND
the FINDCREATEDISPLAY command matches 'xdmcp', then
the user has the option to press Escape and then get a
XDM/GDM/KDM login/greeter panel instead. They will then
supply a username and password directly to the greeter.
.IP
Otherwise, in xdmcp FINDCREATEDISPLAY mode the user
must supply his username and password TWICE. First to
the initial unixpw login dialog, and second to the
subsequent XDM/GDM/KDM greeter. Note that if the user
re-connects and supplies his username and password in
the unixpw dialog the xdmcp greeter is skipped and
he is connected directly to his existing X session.
So the \fB-unixpw_system_greeter\fR option avoids the extra
password at X session creation time.
.IP
Example: x11vnc \fB-xdmsvc\fR \fB-unixpw_system_greeter\fR
See \fB-unixpw\fR and \fB-display\fR WAIT:... for more info.
.IP
The special options after a colon at the end of the
username (e.g. user:solid) described under \fB-display\fR
WAIT: are also applied in this mode if they are typed
in before the user hits Escape. The username is ignored
but the colon options are not.
.IP
If the user pressed Escape the FINDCREATEDISPLAY command
will be run with the env. var. X11VNC_XDM_ONLY=1.
.IP
Remember to enable XDMCP in the xdm-config, gdm.conf,
or kdmrc configuration file. See \fB-display\fR WAIT: for
more info.
.PP
\fB-redirect\fR \fIport\fR
.IP
@ -1285,12 +1333,13 @@ helper program supports RFB_UNIXPW_CMD_RUN (see the
Also in the case of \fB-unixpw,\fR the user logging in can
place a colon at the end of her username and supply
a few options: scale=, scale_cursor= (or sc=), solid
(or so), id=, clear_mods (or cm), clear_keys (or ck),
repeat, speeds= (or sp=), readtimeout= (or rd=),
rotate= (or ro=), or noncache (or nc), all separated by
commas if there is more than one. After the user logs
in successfully, these options will be applied to the
VNC screen. For example,
(or so), id=, clear_mods (or cm), clear_keys (or
ck), clear_all (or ca), repeat, speeds= (or sp=),
readtimeout= (or rd=), viewonly (or vo), nodisplay=
(or nd=), rotate= (or ro=), or noncache (or nc),
all separated by commas if there is more than one.
After the user logs in successfully, these options will
be applied to the VNC screen. For example,
.IP
login: fred:scale=3/4,sc=1,repeat
Password: ...
@ -1302,6 +1351,9 @@ type and enter your password incorrectly, to retrieve
your long "login:" line press the Up arrow once
(before typing anything else).
.IP
In the login panel, press F1 to get a list of the
available options that you can add after the username.
.IP
Another option is "geom=WxH" or "geom=WxHxD" (or
ge=). This only has an effect in FINDCREATEDISPLAY
mode when a virtual X server such as Xvfb is going
@ -1381,7 +1433,9 @@ comma separated list of displays (e.g. ":0,:1") to
ignore in the finding process. The ":" is optional.
Ranges n-m e.g. 0-20 can also be supplied. This string
can also be set by the connecting user via "nd="
using "+" instead of ","
using "+" instead of "," If "nd=all" or you set
X11VNC_SKIP_DISPLAY=all then all display finding fails
as if you set X11VNC_FINDDISPLAY_ALWAYS_FAILS=1 (below.)
.IP
Automatic Creation of User X Sessions:
.IP
@ -1441,6 +1495,8 @@ See the \fB-svc/-service\fR option alias above.
If for some reason you do not want x11vnc to ever
try to find an existing display set the env. var
X11VNC_FINDDISPLAY_ALWAYS_FAILS=1 (also \fB-env\fR ...)
This is the same as setting X11VNC_SKIP_DISPLAY=all or
supplying "nd=all" after "username:"
.IP
Use WAIT:cmd=FINDCREATEDISPLAY-print to print out the
script that is used for this.
@ -1474,12 +1530,15 @@ to pass to the X server. You can also set FD_PROG to
be the full path to the session/windowmanager program.
.IP
More FD tricks: FD_CUPS=port or FD_CUPS=host:port
will set the cups printing environment. Similarly
for FD_ESD=port or FD_ESD=host:port for esddsp sound
redirection. FD_XDUMMY_NOROOT means the Xdummy server
does not need to be started as root (e.g. it will sudo
automatically). Set FD_EXTRA to a command to be run
a few seconds after the X server starts up.
will set the cups printing environment. Similarly for
FD_ESD=port or FD_ESD=host:port for esddsp sound
redirection. FD_XDUMMY_NOROOT means the Xdummy
server does not need to be started as root (e.g. it
will sudo automatically). Set FD_EXTRA to a command
to be run a few seconds after the X server starts up.
Set FD_TAG to be a unique name for the session, it is
set as an X property, that makes FINDDISPLAY only find
sessions with that tag value.
.IP
If you want the FINDCREATEDISPLAY session to contact an
XDMCP login manager (xdm/gdm/kdm) on the same machine,
@ -1561,8 +1620,9 @@ username+passwd method is enabled for Unix logins.
Otherwise in \fB-unixpw\fR mode the normal login panel is
provided.
.IP
You *MUST* supply the \fB-ssl\fR option for VeNCrypt to be
active. This option only fine-tunes its operation.
You *MUST* supply the \fB-ssl\fR option for VeNCrypt to
be active. The \fB-vencrypt\fR option only fine-tunes its
operation.
.PP
\fB-anontls\fR \fImode\fR
.IP
@ -1599,8 +1659,9 @@ description of "plain:" under \fB-vencrypt.\fR
.IP
Long example: \fB-anontls\fR newdh:plain:support
.IP
You *MUST* supply the \fB-ssl\fR option for ANONTLS to be
active. This option only fine-tunes its operation.
You *MUST* supply the \fB-ssl\fR option for ANONTLS to
be active. The \fB-anontls\fR option only fine-tunes its
operation.
.PP
\fB-sslonly\fR
.IP
@ -1631,16 +1692,17 @@ to unset any *earlier* \fB-ssl\fR option (or \fB-svc...)\fR
.IP
Use the openssl library (www.openssl.org) to provide a
built-in encrypted SSL/TLS tunnel between VNC viewers
and x11vnc. This requires libssl support to be compiled
into x11vnc at build time. If x11vnc is not built
with libssl support it will exit immediately when \fB-ssl\fR
is prescribed.
and x11vnc. This requires libssl support to be
compiled into x11vnc at build time. If x11vnc is not
built with libssl support it will exit immediately when
\fB-ssl\fR is prescribed. See the \fB-stunnel\fR option below for
an alternative.
.IP
The VNC Viewer-side needs to support SSL/TLS as well.
See this URL and also the discussion below for
ideas on how to enable SSL support for the viewer:
http://www.karlrunge.com/x11vnc/faq.html#faq-ssl-tun
nel-viewers x11vnc provides an SSL enabled Java
nel-viewers . x11vnc provides an SSL enabled Java
viewer applet in the classes/ssl directory (-http or
\fB-httpdir\fR options.) The SSVNC viewer package supports
SSL tunnels too.
@ -1738,6 +1800,11 @@ a SSL PEM you created or the default "SAVE" method.
See \fB-ssldir\fR below to use a directory besides the
default ~/.vnc/certs
.IP
If your x11vnc binary was not compiled with OpenSSL
library support, use of the \fB-ssl\fR option will induce an
immediate failure and exit. For such binaries, consider
using the \fB-stunnel\fR option for SSL encrypted connections.
.IP
Misc Info: In temporary cert creation mode "TMP", set
the env. var. X11VNC_SHOW_TMP_PEM=1 to have x11vnc print
out the entire certificate, including the PRIVATE KEY
@ -1847,7 +1914,7 @@ See the \fB-sslGenCA\fR and \fB-sslGenCert\fR options below for
how to set up and manage the CA framework.
.IP
NOTE: the following utilities, \fB-sslGenCA,\fR \fB-sslGenCert,\fR
\fB-sslEncKey,\fR and \fB-sslCertInfo\fR are provided for
\fB-sslEncKey,\fR \fB-sslCertInfo,\fR and \fB-sslCRL\fR are provided for
completeness, but for casual usage they are overkill.
.IP
They provide VNC Certificate Authority (CA) key creation
@ -1901,8 +1968,9 @@ the ss_vncviewer example script in the FAQ and SSVNC.)
\fB-sslCRL\fR \fIpath\fR
.IP
Set the Certificate Revocation Lists (CRL) to \fIpath\fR.
This setting applies for both \fB-ssl\fR and \fB-stunnel\fR modes.
.IP
If path is a file, the file contains one more more CRLs
If path is a file, the file contains one or more CRLs
in PEM format. If path is a directory, it contains
hash named files of CRLs in the usual OpenSSL manner.
See the OpenSSL and
@ -1916,6 +1984,10 @@ certificate chain used to verify the VNC client.
The \fB-sslCRL\fR setting will be ignored when \fB-sslverify\fR is
not specified.
.IP
Note that if a CRL's expiration date has passed, all
SSL connections will fail regardless of if they are
related to the subject of the CRL or not.
.IP
Only rarely will one's x11vnc \fB-ssl\fR infrastructure be so
large that this option would be useful (since normally
maintaining the contents of the \fB-sslverify\fR file or
@ -2034,11 +2106,13 @@ delete the line.
.IP
Similar to \fB-sslGenCA,\fR you will be prompted to fill
in some information that will be recorded in the
certificate when it is created. Tip: if you know
the fully-qualified hostname other people will be
connecting to you can use that as the CommonName "CN"
to avoid some applications (e.g. web browsers and java
plugin) complaining it does not match the hostname.
certificate when it is created.
.IP
Tip: if you know the fully-qualified hostname other
people will be connecting to, you can use that as the
CommonName "CN" to avoid some applications (e.g. web
browsers and java plugin) complaining that it does not
match the hostname.
.IP
You will also need to supply the CA private key
passphrase to unlock the private key created from
@ -2062,14 +2136,14 @@ e.g. ~/.vnc/certs/clients/<name>.pem contains both
the cert and private key. The <name>.crt contains the
certificate only.
.IP
NOTE: It is very important to know one should always
NOTE: It is very important to know one should
generate new keys with a passphrase. Otherwise if an
untrusted user steals the key file he could use it to
masquerade as the x11vnc server (or VNC viewer client).
You will be prompted whether to encrypt the key with
a passphrase or not. It is recommended that you do.
One inconvenience to a passphrase is that it must
be suppled every time x11vnc or the client app is
be typed in EVERY time x11vnc or the client app is
started up.
.IP
Examples:
@ -2180,16 +2254,30 @@ encrypted SSL tunnel between viewers and x11vnc.
.IP
This external tunnel method was implemented prior to the
integrated \fB-ssl\fR encryption described above. It still
works well. This requires stunnel to be installed
on the system and available via PATH (n.b. stunnel is
often installed in sbin directories). Version 4.x of
stunnel is assumed (but see \fB-stunnel3\fR below.)
works well and avoids the requirement of linking with
the OpenSSL libraries. This mode requires stunnel
to be installed on the system and available via PATH
(n.b. stunnel is often installed in sbin directories).
Version 4.x of stunnel is assumed (but see \fB-stunnel3\fR
below.)
.IP
[pem] is optional, use "\fB-stunnel\fR \fI/path/to/stunnel.pem\fR"
to specify a PEM certificate file to pass to stunnel.
Whether one is needed or not depends on your stunnel
configuration. stunnel often generates one at install
time. See the stunnel documentation for details.
See the \fB-ssl\fR option for more info on certificate files.
.IP
Whether or not your stunnel has its own certificate
depends on your stunnel configuration; stunnel often
generates one at install time. See your stunnel
documentation for details. In any event, if you want to
use this certificate you must supply the full path to it
as [pem]. Note: the file may only be readable by root.
.IP
[pem] may also be the special strings "TMP", "SAVE",
and "SAVE..." as described in the \fB-ssl\fR option.
If [pem] is not supplied, "SAVE" is assumed.
.IP
Note that the VeNCrypt, ANONTLS, and "ANON" modes
are not supported in \fB-stunnel\fR mode.
.IP
stunnel is started up as a child process of x11vnc and
any SSL connections stunnel receives are decrypted and
@ -2197,22 +2285,37 @@ sent to x11vnc over a local socket. The strings
"The SSL VNC desktop is ..." and "SSLPORT=..."
are printed out at startup to indicate this.
.IP
The \fB-localhost\fR option is enforced by default
to avoid people routing around the SSL channel.
Set STUNNEL_DISABLE_LOCALHOST=1 before starting x11vnc
to disable the requirement.
The \fB-localhost\fR option is enforced by default to avoid
people routing around the SSL channel. Use \fB-env\fR
STUNNEL_DISABLE_LOCALHOST=1 to disable this security
requirement.
.IP
Set \fB-env\fR STUNNEL_DEBUG=1 for more debugging printout.
.IP
Your VNC viewer will also need to be able to connect via
SSL. Unfortunately not too many do this. UltraVNC has
an encryption plugin but it does not seem to be SSL.
Your VNC viewer will also need to be able to connect
via SSL. Unfortunately not too many do this. See the
information about SSL viewers under the \fB-ssl\fR option.
.IP
Also, in the x11vnc distribution, a patched TightVNC
Java applet is provided in classes/ssl that does SSL
connections (only).
Also, in the x11vnc distribution, patched TightVNC
and UltraVNC Java applet jar files are provided in
the classes/ssl directory that do SSL connections.
Enable serving them with the \fB-http,\fR \fB-http_ssl,\fR \fB-https,\fR
or \fB-httpdir\fR (see the option descriptions for more info.)
.IP
It is also not too difficult to set up an stunnel or
other SSL tunnel on the viewer side. A simple example
on Unix using stunnel 3.x is:
Note that for the Java viewer applet usage the
"?PORT=xxxx" in the various URLs printed at startup
will need to be supplied to the web browser to connect
properly.
.IP
Currently the automatic "single port" HTTPS mode of
\fB-ssl\fR is not fully supported in \fB-stunnel\fR mode. However,
it can be emulated via:
.IP
% x11vnc \fB-stunnel\fR \fB-http_ssl\fR \fB-http_oneport\fR ...
.IP
In general, it is also not too difficult to set up
an stunnel or other SSL tunnel on the viewer side.
A simple example on Unix using stunnel 3.x is:
.IP
% stunnel \fB-c\fR \fB-d\fR localhost:5901 \fB-r\fR remotehost:5900
% vncviewer localhost:1
@ -2224,7 +2327,8 @@ and SSVNC for more examples.
\fB-stunnel3\fR \fI[pem]\fR
.IP
Use version 3.x stunnel command line syntax instead of
version 4.x
version 4.x. The \fB-http/-httpdir\fR Java applet serving
is currently not available in this mode.
.PP
\fB-enc\fR \fIcipher:keyfile\fR
.IP
@ -2245,7 +2349,7 @@ that you do not have control over.
Note that this mode will NOT work with the UltraVNC DSM
plugins because they alter the RFB protocol in addition
to tunnelling with the symmetric cipher (an unfortunate
choice of implementation).
choice of implementation...)
.IP
cipher can be one of: arc4, aesv2, aes-cfb, blowfish,
aes256, or 3des. See the OpenSSL documentation for
@ -2321,9 +2425,9 @@ salt,ivec sizes (in GUI or, e.g. arc4@8,16).
.PP
\fB-https\fR \fI[port]\fR
.IP
Use a special, separate HTTPS port (-ssl mode only)
for HTTPS Java viewer applet downloading. I.e. not 5900
and not 5800 (the defaults.)
Use a special, separate HTTPS port (-ssl and
\fB-stunnel\fR modes only) for HTTPS Java viewer applet
downloading. I.e. not 5900 and not 5800 (the defaults.)
.IP
BACKGROUND: In \fB-ssl\fR mode, it turns out you can use the
single VNC port (e.g. 5900) for both VNC and HTTPS
@ -2343,6 +2447,8 @@ ponder the Certificate dialogs in his browser, Java VM,
or VNC Viewer applet. That's right 3 separate "Are
you sure you want to connect?" dialogs!)
.IP
END OF BACKGROUND.
.IP
USAGE: So use the \fB-https\fR option to provide a separate,
more reliable HTTPS port that x11vnc will listen on. If
[port] is not provided (or is 0), one is autoselected.
@ -2377,10 +2483,12 @@ other ports must be explicitly indicated, for example:
https://mygateway.com:8000/?PORT=8000. To avoid having
to include the PORT= in the browser URL, simply supply
"\fB-httpsredir\fR" to x11vnc.
.IP
This options does not work in \fB-stunnel\fR mode.
.PP
\fB-http_oneport\fR
.IP
For un-encrypted connections mode (i.e. no \fB-ssl,\fR
For UN-encrypted connections mode (i.e. no \fB-ssl,\fR
\fB-stunnel,\fR or \fB-enc\fR options), allow the Java VNC Viewer
applet to be downloaded thru the VNC port via HTTP.
.IP
@ -4041,7 +4149,7 @@ times for more output.
.PP
\fB-defer\fR \fItime\fR
.IP
Time in ms to wait for updates before sending to client
Time in ms to delay sending updates to connected clients
(deferUpdateTime) Default: 20
.PP
\fB-wait\fR \fItime\fR
@ -4049,6 +4157,17 @@ Time in ms to wait for updates before sending to client
Time in ms to pause between screen polls. Used to cut
down on load. Default: 20
.PP
\fB-extra_fbur\fR \fIn\fR
.IP
Perform extra FrameBufferUpdateRequests checks to
try to be in better sync with the client's requests.
What this does is perform extra polls of the client
socket at critical times (before '-defer' and '-wait'
calls.) The default is n=1. Set to a larger number to
insert more checks or set to n=0 to disable. A downside
of these extra calls is that more mouse input may be
processed than desired.
.PP
\fB-wait_ui\fR \fIfactor\fR
.IP
Factor by which to cut the \fB-wait\fR time if there
@ -4104,14 +4223,14 @@ Default: take naps
.IP
Time in seconds after NO activity (e.g. screen blank)
to really throttle down the screen polls (i.e. sleep
for about 1.5 secs). Use 0 to disable. Default: 20
for about 1.5 secs). Use 0 to disable. Default: 60
.PP
\fB-readtimeout\fR \fIn\fR
.IP
Set libvncserver rfbMaxClientWait to n seconds. On
slow links that take a long time to paint the first
screen libvncserver may hit the timeout and drop the
connection. Default: 60 seconds.
connection. Default: 20 seconds.
.PP
\fB-ping\fR \fIn\fR
.IP
@ -4987,6 +5106,28 @@ If you do not intend to start x11vnc from the gui
gui process can run on a different machine from the
x11vnc server as long as X permissions, etc. permit
communication between the two.
.IP
FONTS: On some systems the tk fonts can be too small,
jagged, or otherwise unreadable. There are 4 env vars
you can set to be the tk font you prefer:
.IP
X11VNC_FONT_BOLD main font for menus and buttons.
X11VNC_FONT_FIXED font for fixed width text.
.IP
X11VNC_FONT_BOLD_SMALL tray icon font.
X11VNC_FONT_REG_SMALL tray icon menu font.
.IP
The last two only apply for the tray icon mode.
.IP
Here are some examples:
.IP
\fB-env\fR X11VNC_FONT_BOLD='Helvetica \fB-16\fR bold'
\fB-env\fR X11VNC_FONT_FIXED='Courier \fB-14'\fR
\fB-env\fR X11VNC_FONT_REG_SMALL='Helvetica \fB-12'\fR
.IP
You can put the lines like the above (without the
quotes) in your ~/.x11vncrc file to avoid having to
specify them on the x11vnc command line.
.PP
\fB-remote\fR \fIcommand\fR
.IP
@ -5013,6 +5154,18 @@ For example: 'x11vnc \fB-remote\fR stop' (which is the same as
\'x11vnc \fB-R\fR shared' will enable shared connections, and
\'x11vnc \fB-R\fR scale:3/4' will rescale the desktop.
.IP
To run a bunch of commands in a sequence use something
like: x11vnc \fB-R\fR 'script:firstcmd;secondcmd;...'
.IP
Use x11vnc \fB-R\fR script:file=/path/to/file to read commands
from a file (can be multi-line and use the comment '#'
character in the normal way. The ';' separator must
still be used to separate each command.)
.IP
To not try to contact another x11vnc process and instead
just run the command (or query) directly, prefix the
command with the string "DIRECT:"
.IP
.IP
The following \fB-remote/-R\fR commands are supported:
.IP
@ -5020,7 +5173,10 @@ stop terminate the server, same as "quit"
"exit" or "shutdown".
.IP
ping see if the x11vnc server responds.
Return is: ans=ping:<xdisplay>
return is: ans=ping:<display>
.IP
ping:mystring as above, but use your own unique string.
return is: ans=ping:mystring:<xdisplay>
.IP
blacken try to push a black fb update to all
clients (due to timings a client
@ -5174,6 +5330,8 @@ grabalways enable \fB-grabalways\fR mode.
.IP
nograbalways disable \fB-grabalways\fR mode.
.IP
grablocal:n set \fB-grablocal\fR to n.
.IP
client_input:str set the K, M, B \fB-input\fR on a per-client
basis. select which client as for
disconnect, e.g. client_input:host:MB
@ -5322,6 +5480,12 @@ setclipboard disable \fB-nosetclipboard\fR mode.
.IP
seldir:str set \fB-seldir\fR to "str"
.IP
resend_cutbuffer resend the most recent CUTBUFFER0 copy
.IP
resend_clipboard resend the most recent CLIPBOARD copy
.IP
resend_primary resend the most recent PRIMARY copy
.IP
cursor:mode enable \fB-cursor\fR "mode".
.IP
show_cursor enable showing a cursor.
@ -5465,10 +5629,42 @@ debug_keyboard enable \fB-debug_keyboard,\fR same as "dk"
.IP
nodebug_keyboard disable \fB-debug_keyboard,\fR same as "nodk"
.IP
keycode:n inject keystroke 'keycode' (xmodmap \fB-pk)\fR
.IP
keycode:n,down inject 'keycode' (down=0,1)
.IP
keysym:str inject keystroke 'keysym' (number/name)
.IP
keysym:str,down inject 'keysym' (down=0,1)
.IP
ptr:x,y,mask inject pointer event x, y, button-mask
.IP
sleep:t sleep floating point time t.
.IP
get_xprop:p get X property named 'p'.
.IP
set_xprop:p:val set X property named 'p' to 'val'.
p -> id=NNN:p for hex/dec window id.
.IP
wininfo:id get info about X window id. use 'root'
for root window, use +id for children.
.IP
grab_state get state of pointer and keyboard grab.
.IP
pointer_pos print XQueryPointer x,y cursor position.
.IP
mouse_x print x11vnc's idea of cursor position.
.IP
mouse_y print x11vnc's idea of cursor position.
.IP
noop do nothing.
.IP
defer:n set \fB-defer\fR to n ms,same as deferupdate:n
.IP
wait:n set \fB-wait\fR to n ms.
.IP
extra_fbur:n set \fB-extra_fbur\fR to n.
.IP
wait_ui:f set \fB-wait_ui\fR factor to f.
.IP
setdefer:n set \fB-setdefer\fR to \fB-2,-1,0,1,\fR or 2.
@ -5545,6 +5741,8 @@ rawfb:str set \fB-rawfb\fR mode to "str".
.IP
uinput_accel:f set uinput_accel to f.
.IP
uinput_thresh:n set uinput_thresh to n.
.IP
uinput_reset:n set uinput_reset to n ms.
.IP
uinput_always:n set uinput_always to 1/0.
@ -5578,7 +5776,11 @@ maciconanim:n set \fB-maciconanim\fR to n.
.IP
macmenu enable \fB-macmenu\fR mode.
.IP
macnomenu disable \fB-macnmenu\fR mode.
macnomenu disable \fB-macmenu\fR mode.
.IP
macuskbd enable \fB-macuskbd\fR mode.
.IP
macnouskbd disable \fB-macuskbd\fR mode.
.IP
httpport:n set \fB-httpport\fR to n.
.IP
@ -5644,33 +5846,116 @@ noremote disable the \fB-remote\fR command processing,
it cannot be turned back on.
.IP
.IP
bcx_xattach:str This remote control command is for
use with the BARCO xattach program or the x2x program.
Both of these programs are for 'pointer and keyboard'
sharing between separate X displays. In general the
two displays are usually nearby, e.g. on the same desk,
and this allows the user to share a single pointer and
keyboard between them. The user moves the mouse to
an edge and then the mouse pointer appears to 'jump'
to the other display screen. Thus it emulates what a
single X server would do for two screens (e.g. :0.0 and
:0.1) The illusion of a single Xserver with multiple
screens is achieved by forwarding events to the 2nd
one via the XTEST extension.
.IP
What the x11vnc bcx_xattach command does is to perform
some pointer movements to try to INDUCE xattach/x2x
to 'jump' to the other display. In what follows the
\'master' display refers to the one that when it has
\'focus' it is basically doing nothing besides watching
for the mouse to go over an edge. The 'slave'
display refers to the one to which the mouse and
keyboard is redirected to once an edge in the master
has been crossed. Note that the x11vnc executing the
bcx_xattach command MUST be the one connected to the
*master* display.
.IP
Also note that when input is being redirected (via
XTEST) from the master display to the slave display,
the master display's pointer and keyboard are *grabbed*
by xattach/x2x. x11vnc can use this info to verify that
the master/slave mode change has taken place correctly.
If you specify the "ifneeded" option (see below)
and the initial grab state is that of the desired
final state, then no pointer movements are injected
and "DONE,GRAB_OK" is returned.
.IP
"str" must contain one of "up", "down", "left",
or "right" to indicate the direction of the 'jump'.
"str" must also contain one of "master_to_slave"
or "slave_to_master" to indicate the type of mode
change induced by the jump. Use "M2S" and "S2M"
as shorter aliases.
.IP
"str" may be a "+" separated list of additional
tuning options. The "shift=n" option indicates an
offset shift position away from (0,0) (default 20).
"final=x+y" specifies the final position of the cursor
at the end of the normal move sequence; default 30+30.
"extra_move=x+y" means to do one more pointer move
after "final" to x+y. "dt=n" sets the sleep time
in milliseconds between pointer moves (default: 40ms)
"retry=n" specifies the maximum number of retries if
the grab state change fails. "ifneeded" means to not
apply the pointer movements if the initial grab state is
that of the desired final state. "nograbcheck" means
to not check if the grab state changed as expected and
only apply the pointer movements (default is to check
the grab states.)
.IP
If you do not specify "up", etc., to bcx_xattach
nothing will be attempted and the command returns
the string FAIL,NO_DIRECTION_SPECIFIED. If you do
not specify "master_to_slave" or "M2S", etc., to
bcx_xattach nothing will be attempted and the command
returns the string FAIL,NO_MODE_CHANGE_SPECIFIED.
.IP
Otherwise, the returned string will contain "DONE".
It will be "DONE,GRAB_OK" if the grab state changed
as expected (or if "ifneeded" was supplied and
the initial grab state was already the desired
one.) If the initial grab state was incorrect,
but the final grab state was correct then it is
"DONE,GRAB_FAIL_INIT". If the initial grab state
was correct, but the final grab state was incorrect
then it is "DONE,GRAB_FAIL_FINAL". If both are
incorrect it will be "DONE,GRAB_FAIL". Under grab
failure the string will be followed by ":p1,k1-p2,k2"
where p1,k1 indicates the initial pointer and keyboard
grab states and p2,k2 the final ones. If GRAB_FAIL or
GRAB_FAIL_FINAL occurs, the action will be retried up
to 3 times; trying to reset the state and sleeping a
bit between each try. Set retry=n to adjust the number
of retries, zero to disable retries.
.IP
Examples:
\fB-R\fR bcx_xattach:down+M2S
\fB-R\fR bcx_xattach:up+S2M
\fB-R\fR bcx_xattach:up+S2M+nograbcheck+dt=30
\fB-R\fR bcx_xattach:down+M2S+extra_move=100+100
.IP
or use \fB-Q\fR instead of \fB-R\fR to retrieve the result text.
.IP
End of the bcx_xattach:str description.
.IP
The
.IR vncconnect (1)
command from standard VNC
.IP
distributions may also be used if string is prefixed
.IP
with "cmd=" E.g. 'vncconnect cmd=stop'. Under some
.IP
circumstances
.IR xprop (1)
can used if it supports \fB-set\fR
.IP
(see the FAQ).
.IP
.IP
If "\fB-connect\fR \fI/path/to/file\fR" has been supplied to the
.IP
running x11vnc server then that file can be used as a
.IP
communication channel (this is the only way to remote
.IP
control one of many x11vnc's polling the same X display)
.IP
Simply run: 'x11vnc \fB-connect\fR /path/to/file \fB-remote\fR ...'
.IP
or you can directly write to the file via something
.IP
like: "echo cmd=stop > /path/to/file", etc.
.PP
\fB-query\fR \fIvariable\fR
@ -5689,7 +5974,8 @@ these cases the value returned is "N/A". To direct a
query straight to the X11VNC_REMOTE property or connect
file use "qry=..." instead of "cmd=..."
.IP
ans= stop quit exit shutdown ping blacken zero
ans= stop quit exit shutdown ping resend_cutbuffer
resend_clipboard resend_primary blacken zero
refresh reset close disconnect id sid waitmapped
nowaitmapped clip flashcmap noflashcmap shiftcmap
truecolor notruecolor overlay nooverlay overlay_cursor
@ -5700,7 +5986,7 @@ viewonly noviewonly shared noshared forever noforever
once timeout tightfilexfer notightfilexfer ultrafilexfer
noultrafilexfer rfbversion deny lock nodeny unlock
avahi mdns zeroconf noavahi nomdns nozeroconf connect
proxy allowonce allow localhost nolocalhost listen
proxy allowonce allow localhost nolocalhost listen
lookup nolookup accept afteraccept gone shm noshm
flipbyteorder noflipbyteorder onetile noonetile
solid_color solid nosolid blackout xinerama noxinerama
@ -5710,10 +5996,10 @@ nocapslock skip_lockkeys noskip_lockkeys skip_keycodes
sloppy_keys nosloppy_keys skip_dups noskip_dups
add_keysyms noadd_keysyms clear_mods noclear_mods
clear_keys noclear_keys clear_all clear_locks keystate
remap repeat norepeat fb nofb bell nobell sel nosel
primary noprimary setprimary nosetprimary clipboard
noclipboard setclipboard nosetclipboard seldir
cursorshape nocursorshape cursorpos nocursorpos
remap repeat norepeat fb nofb bell nobell sendbell
sel nosel primary noprimary setprimary nosetprimary
clipboard noclipboard setclipboard nosetclipboard
seldir cursorshape nocursorshape cursorpos nocursorpos
cursor_drag nocursor_drag cursor show_cursor
noshow_cursor nocursor arrow xfixes noxfixes xdamage
noxdamage xd_area xd_mem alphacut alphafrac alpharemove
@ -5729,16 +6015,18 @@ debug_ncache nodebug_ncache wireframe_mode wireframe wf
nowireframe nowf wireframelocal wfl nowireframelocal
nowfl wirecopyrect wcr nowirecopyrect nowcr scr_area
scr_skip scr_inc scr_keys scr_term scr_keyrepeat
scr_parms scrollcopyrect scr noscrollcopyrect noscr
fixscreen noxrecord xrecord reset_record pointer_mode pm
input_skip allinput noallinput input grabkbd nograbkbd
grabptr nograbptr grabalways nograbalways grablocal
client_input ssltimeout speeds wmdt debug_pointer dp
nodebug_pointer nodp debug_keyboard dk nodebug_keyboard
nodk keycode deferupdate defer setdefer wait_ui
wait_bog nowait_bog slow_fb xrefresh wait readtimeout
nap nonap sb screen_blank fbpm nofbpm dpms nodpms
clientdpms noclientdpms forcedpms noforcedpms
scr_parms scrollcopyrect scr noscrollcopyrect
noscr fixscreen noxrecord xrecord reset_record
pointer_mode pm input_skip allinput noallinput input
grabkbd nograbkbd grabptr nograbptr grabalways
nograbalways grablocal client_input ssltimeout
speeds wmdt debug_pointer dp nodebug_pointer nodp
debug_keyboard dk nodebug_keyboard nodk keycode
keysym ptr sleep get_xprop set_xprop wininfo
bcx_xattach deferupdate defer setdefer extra_fbur
wait_ui wait_bog nowait_bog slow_fb xrefresh wait
readtimeout nap nonap sb screen_blank fbpm nofbpm dpms
nodpms clientdpms noclientdpms forcedpms noforcedpms
noserverdpms serverdpms noultraext ultraext chatwindow
nochatwindow chaton chatoff fs gaps grow fuzz snapfb
nosnapfb rawfb uinput_accel uinput_thresh uinput_reset
@ -5756,21 +6044,23 @@ nomacnowait macwheel macnoswap macswap nomacnoswap
macnoresize macresize nomacnoresize maciconanim macmenu
macnomenu nomacmenu macuskbd nomacuskbd noremote
.IP
aro= noop display vncdisplay desktopname guess_desktop
http_url auth xauth users rootshift clipshift scale_str
scaled_x scaled_y scale_numer scale_denom scale_fac_x
aro= noop display vncdisplay autoport loop loopbg
desktopname guess_desktop http_url auth xauth
users rootshift clipshift scale_str scaled_x
scaled_y scale_numer scale_denom scale_fac_x
scale_fac_y scaling_blend scaling_nomult4 scaling_pad
scaling_interpolate inetd privremote unsafe safer
nocmds passwdfile unixpw unixpw_nis unixpw_list ssl
ssl_pem sslverify stunnel stunnel_pem https httpsredir
usepw using_shm logfile o flag rc norc h help V version
lastmod bg sigpipe threads readrate netrate netlatency
pipeinput clients client_count pid ext_xtest ext_xtrap
ext_xrecord ext_xkb ext_xshm ext_xinerama ext_overlay
ext_xfixes ext_xdamage ext_xrandr rootwin num_buttons
button_mask mouse_x mouse_y bpp depth indexed_color
dpy_x dpy_y wdpy_x wdpy_y off_x off_y cdpy_x cdpy_y
coff_x coff_y rfbauth passwd viewpasswd
usepw using_shm logfile o flag rmflag rc norc h help
V version lastmod bg sigpipe threads readrate netrate
netlatency pipeinput clients client_count pid ext_xtest
ext_xtrap ext_xrecord ext_xkb ext_xshm ext_xinerama
ext_overlay ext_xfixes ext_xdamage ext_xrandr rootwin
num_buttons button_mask mouse_x mouse_y grab_state
pointer_pos bpp depth indexed_color dpy_x dpy_y wdpy_x
wdpy_y off_x off_y cdpy_x cdpy_y coff_x coff_y rfbauth
passwd viewpasswd
.PP
\fB-QD\fR \fIvariable\fR
.IP
@ -5794,10 +6084,47 @@ first (synchronously: no need for \fB-sync),\fR and then
the \fB-query\fR request is processed in the normal way.
This allows for a reliable way to see if the \fB-remote\fR
command was processed by querying for any new settings.
Note however that there is timeout of a few seconds so
if the x11vnc takes longer than that to process the
requests the requester will think that a failure has
taken place.
Note however that there is timeout of a few seconds
(see the next paragraph) so if the x11vnc takes longer
than that to process the requests the requester will
think that a failure has taken place.
.IP
The default is to wait 3.5 seconds. Or if cmd=stop
only 1.0 seconds. If cmd matches 'script:' then it
will wait up to 10.0 seconds. Set X11VNC_SYNC_TIMEOUT
to the number of seconds you want it to wait.
.PP
\fB-query_retries\fR \fIstr\fR
.IP
If a query fails to get a response from an x11vnc
server, retry up to n times. \fIstr\fR is specified as
n[:t][/match] Optionally the delay between tries may
be specified by "t" a floating point time (default
0.5 seconds.) Note: the response is not checked for
validity or whether it corresponds to the query sent.
The query "ping:mystring" may be used to help uniquely
identify the query. Optionally, a matching string after
a "/" will be used to check the result text. Up to
n retries will take place until the matching string is
found in the output text. If the match string is never
found the program's exit code is 1; if the match is
found it exits with 0. Note that there may be stdout
printed for each retry (i.e. multiple lines printed
out to stdout.)
Example: \fB-query_retries\fR 4:1.5/grab_state
.PP
\fB-remote_prefix\fR \fIstr\fR
.IP
Enable a remote-control communication channel for
connected VNC clients. str is a non-empty string. If a
VNC client sends rfbCutText having the prefix \fIstr\fR
then the part after it is processed as though it were
sent via 'x11vnc \fB-remote\fR ...'. If it begins with
neither 'cmd=' nor 'qry=' then 'qry=' is assumed.
Any corresponding output text for that remote control
command is sent back to all client as rfbCutText.
The returned output is also prefixed with \fIstr\fR.
Example: \fB-remote_prefix\fR DO_THIS:
.PP
\fB-noremote,\fR \fB-yesremote\fR
.IP

@ -8,7 +8,8 @@
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
* the Free Software Foundation; version 2 of the License, or (at
* your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -456,7 +457,7 @@ if (tstk[j] != 0) fprintf(stderr, "B redir[%d][%d] = %d %s\n", i, j, tstk[j], t
int p0, p, found = -1, jzero = -1;
int conn = -1;
get_prop(num, 32, atom[i]);
get_prop(num, 32, atom[i], None);
p0 = atoi(num);
for (j = TSSTK-1; j >= 0; j--) {
@ -654,7 +655,7 @@ void do_tsd(void) {
prop[0] = '\0';
a = XInternAtom(dpy, "TS_REDIR_LIST", False);
if (a != None) {
get_prop(prop, 512, a);
get_prop(prop, 512, a, None);
}
if (db) fprintf(stderr, "TS_REDIR_LIST Atom: %d = '%s'\n", (int) a, prop);
@ -784,7 +785,7 @@ static void check_redir_services(void) {
a = XInternAtom(dpy, "TS_REDIR_PID", False);
if (a != None) {
prop[0] = '\0';
get_prop(prop, 512, a);
get_prop(prop, 512, a, None);
if (prop[0] != '\0') {
pid = (pid_t) atoi(prop);
}
@ -806,7 +807,7 @@ static void check_redir_services(void) {
prop[0] = '\0';
a = XInternAtom(dpy, "TS_REDIR", False);
if (a != None) {
get_prop(prop, 512, a);
get_prop(prop, 512, a, None);
}
if (db) fprintf(stderr, "TS_REDIR Atom: %d = '%s'\n", (int) a, prop);
if (prop[0] == '\0') {
@ -1851,6 +1852,9 @@ char msg2[] =
if (quiet) {
return;
}
if (remote_direct) {
return;
}
if (nofb) {
return;
}
@ -1859,7 +1863,7 @@ char msg2[] =
#endif
if (ncache == 0) {
fprintf(stderr, msg2);
fprintf(stderr, "%s", msg2);
ncache0 = ncache = 0;
} else {
fprintf(stderr, msg, ncache);
@ -1904,6 +1908,7 @@ static void do_sleepin(char *sleep) {
}
extern int dragum(void);
extern int is_decimal(char *);
int main(int argc, char* argv[]) {
@ -1913,6 +1918,9 @@ int main(int argc, char* argv[]) {
int remote_sync = 0;
char *remote_cmd = NULL;
char *query_cmd = NULL;
int query_retries = 0;
double query_delay = 0.5;
char *query_match = NULL;
char *gui_str = NULL;
int got_gui_pw = 0;
int pw_loc = -1, got_passwd = 0, got_rfbauth = 0, nopw = NOPW;
@ -2440,6 +2448,10 @@ int main(int argc, char* argv[]) {
got_localhost = 1;
continue;
}
if (!strcmp(arg, "-unixpw_system_greeter")) {
unixpw_system_greeter = 1;
continue;
}
if (!strcmp(arg, "-unixpw_cmd")
|| !strcmp(arg, "-unixpw_cmd_unsafe")) {
CHECK_ARGC
@ -2693,7 +2705,11 @@ int main(int argc, char* argv[]) {
stunnel_pem = strdup(s);
}
i++;
} else {
stunnel_pem = strdup("SAVE");
}
} else {
stunnel_pem = strdup("SAVE");
}
continue;
}
@ -2709,7 +2725,11 @@ int main(int argc, char* argv[]) {
stunnel_pem = strdup(s);
}
i++;
} else {
stunnel_pem = strdup("SAVE");
}
} else {
stunnel_pem = strdup("SAVE");
}
continue;
}
@ -3397,6 +3417,11 @@ int main(int argc, char* argv[]) {
got_waitms = 1;
continue;
}
if (!strcmp(arg, "-extra_fbur")) {
CHECK_ARGC
extra_fbur = atoi(argv[++i]);
continue;
}
if (!strcmp(arg, "-wait_ui")) {
CHECK_ARGC
wait_ui = atof(argv[++i]);
@ -3700,17 +3725,39 @@ int main(int argc, char* argv[]) {
remote_cmd = str;
}
}
quiet = 1;
if (!getenv("QUERY_VERBOSE")) {
quiet = 1;
}
xkbcompat = 0;
continue;
}
if (!strcmp(arg, "-query") || !strcmp(arg, "-Q")) {
CHECK_ARGC
query_cmd = strdup(argv[++i]);
quiet = 1;
if (!getenv("QUERY_VERBOSE")) {
quiet = 1;
}
xkbcompat = 0;
continue;
}
if (!strcmp(arg, "-query_retries")) {
char *s;
CHECK_ARGC
s = strdup(argv[++i]);
/* n[:t][/match] */
if (strchr(s, '/')) {
char *q = strchr(s, '/');
query_match = strdup(q+1);
*q = '\0';
}
if (strchr(s, ':')) {
char *q = strchr(s, ':');
query_delay = atof(q+1);
}
query_retries = atoi(s);
free(s);
continue;
}
if (!strcmp(arg, "-QD")) {
CHECK_ARGC
query_cmd = strdup(argv[++i]);
@ -3725,6 +3772,11 @@ int main(int argc, char* argv[]) {
remote_sync = 0;
continue;
}
if (!strcmp(arg, "-remote_prefix")) {
CHECK_ARGC
remote_prefix = strdup(argv[++i]);
continue;
}
if (!strcmp(arg, "-noremote")) {
accept_remote_cmds = 0;
continue;
@ -3784,10 +3836,23 @@ int main(int argc, char* argv[]) {
}
if (!strcmp(arg, "-rfbport") && i < argc-1) {
got_rfbport = 1;
if (!strcasecmp(argv[i+1], "prompt")) {
;
} else if (!is_decimal(argv[i+1])) {
rfbLog("Invalid -rfbport value: '%s'\n", argv[i+1]);
rfbLog("setting it to '-1' to induce failure.\n");
argv[i+1] = strdup("-1");
}
got_rfbport_str = strdup(argv[i+1]);
got_rfbport_pos = argc_vnc+1;
got_rfbport_val = atoi(argv[i+1]);
}
if (!strcmp(arg, "-httpport") && i < argc-1) {
if (!is_decimal(argv[i+1])) {
rfbLog("Invalid -httpport value: '%s'\n", argv[i+1]);
clean_up_exit(1);
}
}
if (!strcmp(arg, "-alwaysshared ")) {
got_alwaysshared = 1;
}
@ -3815,6 +3880,11 @@ int main(int argc, char* argv[]) {
set_env("LIBXCB_ALLOW_SLOPPY_LOCK", "1");
}
if (getenv("PATH") == NULL || !strcmp(getenv("PATH"), "")) {
/* set a minimal PATH, usually only null in inetd. */
set_env("PATH", "/bin:/usr/bin");
}
/* set OS struct UT */
uname(&UT);
@ -4052,8 +4122,25 @@ int main(int argc, char* argv[]) {
* similar for query_default.
*/
if (client_connect_file || query_default) {
int rc = do_remote_query(remote_cmd, query_cmd,
remote_sync, query_default);
int i, rc = 1;
for (i=0; i <= query_retries; i++) {
rc = do_remote_query(remote_cmd, query_cmd,
remote_sync, query_default);
if (rc == 0) {
if (query_match) {
if (query_result && strstr(query_result, query_match)) {
break;
}
rc = 1;
} else {
break;
}
}
if (i < query_retries) {
fprintf(stderr, "sleep: %.3f\n", query_delay);
usleep( (int) (query_delay * 1000 * 1000) );
}
}
fflush(stderr);
fflush(stdout);
exit(rc);
@ -4426,6 +4513,8 @@ int main(int argc, char* argv[]) {
}
}
http_try_it = try_http;
if (flip_byte_order && using_shm && ! quiet) {
rfbLog("warning: -flipbyte order only works with -noshm\n");
}
@ -4492,11 +4581,13 @@ int main(int argc, char* argv[]) {
}
if (debug_pointer || debug_keyboard) {
if (bg || quiet) {
rfbLog("disabling -bg/-q under -debug_pointer"
"/-debug_keyboard\n");
bg = 0;
quiet = 0;
if (!logfile) {
if (bg || quiet) {
rfbLog("disabling -bg/-q under -debug_pointer"
"/-debug_keyboard\n");
bg = 0;
quiet = 0;
}
}
}
@ -4521,7 +4612,7 @@ int main(int argc, char* argv[]) {
if (verbose) {
print_settings(try_http, bg, gui_str);
}
rfbLog("x11vnc version: %s\n", lastmod);
rfbLog("x11vnc version: %s pid: %d\n", lastmod, getpid());
} else {
rfbLogEnable(0);
}
@ -4728,14 +4819,38 @@ if (0) fprintf(stderr, "XA: %s\n", getenv("XAUTHORITY"));
window = save;
}
if (! quiet && ! raw_fb_str) {
rfbLog("\n");
rfbLog("------------------ USEFUL INFORMATION ------------------\n");
}
if (remote_cmd || query_cmd) {
int rc = do_remote_query(remote_cmd, query_cmd, remote_sync,
query_default);
if ( (remote_cmd && strstr(remote_cmd, "DIRECT:") == remote_cmd)
|| (query_cmd && strstr(query_cmd, "DIRECT:") == query_cmd )) {
/* handled below after most everything is setup. */
if (getenv("QUERY_VERBOSE")) {
quiet = 0;
} else {
quiet = 1;
remote_direct = 1;
}
if (!auto_port) {
auto_port = 5970;
}
} else if (remote_cmd || query_cmd) {
int i, rc = 1;
for (i=0; i <= query_retries; i++) {
rc = do_remote_query(remote_cmd, query_cmd, remote_sync,
query_default);
if (rc == 0) {
if (query_match) {
if (query_result && strstr(query_result, query_match)) {
break;
}
rc = 1;
} else {
break;
}
}
if (i < query_retries) {
fprintf(stderr, "sleep: %.3f\n", query_delay);
usleep( (int) (query_delay * 1000 * 1000) );
}
}
XFlush_wr(dpy);
fflush(stderr);
fflush(stdout);
@ -4744,6 +4859,11 @@ if (0) fprintf(stderr, "XA: %s\n", getenv("XAUTHORITY"));
exit(rc);
}
if (! quiet && ! raw_fb_str) {
rfbLog("\n");
rfbLog("------------------ USEFUL INFORMATION ------------------\n");
}
if (priv_remote) {
if (! remote_control_access_ok()) {
rfbLog("** Disabling remote commands in -privremote mode.\n");
@ -5086,7 +5206,9 @@ if (0) fprintf(stderr, "XA: %s\n", getenv("XAUTHORITY"));
}
#endif
check_pm();
if (!getenv("X11VNC_NO_CHECK_PM")) {
check_pm();
}
if (! quiet && ! raw_fb_str) {
rfbLog("--------------------------------------------------------\n");
@ -5322,6 +5444,13 @@ if (0) fprintf(stderr, "XA: %s\n", getenv("XAUTHORITY"));
ncache_beta_tester_message();
}
if (remote_cmd || query_cmd) {
/* This is DIRECT: case */
do_remote_query(remote_cmd, query_cmd, remote_sync, query_default);
if (getenv("SLEEP")) sleep(atoi(getenv("SLEEP")));
clean_up_exit(0);
}
#if LIBVNCSERVER_HAVE_FORK && LIBVNCSERVER_HAVE_SETSID
if (bg) {
int p, n;

@ -47,7 +47,7 @@ int xtrap_base_event_type = 0;
int xdamage_base_event_type = 0;
/* date +'lastmod: %Y-%m-%d' */
char lastmod[] = "0.9.9 lastmod: 2009-08-10";
char lastmod[] = "0.9.9 lastmod: 2009-10-07";
/* X display info */

@ -56,6 +56,8 @@ int xdamage_max_area = 20000; /* pixels */
double xdamage_memory = 1.0; /* in units of NSCAN */
int xdamage_tile_count = 0, xdamage_direct_count = 0;
double xdamage_scheduled_mark = 0.0;
double xdamage_crazy_time = 0.0;
double xdamage_crazy_delay = 300.0;
sraRegionPtr xdamage_scheduled_mark_region = NULL;
sraRegionPtr *xdamage_regions = NULL;
int xdamage_ticker = 0;
@ -400,6 +402,7 @@ int collect_xdamage(int scancnt, int call) {
#define DUPSZ 32
int dup_x[DUPSZ], dup_y[DUPSZ], dup_w[DUPSZ], dup_h[DUPSZ];
double tm, dt;
int mark_all = 0, retries = 0, too_many = 1000, tot_ev = 0;
RAWFB_RET(0)
@ -443,6 +446,9 @@ int collect_xdamage(int scancnt, int call) {
X_LOCK;
if (0) XFlush_wr(dpy);
if (0) XEventsQueued(dpy, QueuedAfterFlush);
come_back_for_more:
while (XCheckTypedEvent(dpy, xdamage_base_event_type+XDamageNotify, &ev)) {
/*
* TODO max cut off time in this loop?
@ -450,6 +456,26 @@ if (0) XEventsQueued(dpy, QueuedAfterFlush);
* screen.
*/
ecount++;
tot_ev++;
if (mark_all) {
continue;
}
if (ecount == too_many) {
int nqa = XEventsQueued(dpy, QueuedAlready);
if (nqa >= too_many) {
static double last_msg = 0.0;
tmpregion = sraRgnCreateRect(0, 0, dpy_x, dpy_y);
sraRgnOr(reg, tmpregion);
sraRgnDestroy(tmpregion);
if (dnow() > last_msg + xdamage_crazy_delay) {
rfbLog("collect_xdamage: too many xdamage events %d+%d\n", ecount, nqa);
last_msg = dnow();
}
mark_all = 1;
}
}
if (ev.type != xdamage_base_event_type + XDamageNotify) {
break;
}
@ -537,12 +563,37 @@ if (0) XEventsQueued(dpy, QueuedAfterFlush);
rect_count++;
ccount++;
}
if (mark_all) {
if (ecount + XEventsQueued(dpy, QueuedAlready) >= 3 * too_many && retries < 3) {
retries++;
XFlush_wr(dpy);
usleep(20 * 1000);
XFlush_wr(dpy);
ecount = 0;
goto come_back_for_more;
}
}
/* clear the whole damage region for next time. XXX check */
if (call == 1) {
XDamageSubtract(dpy, xdamage, None, None);
}
X_UNLOCK;
if (tot_ev > 20 * too_many) {
rfbLog("collect_xdamage: xdamage has gone crazy (screensaver or game?) ev: %d ret: %d\n", tot_ev, retries);
rfbLog("collect_xdamage: disabling xdamage for %d seconds.\n", (int) xdamage_crazy_delay);
destroy_xdamage_if_needed();
X_LOCK;
XSync(dpy, False);
while (XCheckTypedEvent(dpy, xdamage_base_event_type+XDamageNotify, &ev)) {
;
}
X_UNLOCK;
xdamage_crazy_time = dnow();
}
if (0 && xdamage_direct_count) {
fb_push();
}
@ -726,7 +777,7 @@ void create_xdamage_if_needed(int force) {
xdamage = XDamageCreate(dpy, window, XDamageReportRawRectangles);
XDamageSubtract(dpy, xdamage, None, None);
X_UNLOCK;
rfbLog("created xdamage object: 0x%lx\n", xdamage);
rfbLog("created xdamage object: 0x%lx\n", xdamage);
}
#endif
}
@ -762,6 +813,9 @@ void check_xdamage_state(void) {
* Create or destroy the Damage object as needed, we don't want
* one if no clients are connected.
*/
if (xdamage_crazy_time > 0.0 && dnow() < xdamage_crazy_time + xdamage_crazy_delay) {
return;
}
if (client_count && use_xdamage) {
create_xdamage_if_needed(0);
if (xdamage_scheduled_mark > 0.0 && dnow() >

@ -44,6 +44,8 @@ extern int xdamage_max_area;
extern double xdamage_memory;
extern int xdamage_tile_count, xdamage_direct_count;
extern double xdamage_scheduled_mark;
extern double xdamage_crazy_time;
extern double xdamage_crazy_delay;
extern sraRegionPtr xdamage_scheduled_mark_region;
extern sraRegionPtr *xdamage_regions;
extern int xdamage_ticker;

@ -76,7 +76,7 @@ void set_server_input(rfbClientPtr cl, int s);
void set_text_chat(rfbClientPtr cl, int l, char *t);
int get_keyboard_led_state_hook(rfbScreenInfoPtr s);
int get_file_transfer_permitted(rfbClientPtr cl);
void get_prop(char *str, int len, Atom prop);
void get_prop(char *str, int len, Atom prop, Window w);
static void initialize_xevents(int reset);
static void print_xevent_bases(void);
@ -212,7 +212,7 @@ static void print_xevent_bases(void) {
fprintf(stderr, " SelClear=%d, Expose=%d\n", SelectionClear, Expose);
}
void get_prop(char *str, int len, Atom prop) {
void get_prop(char *str, int len, Atom prop, Window w) {
int i;
#if !NO_X11
Atom type;
@ -235,9 +235,12 @@ void get_prop(char *str, int len, Atom prop) {
#else
slen = 0;
if (w == None) {
w = DefaultRootWindow(dpy);
}
do {
if (XGetWindowProperty(dpy, DefaultRootWindow(dpy),
if (XGetWindowProperty(dpy, w,
prop, nitems/4, len/16, False,
AnyPropertyType, &type, &format, &nitems, &bytes_after,
&data) == Success) {
@ -584,7 +587,7 @@ static void grab_buster_watch(int parent, char *dstr) {
break;
}
get_prop(propval, 128, ticker_atom);
get_prop(propval, 128, ticker_atom, None);
if (db) fprintf(stderr, "got_prop: %s\n", propval);
if (!process_watch(propval, parent, db)) {
@ -871,21 +874,49 @@ void check_autorepeat(void) {
}
} else {
if (idle_reset) {
int i, state[256];
int i, state[256], didmsg = 0, pressed = 0;
int mwt = 600, mmax = 20;
static int msgcnt = 0;
static double lastmsg = 0.0;
for (i=0; i<256; i++) {
state[i] = 0;
}
if (use_threads) {X_LOCK;}
get_keystate(state);
if (use_threads) {X_UNLOCK;}
for (i=0; i<256; i++) {
if (state[i] != 0) {
/* better wait until all keys are up */
rfbLog("active keyboard: waiting until"
" all keys are up. key_down=%d\n", i);
return;
pressed++;
if (msgcnt < mmax || dnow() > lastmsg + mwt) {
char *str = "unset";
#if !NO_X11
if (use_threads) {X_LOCK;}
str = XKeysymToString(XKeycodeToKeysym(dpy, i, 0));
if (use_threads) {X_UNLOCK;}
#endif
str = str ? str : "nosymbol";
didmsg++;
rfbLog("active keyboard: waiting until "
"all keys are up. key_down=%d %s. "
"If the key is inaccessible via keyboard, "
"consider 'x11vnc -R clear_all'\n", i, str);
}
}
}
if (didmsg > 0) {
msgcnt++;
if (msgcnt == mmax) {
rfbLog("active keyboard: last such "
"message for %d secs.\n", mwt);
}
lastmsg = dnow();
}
if (pressed > 0) {
return;
}
}
if (idle_reset) {
static time_t last_msg = 0;
@ -1055,38 +1086,83 @@ void check_xevents(int reset) {
last_call = now;
}
/* check for CUT_BUFFER0 and VNC_CONNECT changes: */
/* check for CUT_BUFFER0, VNC_CONNECT, X11VNC_REMOTE changes: */
if (XCheckTypedEvent(dpy, PropertyNotify, &xev)) {
if (xev.type == PropertyNotify) {
if (xev.xproperty.atom == XA_CUT_BUFFER0) {
/*
* Go retrieve CUT_BUFFER0 and send it.
*
* set_cutbuffer is a flag to try to avoid
* processing our own cutbuffer changes.
*/
if (have_clients && watch_selection
&& ! set_cutbuffer) {
cutbuffer_send();
sent_some_sel = 1;
int got_cutbuffer = 0;
int got_vnc_connect = 0;
int got_x11vnc_remote = 0;
static int prop_dbg = -1;
/* to avoid piling up between calls, read all PropertyNotify now */
do {
if (xev.type == PropertyNotify) {
if (xev.xproperty.atom == XA_CUT_BUFFER0) {
got_cutbuffer++;
} else if (vnc_connect && vnc_connect_prop != None
&& xev.xproperty.atom == vnc_connect_prop) {
got_vnc_connect++;
} else if (vnc_connect && x11vnc_remote_prop != None
&& xev.xproperty.atom == x11vnc_remote_prop) {
got_x11vnc_remote++;
}
set_cutbuffer = 0;
} else if (vnc_connect && vnc_connect_prop != None
&& xev.xproperty.atom == vnc_connect_prop) {
/*
* Go retrieve VNC_CONNECT string.
*/
read_vnc_connect_prop(0);
} else if (vnc_connect && x11vnc_remote_prop != None
&& xev.xproperty.atom == x11vnc_remote_prop) {
/*
* Go retrieve X11VNC_REMOTE string.
*/
read_x11vnc_remote_prop(0);
set_prop_atom(xev.xproperty.atom);
}
} while (XCheckTypedEvent(dpy, PropertyNotify, &xev));
if (prop_dbg < 0) {
prop_dbg = 0;
if (getenv("PROP_DBG")) {
prop_dbg = 1;
}
}
if (prop_dbg && (got_cutbuffer > 1 || got_vnc_connect > 1 || got_x11vnc_remote > 1)) {
static double lastmsg = 0.0;
static int count = 0;
double now = dnow();
if (1 && now > lastmsg + 300.0) {
if (got_cutbuffer > 1) {
rfbLog("check_xevents: warning: %d cutbuffer events since last check.\n", got_cutbuffer);
}
if (got_vnc_connect > 1) {
rfbLog("check_xevents: warning: %d vnc_connect events since last check.\n", got_vnc_connect);
}
if (got_x11vnc_remote > 1) {
rfbLog("check_xevents: warning: %d x11vnc_remote events since last check.\n", got_x11vnc_remote);
}
count++;
if (count >= 3) {
lastmsg = now;
count = 0;
}
}
set_prop_atom(xev.xproperty.atom);
}
if (got_cutbuffer) {
/*
* Go retrieve CUT_BUFFER0 and send it.
*
* set_cutbuffer is a flag to try to avoid
* processing our own cutbuffer changes.
*/
if (have_clients && watch_selection && !set_cutbuffer) {
cutbuffer_send();
sent_some_sel = 1;
}
set_cutbuffer = 0;
}
if (got_vnc_connect) {
/*
* Go retrieve VNC_CONNECT string.
*/
read_vnc_connect_prop(0);
}
if (got_x11vnc_remote) {
/*
* Go retrieve X11VNC_REMOTE string.
*/
read_x11vnc_remote_prop(0);
}
}
@ -1367,6 +1443,39 @@ void xcut_receive(char *text, int len, rfbClientPtr cl) {
return;
}
if (remote_prefix != NULL && strstr(text, remote_prefix) == text) {
char *result, *rcmd = text + strlen(remote_prefix);
char *tmp = (char *) calloc(len + 8, 1);
if (strstr(rcmd, "cmd=") != rcmd && strstr(rcmd, "qry=") != rcmd) {
strcat(tmp, "qry=");
}
strncat(tmp, rcmd, len - strlen(remote_prefix));
rfbLog("remote_prefix command: '%s'\n", tmp);
result = process_remote_cmd(tmp, 1);
if (result == NULL ) {
result = strdup("null");
} else if (!strcmp(result, "")) {
free(result);
result = strdup("none");
}
rfbLog("remote_prefix result: '%s'\n", result);
free(tmp);
tmp = (char *) calloc(strlen(remote_prefix) + strlen(result) + 1, 1);
strcat(tmp, remote_prefix);
strcat(tmp, result);
free(result);
rfbSendServerCutText(screen, tmp, strlen(tmp));
free(tmp);
return;
}
if (! check_sel_direction("recv", "xcut_receive", text, len)) {
return;
}

@ -59,7 +59,7 @@ extern void set_server_input(rfbClientPtr cl, int s);
extern void set_text_chat(rfbClientPtr cl, int l, char *t);
extern int get_keyboard_led_state_hook(rfbScreenInfoPtr s);
extern int get_file_transfer_permitted(rfbClientPtr cl);
extern void get_prop(char *str, int len, Atom prop);
extern void get_prop(char *str, int len, Atom prop, Window w);
#endif /* _X11VNC_XEVENTS_H */

@ -755,7 +755,6 @@ if (db) fprintf(stderr, "lseek 0 ps: %d sz: %d off: %d bpl: %d\n", pixelsize, s
del = 0;
while (len > 0) {
n = read(raw_fb_fd, dst + del, len);
//if (db > 2) fprintf(stderr, "len: %d n: %d\n", len, n);
if (n > 0) {
del += n;
@ -767,7 +766,6 @@ if (db) fprintf(stderr, "lseek 0 ps: %d sz: %d off: %d bpl: %d\n", pixelsize, s
}
}
if (bpl > sz) {
//if (db > 1) fprintf(stderr, "bpl>sz %d %d\n", bpl, sz);
off = (off_t) (bpl - sz);
lseek(raw_fb_fd, off, SEEK_CUR);
}

Loading…
Cancel
Save