From b2323a90fd8e5d8f481f871ead688db1961d6991 Mon Sep 17 00:00:00 2001 From: runge Date: Tue, 21 Jun 2005 13:28:22 +0000 Subject: x11vnc: long info and tips when XOpenDisplay fails, reinstate "bad desktop" for wireframe --- x11vnc/ChangeLog | 4 +++ x11vnc/README | 37 +++++++++++++--------- x11vnc/x11vnc.1 | 2 +- x11vnc/x11vnc.c | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 4 files changed, 118 insertions(+), 20 deletions(-) diff --git a/x11vnc/ChangeLog b/x11vnc/ChangeLog index 95456f0..ce37ec6 100644 --- a/x11vnc/ChangeLog +++ b/x11vnc/ChangeLog @@ -1,3 +1,7 @@ +2005-06-21 Karl Runge + * reinstate "bad desktop" for wireframe. + * extra long info and tips of XOpenDisplay fails. + 2005-06-18 Karl Runge * clean up some malloc/free problems (don't free the current cursor) * set DISPLAY before calling gconf, dcop under -solid diff --git a/x11vnc/README b/x11vnc/README index a5099a8..0d857e8 100644 --- a/x11vnc/README +++ b/x11vnc/README @@ -1,5 +1,5 @@ -x11vnc README file Date: Sat Jun 18 12:32:19 EDT 2005 +x11vnc README file Date: Tue Jun 21 09:58:37 EDT 2005 The following information is taken from these URLs: @@ -207,8 +207,8 @@ x11vnc: a VNC server for real X displays However, if you "know" port 5900 will be free on the local and remote machines, you can easily automate the above two steps by using the x11vnc option [26]-bg (forks into background after connection to the - display is set up) or using the -f option of ssh. Three example - scripts are shown below. + display is set up) or using the -f option of ssh. Some example scripts + are shown below. _________________________________________________________________ #1. A simple example script, assuming no problems with port 5900 being @@ -301,7 +301,7 @@ vncviewer -via $host localhost:0 # must be TightVNC vncviewer. Chaining ssh's: Note that for use of a ssh gateway and -L redirection - to a internal host (e.g. "-L 5900:otherhost:5900") the VNC traffic + to an internal host (e.g. "-L 5900:otherhost:5900") the VNC traffic inside the firewall is not encrypted and you have to manually log into otherhost to start x11vnc. Kyle Amon shows a method where you chain two ssh's together that encrypts all network traffic and also @@ -578,7 +578,7 @@ make I'd like to release version 0.7.2 in Jun/2005 sometime, here is the current tarball: - RC-3 lastmod: 2005-06-18 [51]x11vnc-0.7.2beta.tar.gz + RC-3 lastmod: 2005-06-20 [51]x11vnc-0.7.2beta.tar.gz There are also some Linux and Solaris test binaries [52]here. Please kick the tires and report bugs, performance regressions, undesired @@ -1134,6 +1134,7 @@ make your DISPLAY environment variable or use the [156]-display option to specify it. Nearly always the correct value will be ":0" + For the latter error, you need to set up the X11 permissions correctly. @@ -1148,13 +1149,19 @@ make How to Solve: See the xauth(1), Xsecurity(7), and xhost(1) man pages for much info on X11 permissions. For example, you may need to set your XAUTHORITY environment variable or use the [157]-auth option to - point to the correct cookie file (e.g. /home/joe/.Xauthority or - /var/gdm/:0.Xauth), or simply be sure you run x11vnc as the correct - user (i.e. the user who owns the X session you wish to view). If sshd - has set XAUTHORITY to point to a random file it has created for X - forwarding that will cause problems. Running x11vnc as root is not - enough: you need to know where the XAUTHORITY file for the desired X - display is. Example: + point to the correct MIT-MAGIC-COOKIE file (e.g. /home/joe/.Xauthority + or /var/gdm/:0.Xauth), or simply be sure you run x11vnc as the correct + user (i.e. the user who owns the X session you wish to view). + + The cookie file contains the secret key that allows x11vnc to connect + to the desired X display. + + If, say, sshd has set XAUTHORITY to point to a random file it has + created for X forwarding that will cause problems. (Under some + circumstances even su(1) and telnet(1) can set XAUTHORITY.) Running + x11vnc as root is often not enough: you need to know where the + MIT-MAGIC-COOKIE file for the desired X display is. Example + solution: x11vnc -display :0 -auth /var/gdm/:0.Xauth (this is for the display manager gdm, see [158]this faq for other @@ -4419,7 +4426,7 @@ References 314. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe 315. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe 316. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe - 317. http://www.karlrunge.com/x11vnc/fb_read_slow + 317. http://www.karlrunge.com/x11vnc/index.html#fb_read_slow 318. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect 319. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe 320. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wirecopyrect @@ -4508,7 +4515,7 @@ x11vnc: a VNC server for real X displays Here are all of x11vnc command line options: % x11vnc -opts (see below for -help long descriptions) -x11vnc: allow VNC connections to real X11 displays. 0.7.2 lastmod: 2005-06-18 +x11vnc: allow VNC connections to real X11 displays. 0.7.2 lastmod: 2005-06-21 x11vnc options: -display disp -auth file @@ -4607,7 +4614,7 @@ libvncserver options: % x11vnc -help -x11vnc: allow VNC connections to real X11 displays. 0.7.2 lastmod: 2005-06-18 +x11vnc: allow VNC connections to real X11 displays. 0.7.2 lastmod: 2005-06-21 Typical usage is: diff --git a/x11vnc/x11vnc.1 b/x11vnc/x11vnc.1 index 7403dd1..a364c78 100644 --- a/x11vnc/x11vnc.1 +++ b/x11vnc/x11vnc.1 @@ -2,7 +2,7 @@ .TH X11VNC "1" "June 2005" "x11vnc " "User Commands" .SH NAME x11vnc - allow VNC connections to real X11 displays - version: 0.7.2, lastmod: 2005-06-18 + version: 0.7.2, lastmod: 2005-06-21 .SH SYNOPSIS .B x11vnc [OPTION]... diff --git a/x11vnc/x11vnc.c b/x11vnc/x11vnc.c index f448ee8..06c6595 100644 --- a/x11vnc/x11vnc.c +++ b/x11vnc/x11vnc.c @@ -382,7 +382,7 @@ double xdamage_scheduled_mark = 0.0; sraRegionPtr xdamage_scheduled_mark_region = NULL; /* date +'lastmod: %Y-%m-%d' */ -char lastmod[] = "0.7.2 lastmod: 2005-06-18"; +char lastmod[] = "0.7.2 lastmod: 2005-06-21"; int hack_val = 0; /* X display info */ @@ -25850,7 +25850,7 @@ int try_copyrect(Window frame, int x, int y, int w, int h, int dx, int dy, dt_bad_check = time(0); } - if (0 && dt_bad) { + if (dt_bad && wireframe_in_progress) { sraRegionPtr rect; /* send the whole thing... */ x1 = crfix(nfix(x, dpy_x), dx, dpy_x); @@ -27921,7 +27921,13 @@ void check_cursor_changes(void) { if (cursor_changes) { double tm, max_push = 0.125, multi_push = 0.01, wait = 0.02; int cursor_shape, dopush = 0, link, latency, netrate; - cursor_shape = cursor_shape_updates_clients(screen); + + if (! all_clients_initialized()) { + /* play it safe */ + return; + } + + if (0) cursor_shape = cursor_shape_updates_clients(screen); dtime0(&tm); link = link_rate(&latency, &netrate); @@ -30512,6 +30518,78 @@ void immediate_switch_user(int argc, char* argv[]) { } } +void xopen_display_fail_message(char *disp) { + fprintf(stderr, "\n"); + fprintf(stderr, "*** x11vnc was unable to open the X DISPLAY: \"%s\"," + " it cannot continue.\n", disp); + fprintf(stderr, "*** There may be \"Xlib:\" error messages above" + " with details about the failure.\n"); + fprintf(stderr, "\n"); + fprintf(stderr, "Some tips and guidelines:\n"); + fprintf(stderr, "\n"); + fprintf(stderr, " * An X server (the one you wish to view) must" + " be running before x11vnc is\n"); + fprintf(stderr, " started: x11vnc does not start the X server.\n"); + fprintf(stderr, "\n"); + fprintf(stderr, " * You must use -display , -OR- set and" + " export your DISPLAY\n"); + fprintf(stderr, " environment variable to refer to the display of" + " the desired X server.\n"); + fprintf(stderr, " - Usually the display is simply \":0\" (in fact" + " x11vnc uses this if you forget\n"); + fprintf(stderr, " to specify it), but in some multi-user" + " situations it could be \":1\", \":2\",\n"); + fprintf(stderr, " or even \":137\". Ask your administrator" + " or a guru if you are having\n"); + fprintf(stderr, " difficulty determining what your X DISPLAY is.\n"); + fprintf(stderr, "\n"); + fprintf(stderr, " * Next, you need to have sufficient permissions" + " (Xauthority) \n"); + fprintf(stderr, " to connect to the X DISPLAY. Here are some" + " Tips:\n"); + fprintf(stderr, "\n"); + fprintf(stderr, " - Often, you just need to run x11vnc as the user" + " logged into the X session.\n"); + fprintf(stderr, " So make sure to be that user when you type" + " x11vnc.\n"); + fprintf(stderr, " - Being root is usually not enough because the" + " incorrect MIT-MAGIC-COOKIE\n"); + fprintf(stderr, " file will be accessed. The cookie file contains" + " the secret key that\n"); + fprintf(stderr, " allows x11vnc to connect to the desired" + " X DISPLAY.\n"); + fprintf(stderr, " - You can explicity indicate which MIT-MAGIC-COOKIE" + " file should be used\n"); + fprintf(stderr, " by the -auth option, e.g.:\n"); + fprintf(stderr, " x11vnc -auth /home/someuser/.Xauthority" + " -display :0\n"); + fprintf(stderr, " you must have read permission for that file.\n"); + fprintf(stderr, "\n"); + fprintf(stderr, " - If NO ONE is logged into an X session yet, but" + " there is a greeter login\n"); + fprintf(stderr, " program like \"gdm\", \"kdm\", \"xdm\", or" + " \"dtlogin\" running, you will need\n"); + fprintf(stderr, " to find and use the raw display manager" + " MIT-MAGIC-COOKIE file.\n"); + fprintf(stderr, " Some examples for various display managers:\n"); + fprintf(stderr, "\n"); + fprintf(stderr, " gdm: -auth /var/gdm/:0.Xauth\n"); + fprintf(stderr, " kdm: -auth /var/lib/kdm/A:0-crWk72\n"); + fprintf(stderr, " xdm: -auth /var/lib/xdm/authdir/authfiles/A:0-XQvaJk\n"); + fprintf(stderr, " dtlogin: -auth /var/dt/A:0-UgaaXa\n"); + fprintf(stderr, "\n"); + fprintf(stderr, " Only root will have read permission for the" + " file, and so x11vnc must be run\n"); + fprintf(stderr, " as root. The random characters in the filenames" + " will of course change,\n"); + fprintf(stderr, " and the directory the cookie file resides in may" + " also be system dependent.\n"); + fprintf(stderr, " Sometimes the command \"ps wwaux | grep auth\"" + " can reveal the file location.\n"); + fprintf(stderr, "\n"); + fprintf(stderr, "See also: http://www.karlrunge.com/x11vnc/#faq\n"); +} + int main(int argc, char* argv[]) { int i, len, tmpi; @@ -31654,6 +31732,7 @@ int main(int argc, char* argv[]) { if (! dpy && ! use_dpy && ! getenv("DISPLAY")) { int i, s = 4; + rfbLogEnable(1); rfbLog("\a\n"); rfbLog("*** XOpenDisplay failed. No -display or DISPLAY.\n"); rfbLog("*** Trying \":0\" in %d seconds. Press Ctrl-C to" @@ -31670,10 +31749,18 @@ int main(int argc, char* argv[]) { rfbLog("*** XOpenDisplay of \":0\" successful.\n"); } rfbLog("\n"); + if (quiet) rfbLogEnable(0); } if (! dpy) { - rfbLog("XOpenDisplay failed (%s)\n", use_dpy ? use_dpy:"null"); + char *d = use_dpy; + if (!d) d = getenv("DISPLAY"); + if (!d) d = "null"; + rfbLogEnable(1); + fprintf(stderr, "\n"); + rfbLog("***************************************\n", d); + rfbLog("*** XOpenDisplay failed (%s)\n", d); + xopen_display_fail_message(d); exit(1); } else if (use_dpy) { if (! quiet) rfbLog("Using X display %s\n", use_dpy); -- cgit v1.2.3