Commit d6c012e9 authored by runge's avatar runge

X props names via env var. fakebuttonevent action, connect_switch and

ultravnc_repeater.pl scripts, find_display try FD_XDM on failure,
-quiet and -storepasswd changes, better port 113 testing.
parent 8f5c9ef0
2009-12-15 Karl Runge <runge@karlrunge.com>
* x11vnc: X11VNC_REMOTE, X11VNC_TICKER, and VNC_CONNECT properties
names can be changed via env. vars (e.g. for multiple
x11vnc instances.) The -quiet option documented better.
Add fakebuttonevent remote control action. Improve child
test for connecting to port 113. Add connect_switch and
ultravnc_repeater.pl to CVS. Report X server number of mouse
buttons. Change find_display script to check for stale pids
in /tmp/.XNN-lock. If root under find_display, try FD_XDM
if previous failed to find auth. Print error reasons for
-storepasswd failures.
2009-12-06 Karl Runge <runge@karlrunge.com>
* x11vnc: findauth/-auth guess works with FD_XDM=1 for root
finding dm's xauthority. Work around for GDM's recent
......
This diff is collapsed.
......@@ -664,6 +664,15 @@ void print_help(int mode) {
" X11VNC_REMOTE channel, and this option disables/enables\n"
" it as well. Default: %s\n"
"\n"
" To use different names for these X11 properties (e.g. to\n"
" have separate communication channels for multiple\n"
" x11vnc's on the same display) set the VNC_CONNECT or\n"
" X11VNC_REMOTE env. vars. to the string you want, for\n"
" example: -env X11VNC_REMOTE=X11VNC_REMOTE_12345\n"
" Both sides of the channel must use the same unique name.\n"
" The same can be done for the internal X11VNC_TICKER\n"
" property (heartbeat and timestamp) if desired.\n"
"\n"
"-allow host1[,host2..] Only allow client connections from hosts matching\n"
" the comma separated list of hostnames or IP addresses.\n"
" Can also be a numerical IP prefix, e.g. \"192.168.100.\"\n"
......@@ -2834,6 +2843,12 @@ void print_help(int mode) {
"\n"
"-q, -quiet Be quiet by printing less informational output to\n"
" stderr. (use -noquiet to undo an earlier -quiet.)\n"
"\n"
" The -quiet option does not eliminate all informational\n"
" output, it only reduces it. It is ignored in most\n"
" auxiliary usage modes, e.g. -storepasswd. To eliminate\n"
" all output use: 2>/dev/null 1>&2, etc.\n"
"\n"
"-v, -verbose Print out more information to stderr.\n"
"\n"
"-bg Go into the background after screen setup. Messages to\n"
......@@ -4635,6 +4650,13 @@ 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 use a different name for the X11 property (e.g. to\n"
" have separate communication channels for multiple\n"
" x11vnc's on the same display) set the X11VNC_REMOTE\n"
" environment variable to the string you want, for\n"
" example: -env X11VNC_REMOTE=X11VNC_REMOTE_12345\n"
" Both sides of the channel must use the same unique name.\n"
"\n"
" To run a bunch of commands in a sequence use something\n"
" like: x11vnc -R 'script:firstcmd;secondcmd;...'\n"
"\n"
......@@ -4921,6 +4943,7 @@ void print_help(int mode) {
" 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"
" fakebuttonevent:button,down direct XTestFakeButtonEvent.\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"
......@@ -5199,8 +5222,8 @@ void print_help(int mode) {
" 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"
" debug_keyboard dk nodebug_keyboard nodk keycode keysym\n"
" ptr fakebuttonevent 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"
......
......@@ -212,6 +212,7 @@ char *ident_username(rfbClientPtr client) {
char msg[128];
int n, sock, ok = 0;
int block = 0;
int refused = 0;
/*
* need to check to see if the operation will block for
......@@ -221,14 +222,24 @@ char *ident_username(rfbClientPtr client) {
{ pid_t pid, pidw;
int rc;
if ((pid = fork()) > 0) {
usleep(100 * 1000); /* 0.1 sec */
usleep(100 * 1000); /* 0.1 sec for quick success or refusal */
pidw = waitpid(pid, &rc, WNOHANG);
if (pidw <= 0) {
usleep(1000 * 1000); /* 1.0 sec */
usleep(1500 * 1000); /* 1.5 sec */
pidw = waitpid(pid, &rc, WNOHANG);
if (pidw <= 0) {
int rc2;
rfbLog("ident_username: set block=1 (hung)\n");
block = 1;
kill(pid, SIGTERM);
usleep(100 * 1000);
waitpid(pid, &rc2, WNOHANG);
}
}
if (pidw > 0 && !block) {
if (WIFEXITED(rc) && WEXITSTATUS(rc) == 1) {
rfbLog("ident_username: set refused=1 (exit)\n");
refused = 1;
}
}
} else if (pid == -1) {
......@@ -249,10 +260,10 @@ char *ident_username(rfbClientPtr client) {
}
}
#endif
if (block) {
if (block || refused) {
;
} else if ((sock = rfbConnectToTcpAddr(client->host, 113)) < 0) {
rfbLog("could not connect to ident: %s:%d\n",
rfbLog("ident_username: could not connect to ident: %s:%d\n",
client->host, 113);
} else {
int ret;
......
SUBDIRS = turbovnc
DIST_SUBDIRS = turbovnc
EXTRA_DIST=README blockdpy.c dtVncPopup rx11vnc rx11vnc.pl shm_clear ranfb.pl slide.pl vcinject.pl x11vnc_loop Xdummy
EXTRA_DIST=README blockdpy.c dtVncPopup rx11vnc rx11vnc.pl shm_clear ranfb.pl slide.pl vcinject.pl x11vnc_loop Xdummy ultravnc_repeater.pl connect_switch
This diff is collapsed.
This diff is collapsed.
......@@ -111,6 +111,7 @@ int connect_once = 1; /* disconnect after first connection session. */
int connect_once = 0;
#endif
int got_connect_once = 0;
int got_findauth = 0;
int deny_all = 0; /* global locking of new clients */
#ifndef REMOTE_DEFAULT
#define REMOTE_DEFAULT 1
......
......@@ -102,6 +102,7 @@ extern int opts_bg;
extern int shared;
extern int connect_once;
extern int got_connect_once;
extern int got_findauth;
extern int deny_all;
extern int accept_remote_cmds;
extern char *remote_prefix;
......
......@@ -265,9 +265,11 @@ void initialize_pointer_map(char *pointer_remap) {
X_LOCK;
num_buttons = XGetPointerMapping(dpy, map, MAX_BUTTONS);
X_UNLOCK;
rfbLog("The X server says there are %d mouse buttons.\n", num_buttons);
#endif
} else {
num_buttons = 5;
rfbLog("Manually set num_buttons to: %d\n", num_buttons);
}
if (num_buttons < 0) {
......
......@@ -4233,6 +4233,21 @@ char *process_remote_cmd(char *cmd, int stringonly) {
goto done;
}
if (strstr(p, "fakebuttonevent") == p) {
int mb, down = 0;
NOTAPP
COLON_CHECK("fakebuttonevent:")
p += strlen("fakebuttonevent:");
rfbLog("remote_cmd: insert fakebuttonevent: %s\n", p);
if (sscanf(p, "%d,%d", &mb, &down) == 2) {
X_LOCK;
rfbLog("remote_cmd: XTestFakeButtonEvent(mb=%d, down=%d)\n", mb, down);
XTestFakeButtonEvent_wr(dpy, mb, down ? True : False, CurrentTime);
X_UNLOCK;
}
goto done;
}
if (strstr(p, "sleep") == p) {
NOTAPP
COLON_CHECK("sleep:")
......
......@@ -1652,7 +1652,7 @@ if (db) fprintf(stderr, "initialize_raw_fb reset\n");
}
if (strstr(rstr, "solid=") == rstr) {
char *n = rstr + strlen("solid=");
char tmp[] = "/tmp/solid.XXXXXX";
char tmp[] = "/tmp/rawfb_solid.XXXXXX";
char str[100];
unsigned int vals[1024], val;
int x, y, fd, w = 1024, h = 768;
......@@ -1680,7 +1680,7 @@ if (db) fprintf(stderr, "initialize_raw_fb reset\n");
sprintf(str, "map:%s@%dx%dx32", tmp, w, h);
rstr = strdup(str);
} else if (strstr(rstr, "swirl") == rstr) {
char tmp[] = "/tmp/solid.XXXXXX";
char tmp[] = "/tmp/rawfb_swirl.XXXXXX";
char str[100];
unsigned int val[1024];
unsigned int c1, c2, c3, c4;
......
......@@ -911,7 +911,7 @@ char find_display[] =
" dL=\"-h\"\n"
"fi\n"
"\n"
"# a portable, but not absolutely safe, tmp file creator\n"
"# a portable tmp file creator\n"
"mytmp() {\n"
" tf=$1\n"
" if type mktemp > /dev/null 2>&1; then\n"
......@@ -1462,7 +1462,26 @@ char create_display[] =
" fi\n"
" while [ $try -lt $sry ]\n"
" do\n"
" if [ ! -f \"/tmp/.X${try}-lock\" ]; then\n"
" tlock=\"/tmp/.X${try}-lock\"\n"
" if [ -r $tlock ]; then\n"
" if echo \"$nsout\" | grep \"/tmp/.X11-unix/X${try}[ ]*\\$\" > /dev/null; then\n"
" :\n"
" else\n"
" pid=`head -n 1 $tlock 2>/dev/null | sed -e 's/[ ]//g' | grep '^[0-9][0-9]*$'`\n"
" if [ \"X$pid\" != \"X\" ]; then\n"
" exists=0\n"
" if [ -d /proc/$pid ]; then\n"
" exists=1\n"
" elif kill -0 $pid 2>/dev/null; then\n"
" exists=1\n"
" fi\n"
" if [ \"X$exists\" = \"X0\" ]; then\n"
" rm -f $tlock\n"
" fi\n"
" fi\n"
" fi\n"
" fi\n"
" if [ ! -f $tlock ]; then\n"
" if echo \"$nsout\" | grep \"/tmp/.X11-unix/X${try}[ ]*\\$\" > /dev/null; then\n"
" :\n"
" else\n"
......@@ -1715,7 +1734,7 @@ char create_display[] =
" dL=\"-h\"\n"
"fi\n"
"\n"
"# a portable, but not absolutely safe, tmp file creator\n"
"# a portable tmp file creator\n"
"mytmp() {\n"
" tf=$1\n"
" if type mktemp > /dev/null 2>&1; then\n"
......
......@@ -121,7 +121,6 @@ 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 */
......@@ -350,7 +349,6 @@ static unsigned char default6x13FontData[2899]={
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;
......
......@@ -1895,12 +1895,21 @@ char *setup_cmd(char *str, int *vnc_redirect, char **vnc_redirect_host, int *vnc
char com[100];
int fd = mkstemp(tmp);
if (fd >= 0) {
int ret;
write(fd, find_display, strlen(find_display));
close(fd);
set_env("FINDDISPLAY_run", "1");
sprintf(com, "/bin/sh %s -n; rm -f %s", tmp, tmp);
sprintf(com, "/bin/sh %s -n", tmp);
ret = system(com);
if (WIFEXITED(ret) && WEXITSTATUS(ret) != 0) {
if (got_findauth && !getenv("FD_XDM")) {
if (getuid() == 0 || geteuid() == 0) {
set_env("FD_XDM", "1");
system(com);
}
}
}
}
unlink(tmp);
exit(0);
}
......@@ -2328,8 +2337,8 @@ static int do_run_cmd(char *cmd, char *create_cmd, char *users_list_save, int cr
int internal_cmd = 0;
int tried_switch = 0;
memset(line1, 0, 1024);
memset(line2, 0, 16384);
memset(line1, 0, sizeof(line1));
memset(line2, 0, sizeof(line2));
if (users_list && strstr(users_list, "sslpeer=") == users_list) {
usslpeer = get_usslpeer();
......@@ -2397,13 +2406,13 @@ static int do_run_cmd(char *cmd, char *create_cmd, char *users_list_save, int cr
int res = 0, k, j, i;
char line[18000];
memset(line, 0, 18000);
memset(line, 0, sizeof(line));
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;
n = sizeof(line);
if (unixpw_cmd != NULL) {
res = unixpw_cmd_run(keep_unixpw_user,
keep_unixpw_pass, cmd, line, &n);
......@@ -2432,13 +2441,13 @@ if (db) {fprintf(stderr, "line: "); write(2, line, n); write(2, "\n", 1); fprint
if (unixpw_cmd != NULL) {
/* let the external unixpw command do it: */
n = 18000;
n = sizeof(line);
close_exec_fds();
res = unixpw_cmd_run(keep_unixpw_user,
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;
n = sizeof(line);
close_exec_fds();
res = su_verify(keep_unixpw_user,
keep_unixpw_pass, create_cmd, line, &n, nodisp);
......
......@@ -2,7 +2,7 @@
.TH X11VNC "1" "December 2009" "x11vnc " "User Commands"
.SH NAME
x11vnc - allow VNC connections to real X11 displays
version: 0.9.9, lastmod: 2009-12-06
version: 0.9.9, lastmod: 2009-12-14
.SH SYNOPSIS
.B x11vnc
[OPTION]...
......@@ -728,6 +728,15 @@ instead of vncconnect may
work (see the FAQ). The \fB-remote\fR control mechanism uses
X11VNC_REMOTE channel, and this option disables/enables
it as well. Default: \fB-vncconnect\fR
.IP
To use different names for these X11 properties (e.g. to
have separate communication channels for multiple
x11vnc's on the same display) set the VNC_CONNECT or
X11VNC_REMOTE env. vars. to the string you want, for
example: \fB-env\fR X11VNC_REMOTE=X11VNC_REMOTE_12345
Both sides of the channel must use the same unique name.
The same can be done for the internal X11VNC_TICKER
property (heartbeat and timestamp) if desired.
.PP
\fB-allow\fR \fIhost1[,host2..]\fR
.IP
......@@ -3159,6 +3168,11 @@ Instead of exiting after cleaning up, run a simple
.IP
Be quiet by printing less informational output to
stderr. (use \fB-noquiet\fR to undo an earlier \fB-quiet.)\fR
.IP
The \fB-quiet\fR option does not eliminate all informational
output, it only reduces it. It is ignored in most
auxiliary usage modes, e.g. \fB-storepasswd.\fR To eliminate
all output use: 2>/dev/null 1>&2, etc.
.PP
\fB-v,\fR \fB-verbose\fR
.IP
......@@ -5274,6 +5288,13 @@ 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 use a different name for the X11 property (e.g. to
have separate communication channels for multiple
x11vnc's on the same display) set the X11VNC_REMOTE
environment variable to the string you want, for
example: \fB-env\fR X11VNC_REMOTE=X11VNC_REMOTE_12345
Both sides of the channel must use the same unique name.
.IP
To run a bunch of commands in a sequence use something
like: x11vnc \fB-R\fR 'script:firstcmd;secondcmd;...'
.IP
......@@ -5766,6 +5787,8 @@ keysym:str,down inject 'keysym' (down=0,1)
.IP
ptr:x,y,mask inject pointer event x, y, button-mask
.IP
fakebuttonevent:button,down direct XTestFakeButtonEvent.
.IP
sleep:t sleep floating point time t.
.IP
get_xprop:p get X property named 'p'.
......@@ -6148,8 +6171,8 @@ 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
debug_keyboard dk nodebug_keyboard nodk keycode keysym
ptr fakebuttonevent 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
......
......@@ -1737,6 +1737,7 @@ static void store_homedir_passwd(char *file) {
fprintf(stderr, "Enter VNC password: ");
system("stty -echo");
if (fgets(str1, 32, stdin) == NULL) {
perror("fgets");
system("stty echo");
exit(1);
}
......@@ -1744,6 +1745,7 @@ static void store_homedir_passwd(char *file) {
fprintf(stderr, "Verify password: ");
if (fgets(str2, 32, stdin) == NULL) {
perror("fgets");
system("stty echo");
exit(1);
}
......@@ -1794,6 +1796,7 @@ static void store_homedir_passwd(char *file) {
fprintf(stderr, "Write password to %s? [y]/n ", f);
if (fgets(str2, 32, stdin) == NULL) {
perror("fgets");
exit(1);
}
if (str2[0] == 'n' || str2[0] == 'N') {
......@@ -1802,14 +1805,16 @@ static void store_homedir_passwd(char *file) {
}
if (rfbEncryptAndStorePasswd(str1, f) != 0) {
fprintf(stderr, "** error creating password.\n");
fprintf(stderr, "** error creating password: %s\n", f);
perror("storepasswd");
exit(1);
}
fprintf(stderr, "Password written to: %s\n", f);
if (stat(f, &sbuf) != 0) {
fprintf(stderr, "** error creating password: %s\n", f);
perror("stat");
exit(1);
}
fprintf(stdout, "Password written to: %s\n", f);
exit(0);
}
......@@ -1945,7 +1950,7 @@ static void check_guess_auth_file(void) {
}
cmd = (char *)malloc(100 + strlen(program_name) + strlen(disp));
sprintf(cmd, "%s -findauth %s", program_name, disp);
sprintf(cmd, "%s -findauth %s -env _D_XDM=1", program_name, disp);
p = popen(cmd, "r");
if (!p) {
rfbLog("-auth guess: could not run cmd '%s'\n", cmd);
......@@ -1962,6 +1967,28 @@ static void check_guess_auth_file(void) {
disp = "unset";
}
}
if (strstr(line, "XAUTHORITY=") != line && !getenv("FD_XDM")) {
if (use_dpy == NULL || strstr(use_dpy, "cmd=FIND") == NULL) {
if (getuid() == 0 || geteuid() == 0) {
char *q = strstr(cmd, "_D_XDM=1");
if (q) {
*q = 'F';
rfbLog("-auth guess: failed for display='%s'\n", disp);
rfbLog("-auth guess: since we are root, retrying with FD_XDM=1\n");
p = popen(cmd, "r");
if (!p) {
rfbLog("-auth guess: could not run cmd '%s'\n", cmd);
clean_up_exit(1);
}
memset(line, 0, sizeof(line));
n = fread(line, 1, sizeof(line), p);
pclose(p);
q = strrchr(line, '\n');
if (q) *q = '\0';
}
}
}
}
if (!strcmp(line, "")) {
rfbLog("-auth guess: failed for display='%s'\n", disp);
clean_up_exit(1);
......@@ -2013,7 +2040,6 @@ int main(int argc, char* argv[]) {
int got_tls = 0;
int got_inetd = 0;
int got_noxrandr = 0;
int got_findauth = 0;
/* used to pass args we do not know about to rfbGetScreen(): */
int argc_vnc_max = 1024;
......@@ -2890,10 +2916,12 @@ int main(int argc, char* argv[]) {
}
if (argc >= i+4 || rfbEncryptAndStorePasswd(argv[i+1],
argv[i+2]) != 0) {
fprintf(stderr, "-storepasswd failed\n");
perror("storepasswd");
fprintf(stderr, "-storepasswd failed for file: %s\n",
argv[i+2]);
exit(1);
} else {
fprintf(stderr, "stored passwd in file %s\n",
fprintf(stderr, "stored passwd in file: %s\n",
argv[i+2]);
exit(0);
}
......@@ -2904,6 +2932,7 @@ int main(int argc, char* argv[]) {
char *f = argv[i+1];
char *s = rfbDecryptPasswdFromFile(f);
if (!s) {
perror("showrfbauth");
fprintf(stderr, "rfbDecryptPasswdFromFile failed: %s\n", f);
exit(1);
}
......@@ -4801,13 +4830,6 @@ int main(int argc, char* argv[]) {
/* open the X display: */
if (auth_file) {
check_guess_auth_file();
if (auth_file != NULL) {
set_env("XAUTHORITY", auth_file);
}
}
#if LIBVNCSERVER_HAVE_XKEYBOARD
/*
* Disable XKEYBOARD before calling XOpenDisplay()
......@@ -4874,6 +4896,9 @@ int main(int argc, char* argv[]) {
rfbLog("warning: -display does not make sense in "
"\"lurk=\" mode...\n");
}
if (auth_file != NULL && strcmp(auth_file, "guess")) {
set_env("XAUTHORITY", auth_file);
}
lurk_loop(users_list);
} else if (use_dpy && strstr(use_dpy, "WAIT:") == use_dpy) {
......@@ -4888,6 +4913,13 @@ int main(int argc, char* argv[]) {
}
}
if (auth_file) {
check_guess_auth_file();
if (auth_file != NULL) {
set_env("XAUTHORITY", auth_file);
}
}
#ifdef MACOSX
if (use_dpy && !strcmp(use_dpy, "console")) {
;
......
......@@ -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-12-06";
char lastmod[] = "0.9.9 lastmod: 2009-12-14";
/* X display info */
......
......@@ -771,6 +771,8 @@ void create_xdamage_if_needed(int force) {
RAWFB_RET_VOID
if (force) {}
#if LIBVNCSERVER_HAVE_LIBXDAMAGE
if (! xdamage || force) {
X_LOCK;
......
......@@ -87,18 +87,28 @@ static void grab_buster_watch(int parent, char *dstr);
void initialize_vnc_connect_prop(void) {
char *prop_str;
vnc_connect_str[0] = '\0';
RAWFB_RET_VOID
#if !NO_X11
prop_str = getenv("VNC_CONNECT");
if (prop_str == NULL) {
prop_str = "VNC_CONNECT";
}
vnc_connect_prop = XInternAtom(dpy, "VNC_CONNECT", False);
#endif
}
void initialize_x11vnc_remote_prop(void) {
char *prop_str;
x11vnc_remote_str[0] = '\0';
RAWFB_RET_VOID
#if !NO_X11
x11vnc_remote_prop = XInternAtom(dpy, "X11VNC_REMOTE", False);
prop_str = getenv("X11VNC_REMOTE");
if (prop_str == NULL) {
prop_str = "X11VNC_REMOTE";
}
x11vnc_remote_prop = XInternAtom(dpy, prop_str, False);
#endif
}
......@@ -734,6 +744,7 @@ static void grab_buster_watch(int parent, char *dstr) {
char propval[200];
int ev, er, maj, min;
int db = 0;
char *ticker_str = "X11VNC_TICKER";
RAWFB_RET_VOID
......@@ -771,7 +782,10 @@ static void grab_buster_watch(int parent, char *dstr) {
usleep(3 * sleep);
ticker_atom = XInternAtom(dpy, "X11VNC_TICKER", False);
if (getenv("X11VNC_TICKER")) {
ticker_str = getenv("X11VNC_TICKER");
}
ticker_atom = XInternAtom(dpy, ticker_str, False);
if (! ticker_atom) {
fprintf(stderr, "grab_buster_watch: no ticker atom\n");
return;
......@@ -865,7 +879,11 @@ void sync_tod_with_servertime(void) {
}
if (! ticker_atom) {
ticker_atom = XInternAtom(dpy, "X11VNC_TICKER", False);
char *ticker_str = "X11VNC_TICKER";
if (getenv("X11VNC_TICKER")) {
ticker_str = getenv("X11VNC_TICKER");
}
ticker_atom = XInternAtom(dpy, ticker_str, False);
}
if (! ticker_atom) {
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment