diff options
author | runge <runge> | 2006-09-17 18:08:23 +0000 |
---|---|---|
committer | runge <runge> | 2006-09-17 18:08:23 +0000 |
commit | dba5e098767b71bb017fa191cc3f07dc68437655 (patch) | |
tree | 2cc3de51656fb733b93baaa0b7a02a058801cd3c | |
parent | 31d3a9fa8d081c573822fd8b66b9cdf70092c9d2 (diff) | |
download | libtdevnc-dba5e098767b71bb017fa191cc3f07dc68437655.tar.gz libtdevnc-dba5e098767b71bb017fa191cc3f07dc68437655.zip |
x11vnc: -verbose, -connect_or_exit, -rfbport 0, print out SSL cert.
-rw-r--r-- | x11vnc/ChangeLog | 6 | ||||
-rw-r--r-- | x11vnc/README | 156 | ||||
-rw-r--r-- | x11vnc/connections.c | 23 | ||||
-rw-r--r-- | x11vnc/cursor.c | 8 | ||||
-rw-r--r-- | x11vnc/help.c | 21 | ||||
-rw-r--r-- | x11vnc/keyboard.c | 36 | ||||
-rw-r--r-- | x11vnc/options.c | 3 | ||||
-rw-r--r-- | x11vnc/options.h | 3 | ||||
-rw-r--r-- | x11vnc/pm.c | 8 | ||||
-rw-r--r-- | x11vnc/scan.c | 2 | ||||
-rw-r--r-- | x11vnc/screen.c | 54 | ||||
-rw-r--r-- | x11vnc/sslcmds.c | 25 | ||||
-rw-r--r-- | x11vnc/sslhelper.c | 37 | ||||
-rw-r--r-- | x11vnc/x11vnc.1 | 27 | ||||
-rw-r--r-- | x11vnc/x11vnc.c | 60 | ||||
-rw-r--r-- | x11vnc/x11vnc_defs.c | 2 | ||||
-rw-r--r-- | x11vnc/xinerama.c | 18 | ||||
-rw-r--r-- | x11vnc/xwrappers.c | 8 |
18 files changed, 337 insertions, 160 deletions
diff --git a/x11vnc/ChangeLog b/x11vnc/ChangeLog index 43bd5b8..8bcd818 100644 --- a/x11vnc/ChangeLog +++ b/x11vnc/ChangeLog @@ -1,3 +1,9 @@ +2006-09-17 Karl Runge <runge@karlrunge.com> + * x11vnc: move some info printout to -v, -verbose mode. Add + -connect_or_exit option. Have -rfbport 0 lead to no TCP + listening. Eliminate double certificates in .pem files. + Always print SSL certificate to the screen to aid pasting. + 2006-09-15 Karl Runge <runge@karlrunge.com> * x11vnc: allow user set signals to ignore, clear DISPLAY in -unixpw su_verify. -rawfb none same as null. diff --git a/x11vnc/README b/x11vnc/README index d7359a3..703ba63 100644 --- a/x11vnc/README +++ b/x11vnc/README @@ -1,5 +1,5 @@ -x11vnc README file Date: Fri Sep 15 12:06:02 EDT 2006 +x11vnc README file Date: Sun Sep 17 13:31:31 EDT 2006 The following information is taken from these URLs: @@ -4001,9 +4001,14 @@ ied) [494]scrollcopyrect FAQ below) provide schemes to sweep this problem under the rug for window moves or resizes and for some (but not all) window scrolls. These are the preferred way of avoiding the "lurching" - problem, contact me if they are not working. (Note on SuSE the RECORD - X extension used by scrollcopyrect is not enabled by default, turn it - on in xorg.conf) + problem, contact me if they are not working. Note on SuSE and some + other distros the RECORD X extension used by scrollcopyrect is not + enabled by default, turn it on in xorg.conf: +Section "Module" + ... + Load "record" + ... +EndSection Q-65: Why not do something like wireframe animations to avoid the @@ -4131,7 +4136,12 @@ ied) protocol between the X client with the focus window and the X server. This extension is usually present on most X servers (but SuSE disables it for some reason). On XFree86/Xorg it can be enabled via Load - "record" in the Module section of the config file if it isn't already. + "record" in the Module section of the config file if it isn't already: +Section "Module" + ... + Load "record" + ... +EndSection Currently the RECORD extension is used as little as possible so as to not slow down regular use. Only simple heuristics are applied to @@ -8061,7 +8071,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.8.3 lastmod: 2006-09-15 +x11vnc: allow VNC connections to real X11 displays. 0.8.3 lastmod: 2006-09-17 x11vnc options: -display disp -auth file -id windowid @@ -8072,61 +8082,62 @@ x11vnc options: -viewonly -shared -once -forever -loop -timeout n -inetd -nofilexfer -http - -http_ssl -connect string -vncconnect - -novncconnect -allow host1[,host2..] -localhost - -nolookup -input string -grabkbd - -grabptr -viewpasswd string -passwdfile filename - -unixpw [list] -unixpw_nis [list] -display WAIT:... - -ssl [pem] -ssltimeout n -ssldir [dir] - -sslverify [path] -sslGenCA [dir] -sslGenCert type name - -sslEncKey [pem] -sslCertInfo [pem] -sslDelCert [pem] - -stunnel [pem] -stunnel3 [pem] -https [port] - -usepw -storepasswd pass file -nopw - -accept string -afteraccept string -gone string - -users list -noshm -flipbyteorder - -onetile -solid [color] -blackout string - -xinerama -noxinerama -xtrap - -xrandr [mode] -rotate string -padgeom WxH - -o logfile -flag file -rc filename - -norc -env VAR=VALUE -h, -help - -?, -opts -V, -version -license - -dbg -q -bg - -modtweak -nomodtweak -xkb - -noxkb -capslock -skip_lockkeys - -skip_keycodes string -sloppy_keys -skip_dups - -noskip_dups -add_keysyms -noadd_keysyms - -clear_mods -clear_keys -remap string - -norepeat -repeat -nofb - -nobell -nosel -noprimary - -nosetprimary -noclipboard -nosetclipboard - -seldir string -cursor [mode] -nocursor - -arrow n -noxfixes -alphacut n - -alphafrac fraction -alpharemove -noalphablend - -nocursorshape -cursorpos -nocursorpos - -xwarppointer -buttonmap string -nodragging - -wireframe [str] -nowireframe -wirecopyrect mode - -nowirecopyrect -debug_wireframe -scrollcopyrect mode - -noscrollcopyrect -scr_area n -scr_skip list - -scr_inc list -scr_keys list -scr_term list - -scr_keyrepeat lo-hi -scr_parms string -fixscreen string - -debug_scroll -noxrecord -grab_buster - -nograb_buster -debug_grabs -debug_sel - -pointer_mode n -input_skip n -allinput - -speeds rd,bw,lat -wmdt string -debug_pointer - -debug_keyboard -defer time -wait time - -wait_ui factor -nowait_bog -slow_fb time - -readtimeout n -nap -nonap - -sb time -nofbpm -fbpm - -noxdamage -xd_area A -xd_mem f - -sigpipe string -threads -nothreads - -fs f -gaps n -grow n - -fuzz n -debug_tiles -snapfb - -rawfb string -freqtab file -pipeinput cmd - -gui [gui-opts] -remote command -query variable - -QD variable -sync -noremote - -yesremote -unsafe -safer - -privremote -nocmds -allowedcmds list - -deny_all + -http_ssl -connect string -connect_or_exit str + -vncconnect -novncconnect -allow host1[,host2..] + -localhost -nolookup -input string + -grabkbd -grabptr -viewpasswd string + -passwdfile filename -unixpw [list] -unixpw_nis [list] + -display WAIT:... -ssl [pem] -ssltimeout n + -ssldir [dir] -sslverify [path] -sslGenCA [dir] + -sslGenCert type name -sslEncKey [pem] -sslCertInfo [pem] + -sslDelCert [pem] -stunnel [pem] -stunnel3 [pem] + -https [port] -usepw -storepasswd pass file + -nopw -accept string -afteraccept string + -gone string -users list -noshm + -flipbyteorder -onetile -solid [color] + -blackout string -xinerama -noxinerama + -xtrap -xrandr [mode] -rotate string + -padgeom WxH -o logfile -flag file + -rc filename -norc -env VAR=VALUE + -h, -help -?, -opts -V, -version + -license -dbg -q, -quiet + -v, -verbose -bg -modtweak + -nomodtweak -xkb -noxkb + -capslock -skip_lockkeys -skip_keycodes string + -sloppy_keys -skip_dups -noskip_dups + -add_keysyms -noadd_keysyms -clear_mods + -clear_keys -remap string -norepeat + -repeat -nofb -nobell + -nosel -noprimary -nosetprimary + -noclipboard -nosetclipboard -seldir string + -cursor [mode] -nocursor -arrow n + -noxfixes -alphacut n -alphafrac fraction + -alpharemove -noalphablend -nocursorshape + -cursorpos -nocursorpos -xwarppointer + -buttonmap string -nodragging -wireframe [str] + -nowireframe -wirecopyrect mode -nowirecopyrect + -debug_wireframe -scrollcopyrect mode -noscrollcopyrect + -scr_area n -scr_skip list -scr_inc list + -scr_keys list -scr_term list -scr_keyrepeat lo-hi + -scr_parms string -fixscreen string -debug_scroll + -noxrecord -grab_buster -nograb_buster + -debug_grabs -debug_sel -pointer_mode n + -input_skip n -allinput -speeds rd,bw,lat + -wmdt string -debug_pointer -debug_keyboard + -defer time -wait time -wait_ui factor + -nowait_bog -slow_fb time -readtimeout n + -nap -nonap -sb time + -nofbpm -fbpm -noxdamage + -xd_area A -xd_mem f -sigpipe string + -threads -nothreads -fs f + -gaps n -grow n -fuzz n + -debug_tiles -snapfb -rawfb string + -freqtab file -pipeinput cmd -gui [gui-opts] + -remote command -query variable -QD variable + -sync -noremote -yesremote + -unsafe -safer -privremote + -nocmds -allowedcmds list -deny_all + libvncserver options: -rfbport port TCP port for RFB protocol @@ -8160,7 +8171,7 @@ libvncserver-tight-extension options: % x11vnc -help -x11vnc: allow VNC connections to real X11 displays. 0.8.3 lastmod: 2006-09-15 +x11vnc: allow VNC connections to real X11 displays. 0.8.3 lastmod: 2006-09-17 (type "x11vnc -opts" to just list the options.) @@ -8485,8 +8496,14 @@ Options: If "string" contains "/" it is instead interpreted as a file to periodically check for new hosts. The first line is read and then the file is truncated. - Be careful for this usage mode if x11vnc is running as - root (e.g. via gdm(1), etc). + Be careful about the location of this file if x11vnc + is running as root (e.g. via gdm(1), etc). + +-connect_or_exit str As with -connect, except if none of the reverse + connections succeed, then x11vnc shutdowns immediately. + + If you do not want x11vnc to listen on ANY interface + use -rfbport 0 -vncconnect Monitor the VNC_CONNECT X property set by the standard -novncconnect VNC program vncconnect(1). When the property is @@ -8519,6 +8536,11 @@ Options: the -allow list (and vice versa) to avoid situations where no connections (or too many) are allowed. + If you do not want x11vnc to listen on ANY interface + (evidently you are using -connect or -connect_or_exit, + or plan to use remote control: -R connect:host), use + -rfbport 0 + -nolookup Do not use gethostbyname() or gethostbyaddr() to look up host names or IP numbers. Use this if name resolution is incorrectly set up and leads to long pauses as name @@ -9676,8 +9698,10 @@ Options: -dbg Instead of exiting after cleaning up, run a simple "debug crash shell" when fatal errors are trapped. --q Be quiet by printing less informational output to - stderr. Same as -quiet. +-q, -quiet Be quiet by printing less informational output to + stderr. +-v, -verbose Print out more information to stderr. + -bg Go into the background after screen setup. Messages to stderr are lost unless -o logfile is used. Something like this could be useful in a script: diff --git a/x11vnc/connections.c b/x11vnc/connections.c index 159c884..291cd7b 100644 --- a/x11vnc/connections.c +++ b/x11vnc/connections.c @@ -1587,6 +1587,9 @@ static int do_reverse_connect(char *str) { free(host); if (cl == NULL) { + if (quiet && connect_or_exit) { + rfbLogEnable(1); + } rfbLog("reverse_connect: %s failed\n", str); return 0; } else { @@ -1609,6 +1612,7 @@ void reverse_connect(char *str) { int sleep_between_host = 300; int sleep_min = 1500, sleep_max = 4500, n_max = 5; int n, tot, t, dt = 100, cnt = 0; + int nclients0 = client_count; if (unixpw_in_progress) return; @@ -1634,6 +1638,11 @@ void reverse_connect(char *str) { free(tmp); if (cnt == 0) { + if (connect_or_exit) { + rfbLogEnable(1); + rfbLog("exiting under -connect_or_exit\n"); + clean_up_exit(0); + } return; } @@ -1653,9 +1662,23 @@ void reverse_connect(char *str) { t = 0; while (t < tot) { rfbPE(-1); + rfbPE(-1); usleep(dt * 1000); t += dt; } + if (connect_or_exit) { + if (client_count <= nclients0) { + for (t = 0; t < 10; t++) { + rfbPE(-1); + usleep(100 * 1000); + } + } + if (client_count <= nclients0) { + rfbLogEnable(1); + rfbLog("exiting under -connect_or_exit\n"); + clean_up_exit(0); + } + } } /* diff --git a/x11vnc/cursor.c b/x11vnc/cursor.c index 761e036..53ef4e7 100644 --- a/x11vnc/cursor.c +++ b/x11vnc/cursor.c @@ -554,7 +554,9 @@ static void setup_cursors(void) { int i, j, n = 0; static int first = 1; - rfbLog("setting up %d cursors...\n", CURS_MAX); + if (verbose) { + rfbLog("setting up %d cursors...\n", CURS_MAX); + } if (first) { for (i=0; i<CURS_MAX; i++) { @@ -814,7 +816,9 @@ static void setup_cursors(void) { if (screen) { UNLOCK(screen->cursorMutex); } - rfbLog(" done.\n"); + if (verbose) { + rfbLog(" done.\n"); + } rfbLog("\n"); } diff --git a/x11vnc/help.c b/x11vnc/help.c index 9c3e54b..0959cb8 100644 --- a/x11vnc/help.c +++ b/x11vnc/help.c @@ -345,8 +345,14 @@ void print_help(int mode) { " If \"string\" contains \"/\" it is instead interpreted\n" " as a file to periodically check for new hosts.\n" " The first line is read and then the file is truncated.\n" -" Be careful for this usage mode if x11vnc is running as\n" -" root (e.g. via gdm(1), etc).\n" +" Be careful about the location of this file if x11vnc\n" +" is running as root (e.g. via gdm(1), etc).\n" +"\n" +"-connect_or_exit str As with -connect, except if none of the reverse\n" +" connections succeed, then x11vnc shutdowns immediately.\n" +"\n" +" If you do not want x11vnc to listen on ANY interface\n" +" use -rfbport 0\n" "\n" "-vncconnect Monitor the VNC_CONNECT X property set by the standard\n" "-novncconnect VNC program vncconnect(1). When the property is\n" @@ -379,6 +385,11 @@ void print_help(int mode) { " the -allow list (and vice versa) to avoid situations\n" " where no connections (or too many) are allowed.\n" "\n" +" If you do not want x11vnc to listen on ANY interface\n" +" (evidently you are using -connect or -connect_or_exit,\n" +" or plan to use remote control: -R connect:host), use\n" +" -rfbport 0\n" +"\n" "-nolookup Do not use gethostbyname() or gethostbyaddr() to look up\n" " host names or IP numbers. Use this if name resolution\n" " is incorrectly set up and leads to long pauses as name\n" @@ -1543,8 +1554,10 @@ void print_help(int mode) { "-dbg Instead of exiting after cleaning up, run a simple\n" " \"debug crash shell\" when fatal errors are trapped.\n" "\n" -"-q Be quiet by printing less informational output to\n" -" stderr. Same as -quiet.\n" +"-q, -quiet Be quiet by printing less informational output to\n" +" stderr.\n" +"-v, -verbose Print out more information to stderr.\n" +"\n" "-bg Go into the background after screen setup. Messages to\n" " stderr are lost unless -o logfile is used. Something\n" " like this could be useful in a script:\n" diff --git a/x11vnc/keyboard.c b/x11vnc/keyboard.c index 0f05106..240c4bc 100644 --- a/x11vnc/keyboard.c +++ b/x11vnc/keyboard.c @@ -996,27 +996,31 @@ void switch_to_xkb_if_better(void) { XFree(keymap); if (missing_noxkb == 0 && syms_gt_4 >= 8) { - rfbLog("XKEYBOARD: number of keysyms per keycode %d " - "is greater\n", syms_per_keycode); - rfbLog(" than 4 and %d keysyms are mapped above 4.\n", - syms_gt_4); - rfbLog(" Automatically switching to -xkb mode.\n"); - rfbLog(" If this makes the key mapping worse you can\n"); - rfbLog(" disable it with the \"-noxkb\" option.\n"); - rfbLog(" Also, remember \"-remap DEAD\" for accenting" - " characters.\n"); + if (! raw_fb_str) { + rfbLog("XKEYBOARD: number of keysyms per keycode %d " + "is greater\n", syms_per_keycode); + rfbLog(" than 4 and %d keysyms are mapped above 4.\n", + syms_gt_4); + rfbLog(" Automatically switching to -xkb mode.\n"); + rfbLog(" If this makes the key mapping worse you can\n"); + rfbLog(" disable it with the \"-noxkb\" option.\n"); + rfbLog(" Also, remember \"-remap DEAD\" for accenting" + " characters.\n"); + } use_xkb_modtweak = 1; return; } else if (missing_noxkb == 0) { - rfbLog("XKEYBOARD: all %d \"must have\" keysyms accounted" - " for.\n", n); - rfbLog(" Not automatically switching to -xkb mode.\n"); - rfbLog(" If some keys still cannot be typed, try using" - " -xkb.\n"); - rfbLog(" Also, remember \"-remap DEAD\" for accenting" - " characters.\n"); + if (! raw_fb_str) { + rfbLog("XKEYBOARD: all %d \"must have\" keysyms accounted" + " for.\n", n); + rfbLog(" Not automatically switching to -xkb mode.\n"); + rfbLog(" If some keys still cannot be typed, try using" + " -xkb.\n"); + rfbLog(" Also, remember \"-remap DEAD\" for accenting" + " characters.\n"); + } return; } diff --git a/x11vnc/options.c b/x11vnc/options.c index 9494f40..93d215b 100644 --- a/x11vnc/options.c +++ b/x11vnc/options.c @@ -150,6 +150,7 @@ int noxrecord = 0; char *client_connect = NULL; /* strings for -connect option */ char *client_connect_file = NULL; +int connect_or_exit = 0; int vnc_connect = 1; /* -vncconnect option */ int show_cursor = 1; /* show cursor shapes */ @@ -326,6 +327,7 @@ int debug_pointer = 0; int debug_keyboard = 0; int quiet = 0; +int verbose = 0; /* threaded vs. non-threaded (default) */ #if LIBVNCSERVER_HAVE_LIBPTHREAD && defined(X11VNC_THREADED) @@ -336,6 +338,7 @@ int use_threads = 0; /* info about command line opts */ int got_rfbport = 0; +int got_rfbport_val = -1; int got_alwaysshared = 0; int got_nevershared = 0; int got_cursorpos = 0; diff --git a/x11vnc/options.h b/x11vnc/options.h index e1fac0e..fb0b8da 100644 --- a/x11vnc/options.h +++ b/x11vnc/options.h @@ -125,6 +125,7 @@ extern int noxrecord; extern char *client_connect; extern char *client_connect_file; +extern int connect_or_exit; extern int vnc_connect; extern int show_cursor; @@ -247,10 +248,12 @@ extern int debug_pointer; extern int debug_keyboard; extern int quiet; +extern int verbose; extern int use_threads; extern int got_rfbport; +extern int got_rfbport_val; extern int got_alwaysshared; extern int got_nevershared; extern int got_cursorpos; diff --git a/x11vnc/pm.c b/x11vnc/pm.c index 75e4e1e..8ee0ebd 100644 --- a/x11vnc/pm.c +++ b/x11vnc/pm.c @@ -36,7 +36,9 @@ static void check_fbpm(void) { " VNC clients are connected.\n"); } } else { - rfbLog("X display is not capable of FBPM.\n"); + if (! raw_fb_str) { + rfbLog("X display is not capable of FBPM.\n"); + } fbpm_capable = 0; } init_fbpm = 1; @@ -85,7 +87,9 @@ static void check_fbpm(void) { #else RAWFB_RET_VOID if (! init_fbpm) { - rfbLog("X FBPM extension not supported.\n"); + if (! raw_fb_str) { + rfbLog("X FBPM extension not supported.\n"); + } init_fbpm = 1; } #endif diff --git a/x11vnc/scan.c b/x11vnc/scan.c index 96d0eaa..874de6d 100644 --- a/x11vnc/scan.c +++ b/x11vnc/scan.c @@ -467,7 +467,7 @@ void initialize_polling_images(void) { break; } } - if (!quiet) { + if (verbose) { if (using_shm && ! xform24to32) { rfbLog("created %d tile_row shm polling images.\n", tile_shm_count); diff --git a/x11vnc/screen.c b/x11vnc/screen.c index fd3ce33..f87ae09 100644 --- a/x11vnc/screen.c +++ b/x11vnc/screen.c @@ -565,7 +565,7 @@ void set_raw_fb_params(int restore) { return; } - if (! quiet) { + if (verbose) { rfbLog("set_raw_fb_params: modifying settings for " "-rawfb mode.\n"); } @@ -577,7 +577,7 @@ void set_raw_fb_params(int restore) { * (i.e. rawfb but also send user input to the X * display, most likely using /dev/fb0 for some reason...) */ - if (! quiet) { + if (verbose) { rfbLog("rawfb: -noviewonly mode: still sending mouse and\n"); rfbLog("rawfb: keyboard input to the X DISPLAY!!\n"); } @@ -590,50 +590,50 @@ void set_raw_fb_params(int restore) { } #endif if (watch_selection) { - if (! quiet) rfbLog(" rawfb: turning off " + if (verbose) rfbLog(" rawfb: turning off " "watch_selection\n"); watch_selection = 0; } if (watch_primary) { - if (! quiet) rfbLog(" rawfb: turning off " + if (verbose) rfbLog(" rawfb: turning off " "watch_primary\n"); watch_primary = 0; } if (watch_clipboard) { - if (! quiet) rfbLog(" rawfb: turning off " + if (verbose) rfbLog(" rawfb: turning off " "watch_clipboard\n"); watch_clipboard = 0; } if (watch_bell) { - if (! quiet) rfbLog(" rawfb: turning off watch_bell\n"); + if (verbose) rfbLog(" rawfb: turning off watch_bell\n"); watch_bell = 0; } if (no_autorepeat) { - if (! quiet) rfbLog(" rawfb: turning off " + if (verbose) rfbLog(" rawfb: turning off " "no_autorepeat\n"); no_autorepeat = 0; } if (use_solid_bg) { - if (! quiet) rfbLog(" rawfb: turning off " + if (verbose) rfbLog(" rawfb: turning off " "use_solid_bg\n"); use_solid_bg = 0; } multiple_cursors_mode = strdup("arrow"); } if (using_shm) { - if (! quiet) rfbLog(" rawfb: turning off using_shm\n"); + if (verbose) rfbLog(" rawfb: turning off using_shm\n"); using_shm = 0; } if (take_naps) { - if (! quiet) rfbLog(" rawfb: turning off take_naps\n"); + if (verbose) rfbLog(" rawfb: turning off take_naps\n"); take_naps = 0; } if (xrandr) { - if (! quiet) rfbLog(" rawfb: turning off xrandr\n"); + if (verbose) rfbLog(" rawfb: turning off xrandr\n"); xrandr = 0; } if (! noxrecord) { - if (! quiet) rfbLog(" rawfb: turning off xrecord\n"); + if (verbose) rfbLog(" rawfb: turning off xrecord\n"); noxrecord = 1; } } @@ -1304,16 +1304,19 @@ if (db) fprintf(stderr, "initialize_raw_fb reset\n"); memset(raw_fb, 0xff, dpy_x * dpy_y * b/8); } - rfbLog("\n"); - rfbLog("rawfb: raw_fb %p\n", raw_fb); - rfbLog(" format %d\n", raw_fb_image->format); - rfbLog(" width %d\n", raw_fb_image->width); - rfbLog(" height %d\n", raw_fb_image->height); - rfbLog(" bpp %d\n", raw_fb_image->bits_per_pixel); - rfbLog(" depth %d\n", raw_fb_image->depth); - rfbLog(" bpl %d\n", raw_fb_image->bytes_per_line); - if (use_snapfb && snap_fb) { - rfbLog(" snap_fb %p\n", snap_fb); + if (verbose) { + + rfbLog("\n"); + rfbLog("rawfb: raw_fb %p\n", raw_fb); + rfbLog(" format %d\n", raw_fb_image->format); + rfbLog(" width %d\n", raw_fb_image->width); + rfbLog(" height %d\n", raw_fb_image->height); + rfbLog(" bpp %d\n", raw_fb_image->bits_per_pixel); + rfbLog(" depth %d\n", raw_fb_image->depth); + rfbLog(" bpl %d\n", raw_fb_image->bytes_per_line); + if (use_snapfb && snap_fb) { + rfbLog(" snap_fb %p\n", snap_fb); + } } free(str); @@ -2196,7 +2199,7 @@ void initialize_screen(int *argc, char **argv, XImage *fb) { } #if !SMALL_FOOTPRINT - if (!quiet) { + if (verbose) { fprintf(stderr, "\n"); fprintf(stderr, "FrameBuffer Info:\n"); fprintf(stderr, " width: %d\n", fb->width); @@ -2325,7 +2328,7 @@ void initialize_screen(int *argc, char **argv, XImage *fb) { } else { screen->frameBuffer = rfb_fb; } - if (!quiet) { + if (verbose) { fprintf(stderr, " rfb_fb: %p\n", rfb_fb); fprintf(stderr, " main_fb: %p\n", main_fb); fprintf(stderr, " 8to24_fb: %p\n", cmap8to24_fb); @@ -2399,6 +2402,9 @@ void initialize_screen(int *argc, char **argv, XImage *fb) { } else if (! got_rfbport) { screen->autoPort = TRUE; + } else if (got_rfbport && got_rfbport_val == 0) { + screen->autoPort = FALSE; + screen->port = 0; } if (! got_nevershared && ! got_alwaysshared) { diff --git a/x11vnc/sslcmds.c b/x11vnc/sslcmds.c index cf69910..d1ed95c 100644 --- a/x11vnc/sslcmds.c +++ b/x11vnc/sslcmds.c @@ -314,6 +314,7 @@ void setup_stunnel(int rport, int *argc, char **argv) { argv[i+1] = strdup(tmp); *argc += 2; got_rfbport = 1; + got_rfbport_val = atoi(tmp); } } stunnel_port = rport; @@ -710,14 +711,34 @@ void sslEncKey(char *path, int mode) { unlink(tmp); if (! mode && cert && cert[0] != '\0') { - file = fopen(path, "a"); + int got_cert = 0; + file = fopen(path, "r"); if (file == NULL) { rfbLog("sslEncKey: %s\n", path); rfbLogPerror("fopen"); exit(1); } - fprintf(file, "%s", cert); + while (fgets(line, 1024, file) != NULL) { + if (strstr(line, "-----BEGIN CERTIFICATE-----") + == line) { + got_cert++; + } + if (strstr(line, "-----END CERTIFICATE-----") + == line) { + got_cert++; + } + } fclose(file); + if (got_cert < 2) { + file = fopen(path, "a"); + if (file == NULL) { + rfbLog("sslEncKey: %s\n", path); + rfbLogPerror("fopen"); + exit(1); + } + fprintf(file, "%s", cert); + fclose(file); + } free(cert); } diff --git a/x11vnc/sslhelper.c b/x11vnc/sslhelper.c index 26c36b1..abd0a77 100644 --- a/x11vnc/sslhelper.c +++ b/x11vnc/sslhelper.c @@ -146,9 +146,35 @@ char *get_saved_pem(char *save, int create) { } } return new; - } else { - return strdup(path); } + + if (! quiet) { + char line[1024]; + int on = 0; + FILE *in = fopen(path, "r"); + if (in != NULL) { + rfbLog("\n"); + rfbLog("Using SSL Certificate:\n"); + fprintf(stderr, "\n"); + while (fgets(line, 1024, in) != NULL) { + if (strstr(line, "BEGIN CERTIFICATE")) { + on = 1; + } + if (on) { + fprintf(stderr, "%s", line); + } + if (strstr(line, "END CERTIFICATE")) { + on = 0; + } + if (strstr(line, "PRIVATE KEY")) { + on = 0; + } + } + fprintf(stderr, "\n"); + fclose(in); + } + } + return strdup(path); } static char *get_input(char *tag, char **in) { @@ -441,14 +467,17 @@ static char *create_tmp_pem(char *pathin, int prompt) { return NULL; } while (fgets(line, 1024, in) != NULL) { - if (strstr(line, "-----BEGIN CERTIFICATE-----")) { + if (strstr(line, "BEGIN CERTIFICATE")) { on = 1; } fprintf(out, "%s", line); if (on) { fprintf(crt, "%s", line); } - if (strstr(line, "-----END CERTIFICATE-----")) { + if (strstr(line, "END CERTIFICATE")) { + on = 0; + } + if (strstr(line, "PRIVATE KEY")) { on = 0; } } diff --git a/x11vnc/x11vnc.1 b/x11vnc/x11vnc.1 index d3ef73b..e190b4d 100644 --- a/x11vnc/x11vnc.1 +++ b/x11vnc/x11vnc.1 @@ -2,7 +2,7 @@ .TH X11VNC "1" "September 2006" "x11vnc " "User Commands" .SH NAME x11vnc - allow VNC connections to real X11 displays - version: 0.8.3, lastmod: 2006-09-15 + version: 0.8.3, lastmod: 2006-09-17 .SH SYNOPSIS .B x11vnc [OPTION]... @@ -409,11 +409,19 @@ your environment before starting x11vnc. If \fIstring\fR contains "/" it is instead interpreted as a file to periodically check for new hosts. The first line is read and then the file is truncated. -Be careful for this usage mode if x11vnc is running as -root (e.g. via +Be careful about the location of this file if x11vnc +is running as root (e.g. via .IR gdm (1) , etc). .PP +\fB-connect_or_exit\fR \fIstr\fR +.IP +As with \fB-connect,\fR except if none of the reverse +connections succeed, then x11vnc shutdowns immediately. +.IP +If you do not want x11vnc to listen on ANY interface +use \fB-rfbport\fR 0 +.PP \fB-vncconnect,\fR \fB-novncconnect\fR .IP Monitor the VNC_CONNECT X property set by the standard @@ -455,6 +463,11 @@ you use the remote control mechanism (-R) to change the \fB-listen\fR interface you may need to manually adjust the \fB-allow\fR list (and vice versa) to avoid situations where no connections (or too many) are allowed. +.IP +If you do not want x11vnc to listen on ANY interface +(evidently you are using \fB-connect\fR or \fB-connect_or_exit,\fR +or plan to use remote control: \fB-R\fR connect:host), use +\fB-rfbport\fR 0 .PP \fB-nolookup\fR .IP @@ -1788,10 +1801,14 @@ Print out license information. Same as \fB-copying\fR and Instead of exiting after cleaning up, run a simple "debug crash shell" when fatal errors are trapped. .PP -\fB-q\fR +\fB-q,\fR \fB-quiet\fR .IP Be quiet by printing less informational output to -stderr. Same as \fB-quiet.\fR +stderr. +.PP +\fB-v,\fR \fB-verbose\fR +.IP +Print out more information to stderr. .PP \fB-bg\fR .IP diff --git a/x11vnc/x11vnc.c b/x11vnc/x11vnc.c index 7cbaa25..0ca354e 100644 --- a/x11vnc/x11vnc.c +++ b/x11vnc/x11vnc.c @@ -1625,13 +1625,17 @@ int main(int argc, char* argv[]) { } else if (!strcmp(arg, "-http_ssl")) { try_http = 1; http_ssl = 1; - } else if (!strcmp(arg, "-connect")) { + } else if (!strcmp(arg, "-connect") || + !strcmp(arg, "-connect_or_exit")) { CHECK_ARGC if (strchr(argv[++i], '/')) { client_connect_file = strdup(argv[i]); } else { client_connect = strdup(argv[i]); } + if (!strcmp(arg, "-connect_or_exit")) { + connect_or_exit = 1; + } } else if (!strcmp(arg, "-vncconnect")) { vnc_connect = 1; } else if (!strcmp(arg, "-novncconnect")) { @@ -1887,6 +1891,8 @@ int main(int argc, char* argv[]) { crash_debug = 0; } else if (!strcmp(arg, "-q") || !strcmp(arg, "-quiet")) { quiet = 1; + } else if (!strcmp(arg, "-v") || !strcmp(arg, "-verbose")) { + verbose = 1; } else if (!strcmp(arg, "-bg") || !strcmp(arg, "-background")) { #if LIBVNCSERVER_HAVE_SETSID bg = 1; @@ -2306,7 +2312,8 @@ int main(int argc, char* argv[]) { got_deferupdate = 1; } if (!strcmp(arg, "-rfbport") && i < argc-1) { - got_rfbport = atoi(argv[i+1]); + got_rfbport = 1; + got_rfbport_val = atoi(argv[i+1]); } if (!strcmp(arg, "-alwaysshared ")) { got_alwaysshared = 1; @@ -2710,7 +2717,6 @@ int main(int argc, char* argv[]) { if (use_stunnel) { exit(1); } - /* others? */ } if (flip_byte_order && using_shm && ! quiet) { @@ -2790,7 +2796,9 @@ int main(int argc, char* argv[]) { initialize_crash_handler(); if (! quiet) { - print_settings(try_http, bg, gui_str); + if (verbose) { + print_settings(try_http, bg, gui_str); + } } else { rfbLogEnable(0); } @@ -2907,7 +2915,7 @@ int main(int argc, char* argv[]) { scr = DefaultScreen(dpy); rootwin = RootWindow(dpy, scr); - if (! quiet) { + if (! quiet && ! raw_fb_str) { rfbLog("\n"); rfbLog("------------------ USEFUL INFORMATION ------------------\n"); } @@ -2938,7 +2946,7 @@ int main(int argc, char* argv[]) { #if LIBVNCSERVER_HAVE_LIBXFIXES if (! XFixesQueryExtension(dpy, &xfixes_base_event_type, &er)) { - if (! quiet) { + if (! quiet && ! raw_fb_str) { rfbLog("Disabling XFIXES mode: display does not " "support it.\n"); } @@ -2954,7 +2962,7 @@ int main(int argc, char* argv[]) { #if LIBVNCSERVER_HAVE_LIBXDAMAGE if (! XDamageQueryExtension(dpy, &xdamage_base_event_type, &er)) { - if (! quiet) { + if (! quiet && ! raw_fb_str) { rfbLog("Disabling X DAMAGE mode: display does not " "support it.\n"); } @@ -2967,14 +2975,14 @@ int main(int argc, char* argv[]) { if (! xdamage_present) { use_xdamage = 0; } - if (! quiet && xdamage_present && use_xdamage) { + if (! quiet && xdamage_present && use_xdamage && ! raw_fb_str) { rfbLog("X DAMAGE available on display, using it for" " polling hints.\n"); rfbLog(" To disable this behavior use: " "'-noxdamage'\n"); } - if (! quiet && wireframe) { + if (! quiet && wireframe && ! raw_fb_str) { rfbLog("Wireframing: -wireframe mode is in effect for window " "moves.\n"); rfbLog(" If this yields undesired behavior (poor response, " @@ -2999,7 +3007,7 @@ int main(int argc, char* argv[]) { overlay_present = 0; #if defined(SOLARIS_OVERLAY) && !NO_X11 if (! XQueryExtension(dpy, "SUN_OVL", &maj, &ev, &er)) { - if (! quiet && overlay) { + if (! quiet && overlay && ! raw_fb_str) { rfbLog("Disabling -overlay: SUN_OVL " "extension not available.\n"); } @@ -3009,7 +3017,7 @@ int main(int argc, char* argv[]) { #endif #if defined(IRIX_OVERLAY) && !NO_X11 if (! XReadDisplayQueryExtension(dpy, &ev, &er)) { - if (! quiet && overlay) { + if (! quiet && overlay && ! raw_fb_str) { rfbLog("Disabling -overlay: IRIX ReadDisplay " "extension not available.\n"); } @@ -3032,7 +3040,7 @@ int main(int argc, char* argv[]) { free(multiple_cursors_mode); multiple_cursors_mode = strdup("most"); - if (! quiet) { + if (! quiet && ! raw_fb_str) { rfbLog("XFIXES available on display, resetting" " cursor mode\n"); rfbLog(" to: '-cursor most'.\n"); @@ -3044,7 +3052,7 @@ int main(int argc, char* argv[]) { if(!strcmp(multiple_cursors_mode, "most")) { if (xfixes_present && use_xfixes && overlay_cursor == 1) { - if (! quiet) { + if (! quiet && ! raw_fb_str) { rfbLog("using XFIXES for cursor " "drawing.\n"); } @@ -3055,7 +3063,7 @@ int main(int argc, char* argv[]) { if (overlay) { using_shm = 0; - if (flash_cmap && ! quiet) { + if (flash_cmap && ! quiet && ! raw_fb_str) { rfbLog("warning: -flashcmap may be " "incompatible with -overlay\n"); } @@ -3082,7 +3090,7 @@ int main(int argc, char* argv[]) { /* check for XTEST */ if (! XTestQueryExtension_wr(dpy, &ev, &er, &maj, &min)) { - if (! quiet) { + if (! quiet && ! raw_fb_str) { rfbLog("WARNING: XTEST extension not available " "(either missing from\n"); rfbLog(" display or client library libXtst " @@ -3149,7 +3157,7 @@ int main(int argc, char* argv[]) { #if !LIBVNCSERVER_HAVE_RECORD tmpi = 0; #endif - if (! quiet && tmpi) { + if (! quiet && tmpi && ! raw_fb_str) { rfbLog("Scroll Detection: -scrollcopyrect mode is in effect " "to\n"); rfbLog(" use RECORD extension to try to detect scrolling " @@ -3183,12 +3191,12 @@ int main(int argc, char* argv[]) { if (! XShmQueryExtension_wr(dpy)) { xshm_present = 0; if (! using_shm) { - if (! quiet) { + if (! quiet && ! raw_fb_str) { rfbLog("info: display does not support" " XShm.\n"); } } else { - if (! quiet) { + if (! quiet && ! raw_fb_str) { rfbLog("warning: XShm extension is not available.\n"); rfbLog("For best performance the X Display should be" " local. (i.e.\n"); @@ -3212,7 +3220,7 @@ int main(int argc, char* argv[]) { initialize_xkb(); initialize_watch_bell(); if (!xkb_present && use_xkb_modtweak) { - if (! quiet) { + if (! quiet && ! raw_fb_str) { rfbLog("warning: disabling xkb modtweak." " XKEYBOARD ext. not present.\n"); } @@ -3228,7 +3236,7 @@ int main(int argc, char* argv[]) { #if LIBVNCSERVER_HAVE_LIBXRANDR if (! XRRQueryExtension(dpy, &xrandr_base_event_type, &er)) { - if (xrandr && ! quiet) { + if (xrandr && ! quiet && ! raw_fb_str) { rfbLog("Disabling -xrandr mode: display does not" " support X RANDR.\n"); } @@ -3242,7 +3250,7 @@ int main(int argc, char* argv[]) { check_pm(); - if (! quiet) { + if (! quiet && ! raw_fb_str) { rfbLog("--------------------------------------------------------\n"); rfbLog("\n"); } @@ -3337,9 +3345,13 @@ int main(int argc, char* argv[]) { } if (! inetd && ! use_openssl) { if (! screen->port || screen->listenSock < 0) { - rfbLogEnable(1); - rfbLog("Error: could not obtain listening port.\n"); - clean_up_exit(1); + if (got_rfbport && got_rfbport_val == 0) { + ; + } else { + rfbLogEnable(1); + rfbLog("Error: could not obtain listening port.\n"); + clean_up_exit(1); + } } } if (! quiet) { diff --git a/x11vnc/x11vnc_defs.c b/x11vnc/x11vnc_defs.c index 170c981..b115171 100644 --- a/x11vnc/x11vnc_defs.c +++ b/x11vnc/x11vnc_defs.c @@ -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.3 lastmod: 2006-09-15"; +char lastmod[] = "0.8.3 lastmod: 2006-09-17"; /* X display info */ diff --git a/x11vnc/xinerama.c b/x11vnc/xinerama.c index ddc2da7..8582dab 100644 --- a/x11vnc/xinerama.c +++ b/x11vnc/xinerama.c @@ -243,14 +243,18 @@ static void initialize_xinerama (void) { RAWFB_RET_VOID if (! XineramaQueryExtension(dpy, &ev, &er)) { - rfbLog("Xinerama: disabling: display does not support it.\n"); + if (verbose) { + rfbLog("Xinerama: disabling: display does not support it.\n"); + } xinerama = 0; xinerama_present = 0; return; } if (! XineramaIsActive(dpy)) { /* n.b. change to XineramaActive(dpy, window) someday */ - rfbLog("Xinerama: disabling: not active on display.\n"); + if (verbose) { + rfbLog("Xinerama: disabling: not active on display.\n"); + } xinerama = 0; xinerama_present = 0; return; @@ -259,11 +263,15 @@ static void initialize_xinerama (void) { /* n.b. change to XineramaGetData() someday */ xineramas = XineramaQueryScreens(dpy, &n); - rfbLog("Xinerama: number of sub-screens: %d\n", n); + if (verbose) { + rfbLog("Xinerama: number of sub-screens: %d\n", n); + } if (n == 1) { - rfbLog("Xinerama: no blackouts needed (only one" - " sub-screen)\n"); + if (verbose) { + rfbLog("Xinerama: no blackouts needed (only one" + " sub-screen)\n"); + } XFree(xineramas); return; /* must be OK w/o change */ } diff --git a/x11vnc/xwrappers.c b/x11vnc/xwrappers.c index 2511009..2849d3d 100644 --- a/x11vnc/xwrappers.c +++ b/x11vnc/xwrappers.c @@ -922,7 +922,7 @@ void disable_grabserver(Display *in_dpy, int change) { if (change) { XTRAP_GrabControl_wr(in_dpy, False); } - if (! didmsg) { + if (! didmsg && ! raw_fb_str) { rfbLog("GrabServer control via XTEST.\n"); didmsg = 1; } @@ -930,7 +930,7 @@ void disable_grabserver(Display *in_dpy, int change) { } else { if (XTRAP_GrabControl_wr(in_dpy, True)) { ok = 1; - if (! didmsg) { + if (! didmsg && ! raw_fb_str) { rfbLog("Using DEC-XTRAP for protection" " from XGrabServer.\n"); didmsg = 1; @@ -942,7 +942,7 @@ void disable_grabserver(Display *in_dpy, int change) { if (change) { XTestGrabControl_wr(in_dpy, False); } - if (! didmsg) { + if (! didmsg && ! raw_fb_str) { rfbLog("GrabServer control via DEC-XTRAP.\n"); didmsg = 1; } @@ -950,7 +950,7 @@ void disable_grabserver(Display *in_dpy, int change) { } else { if (XTestGrabControl_wr(in_dpy, True)) { ok = 1; - if (! didmsg) { + if (! didmsg && ! raw_fb_str) { rfbLog("DEC-XTRAP XGrabServer " "protection not available, " "using XTEST.\n"); |