x11vnc: -grabalways, -forcedpms, -clientdpms, -noserverdpms, -loopbg, -svc, -xdmsvc

pull/1/head
runge 18 years ago
parent 90d96b971f
commit 0016cd4280

@ -1,3 +1,9 @@
2007-02-11 Karl Runge <runge@karlrunge.com>
* x11vnc: add -grabalways, -forcedpms, -clientdpms, and
-noserverdpms (ultravnc viewer) for improvements in
the still approximate server locking. Add -loopbg
and -svc, -xdmsvc aliases. Bug fix create_display.
2007-02-10 Karl Runge <runge@karlrunge.com>
* x11vnc: watch things like textchat, etc. more carefully
in unixpw state. Monitor broken XDAMAGE reports when

File diff suppressed because it is too large Load Diff

@ -2377,7 +2377,9 @@ void check_new_clients(void) {
return;
}
if (grab_kbd || grab_ptr) {
if (grab_always) {
;
} else if (grab_kbd || grab_ptr) {
static double last_force = 0.0;
if (client_count != last_count || dnow() > last_force + 0.25) {
int q = (client_count == last_count);

@ -306,14 +306,32 @@ void print_help(int mode) {
" disconnects, opposite of -forever. This is the Default.\n"
"-forever Keep listening for more connections rather than exiting\n"
" as soon as the first client(s) disconnect. Same as -many\n"
"\n"
"-loop Create an outer loop restarting the x11vnc process\n"
" whenever it terminates. -bg and -inetd are ignored in\n"
" this mode. Useful for continuing even if the X server\n"
" terminates and restarts (you will need permission to\n"
" reconnect of course). Use, e.g., -loop100 to sleep\n"
" 100 millisecs between restarts, etc. Default is 2000ms\n"
" (i.e. 2 secs) Use, e.g. -loop300,5 to sleep 300 ms\n"
" and only loop 5 times.\n"
" whenever it terminates. -bg and -inetd are ignored\n"
" in this mode (however see -loopbg below).\n"
"\n"
" Useful for continuing even if the X server terminates\n"
" and restarts (at that moment the process will need\n"
" permission to reconnect to the new X server of course).\n"
"\n"
" Use, e.g., -loop100 to sleep 100 millisecs between\n"
" restarts, etc. Default is 2000ms (i.e. 2 secs) Use,\n"
" e.g. -loop300,5 to sleep 300 ms and only loop 5 times.\n"
"\n"
" If -loopbg (plus any numbers) is specified instead,\n"
" the \"-bg\" option is implied and the mode approximates\n"
" inetd(8) usage to some degree. In this case when\n"
" it goes into the background any listening sockets\n"
" (i.e. ports 5900, 5800) are closed, so the next one\n"
" in the loop can use them. This mode will only be of\n"
" use if a VNC client (the only client for that process)\n"
" is already connected before the process goes into the\n"
" background, for example, usage of -display WAIT:..,\n"
" -svc, and -connect can make use of this \"poor man's\"\n"
" inetd mode. The default wait time is 500ms in this\n"
" mode. This usage could use useful: -svc -loopbg\n"
"\n"
"-timeout n Exit unless a client connects within the first n seconds\n"
" after startup.\n"
"-inetd Launched by inetd(8): stdio instead of listening socket.\n"
@ -445,6 +463,11 @@ void print_help(int mode) {
" act on the local user's input. Again, some degree of\n"
" cooperation from the person at the display is assumed.\n"
"\n"
"-grabalways Apply both -grabkbd and -grabptr even when no VNC\n"
" viewers are connected. If you only want one of them,\n"
" use the -R remote control to turn the other back on,\n"
" e.g. -R nograbptr.\n"
"\n"
"-viewpasswd string Supply a 2nd password for view-only logins. The -passwd\n"
" (full-access) password must also be supplied.\n"
"\n"
@ -688,6 +711,14 @@ void print_help(int mode) {
" in addition to this option.\n"
"\n"
#endif
"-svc Terminal services mode. Also \"-service\", implies\n"
" -display WAIT:cmd=FINDCREATEDISPLAY-Xvfb -unixpw\n"
" -users unixpw= -ssl SAVE\n"
"\n"
"-xdmsvc Terminal services mode. Also \"-xdm_service\", implies\n"
" -display WAIT:cmd=FINDCREATEDISPLAY-Xvfb.xdmcp -unixpw\n"
" -users unixpw= -ssl SAVE\n"
"\n"
"-display WAIT:... A special usage mode for the normal -display option.\n"
" Useful with -unixpw, but can be used independently\n"
" of it. If the display string begins with WAIT: then\n"
@ -792,7 +823,7 @@ void print_help(int mode) {
" Where /.../x11vnc is the full path to x11vnc.\n"
" It is used in the Apache SSL-portal example (see FAQ).\n"
"\n"
" An experimental option is WAIT:cmd=FINDCREATEDISPLAY\n"
" An interesting option is WAIT:cmd=FINDCREATEDISPLAY\n"
" that is like FINDDISPLAY in that is uses the same method\n"
" to find an existing display. However, if it does not\n"
" find one it will try to *start* up an X server session\n"
@ -807,11 +838,12 @@ void print_help(int mode) {
" and only works on Linux. Xvfb is available on most\n"
" platforms and does not require root.\n"
"\n"
" When x11vnc exits (i.e. user disconnects) the X server\n"
" session stays running in the background. Presumably\n"
" the FINDDISPLAY will find it next time. The user must\n"
" exit the X session in the usual way for it to terminate\n"
" (or kill the X server process if all else fails).\n"
" When x11vnc exits (i.e. user disconnects) the X\n"
" server session stays running in the background.\n"
" The FINDDISPLAY will find it directly next time.\n"
" The user must exit the X session in the usual way for\n"
" it to terminate (or kill the X server process if all\n"
" else fails).\n"
"\n"
" So this is a somewhat odd mode for x11vnc in that it\n"
" will start up and poll virtual X servers! This can\n"
@ -848,7 +880,14 @@ void print_help(int mode) {
" for kdm in kdmrc: Enable=true in section [Xdmcp]\n"
" for xdm in xdm-config: DisplayManager.requestPort: 177\n"
"\n"
" See the shorthand options above \"-svc\" and \"-xdmsvc\"\n"
" that specify the above options for some useful cases.\n"
"\n"
#ifndef NO_SSL_OR_UNIXPW
"-nossl Disable the -ssl option (see below). Since -ssl is off\n"
" by default -nossl would only be used on the commandline\n"
" to unset any *earlier* -ssl option (or -svc...)\n"
"\n"
"-ssl [pem] Use the openssl library (www.openssl.org) to provide a\n"
" built-in encrypted SSL tunnel between VNC viewers and\n"
" x11vnc. This requires libssl support to be compiled\n"
@ -2649,6 +2688,32 @@ void print_help(int mode) {
" for details. -nodpms is basically the same as running\n"
" \"xset dpms force on\" periodically. Default: %s\n"
"\n"
"-forcedpms If the system supports the DPMS (Display Power\n"
" Management Signaling) extension, then try to keep the\n"
" monitor in a powered off state. This is to prevent\n"
" nosey people at the physical display from viewing\n"
" what is on the screen. Be sure lock the screen before\n"
" disconnecting.\n"
"\n"
" This method is far from bullet proof, e.g. suppose\n"
" someone attaches a non-DPMS monitor, or loads the\n"
" machine so that there is a gap of time before x11vnc\n"
" restores the powered off state? On many machines if\n"
" he floods it with keyboard and mouse input he can see\n"
" flashes of what is on the screen before the DPMS off\n"
" state is reestablished. For this to work securely\n"
" there would need to be support in the X server to do\n"
" this exactly rather than approximately with DPMS.\n"
"\n"
"-clientdpms As -forcedpms but only when VNC clients are connected.\n"
"\n"
"-noserverdpms The UltraVNC ServerInput extension is supported.\n"
" This allows the VNC viewer to click a button that will\n"
" cause the server (x11vnc) to try to disable keyboard\n"
" and mouse input at the physical display and put the\n"
" monitor in dpms powered off state. Use this option to\n"
" skip powering off the monitor.\n"
"\n"
"-noxdamage Do not use the X DAMAGE extension to detect framebuffer\n"
" changes even if it is available. Use -xdamage if your\n"
" default is to have it off.\n"
@ -3339,6 +3404,8 @@ void print_help(int mode) {
" nograbkbd disable -grabkbd mode.\n"
" grabptr enable -grabptr mode.\n"
" nograbptr disable -grabptr mode.\n"
" grabalways enable -grabalways mode.\n"
" nograbalways disable -grabalways mode.\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"
@ -3503,6 +3570,12 @@ void print_help(int mode) {
" nofbpm enable -nofbpm mode.\n"
" dpms disable -nodpms mode.\n"
" nodpms enable -nodpms mode.\n"
" forcedpms enable -forcedpms mode.\n"
" noforcedpms disable -forcedpms mode.\n"
" clientdpms enable -clientdpms mode.\n"
" noclientdpms disable -clientdpms mode.\n"
" noserverdpms enable -noserverdpms mode.\n"
" serverdpms disable -noserverdpms mode.\n"
" xdamage enable xdamage polling hints.\n"
" noxdamage disable xdamage polling hints.\n"
" xd_area:A set -xd_area max pixel area to \"A\"\n"
@ -3608,38 +3681,40 @@ void print_help(int mode) {
" listen lookup nolookup accept afteraccept gone shm\n"
" noshm flipbyteorder noflipbyteorder onetile noonetile\n"
" solid_color solid nosolid blackout xinerama noxinerama\n"
" xtrap noxtrap xrandr noxrandr xrandr_mode rotate\n"
" padgeom quiet q noquiet modtweak nomodtweak xkb noxkb\n"
" capslock nocapslock skip_lockkeys noskip_lockkeys\n"
" skip_keycodes sloppy_keys nosloppy_keys skip_dups\n"
" noskip_dups add_keysyms noadd_keysyms clear_mods\n"
" noclear_mods clear_keys noclear_keys remap repeat\n"
" norepeat fb nofb bell nobell sel nosel primary\n"
" noprimary setprimary nosetprimary clipboard noclipboard\n"
" setclipboard nosetclipboard seldir cursorshape\n"
" nocursorshape cursorpos nocursorpos cursor_drag\n"
" nocursor_drag cursor show_cursor noshow_cursor\n"
" nocursor arrow xfixes noxfixes xdamage noxdamage\n"
" xd_area xd_mem alphacut alphafrac alpharemove\n"
" noalpharemove alphablend noalphablend xwarppointer\n"
" xwarp noxwarppointer noxwarp buttonmap dragging\n"
" nodragging ncache_cr noncache_cr ncache_no_moveraise\n"
" noncache_no_moveraise ncache_no_dtchange\n"
" noncache_no_dtchange ncache_no_rootpixmap\n"
" noncache_no_rootpixmap ncache_reset_rootpixmap\n"
" ncache_keep_anims noncache_keep_anims ncache noncache\n"
" ncache_size wireframe_mode wireframe wf nowireframe nowf\n"
" wireframelocal wfl nowireframelocal nowfl wirecopyrect\n"
" wcr nowirecopyrect nowcr scr_area scr_skip scr_inc\n"
" scr_keys scr_term scr_keyrepeat scr_parms scrollcopyrect\n"
" scr noscrollcopyrect noscr fixscreen noxrecord xrecord\n"
" reset_record pointer_mode pm input_skip allinput\n"
" noallinput input grabkbd nograbkbd grabptr nograbptr\n"
" client_input ssltimeout speeds wmdt debug_pointer dp\n"
" nodebug_pointer nodp debug_keyboard dk nodebug_keyboard\n"
" nodk deferupdate defer wait_ui wait_bog nowait_bog\n"
" slow_fb wait readtimeout nap nonap sb screen_blank\n"
" fbpm nofbpm dpms nodpms fs gaps grow fuzz snapfb\n"
" xtrap noxtrap xrandr noxrandr xrandr_mode rotate padgeom\n"
" quiet q noquiet modtweak nomodtweak xkb noxkb capslock\n"
" nocapslock skip_lockkeys noskip_lockkeys skip_keycodes\n"
" sloppy_keys nosloppy_keys skip_dups noskip_dups\n"
" add_keysyms noadd_keysyms clear_mods noclear_mods\n"
" clear_keys noclear_keys remap repeat norepeat fb nofb\n"
" bell nobell sel nosel primary noprimary setprimary\n"
" nosetprimary clipboard noclipboard setclipboard\n"
" nosetclipboard seldir cursorshape nocursorshape\n"
" cursorpos nocursorpos cursor_drag nocursor_drag cursor\n"
" show_cursor noshow_cursor nocursor arrow xfixes\n"
" noxfixes xdamage noxdamage xd_area xd_mem alphacut\n"
" alphafrac alpharemove noalpharemove alphablend\n"
" noalphablend xwarppointer xwarp noxwarppointer\n"
" noxwarp buttonmap dragging nodragging ncache_cr\n"
" noncache_cr ncache_no_moveraise noncache_no_moveraise\n"
" ncache_no_dtchange noncache_no_dtchange\n"
" ncache_no_rootpixmap noncache_no_rootpixmap\n"
" ncache_reset_rootpixmap ncache_keep_anims\n"
" noncache_keep_anims ncache_old_wm noncache_old_wm\n"
" ncache noncache ncache_size wireframe_mode wireframe wf\n"
" 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 client_input\n"
" ssltimeout speeds wmdt debug_pointer dp nodebug_pointer\n"
" nodp debug_keyboard dk nodebug_keyboard nodk deferupdate\n"
" defer wait_ui wait_bog nowait_bog slow_fb wait\n"
" readtimeout nap nonap sb screen_blank fbpm nofbpm dpms\n"
" nodpms clientdpms noclientdpms forcedpms noforcedpms\n"
" noserverdpms serverdpms fs gaps grow fuzz snapfb\n"
" nosnapfb rawfb uinput_accel uinput_thresh uinput_reset\n"
" uinput_always progressive rfbport http nohttp httpport\n"
" httpdir enablehttpproxy noenablehttpproxy alwaysshared\n"

@ -356,6 +356,9 @@ int watch_fbpm = 0;
#endif
int watch_dpms = 0; /* -dpms */
int force_dpms = 0;
int client_dpms = 0;
int no_ultra_dpms = 0;
int watch_selection = 1; /* normal selection/cutbuffer maintenance */
int watch_primary = 1; /* more dicey, poll for changes in PRIMARY */

@ -261,6 +261,9 @@ extern int all_input;
extern int watch_fbpm;
extern int watch_dpms;
extern int force_dpms;
extern int client_dpms;
extern int no_ultra_dpms;
extern int watch_selection;
extern int watch_primary;

@ -123,16 +123,22 @@ void set_dpms_mode(char *mode) {
want = DPMSModeStandby;
} else if (!strcmp(mode, "suspend")) {
want = DPMSModeSuspend;
} else if (!strcmp(mode, "enable")) {
DPMSEnable(dpy);
return;
} else if (!strcmp(mode, "disable")) {
DPMSDisable(dpy);
return;
} else {
return;
}
if (DPMSInfo(dpy, &level, &enabled)) {
char *from;
fprintf(stderr, "DPMSInfo level: %d enabled: %d\n", level, enabled);
if (enabled && level != want) {
XErrorHandler old_handler = XSetErrorHandler(trap_xerror);
trapped_xerror = 0;
rfbLog("DPMSInfo level: %d enabled: %d\n", level, enabled);
if (level == DPMSModeStandby) {
from = "DPMSModeStandby";
} else if (level == DPMSModeSuspend) {
@ -188,6 +194,14 @@ static void check_dpms(void) {
init_dpms = 1;
}
if (force_dpms || (client_dpms && client_count)) {
static int last_enable = 0;
if (time(NULL) > last_enable) {
set_dpms_mode("enable");
last_enable = time(NULL);
}
set_dpms_mode("off");
}
if (! watch_dpms) {
return;
}

@ -3287,6 +3287,9 @@ char *process_remote_cmd(char *cmd, int stringonly) {
goto qry;
}
grab_kbd = 1;
if (grab_always) {
adjust_grabs(1, 0);
}
rfbLog("enabled grab_kbd\n");
} else if (!strcmp(p, "nograbkbd")) {
int orig = grab_kbd;
@ -3303,12 +3306,16 @@ char *process_remote_cmd(char *cmd, int stringonly) {
#endif
}
rfbLog("disabled grab_kbd\n");
} else if (!strcmp(p, "grabptr")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p, grab_ptr);
goto qry;
}
grab_ptr = 1;
if (grab_always) {
adjust_grabs(1, 0);
}
rfbLog("enabled grab_ptr\n");
} else if (!strcmp(p, "nograbptr")) {
int orig = grab_ptr;
@ -3326,6 +3333,36 @@ char *process_remote_cmd(char *cmd, int stringonly) {
}
rfbLog("disabled grab_ptr\n");
} else if (!strcmp(p, "grabalways")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p, grab_always);
goto qry;
}
grab_ptr = 1;
grab_kbd = 1;
grab_always = 1;
adjust_grabs(1, 0);
rfbLog("enabled grab_always\n");
} else if (!strcmp(p, "nograbalways")) {
int orig = grab_always;
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p, !grab_always);
goto qry;
}
grab_ptr = 0;
grab_kbd = 0;
grab_always = 0;
if (orig && dpy) {
#if !NO_X11
X_LOCK;
XUngrabKeyboard(dpy, CurrentTime);
XUngrabPointer(dpy, CurrentTime);
X_UNLOCK;
#endif
}
adjust_grabs(0, 0);
rfbLog("disabled grab_always\n");
} else if (strstr(p, "client_input") == p) {
NOTAPP
COLON_CHECK("client_input:")
@ -3583,6 +3620,51 @@ char *process_remote_cmd(char *cmd, int stringonly) {
rfbLog("remote_cmd: turning on -nodpms mode.\n");
watch_dpms = 1;
} else if (!strcmp(p, "clientdpms")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p, client_dpms);
goto qry;
}
rfbLog("remote_cmd: turning on -clientdpms mode.\n");
client_dpms = 1;
} else if (!strcmp(p, "noclientdpms")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p, !client_dpms);
goto qry;
}
rfbLog("remote_cmd: turning off -clientdpms mode.\n");
client_dpms = 0;
} else if (!strcmp(p, "forcedpms")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p, force_dpms);
goto qry;
}
rfbLog("remote_cmd: turning on -forcedpms mode.\n");
force_dpms = 1;
} else if (!strcmp(p, "noforcedpms")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p, !force_dpms);
goto qry;
}
rfbLog("remote_cmd: turning off -forcedpms mode.\n");
force_dpms = 0;
} else if (!strcmp(p, "noserverdpms")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p, no_ultra_dpms);
goto qry;
}
rfbLog("remote_cmd: turning on -noserverdpms mode.\n");
no_ultra_dpms = 1;
} else if (!strcmp(p, "serverdpms")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p, !no_ultra_dpms);
goto qry;
}
rfbLog("remote_cmd: turning off -noserverdpms mode.\n");
no_ultra_dpms = 0;
} else if (strstr(p, "fs") == p) {
COLON_CHECK("fs:")
if (query) {

@ -1458,6 +1458,24 @@ void accept_openssl(int mode) {
}
close(i);
}
if (screen->listenSock >= 0) {
close(screen->listenSock);
FD_CLR(screen->listenSock,&screen->allFds);
screen->listenSock = -1;
}
if (screen->httpListenSock >= 0) {
close(screen->httpListenSock);
FD_CLR(screen->httpListenSock,&screen->allFds);
screen->httpListenSock = -1;
}
if (openssl_sock >= 0) {
close(openssl_sock);
openssl_sock = -1;
}
if (https_sock >= 0) {
close(https_sock);
https_sock = -1;
}
/*
* sadly, we are a long lived child and so the large

@ -869,6 +869,8 @@ char create_display[] =
"#!/bin/sh\n"
"\n"
"#CREATE_DISPLAY_OUTPUT=/tmp/cdo.txt\n"
"\n"
"CREATE_DISPLAY_OUTPUT=/tmp/cdo.$USER.txt\n"
"if [ \"X$CREATE_DISPLAY_OUTPUT\" != \"X\" ]; then\n"
" if [ \"X$CREATE_DISPLAY_EXEC\" = \"X\" ]; then\n"
" CREATE_DISPLAY_EXEC=1\n"
@ -1033,29 +1035,56 @@ char create_display[] =
" $have_xauth -f $authfile nextract - `hostname`:$N | $have_xauth nmerge -\n"
" fi\n"
"\n"
" result=0\n"
" ns=4\n"
" if [ \"X$use_xdmcp_query\" = \"X1\" ]; then\n"
" # we cannot use -nolisten tcp\n"
" #echo \"$* -from localhost -once -query localhost\"\n"
" #nohup $* -from localhost -once -query localhost 1>&2 &\n"
" echo \"$* -once -query localhost\" 1>&2\n"
" nohup $* -once -query localhost 1>&2 &\n"
" pid=$!\n"
" elif [ \"X$have_startx\" != \"X\" ]; then\n"
" echo \"$have_startx $sess -- $* -nolisten tcp -auth $authfile\" 1>&2\n"
" $have_startx $sess -- $* -nolisten tcp -auth $authfile 1>&2 &\n"
" if [ \"X$have_root\" != \"X\" ]; then\n"
" nohup $* -once -query localhost 1>&2 &\n"
" else\n"
" nohup sh -c \"(sleep $ns; $* -once -query localhost -auth $authfile)\" 1>&2 &\n"
" ns=0\n"
" result=1\n"
" fi\n"
" pid=$!\n"
" elif [ \"X$have_xinit\" != \"X\" ]; then\n"
" echo \"$have_xinit $sess -- $* -nolisten tcp -auth $authfile\" 1>&2\n"
" $have_xinit $sess -- $* -nolisten tcp -auth $authfile 1>&2 &\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"
" sxcmd=$have_xinit\n"
" fi\n"
" echo \"$sxcmd $sess -- $* -nolisten tcp -auth $authfile\" 1>&2\n"
" if [ \"X$have_root\" != \"X\" ]; then\n"
" $sxcmd $sess -- $* -nolisten tcp -auth $authfile 1>&2 &\n"
" else\n"
" nohup sh -c \"(sleep $ns; $sxcmd $sess -- $* -nolisten tcp -auth $authfile)\" 1>&2 &\n"
" ns=0\n"
" result=1\n"
" fi\n"
" pid=$!\n"
" else\n"
" echo \"$* -nolisten tcp -auth $authfile\" 1>&2\n"
" nohup $* -nolisten tcp -auth $authfile 1>&2 &\n"
" pid=$!\n"
" nohup $sess 1>&2 &\n"
" if [ \"X$have_root\" != \"X\" ]; then\n"
" nohup $* -nolisten tcp -auth $authfile 1>&2 &\n"
" pid=$!\n"
" sleep 2\n"
" nohup $sess 1>&2 &\n"
" else\n"
" nohup sh -c \"(sleep $ns; $* -nolisten tcp -auth $authfile)\" 1>&2 &\n"
" pid=$!\n"
" sleep 2\n"
" nohup sh -c \"(sleep $ns; $sess)\" 1>&2 &\n"
" ns=0\n"
" result=1\n"
" fi\n"
" fi\n"
" sleep 4\n"
" if kill -0 $pid; then\n"
" sleep $ns\n"
" if [ \"X$result\" = \"X1\" ]; then\n"
" :\n"
" elif [ -d /proc/$pid ]; then\n"
" result=1\n"
" elif kill -0 $pid; then\n"
" result=1\n"
" else\n"
" result=0\n"
@ -1123,17 +1152,33 @@ char create_display[] =
" #have_startx=$save_have_startx\n"
"\n"
" if [ \"X$result\" = \"X1\" -a \"X$have_xmodmap\" != \"X\" ]; then\n"
" (\n"
" sleep 1; $have_xmodmap -display :$N -e \"keycode any = Shift_R\" \n"
" sleep 1; $have_xmodmap -display :$N -e \"add Shift = Shift_L Shift_R\" \n"
" sleep 1; $have_xmodmap -display :$N -e \"keycode any = Control_R\" \n"
" sleep 1; $have_xmodmap -display :$N -e \"add Control = Control_L Control_R\" \n"
" sleep 1; $have_xmodmap -display :$N -e \"keycode any = Alt_L\" \n"
" sleep 1; $have_xmodmap -display :$N -e \"keycode any = Alt_R\" \n"
" sleep 1; $have_xmodmap -display :$N -e \"keycode any = Meta_L\" \n"
" sleep 1; $have_xmodmap -display :$N -e \"clear Mod1\" \n"
" sleep 1; $have_xmodmap -display :$N -e \"add Mod1 = Alt_L Alt_R Meta_L\" \n"
" ) 1>&2 &\n"
" if [ \"X$have_root\" = \"X\" ]; then\n"
" nohup sh -c \"(\n"
" sleep 6;\n"
" $have_xmodmap -display :$N -e 'keycode any = Shift_R' \\\n"
" -e 'add Shift = Shift_L Shift_R' \\\n"
" -e 'keycode any = Control_R' \\\n"
" -e 'add Control = Control_L Control_R' \\\n"
" -e 'keycode any = Alt_L' \\\n"
" -e 'keycode any = Alt_R' \\\n"
" -e 'keycode any = Meta_L' \\\n"
" -e 'clear Mod1' \\\n"
" -e 'add Mod1 = Alt_L Alt_R Meta_L' \\\n"
" )\" 1>&2 &\n"
" else\n"
" (\n"
" sleep 1;\n"
" $have_xmodmap -display :$N -e 'keycode any = Shift_R' \\\n"
" -e 'add Shift = Shift_L Shift_R' \\\n"
" -e 'keycode any = Control_R' \\\n"
" -e 'add Control = Control_L Control_R' \\\n"
" -e 'keycode any = Alt_L' \\\n"
" -e 'keycode any = Alt_R' \\\n"
" -e 'keycode any = Meta_L' \\\n"
" -e 'clear Mod1' \\\n"
" -e 'add Mod1 = Alt_L Alt_R Meta_L' \\\n"
" ) 1>&2 &\n"
" fi\n"
" fi\n"
"}\n"
"\n"

@ -213,6 +213,7 @@ Pointer
=D nocursorshape
--
noxfixes
cursor_drag
=GAL AlphaBlending::
noalphablend
alphacut:
@ -257,6 +258,8 @@ Misc
=D nobell
nolookup
bg
=S loop
=S loopbg
=-C:ignore,exit sigpipe:
=0 inetd
@ -329,6 +332,10 @@ Permissions
timeout:
grabkbd
grabptr
grabalways
forcedpms
clientdpms
noserverdpms
=GAL LOFF
Tuning

@ -224,6 +224,7 @@ char gui_code[] = "";
" =D nocursorshape\n"
" --\n"
" noxfixes\n"
" cursor_drag\n"
" =GAL AlphaBlending::\n"
" noalphablend\n"
" alphacut:\n"
@ -268,6 +269,8 @@ char gui_code[] = "";
" =D nobell\n"
" nolookup\n"
" bg\n"
" =S loop\n"
" =S loopbg\n"
" =-C:ignore,exit sigpipe:\n"
" =0 inetd\n"
"\n"
@ -340,6 +343,10 @@ char gui_code[] = "";
" timeout:\n"
" grabkbd\n"
" grabptr\n"
" grabalways\n"
" forcedpms\n"
" clientdpms\n"
" noserverdpms\n"
" =GAL LOFF\n"
"\n"
"Tuning\n"

@ -558,7 +558,7 @@ int su_verify(char *user, char *pass, char *cmd, char *rbuf, int *rbuf_size, int
#ifndef UNIXPW_SU
return 0;
#else
int i, j, status, fd = -1, sfd, tfd, drain_size = 4096, rsize = 0;
int i, j, status, fd = -1, sfd, tfd, drain_size = 65536, rsize = 0;
int slow_pw = 1;
char *slave, *bin_true = NULL, *bin_su = NULL;
pid_t pid, pidw;
@ -1542,7 +1542,7 @@ void unixpw_accept(char *user) {
} else if (switch_user(u, 0)) {
rfbLog("unixpw_accept switched to user: %s\n", user);
} else {
rfbLog("unixpw_accept failed to switched to user: %s\n", user);
rfbLog("unixpw_accept failed to switch to user: %s\n", user);
}
free(u);
}

@ -1404,6 +1404,7 @@ int wait_for_client(int *argc, char** argv, int http) {
break;
}
if (unixpw) {
if (! unixpw_in_progress) {
rfbLog("unixpw but no unixpw_in_progress\n");
@ -1517,12 +1518,15 @@ if (db) {fprintf(stderr, "line: "); write(2, line, n); write(2, "\n", 1); fprint
fprintf(mt, "%s", create_display);
fclose(mt);
findcreatedisplay = 1;
if (getuid() != 0) {
/* if not root, run as the other user... */
n = 18000;
close_exec_fds();
res = su_verify(keep_unixpw_user,
keep_unixpw_pass, create_cmd, line, &n, nodisp);
if (db) fprintf(stderr, "line: '%s'\n", line);
if (db) fprintf(stderr, "c-res=%d n=%d line: '%s'\n", res, n, line);
} else {
FILE *p;
@ -1633,6 +1637,8 @@ if (db) fprintf(stderr, "\n");
fprintf(mt, "%s", create_display);
fclose(mt);
findcreatedisplay = 1;
rfbLog("wait_for_client: FINDCREATEDISPLAY cmd: %s\n", create_cmd);
p = popen(create_cmd, "r");
@ -1772,7 +1778,7 @@ fprintf(stderr, "\n");}
} else if (switch_user(u, 0)) {
rfbLog("unixpw_accept switched to user: %s\n", user);
} else {
rfbLog("unixpw_accept failed to switched to user: %s\n", user);
rfbLog("unixpw_accept failed to switch to user: %s\n", user);
}
free(u);
}

@ -2,7 +2,7 @@
.TH X11VNC "1" "February 2007" "x11vnc " "User Commands"
.SH NAME
x11vnc - allow VNC connections to real X11 displays
version: 0.8.5, lastmod: 2007-02-10
version: 0.8.5, lastmod: 2007-02-11
.SH SYNOPSIS
.B x11vnc
[OPTION]...
@ -360,13 +360,30 @@ as soon as the first client(s) disconnect. Same as \fB-many\fR
\fB-loop\fR
.IP
Create an outer loop restarting the x11vnc process
whenever it terminates. \fB-bg\fR and \fB-inetd\fR are ignored in
this mode. Useful for continuing even if the X server
terminates and restarts (you will need permission to
reconnect of course). Use, e.g., \fB-loop100\fR to sleep
100 millisecs between restarts, etc. Default is 2000ms
(i.e. 2 secs) Use, e.g. \fB-loop300,5\fR to sleep 300 ms
and only loop 5 times.
whenever it terminates. \fB-bg\fR and \fB-inetd\fR are ignored
in this mode (however see \fB-loopbg\fR below).
.IP
Useful for continuing even if the X server terminates
and restarts (at that moment the process will need
permission to reconnect to the new X server of course).
.IP
Use, e.g., \fB-loop100\fR to sleep 100 millisecs between
restarts, etc. Default is 2000ms (i.e. 2 secs) Use,
e.g. \fB-loop300,5\fR to sleep 300 ms and only loop 5 times.
.IP
If \fB-loopbg\fR (plus any numbers) is specified instead,
the "\fB-bg\fR" option is implied and the mode approximates
.IR inetd (8)
usage to some degree. In this case when
it goes into the background any listening sockets
(i.e. ports 5900, 5800) are closed, so the next one
in the loop can use them. This mode will only be of
use if a VNC client (the only client for that process)
is already connected before the process goes into the
background, for example, usage of \fB-display\fR WAIT:..,
\fB-svc,\fR and \fB-connect\fR can make use of this "poor man's"
inetd mode. The default wait time is 500ms in this
mode. This usage could use useful: \fB-svc\fR \fB-loopbg\fR
.PP
\fB-timeout\fR \fIn\fR
.IP
@ -544,6 +561,13 @@ for resizes, etc, will
act on the local user's input. Again, some degree of
cooperation from the person at the display is assumed.
.PP
\fB-grabalways\fR
.IP
Apply both \fB-grabkbd\fR and \fB-grabptr\fR even when no VNC
viewers are connected. If you only want one of them,
use the \fB-R\fR remote control to turn the other back on,
e.g. \fB-R\fR nograbptr.
.PP
\fB-viewpasswd\fR \fIstring\fR
.IP
Supply a 2nd password for view-only logins. The \fB-passwd\fR
@ -819,6 +843,18 @@ is given 3 tries to enter the correct password.
If a list of allowed users is needed use \fB-unixpw\fR [list]
in addition to this option.
.PP
\fB-svc\fR
.IP
Terminal services mode. Also "\fB-service\fR", implies
\fB-display\fR WAIT:cmd=FINDCREATEDISPLAY-Xvfb \fB-unixpw\fR
\fB-users\fR unixpw= \fB-ssl\fR SAVE
.PP
\fB-xdmsvc\fR
.IP
Terminal services mode. Also "\fB-xdm_service\fR", implies
\fB-display\fR WAIT:cmd=FINDCREATEDISPLAY-Xvfb.xdmcp \fB-unixpw\fR
\fB-users\fR unixpw= \fB-ssl\fR SAVE
.PP
\fB-display\fR \fIWAIT:...\fR
.IP
A special usage mode for the normal \fB-display\fR option.
@ -928,7 +964,7 @@ by client web browsers. For example:
Where /.../x11vnc is the full path to x11vnc.
It is used in the Apache SSL-portal example (see FAQ).
.IP
An experimental option is WAIT:cmd=FINDCREATEDISPLAY
An interesting option is WAIT:cmd=FINDCREATEDISPLAY
that is like FINDDISPLAY in that is uses the same method
to find an existing display. However, if it does not
find one it will try to *start* up an X server session
@ -943,11 +979,12 @@ the shared library. Xdummy requires root permission
and only works on Linux. Xvfb is available on most
platforms and does not require root.
.IP
When x11vnc exits (i.e. user disconnects) the X server
session stays running in the background. Presumably
the FINDDISPLAY will find it next time. The user must
exit the X session in the usual way for it to terminate
(or kill the X server process if all else fails).
When x11vnc exits (i.e. user disconnects) the X
server session stays running in the background.
The FINDDISPLAY will find it directly next time.
The user must exit the X session in the usual way for
it to terminate (or kill the X server process if all
else fails).
.IP
So this is a somewhat odd mode for x11vnc in that it
will start up and poll virtual X servers! This can
@ -991,6 +1028,15 @@ display manager. This seems to be:
for gdm in gdm.conf: Enable=true in section [xdmcp]
for kdm in kdmrc: Enable=true in section [Xdmcp]
for xdm in xdm-config: DisplayManager.requestPort: 177
.IP
See the shorthand options above "\fB-svc\fR" and "\fB-xdmsvc\fR"
that specify the above options for some useful cases.
.PP
\fB-nossl\fR
.IP
Disable the \fB-ssl\fR option (see below). Since \fB-ssl\fR is off
by default \fB-nossl\fR would only be used on the commandline
to unset any *earlier* \fB-ssl\fR option (or \fB-svc...)\fR
.PP
\fB-ssl\fR \fI[pem]\fR
.IP
@ -3117,6 +3163,38 @@ manpage
for details. \fB-nodpms\fR is basically the same as running
"xset dpms force on" periodically. Default: \fB-dpms\fR
.PP
\fB-forcedpms\fR
.IP
If the system supports the DPMS (Display Power
Management Signaling) extension, then try to keep the
monitor in a powered off state. This is to prevent
nosey people at the physical display from viewing
what is on the screen. Be sure lock the screen before
disconnecting.
.IP
This method is far from bullet proof, e.g. suppose
someone attaches a non-DPMS monitor, or loads the
machine so that there is a gap of time before x11vnc
restores the powered off state? On many machines if
he floods it with keyboard and mouse input he can see
flashes of what is on the screen before the DPMS off
state is reestablished. For this to work securely
there would need to be support in the X server to do
this exactly rather than approximately with DPMS.
.PP
\fB-clientdpms\fR
.IP
As \fB-forcedpms\fR but only when VNC clients are connected.
.PP
\fB-noserverdpms\fR
.IP
The UltraVNC ServerInput extension is supported.
This allows the VNC viewer to click a button that will
cause the server (x11vnc) to try to disable keyboard
and mouse input at the physical display and put the
monitor in dpms powered off state. Use this option to
skip powering off the monitor.
.PP
\fB-noxdamage\fR
.IP
Do not use the X DAMAGE extension to detect framebuffer
@ -3940,6 +4018,10 @@ grabptr enable \fB-grabptr\fR mode.
.IP
nograbptr disable \fB-grabptr\fR mode.
.IP
grabalways enable \fB-grabalways\fR mode.
.IP
nograbalways disable \fB-grabalways\fR mode.
.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
@ -4245,6 +4327,18 @@ dpms disable \fB-nodpms\fR mode.
.IP
nodpms enable \fB-nodpms\fR mode.
.IP
forcedpms enable \fB-forcedpms\fR mode.
.IP
noforcedpms disable \fB-forcedpms\fR mode.
.IP
clientdpms enable \fB-clientdpms\fR mode.
.IP
noclientdpms disable \fB-clientdpms\fR mode.
.IP
noserverdpms enable \fB-noserverdpms\fR mode.
.IP
serverdpms disable \fB-noserverdpms\fR mode.
.IP
xdamage enable xdamage polling hints.
.IP
noxdamage disable xdamage polling hints.
@ -4422,38 +4516,40 @@ unlock connect allowonce allow localhost nolocalhost
listen lookup nolookup accept afteraccept gone shm
noshm flipbyteorder noflipbyteorder onetile noonetile
solid_color solid nosolid blackout xinerama noxinerama
xtrap noxtrap xrandr noxrandr xrandr_mode rotate
padgeom quiet q noquiet modtweak nomodtweak xkb noxkb
capslock 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 remap repeat
norepeat fb nofb bell nobell 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
noalpharemove alphablend noalphablend xwarppointer
xwarp noxwarppointer noxwarp buttonmap dragging
nodragging ncache_cr noncache_cr ncache_no_moveraise
noncache_no_moveraise ncache_no_dtchange
noncache_no_dtchange ncache_no_rootpixmap
noncache_no_rootpixmap ncache_reset_rootpixmap
ncache_keep_anims noncache_keep_anims ncache noncache
ncache_size 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
client_input ssltimeout speeds wmdt debug_pointer dp
nodebug_pointer nodp debug_keyboard dk nodebug_keyboard
nodk deferupdate defer wait_ui wait_bog nowait_bog
slow_fb wait readtimeout nap nonap sb screen_blank
fbpm nofbpm dpms nodpms fs gaps grow fuzz snapfb
xtrap noxtrap xrandr noxrandr xrandr_mode rotate padgeom
quiet q noquiet modtweak nomodtweak xkb noxkb capslock
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 remap repeat norepeat fb nofb
bell nobell 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 noalpharemove alphablend
noalphablend xwarppointer xwarp noxwarppointer
noxwarp buttonmap dragging nodragging ncache_cr
noncache_cr ncache_no_moveraise noncache_no_moveraise
ncache_no_dtchange noncache_no_dtchange
ncache_no_rootpixmap noncache_no_rootpixmap
ncache_reset_rootpixmap ncache_keep_anims
noncache_keep_anims ncache_old_wm noncache_old_wm
ncache noncache ncache_size 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 client_input
ssltimeout speeds wmdt debug_pointer dp nodebug_pointer
nodp debug_keyboard dk nodebug_keyboard nodk deferupdate
defer wait_ui wait_bog nowait_bog slow_fb wait
readtimeout nap nonap sb screen_blank fbpm nofbpm dpms
nodpms clientdpms noclientdpms forcedpms noforcedpms
noserverdpms serverdpms fs gaps grow fuzz snapfb
nosnapfb rawfb uinput_accel uinput_thresh uinput_reset
uinput_always progressive rfbport http nohttp httpport
httpdir enablehttpproxy noenablehttpproxy alwaysshared

@ -1302,12 +1302,16 @@ static void check_loop_mode(int argc, char* argv[]) {
loop_max = atoi(q+1);
*q = '\0';
}
if (strstr(p, "-loopbg") == p) {
set_env("X11VNC_LOOP_MODE_BG", "1");
loop_sleep = 500;
}
q = strpbrk(p, "0123456789");
if (q) {
loop_sleep = atoi(q);
if (loop_sleep <= 0) {
loop_sleep = 10;
loop_sleep = 20;
}
}
}
@ -1528,7 +1532,6 @@ int main(int argc, char* argv[]) {
int dt = 0, bg = 0;
int got_rfbwait = 0;
int got_httpdir = 0, try_http = 0;
int waited_for_client = 0;
int orig_use_xdamage = use_xdamage;
XImage *fb0 = NULL;
@ -1745,6 +1748,14 @@ int main(int argc, char* argv[]) {
connect_once = 0;
} else if (strstr(arg, "-loop") == arg) {
; /* handled above */
#if LIBVNCSERVER_HAVE_SETSID
bg = 1;
opts_bg = bg;
#else
fprintf(stderr, "warning: -bg mode not supported.\n");
#endif
} else if (strstr(arg, "-loop") == arg) {
; /* handled above */
} else if (!strcmp(arg, "-timeout")) {
CHECK_ARGC
first_conn_timeout = atoi(argv[++i]);
@ -1792,6 +1803,10 @@ int main(int argc, char* argv[]) {
grab_kbd = 1;
} else if (!strcmp(arg, "-grabptr")) {
grab_ptr = 1;
} else if (!strcmp(arg, "-grabalways")) {
grab_kbd = 1;
grab_ptr = 1;
grab_always = 1;
} else if (!strcmp(arg, "-viewpasswd")) {
vpw_loc = i;
CHECK_ARGC
@ -1801,6 +1816,18 @@ int main(int argc, char* argv[]) {
CHECK_ARGC
passwdfile = strdup(argv[++i]);
got_passwdfile = 1;
} else if (!strcmp(arg, "-svc") || !strcmp(arg, "-service")) {
use_dpy = strdup("WAIT:cmd=FINDCREATEDISPLAY-Xvfb");
unixpw = 1;
users_list = strdup("unixpw=");
use_openssl = 1;
openssl_pem = strdup("SAVE");
} else if (!strcmp(arg, "-xdmsvc") || !strcmp(arg, "-xdm_service")) {
use_dpy = strdup("WAIT:cmd=FINDCREATEDISPLAY-Xvfb.xdmcp");
unixpw = 1;
users_list = strdup("unixpw=");
use_openssl = 1;
openssl_pem = strdup("SAVE");
#ifndef NO_SSL_OR_UNIXPW
} else if (!strcmp(arg, "-unixpw_cmd")
|| !strcmp(arg, "-unixpw_cmd_unsafe")) {
@ -1834,6 +1861,9 @@ int main(int argc, char* argv[]) {
set_env("UNIXPW_DISABLE_SSL", "1");
set_env("UNIXPW_DISABLE_LOCALHOST", "1");
}
} else if (!strcmp(arg, "-nossl")) {
use_openssl = 0;
openssl_pem = NULL;
} else if (!strcmp(arg, "-ssl")) {
use_openssl = 1;
if (i < argc-1) {
@ -2344,6 +2374,12 @@ int main(int argc, char* argv[]) {
watch_dpms = 1;
} else if (!strcmp(arg, "-dpms")) {
watch_dpms = 0;
} else if (!strcmp(arg, "-forcedpms")) {
force_dpms = 1;
} else if (!strcmp(arg, "-clientdpms")) {
client_dpms = 1;
} else if (!strcmp(arg, "-noserverdpms")) {
no_ultra_dpms = 1;
} else if (!strcmp(arg, "-xdamage")) {
use_xdamage++;
} else if (!strcmp(arg, "-noxdamage")) {
@ -2563,7 +2599,7 @@ int main(int argc, char* argv[]) {
orig_use_xdamage = use_xdamage;
if (getenv("X11VNC_LOOP_MODE")) {
if (bg) {
if (bg && !getenv("X11VNC_LOOP_MODE_BG")) {
if (! quiet) {
fprintf(stderr, "disabling -bg in -loop "
"mode\n");
@ -3210,6 +3246,13 @@ int main(int argc, char* argv[]) {
scr = DefaultScreen(dpy);
rootwin = RootWindow(dpy, scr);
if (grab_always) {
Window save = window;
window = rootwin;
adjust_grabs(1, 0);
window = save;
}
if (! quiet && ! raw_fb_str) {
rfbLog("\n");
rfbLog("------------------ USEFUL INFORMATION ------------------\n");
@ -3764,6 +3807,26 @@ int main(int argc, char* argv[]) {
#if LIBVNCSERVER_HAVE_FORK && LIBVNCSERVER_HAVE_SETSID
if (bg) {
if (getenv("X11VNC_LOOP_MODE_BG")) {
if (screen && screen->listenSock >= 0) {
close(screen->listenSock);
FD_CLR(screen->listenSock,&screen->allFds);
screen->listenSock = -1;
}
if (screen && screen->httpListenSock >= 0) {
close(screen->httpListenSock);
FD_CLR(screen->httpListenSock,&screen->allFds);
screen->httpListenSock = -1;
}
if (openssl_sock >= 0) {
close(openssl_sock);
openssl_sock = -1;
}
if (https_sock >= 0) {
close(https_sock);
https_sock = -1;
}
}
/* fork into the background now */
int p, n;
if ((p = fork()) > 0) {

@ -482,6 +482,9 @@ extern int hack_val;
extern rfbClientPtr last_pointer_client;
extern rfbClientPtr latest_client;
extern int waited_for_client;
extern int findcreatedisplay;
extern int client_count;
extern int clients_served;

@ -15,7 +15,7 @@ int xtrap_base_event_type = 0;
int xdamage_base_event_type = 0;
/* date +'lastmod: %Y-%m-%d' */
char lastmod[] = "0.8.5 lastmod: 2007-02-10";
char lastmod[] = "0.8.5 lastmod: 2007-02-11";
/* X display info */
@ -146,6 +146,9 @@ int hack_val = 0;
rfbClientPtr last_pointer_client = NULL;
rfbClientPtr latest_client = NULL;
int waited_for_client = 0;
int findcreatedisplay = 0;
int client_count = 0;
int clients_served = 0;

@ -21,6 +21,7 @@
int grab_buster = 0;
int grab_kbd = 0;
int grab_ptr = 0;
int grab_always = 0;
int sync_tod_delay = 20;
void initialize_vnc_connect_prop(void);
@ -871,6 +872,7 @@ void check_xevents(int reset) {
XSetErrorHandler(old_handler);
trapped_xerror = 0;
last_call = now;
}
/* check for CUT_BUFFER0 and VNC_CONNECT changes: */
@ -1156,7 +1158,6 @@ void check_xevents(int reset) {
}
X_UNLOCK;
last_call = now;
#endif /* NO_X11 */
}
@ -1346,14 +1347,22 @@ void set_server_input(rfbClientPtr cl, int grab) {
return;
#else
if (grab) {
if (!no_ultra_dpms) {
set_dpms_mode("enable");
set_dpms_mode("off");
force_dpms = 1;
}
process_remote_cmd("cmd=grabkbd", 0);
process_remote_cmd("cmd=grabptr", 0);
set_dpms_mode("off");
} else {
process_remote_cmd("cmd=nograbkbd", 0);
process_remote_cmd("cmd=nograbptr", 0);
if (!no_ultra_dpms) {
force_dpms = 0;
}
}
#endif
}

@ -6,6 +6,7 @@
extern int grab_buster;
extern int grab_kbd;
extern int grab_ptr;
extern int grab_always;
extern int sync_tod_delay;
extern void initialize_vnc_connect_prop(void);

@ -1042,7 +1042,7 @@ int xauth_raw(int on) {
rfbLog("could not create tmp xauth file: %s\n", tmp);
return 0;
}
if (db) fprintf(stderr, "tmp: %s\n", tmp);
if (db) fprintf(stderr, "XAUTHORITY tmp: %s\n", tmp);
write(tmp_fd, xauth_raw_data, xauth_raw_len);
close(tmp_fd);
if (getenv("XAUTHORITY")) {

Loading…
Cancel
Save