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>
* x11vnc: bcx_xattach/x2x desktop switching facility.
More remote control features: grab_state, ping:mystring,
......
This diff is collapsed.
......@@ -276,6 +276,13 @@ int trap_getimage_xerror(Display *d, XErrorEvent *error) {
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) {
X_UNLOCK;
......
......@@ -781,6 +781,9 @@ void print_help(int mode) {
" and last line be \"__BEGIN_VIEWONLY__\" to have 2\n"
" full-access passwords)\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"
" will use the su(1) program to verify the user's\n"
" password. [list] is an optional comma separated list\n"
......@@ -2576,15 +2579,18 @@ void print_help(int mode) {
" e.g. \"darkblue\" or numerical \"#RRGGBB\").\n"
"\n"
" Currently this option only works on GNOME, KDE, CDE,\n"
" and classic X (i.e. with the background image on the\n"
" root window). The \"gconftool-2\" and \"dcop\" external\n"
" commands are run for GNOME and KDE respectively.\n"
" Other desktops won't work, e.g. Xfce (send us the\n"
" corresponding commands if you find them). If x11vnc is\n"
" running as root (inetd(8) or gdm(1)), the -users option\n"
" may be needed for GNOME and KDE. If x11vnc guesses\n"
" your desktop incorrectly, you can force it by prefixing\n"
" color with \"gnome:\", \"kde:\", \"cde:\" or \"root:\".\n"
" XFCE, and classic X (i.e. with the background image\n"
" on the root window). The \"gconftool-2\", \"dcop\"\n"
" and \"xfconf-query\" external commands are run for\n"
" GNOME, KDE, and XFCE respectively. This also works\n"
" on native MacOSX. (There is no color selection for\n"
" MacOSX or XFCE.) Other desktops won't work, (send\n"
" us the corresponding commands if you find them).\n"
" If x11vnc is running as root (inetd(8) or gdm(1)),\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"
" This mode works in a limited way on the Mac OS X Console\n"
" with one color ('kelp') using the screensaver writing\n"
......@@ -5094,9 +5100,9 @@ void print_help(int mode) {
" macnomenu nomacmenu macuskbd nomacuskbd noremote\n"
"\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"
" desktopname guess_desktop guess_dbus http_url\n"
" auth xauth users rootshift clipshift scale_str\n"
" scaled_x 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"
......
......@@ -735,6 +735,100 @@ static void solid_gnome(char *color) {
#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) {
char *empty = strdup("");
#if NO_X11
......@@ -1219,6 +1313,8 @@ void solid_bg(int restore) {
solid_kde(NULL);
} else if (desktop == 3) {
solid_cde(NULL);
} else if (desktop == 4) {
solid_xfce(NULL);
}
solid_on = 0;
return;
......@@ -1240,6 +1336,8 @@ void solid_bg(int restore) {
dtname = "kde";
} else if (strstr(solid_str, "cde:") == solid_str) {
dtname = "cde";
} else if (strstr(solid_str, "xfce:") == solid_str) {
dtname = "xfce";
} else {
dtname = "root";
}
......@@ -1268,6 +1366,9 @@ void solid_bg(int restore) {
} else if (!strcmp(dtname, "cde")) {
desktop = 3;
solid_cde(color);
} else if (!strcmp(dtname, "xfce")) {
desktop = 4;
solid_xfce(color);
} else {
desktop = 0;
solid_root(color);
......
......@@ -3639,8 +3639,8 @@ void accept_openssl(int mode, int presock) {
wrote_cookie:
ssl_xfer(vncsock, s_in, s_out, 0);
rfbLog("SSL: ssl_helper[%d]: exit case 7 (ssl_xfer done)\n", getpid());
if (0) usleep(50 * 1000);
exit(0);
}
/* parent here */
......
......@@ -2,7 +2,7 @@
.TH X11VNC "1" "October 2009" "x11vnc " "User Commands"
.SH NAME
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
.B x11vnc
[OPTION]...
......@@ -868,6 +868,11 @@ used to have viewonly passwords. (tip: make the 3rd
and last line be "__BEGIN_VIEWONLY__" to have 2
full-access passwords)
.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
.IP
Use Unix username and password authentication. x11vnc
......@@ -2856,19 +2861,22 @@ For a different one specify the X color (rgb.txt name,
e.g. "darkblue" or numerical "#RRGGBB").
.IP
Currently this option only works on GNOME, KDE, CDE,
and classic X (i.e. with the background image on the
root window). The "gconftool-2" and "dcop" external
commands are run for GNOME and KDE respectively.
Other desktops won't work, e.g. Xfce (send us the
corresponding commands if you find them). If x11vnc is
running as root (
XFCE, and classic X (i.e. with the background image
on the root window). The "gconftool-2", "dcop"
and "xfconf-query" external commands are run for
GNOME, KDE, and XFCE respectively. This also works
on native MacOSX. (There is no color selection for
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)
or
.IR gdm (1)
), the \fB-users\fR option
may be needed for GNOME and KDE. If x11vnc guesses
your desktop incorrectly, you can force it by prefixing
color with "gnome:", "kde:", "cde:" or "root:".
),
the \fB-users\fR option may be needed for GNOME, KDE, XFCE.
If x11vnc guesses your desktop incorrectly, you can
force it by prefixing color with "gnome:", "kde:",
"cde:", "xfce:", or "root:".
.IP
This mode works in a limited way on the Mac OS X Console
with one color ('kelp') using the screensaver writing
......@@ -6045,9 +6053,9 @@ macnoresize macresize nomacnoresize maciconanim macmenu
macnomenu nomacmenu macuskbd nomacuskbd noremote
.IP
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
desktopname guess_desktop guess_dbus 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
......
......@@ -2791,6 +2791,19 @@ int main(int argc, char* argv[]) {
}
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")) {
CHECK_ARGC
accept_cmd = strdup(argv[++i]);
......
......@@ -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-10-07";
char lastmod[] = "0.9.9 lastmod: 2009-10-15";
/* 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