Commit 35c42cf3 authored by runge's avatar runge

Workaround for inane X_ShmAttach incompatibility in Xorg, -solid support in...

Workaround for inane X_ShmAttach incompatibility in Xorg, -solid support in xfce, showrfbauth option.
parent 387e189b
2009-10-17 Karl Runge <runge@karlrunge.com>
* x11vnc: support for -solid option in xfce desktop.
List -Q guess_dbus query. Implement -showrfbauth option.
Workaround for inane X_ShmAttach incompatibility in Xorg.
2009-10-08 Karl Runge <runge@karlrunge.com> 2009-10-08 Karl Runge <runge@karlrunge.com>
* x11vnc: bcx_xattach/x2x desktop switching facility. * x11vnc: bcx_xattach/x2x desktop switching facility.
More remote control features: grab_state, ping:mystring, More remote control features: grab_state, ping:mystring,
......
This diff is collapsed.
...@@ -276,6 +276,13 @@ int trap_getimage_xerror(Display *d, XErrorEvent *error) { ...@@ -276,6 +276,13 @@ int trap_getimage_xerror(Display *d, XErrorEvent *error) {
return 0; return 0;
} }
/* Are silly Xorg people removing X_ShmAttach from XShm.h? */
/* INDEED! What stupid, myopic morons... */
/* Maintenance Monkeys busy typing at their keyboards... */
#ifndef X_ShmAttach
#define X_ShmAttach 1
#endif
static int Xerror(Display *d, XErrorEvent *error) { static int Xerror(Display *d, XErrorEvent *error) {
X_UNLOCK; X_UNLOCK;
......
...@@ -781,6 +781,9 @@ void print_help(int mode) { ...@@ -781,6 +781,9 @@ void print_help(int mode) {
" and last line be \"__BEGIN_VIEWONLY__\" to have 2\n" " and last line be \"__BEGIN_VIEWONLY__\" to have 2\n"
" full-access passwords)\n" " full-access passwords)\n"
"\n" "\n"
"-showrfbauth filename Print to the screen the obscured VNC password kept in\n"
" the rfbauth file \"filename\" and then exit.\n"
"\n"
"-unixpw [list] Use Unix username and password authentication. x11vnc\n" "-unixpw [list] Use Unix username and password authentication. x11vnc\n"
" will use the su(1) program to verify the user's\n" " will use the su(1) program to verify the user's\n"
" password. [list] is an optional comma separated list\n" " password. [list] is an optional comma separated list\n"
...@@ -2576,15 +2579,18 @@ void print_help(int mode) { ...@@ -2576,15 +2579,18 @@ void print_help(int mode) {
" e.g. \"darkblue\" or numerical \"#RRGGBB\").\n" " e.g. \"darkblue\" or numerical \"#RRGGBB\").\n"
"\n" "\n"
" Currently this option only works on GNOME, KDE, CDE,\n" " Currently this option only works on GNOME, KDE, CDE,\n"
" and classic X (i.e. with the background image on the\n" " XFCE, and classic X (i.e. with the background image\n"
" root window). The \"gconftool-2\" and \"dcop\" external\n" " on the root window). The \"gconftool-2\", \"dcop\"\n"
" commands are run for GNOME and KDE respectively.\n" " and \"xfconf-query\" external commands are run for\n"
" Other desktops won't work, e.g. Xfce (send us the\n" " GNOME, KDE, and XFCE respectively. This also works\n"
" corresponding commands if you find them). If x11vnc is\n" " on native MacOSX. (There is no color selection for\n"
" running as root (inetd(8) or gdm(1)), the -users option\n" " MacOSX or XFCE.) Other desktops won't work, (send\n"
" may be needed for GNOME and KDE. If x11vnc guesses\n" " us the corresponding commands if you find them).\n"
" your desktop incorrectly, you can force it by prefixing\n" " If x11vnc is running as root (inetd(8) or gdm(1)),\n"
" color with \"gnome:\", \"kde:\", \"cde:\" or \"root:\".\n" " the -users option may be needed for GNOME, KDE, XFCE.\n"
" If x11vnc guesses your desktop incorrectly, you can\n"
" force it by prefixing color with \"gnome:\", \"kde:\",\n"
" \"cde:\", \"xfce:\", or \"root:\".\n"
"\n" "\n"
" This mode works in a limited way on the Mac OS X Console\n" " This mode works in a limited way on the Mac OS X Console\n"
" with one color ('kelp') using the screensaver writing\n" " with one color ('kelp') using the screensaver writing\n"
...@@ -5094,9 +5100,9 @@ void print_help(int mode) { ...@@ -5094,9 +5100,9 @@ void print_help(int mode) {
" macnomenu nomacmenu macuskbd nomacuskbd noremote\n" " macnomenu nomacmenu macuskbd nomacuskbd noremote\n"
"\n" "\n"
" aro= noop display vncdisplay autoport loop loopbg\n" " aro= noop display vncdisplay autoport loop loopbg\n"
" desktopname guess_desktop http_url auth xauth\n" " desktopname guess_desktop guess_dbus http_url\n"
" users rootshift clipshift scale_str scaled_x\n" " auth xauth users rootshift clipshift scale_str\n"
" scaled_y scale_numer scale_denom scale_fac_x\n" " scaled_x scaled_y scale_numer scale_denom scale_fac_x\n"
" scale_fac_y scaling_blend scaling_nomult4 scaling_pad\n" " scale_fac_y scaling_blend scaling_nomult4 scaling_pad\n"
" scaling_interpolate inetd privremote unsafe safer\n" " scaling_interpolate inetd privremote unsafe safer\n"
" nocmds passwdfile unixpw unixpw_nis unixpw_list ssl\n" " nocmds passwdfile unixpw unixpw_nis unixpw_list ssl\n"
......
...@@ -735,6 +735,100 @@ static void solid_gnome(char *color) { ...@@ -735,6 +735,100 @@ static void solid_gnome(char *color) {
#endif /* NO_X11 */ #endif /* NO_X11 */
} }
static void solid_xfce(char *color) {
#if NO_X11
RAWFB_RET_VOID
if (!color) {}
return;
#else
char get_image_show[] = "%s xfconf-query -v -c xfce4-desktop -p /backdrop/screen0/monitor0/image-show";
char set_image_show[] = "%s xfconf-query -v -c xfce4-desktop -p /backdrop/screen0/monitor0/image-show -s '%s'";
char get_color_style[] = "%s xfconf-query -v -c xfce4-desktop -p /backdrop/screen0/monitor0/color-style";
char set_color_style[] = "%s xfconf-query -v -c xfce4-desktop -p /backdrop/screen0/monitor0/color-style -s '%s'";
static char *orig_image_show = NULL;
static char *orig_color_style = NULL;
char *cmd, *dbus = "";
RAWFB_RET_VOID
dbus = dbus_session();
rfbLog("guessed dbus: %s\n", dbus);
if (! color) {
if (! orig_image_show) {
orig_image_show = strdup("true");
}
if (! orig_color_style) {
orig_color_style = strdup("0");
}
if (strstr(orig_image_show, "'") != NULL) {
rfbLog("invalid image show: %s\n", orig_image_show);
return;
}
if (strstr(orig_color_style, "'") != NULL) {
rfbLog("invalid color style: %s\n", orig_color_style);
return;
}
cmd = (char *) malloc(strlen(set_image_show) - 2 + strlen(orig_image_show) + strlen(dbus) + 1);
sprintf(cmd, set_image_show, dbus, orig_image_show);
dt_cmd(cmd);
free(cmd);
cmd = (char *) malloc(strlen(set_color_style) - 2 + strlen(orig_color_style) + strlen(dbus) + 1);
sprintf(cmd, set_color_style, dbus, orig_color_style);
dt_cmd(cmd);
free(cmd);
return;
}
if (! orig_image_show) {
char *q;
if (cmd_ok("dt")) {
cmd = (char *) malloc(strlen(get_image_show) + strlen(dbus) + 1);
sprintf(cmd, get_image_show, dbus);
orig_image_show = strdup(cmd_output(cmd));
free(cmd);
}
if (*orig_image_show == '\0') {
orig_image_show = strdup("true");
}
if ((q = strchr(orig_image_show, '\n')) != NULL) {
*q = '\0';
}
}
if (! orig_color_style) {
char *q;
if (cmd_ok("dt")) {
cmd = (char *) malloc(strlen(get_color_style) + strlen(dbus) + 1);
sprintf(cmd, get_color_style, dbus);
orig_color_style = strdup(cmd_output(cmd));
free(cmd);
}
if (*orig_color_style == '\0') {
orig_color_style = strdup("0");
}
if ((q = strchr(orig_color_style, '\n')) != NULL) {
*q = '\0';
}
}
if (strstr(color, "'") != NULL) {
rfbLog("invalid color: %s\n", color);
return;
}
cmd = (char *) malloc(strlen(set_color_style) + strlen("0") + strlen(dbus) + 1);
sprintf(cmd, set_color_style, dbus, "0");
dt_cmd(cmd);
free(cmd);
cmd = (char *) malloc(strlen(set_image_show) + strlen("false") + strlen(dbus) + 1);
sprintf(cmd, set_image_show, dbus, "false");
dt_cmd(cmd);
free(cmd);
#endif /* NO_X11 */
}
static char *dcop_session(void) { static char *dcop_session(void) {
char *empty = strdup(""); char *empty = strdup("");
#if NO_X11 #if NO_X11
...@@ -1219,6 +1313,8 @@ void solid_bg(int restore) { ...@@ -1219,6 +1313,8 @@ void solid_bg(int restore) {
solid_kde(NULL); solid_kde(NULL);
} else if (desktop == 3) { } else if (desktop == 3) {
solid_cde(NULL); solid_cde(NULL);
} else if (desktop == 4) {
solid_xfce(NULL);
} }
solid_on = 0; solid_on = 0;
return; return;
...@@ -1240,6 +1336,8 @@ void solid_bg(int restore) { ...@@ -1240,6 +1336,8 @@ void solid_bg(int restore) {
dtname = "kde"; dtname = "kde";
} else if (strstr(solid_str, "cde:") == solid_str) { } else if (strstr(solid_str, "cde:") == solid_str) {
dtname = "cde"; dtname = "cde";
} else if (strstr(solid_str, "xfce:") == solid_str) {
dtname = "xfce";
} else { } else {
dtname = "root"; dtname = "root";
} }
...@@ -1268,6 +1366,9 @@ void solid_bg(int restore) { ...@@ -1268,6 +1366,9 @@ void solid_bg(int restore) {
} else if (!strcmp(dtname, "cde")) { } else if (!strcmp(dtname, "cde")) {
desktop = 3; desktop = 3;
solid_cde(color); solid_cde(color);
} else if (!strcmp(dtname, "xfce")) {
desktop = 4;
solid_xfce(color);
} else { } else {
desktop = 0; desktop = 0;
solid_root(color); solid_root(color);
......
...@@ -3639,8 +3639,8 @@ void accept_openssl(int mode, int presock) { ...@@ -3639,8 +3639,8 @@ void accept_openssl(int mode, int presock) {
wrote_cookie: wrote_cookie:
ssl_xfer(vncsock, s_in, s_out, 0); ssl_xfer(vncsock, s_in, s_out, 0);
rfbLog("SSL: ssl_helper[%d]: exit case 7 (ssl_xfer done)\n", getpid()); rfbLog("SSL: ssl_helper[%d]: exit case 7 (ssl_xfer done)\n", getpid());
if (0) usleep(50 * 1000);
exit(0); exit(0);
} }
/* parent here */ /* parent here */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
.TH X11VNC "1" "October 2009" "x11vnc " "User Commands" .TH X11VNC "1" "October 2009" "x11vnc " "User Commands"
.SH NAME .SH NAME
x11vnc - allow VNC connections to real X11 displays x11vnc - allow VNC connections to real X11 displays
version: 0.9.9, lastmod: 2009-10-07 version: 0.9.9, lastmod: 2009-10-15
.SH SYNOPSIS .SH SYNOPSIS
.B x11vnc .B x11vnc
[OPTION]... [OPTION]...
...@@ -868,6 +868,11 @@ used to have viewonly passwords. (tip: make the 3rd ...@@ -868,6 +868,11 @@ used to have viewonly passwords. (tip: make the 3rd
and last line be "__BEGIN_VIEWONLY__" to have 2 and last line be "__BEGIN_VIEWONLY__" to have 2
full-access passwords) full-access passwords)
.PP .PP
\fB-showrfbauth\fR \fIfilename\fR
.IP
Print to the screen the obscured VNC password kept in
the rfbauth file \fIfilename\fR and then exit.
.PP
\fB-unixpw\fR \fI[list]\fR \fB-unixpw\fR \fI[list]\fR
.IP .IP
Use Unix username and password authentication. x11vnc Use Unix username and password authentication. x11vnc
...@@ -2856,19 +2861,22 @@ For a different one specify the X color (rgb.txt name, ...@@ -2856,19 +2861,22 @@ For a different one specify the X color (rgb.txt name,
e.g. "darkblue" or numerical "#RRGGBB"). e.g. "darkblue" or numerical "#RRGGBB").
.IP .IP
Currently this option only works on GNOME, KDE, CDE, Currently this option only works on GNOME, KDE, CDE,
and classic X (i.e. with the background image on the XFCE, and classic X (i.e. with the background image
root window). The "gconftool-2" and "dcop" external on the root window). The "gconftool-2", "dcop"
commands are run for GNOME and KDE respectively. and "xfconf-query" external commands are run for
Other desktops won't work, e.g. Xfce (send us the GNOME, KDE, and XFCE respectively. This also works
corresponding commands if you find them). If x11vnc is on native MacOSX. (There is no color selection for
running as root ( MacOSX or XFCE.) Other desktops won't work, (send
us the corresponding commands if you find them).
If x11vnc is running as root (
.IR inetd (8) .IR inetd (8)
or or
.IR gdm (1) .IR gdm (1)
), the \fB-users\fR option ),
may be needed for GNOME and KDE. If x11vnc guesses the \fB-users\fR option may be needed for GNOME, KDE, XFCE.
your desktop incorrectly, you can force it by prefixing If x11vnc guesses your desktop incorrectly, you can
color with "gnome:", "kde:", "cde:" or "root:". force it by prefixing color with "gnome:", "kde:",
"cde:", "xfce:", or "root:".
.IP .IP
This mode works in a limited way on the Mac OS X Console This mode works in a limited way on the Mac OS X Console
with one color ('kelp') using the screensaver writing with one color ('kelp') using the screensaver writing
...@@ -6045,9 +6053,9 @@ macnoresize macresize nomacnoresize maciconanim macmenu ...@@ -6045,9 +6053,9 @@ macnoresize macresize nomacnoresize maciconanim macmenu
macnomenu nomacmenu macuskbd nomacuskbd noremote macnomenu nomacmenu macuskbd nomacuskbd noremote
.IP .IP
aro= noop display vncdisplay autoport loop loopbg aro= noop display vncdisplay autoport loop loopbg
desktopname guess_desktop http_url auth xauth desktopname guess_desktop guess_dbus http_url
users rootshift clipshift scale_str scaled_x auth xauth users rootshift clipshift scale_str
scaled_y scale_numer scale_denom scale_fac_x scaled_x scaled_y scale_numer scale_denom scale_fac_x
scale_fac_y scaling_blend scaling_nomult4 scaling_pad scale_fac_y scaling_blend scaling_nomult4 scaling_pad
scaling_interpolate inetd privremote unsafe safer scaling_interpolate inetd privremote unsafe safer
nocmds passwdfile unixpw unixpw_nis unixpw_list ssl nocmds passwdfile unixpw unixpw_nis unixpw_list ssl
......
...@@ -2791,6 +2791,19 @@ int main(int argc, char* argv[]) { ...@@ -2791,6 +2791,19 @@ int main(int argc, char* argv[]) {
} }
continue; continue;
} }
if (!strcmp(arg, "-showrfbauth")) {
if (argc >= i+2) {
char *f = argv[i+1];
char *s = rfbDecryptPasswdFromFile(f);
if (!s) {
fprintf(stderr, "rfbDecryptPasswdFromFile failed: %s\n", f);
exit(1);
}
fprintf(stdout, "rfbDecryptPasswdFromFile file: %s\n", f);
fprintf(stdout, "rfbDecryptPasswdFromFile pass: %s\n", s);
}
exit(0);
}
if (!strcmp(arg, "-accept")) { if (!strcmp(arg, "-accept")) {
CHECK_ARGC CHECK_ARGC
accept_cmd = strdup(argv[++i]); accept_cmd = strdup(argv[++i]);
......
...@@ -47,7 +47,7 @@ int xtrap_base_event_type = 0; ...@@ -47,7 +47,7 @@ int xtrap_base_event_type = 0;
int xdamage_base_event_type = 0; int xdamage_base_event_type = 0;
/* date +'lastmod: %Y-%m-%d' */ /* date +'lastmod: %Y-%m-%d' */
char lastmod[] = "0.9.9 lastmod: 2009-10-07"; char lastmod[] = "0.9.9 lastmod: 2009-10-15";
/* X display info */ /* X display info */
......
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