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.
pull/1/head
runge 15 years ago
parent 8f5c9ef01e
commit d6c012e968

@ -1,3 +1,15 @@
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> 2009-12-06 Karl Runge <runge@karlrunge.com>
* x11vnc: findauth/-auth guess works with FD_XDM=1 for root * x11vnc: findauth/-auth guess works with FD_XDM=1 for root
finding dm's xauthority. Work around for GDM's recent finding dm's xauthority. Work around for GDM's recent

@ -2,7 +2,7 @@
Copyright (C) 2002-2009 Karl J. Runge <runge@karlrunge.com> Copyright (C) 2002-2009 Karl J. Runge <runge@karlrunge.com>
All rights reserved. All rights reserved.
x11vnc README file Date: Mon Dec 7 08:14:20 EST 2009 x11vnc README file Date: Mon Dec 14 18:18:24 EST 2009
The following information is taken from these URLs: The following information is taken from these URLs:
@ -565,7 +565,7 @@ vncviewer -via $host localhost:0 # must be TightVNC vncviewer.
Tunnelling x11vnc via SSL/TLS: Tunnelling x11vnc via SSL/TLS:
One can also encrypt the VNC traffic using an SSL/TLS tunnel such as One can also encrypt the VNC traffic using an SSL/TLS tunnel such as
[85]stunnel (also [86]stunnel.mirt.net) or using the built-in [85]stunnel.mirt.net (also [86]stunnel.org) or using the built-in
(Mar/2006) [87]-ssl openssl mode. A SSL-enabled Java applet VNC Viewer (Mar/2006) [87]-ssl openssl mode. A SSL-enabled Java applet VNC Viewer
is also provided in the x11vnc package (and https can be used to is also provided in the x11vnc package (and https can be used to
download it.) download it.)
@ -1280,56 +1280,56 @@ LAY
and client certificate authentication schemes. and client certificate authentication schemes.
* Similar to -ssl, the [253]-stunnel option starts up a SSL tunnel * Similar to -ssl, the [253]-stunnel option starts up a SSL tunnel
server stunnel (that must be installed separately on the system: server stunnel (that must be installed separately on the system:
[254]www.stunnel.org [255]stunnel.mirt.net ) to allow only [254]stunnel.mirt.net ) to allow only encrypted SSL connections
encrypted SSL connections from the network. from the network.
* The [256]-sslverify option allows for authenticating VNC clients * The [255]-sslverify option allows for authenticating VNC clients
via their certificates in either -ssl or -stunnel modes. via their certificates in either -ssl or -stunnel modes.
* Certificate creation and management tools are provide in the * Certificate creation and management tools are provide in the
[257]-sslGenCert, [258]-sslGenCA, and [259]related options. [256]-sslGenCert, [257]-sslGenCA, and [258]related options.
* An SSL enabled Java applet VNC Viewer applet is provided by x11vnc * An SSL enabled Java applet VNC Viewer applet is provided by x11vnc
in classes/ssl/VncViewer.jar. In addition to normal HTTP, the in classes/ssl/VncViewer.jar. In addition to normal HTTP, the
applet may be loaded into the web browser via HTTPS (HTTP over applet may be loaded into the web browser via HTTPS (HTTP over
SSL.) (one can use the VNC port, e.g. https://host:5900/, or also SSL.) (one can use the VNC port, e.g. https://host:5900/, or also
the separate [260]-https port option.) A wrapper shell script the separate [259]-https port option.) A wrapper shell script
[261]ss_vncviewer is also provided that sets up a stunnel [260]ss_vncviewer is also provided that sets up a stunnel
client-side tunnel on Unix systems. See [262]Enhanced TightVNC client-side tunnel on Unix systems. See [261]Enhanced TightVNC
Viewer (SSVNC) for other SSL/SSH viewer possibilities. Viewer (SSVNC) for other SSL/SSH viewer possibilities.
* The [263]-unixpw option supports Unix username and password * The [262]-unixpw option supports Unix username and password
authentication (a simpler variant is the [264]-unixpw_nis option authentication (a simpler variant is the [263]-unixpw_nis option
that works in environments where the encrypted passwords are that works in environments where the encrypted passwords are
readable, e.g. NIS.) The [265]-ssl or [266]-localhost + readable, e.g. NIS.) The [264]-ssl or [265]-localhost +
[267]-stunnel options are enforced in this mode to prevent [266]-stunnel options are enforced in this mode to prevent
password sniffing. As a convenience, these requirements are lifted password sniffing. As a convenience, these requirements are lifted
if a SSH tunnel can be deduced (but -localhost still applies.) if a SSH tunnel can be deduced (but -localhost still applies.)
* Coupling [268]-unixpw with "[269]-display WAIT:cmd=FINDDISPLAY" or * Coupling [267]-unixpw with "[268]-display WAIT:cmd=FINDDISPLAY" or
"-display WAIT:cmd=FINDCREATEDISPLAY" provides a way to allow a "-display WAIT:cmd=FINDCREATEDISPLAY" provides a way to allow a
user to login with their UNIX password and have their display user to login with their UNIX password and have their display
connected to [270]automatically. See the [271]-svc and the connected to [269]automatically. See the [270]-svc and the
[272]-xdmsvc aliases. [271]-xdmsvc aliases.
* Hooks are provided in the [273]-unixpw_cmd and "[274]-passwdfile * Hooks are provided in the [272]-unixpw_cmd and "[273]-passwdfile
cmd:,custom:..." options to allow you to supply your own cmd:,custom:..." options to allow you to supply your own
authentication and password lookup programs. authentication and password lookup programs.
* x11vnc can be configured and built to not depend on X11 libraries * x11vnc can be configured and built to not depend on X11 libraries
"./configure --without-x" for [275]-rawfb only operation (e.g. "./configure --without-x" for [274]-rawfb only operation (e.g.
embedded linux console devices.) embedded linux console devices.)
* The [276]-rotate option enables you to rotate or reflect the * The [275]-rotate option enables you to rotate or reflect the
screen before exporting via VNC. This is intended for use on screen before exporting via VNC. This is intended for use on
handhelds and other devices where the rotation orientation is not handhelds and other devices where the rotation orientation is not
"natural". "natural".
* The "[277]-ultrafilexfer" alias is provided and improved UltraVNC * The "[276]-ultrafilexfer" alias is provided and improved UltraVNC
filetransfer rates have been achieved. filetransfer rates have been achieved.
* Under the "[278]-connect_or_exit host" option x11vnc will exit * Under the "[277]-connect_or_exit host" option x11vnc will exit
immediately unless the reverse connection to host succeeds. The immediately unless the reverse connection to host succeeds. The
"-rfbport 0" option disables TCP listening for connections (useful "-rfbport 0" option disables TCP listening for connections (useful
for this mode.) for this mode.)
* The "[279]-rawfb rand" and "-rawfb none" options are useful for * The "[278]-rawfb rand" and "-rawfb none" options are useful for
testing automation scripts, etc., without requiring a full testing automation scripts, etc., without requiring a full
desktop. desktop.
* Reduced spewing of information at startup, use "[280]-verbose" * Reduced spewing of information at startup, use "[279]-verbose"
(also "-v") to turn it back on for debugging or if you are going (also "-v") to turn it back on for debugging or if you are going
to send me a problem report. to send me a problem report.
Here are some [281]Previous Release Notes Here are some [280]Previous Release Notes
_________________________________________________________________ _________________________________________________________________
Some Notes: Some Notes:
@ -1356,13 +1356,13 @@ LAY
protocol.) I suggest using xsetroot, dtstyle or similar utility to set protocol.) I suggest using xsetroot, dtstyle or similar utility to set
a solid background while using x11vnc. You can turn the pretty a solid background while using x11vnc. You can turn the pretty
background image back on when you are using the display directly. background image back on when you are using the display directly.
Update: As of Feb/2005 x11vnc has the [282]-solid [color] option that Update: As of Feb/2005 x11vnc has the [281]-solid [color] option that
works on recent GNOME, KDE, and CDE and also on classic X (background works on recent GNOME, KDE, and CDE and also on classic X (background
image is on the root window.) Update: As of Oct/2007 x11vnc has the image is on the root window.) Update: As of Oct/2007 x11vnc has the
[283]-ncache option that does a reasonable job caching the background [282]-ncache option that does a reasonable job caching the background
(and other) pixmap data on the viewer side. (and other) pixmap data on the viewer side.
I also find the [284]TightVNC encoding gives the best response for my I also find the [283]TightVNC encoding gives the best response for my
usage (Unix <-> Unix over cable modem.) One needs a tightvnc-aware usage (Unix <-> Unix over cable modem.) One needs a tightvnc-aware
vncviewer to take advantage of this encoding. vncviewer to take advantage of this encoding.
@ -1374,17 +1374,17 @@ LAY
is X11's default listening port.) Had port 5900 been taken by some is X11's default listening port.) Had port 5900 been taken by some
other application, x11vnc would have next tried 5901. That would mean other application, x11vnc would have next tried 5901. That would mean
the viewer command above should be changed to vncviewer the viewer command above should be changed to vncviewer
far-away.east:1. You can force the port with the "[285]-rfbport NNNN" far-away.east:1. You can force the port with the "[284]-rfbport NNNN"
option where NNNN is the desired port number. If that port is already option where NNNN is the desired port number. If that port is already
taken, x11vnc will exit immediately. The "[286]-N" option will try to taken, x11vnc will exit immediately. The "[285]-N" option will try to
match the VNC display number to the X display. (also see the "SunRay match the VNC display number to the X display. (also see the "SunRay
Gotcha" note below) Gotcha" note below)
Options: x11vnc has (far too) many features that may be activated Options: x11vnc has (far too) many features that may be activated
via its [287]command line options. Useful options are, e.g., -scale to via its [286]command line options. Useful options are, e.g., -scale to
do server-side scaling, and -rfbauth passwd-file to use VNC password do server-side scaling, and -rfbauth passwd-file to use VNC password
protection (the vncpasswd or storepasswd programs, or the x11vnc protection (the vncpasswd or storepasswd programs, or the x11vnc
[288]-storepasswd option can be used to create the password file.) [287]-storepasswd option can be used to create the password file.)
Algorithm: How does x11vnc do it? Rather brute-forcedly: it Algorithm: How does x11vnc do it? Rather brute-forcedly: it
continuously polls the X11 framebuffer for changes using continuously polls the X11 framebuffer for changes using
@ -1412,7 +1412,7 @@ LAY
first testing out the programs. You get an interesting first testing out the programs. You get an interesting
recursive/feedback effect where vncviewer images keep popping up each recursive/feedback effect where vncviewer images keep popping up each
one contained in the previous one and slightly shifted a bit by the one contained in the previous one and slightly shifted a bit by the
window manager decorations. There will be an [289]even more window manager decorations. There will be an [288]even more
interesting effect if -scale is used. Also, if the XKEYBOARD is interesting effect if -scale is used. Also, if the XKEYBOARD is
supported and the XBell "beeps" once, you get an infinite loop of supported and the XBell "beeps" once, you get an infinite loop of
beeps going off. Although all of this is mildly exciting it is not beeps going off. Although all of this is mildly exciting it is not
@ -1422,8 +1422,8 @@ LAY
Sun Ray Notes: Sun Ray Notes:
You can run x11vnc on your (connected or disconnected) [290]SunRay You can run x11vnc on your (connected or disconnected) [289]SunRay
session. Here are some [291]notes on SunRay usage with x11vnc. session. Here are some [290]notes on SunRay usage with x11vnc.
_________________________________________________________________ _________________________________________________________________
@ -1435,7 +1435,7 @@ LAY
than you normally do to minimize the effects (e.g. do fullpage than you normally do to minimize the effects (e.g. do fullpage
paging rather than line-by-line scrolling, and move windows in a paging rather than line-by-line scrolling, and move windows in a
single, quick motion.) Recent work has provided the single, quick motion.) Recent work has provided the
[292]-scrollcopyrect and [293]-wireframe speedups using the [291]-scrollcopyrect and [292]-wireframe speedups using the
CopyRect VNC encoding and other things, but they only speed up CopyRect VNC encoding and other things, but they only speed up
some activities, not all. some activities, not all.
* A rate limiting factor for x11vnc performance is that graphics * A rate limiting factor for x11vnc performance is that graphics
@ -1494,18 +1494,18 @@ LAY
but we mention it because it may be of use for special purpose but we mention it because it may be of use for special purpose
applications. You may need to use the "-cc 4" option to force Xvfb applications. You may need to use the "-cc 4" option to force Xvfb
to use a TrueColor visual instead of DirectColor. See also the to use a TrueColor visual instead of DirectColor. See also the
description of the [294]-create option that does all of this description of the [293]-create option that does all of this
automatically for you. automatically for you.
Also, a faster and more accurate way is to use the "dummy" Also, a faster and more accurate way is to use the "dummy"
XFree86/Xorg device driver (or our Xdummy wrapper script.) See XFree86/Xorg device driver (or our Xdummy wrapper script.) See
[295]this FAQ for details. [294]this FAQ for details.
* Somewhat surprisingly, the X11 mouse (cursor) shape is write-only * Somewhat surprisingly, the X11 mouse (cursor) shape is write-only
and cannot be queried from the X server. So traditionally in and cannot be queried from the X server. So traditionally in
x11vnc the cursor shape stays fixed at an arrow. (see the "-cursor x11vnc the cursor shape stays fixed at an arrow. (see the "-cursor
X" and "-cursor some" [296]options, however, for a partial hack X" and "-cursor some" [295]options, however, for a partial hack
for the root window, etc.) However, on Solaris using the SUN_OVL for the root window, etc.) However, on Solaris using the SUN_OVL
overlay extension, x11vnc can show the correct mouse cursor when overlay extension, x11vnc can show the correct mouse cursor when
the [297]-overlay option is also supplied. A similar thing is done the [296]-overlay option is also supplied. A similar thing is done
on IRIX as well when -overlay is supplied. on IRIX as well when -overlay is supplied.
More generally, as of Dec/2004 x11vnc supports the new XFIXES More generally, as of Dec/2004 x11vnc supports the new XFIXES
extension (in Xorg and Solaris 10) to query the X server for the extension (in Xorg and Solaris 10) to query the X server for the
@ -1513,18 +1513,18 @@ LAY
with transparency (alpha channel) need to approximated to solid with transparency (alpha channel) need to approximated to solid
RGB values (some cursors look worse than others.) RGB values (some cursors look worse than others.)
* Audio from applications is of course not redirected (separate * Audio from applications is of course not redirected (separate
redirectors do exist, e.g. esd, see [298]the FAQ on this below.) redirectors do exist, e.g. esd, see [297]the FAQ on this below.)
The XBell() "beeps" will work if the X server supports the The XBell() "beeps" will work if the X server supports the
XKEYBOARD extension. (Note that on Solaris XKEYBOARD is disabled XKEYBOARD extension. (Note that on Solaris XKEYBOARD is disabled
by default. Passing +kb to Xsun enables it.) by default. Passing +kb to Xsun enables it.)
* The scroll detection algorithm for the [299]-scrollcopyrect option * The scroll detection algorithm for the [298]-scrollcopyrect option
can give choppy or bunched up transient output and occasionally can give choppy or bunched up transient output and occasionally
painting errors. painting errors.
* Using -threads can expose some bugs/crashes in libvncserver. * Using -threads can expose some bugs/crashes in libvncserver.
Please feel free to [300]contact me if you have any questions, Please feel free to [299]contact me if you have any questions,
problems, or comments about x11vnc, etc. problems, or comments about x11vnc, etc.
Also, some people ask if they can make a donation, see [301]this link Also, some people ask if they can make a donation, see [300]this link
for that. for that.
References References
@ -1613,8 +1613,8 @@ References
82. http://www.karlrunge.com/x11vnc/ssvnc.html 82. http://www.karlrunge.com/x11vnc/ssvnc.html
83. http://www.karlrunge.com/x11vnc/faq.html#faq-allow-opt 83. http://www.karlrunge.com/x11vnc/faq.html#faq-allow-opt
84. http://www.karlrunge.com/x11vnc/faq.html#faq-tcp_wrappers 84. http://www.karlrunge.com/x11vnc/faq.html#faq-tcp_wrappers
85. http://www.stunnel.org/ 85. http://stunnel.mirt.net/
86. http://stunnel.mirt.net/ 86. http://www.stunnel.org/
87. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-ssl 87. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-ssl
88. http://www.karlrunge.com/x11vnc/faq.html#faq-ssl-tunnel-int 88. http://www.karlrunge.com/x11vnc/faq.html#faq-ssl-tunnel-int
89. http://www.karlrunge.com/x11vnc/ssvnc.html 89. http://www.karlrunge.com/x11vnc/ssvnc.html
@ -1782,54 +1782,53 @@ References
251. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-ssl 251. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-ssl
252. http://www.openssl.org/ 252. http://www.openssl.org/
253. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-stunnel 253. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-stunnel
254. http://www.stunnel.org/ 254. http://stunnel.mirt.net/
255. http://stunnel.mirt.net/ 255. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sslverify
256. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sslverify 256. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sslGenCert
257. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sslGenCert 257. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sslGenCA
258. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sslGenCA 258. http://www.karlrunge.com/x11vnc/ssl.html
259. http://www.karlrunge.com/x11vnc/ssl.html 259. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-https
260. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-https 260. http://www.karlrunge.com/x11vnc/faq.html#infaq_ss_vncviewer
261. http://www.karlrunge.com/x11vnc/faq.html#infaq_ss_vncviewer 261. http://www.karlrunge.com/x11vnc/ssvnc.html
262. http://www.karlrunge.com/x11vnc/ssvnc.html 262. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-unixpw
263. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-unixpw 263. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-unixpw_nis
264. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-unixpw_nis 264. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-ssl
265. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-ssl 265. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-localhost
266. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-localhost 266. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-stunnel
267. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-stunnel 267. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-unixpw
268. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-unixpw 268. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-display_WAIT
269. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-display_WAIT 269. http://www.karlrunge.com/x11vnc/faq.html#faq-userlogin
270. http://www.karlrunge.com/x11vnc/faq.html#faq-userlogin 270. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-svc
271. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-svc 271. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xdmsvc
272. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xdmsvc 272. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-unixpw_cmd
273. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-unixpw_cmd 273. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-passwdfile
274. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-passwdfile 274. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rawfb
275. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rawfb 275. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rotate
276. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rotate 276. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-ultrafilexfer
277. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-ultrafilexfer 277. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-connect_or_exit
278. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-connect_or_exit 278. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rawfb
279. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rawfb 279. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-v,
280. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-v, 280. http://www.karlrunge.com/x11vnc/prevrels.html
281. http://www.karlrunge.com/x11vnc/prevrels.html 281. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-solid
282. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-solid 282. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-ncache
283. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-ncache 283. http://www.tightvnc.com/
284. http://www.tightvnc.com/ 284. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rfbport
285. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rfbport 285. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-N
286. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-N 286. http://www.karlrunge.com/x11vnc/x11vnc_opts.html
287. http://www.karlrunge.com/x11vnc/x11vnc_opts.html 287. http://www.karlrunge.com/x11vnc/faq.html#faq-passwd
288. http://www.karlrunge.com/x11vnc/faq.html#faq-passwd 288. http://www.karlrunge.com/x11vnc/recurse_x11vnc.jpg
289. http://www.karlrunge.com/x11vnc/recurse_x11vnc.jpg 289. http://www.sun.com/sunray/index.html
290. http://www.sun.com/sunray/index.html 290. http://www.karlrunge.com/x11vnc/sunray.html
291. http://www.karlrunge.com/x11vnc/sunray.html 291. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect
292. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect 292. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe
293. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe 293. http://www.karlrunge.com/x11vnc/faq.html#infaq_findcreatedisplay
294. http://www.karlrunge.com/x11vnc/faq.html#infaq_findcreatedisplay 294. http://www.karlrunge.com/x11vnc/faq.html#faq-xvfb
295. http://www.karlrunge.com/x11vnc/faq.html#faq-xvfb 295. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-cursor
296. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-cursor 296. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-overlay
297. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-overlay 297. http://www.karlrunge.com/x11vnc/faq.html#faq-sound
298. http://www.karlrunge.com/x11vnc/faq.html#faq-sound 298. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect
299. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect 299. mailto:xvml@karlrunge.com
300. mailto:xvml@karlrunge.com 300. http://www.karlrunge.com/x11vnc/faq.html#faq-thanks
301. http://www.karlrunge.com/x11vnc/faq.html#faq-thanks
======================================================================= =======================================================================
http://www.karlrunge.com/x11vnc/faq.html: http://www.karlrunge.com/x11vnc/faq.html:
@ -12899,7 +12898,7 @@ x11vnc: a VNC server for real X displays
Here are all of x11vnc command line options: Here are all of x11vnc command line options:
% x11vnc -opts (see below for -help long descriptions) % x11vnc -opts (see below for -help long descriptions)
x11vnc: allow VNC connections to real X11 displays. 0.9.9 lastmod: 2009-12-06 x11vnc: allow VNC connections to real X11 displays. 0.9.9 lastmod: 2009-12-14
x11vnc options: x11vnc options:
-display disp -auth file -N -display disp -auth file -N
@ -13026,7 +13025,7 @@ libvncserver-tight-extension options:
% x11vnc -help % x11vnc -help
x11vnc: allow VNC connections to real X11 displays. 0.9.9 lastmod: 2009-12-06 x11vnc: allow VNC connections to real X11 displays. 0.9.9 lastmod: 2009-12-14
(type "x11vnc -opts" to just list the options.) (type "x11vnc -opts" to just list the options.)
@ -13633,6 +13632,15 @@ Options:
X11VNC_REMOTE channel, and this option disables/enables X11VNC_REMOTE channel, and this option disables/enables
it as well. Default: -vncconnect it as well. Default: -vncconnect
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: -env 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.
-allow host1[,host2..] Only allow client connections from hosts matching -allow host1[,host2..] Only allow client connections from hosts matching
the comma separated list of hostnames or IP addresses. the comma separated list of hostnames or IP addresses.
Can also be a numerical IP prefix, e.g. "192.168.100." Can also be a numerical IP prefix, e.g. "192.168.100."
@ -15794,6 +15802,12 @@ t
-q, -quiet Be quiet by printing less informational output to -q, -quiet Be quiet by printing less informational output to
stderr. (use -noquiet to undo an earlier -quiet.) stderr. (use -noquiet to undo an earlier -quiet.)
The -quiet option does not eliminate all informational
output, it only reduces it. It is ignored in most
auxiliary usage modes, e.g. -storepasswd. To eliminate
all output use: 2>/dev/null 1>&2, etc.
-v, -verbose Print out more information to stderr. -v, -verbose Print out more information to stderr.
-bg Go into the background after screen setup. Messages to -bg Go into the background after screen setup. Messages to
@ -17597,6 +17611,13 @@ n
'x11vnc -R shared' will enable shared connections, and 'x11vnc -R shared' will enable shared connections, and
'x11vnc -R scale:3/4' will rescale the desktop. 'x11vnc -R scale:3/4' will rescale the desktop.
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: -env X11VNC_REMOTE=X11VNC_REMOTE_12345
Both sides of the channel must use the same unique name.
To run a bunch of commands in a sequence use something To run a bunch of commands in a sequence use something
like: x11vnc -R 'script:firstcmd;secondcmd;...' like: x11vnc -R 'script:firstcmd;secondcmd;...'
@ -17877,6 +17898,7 @@ n
keysym:str inject keystroke 'keysym' (number/name) keysym:str inject keystroke 'keysym' (number/name)
keysym:str,down inject 'keysym' (down=0,1) keysym:str,down inject 'keysym' (down=0,1)
ptr:x,y,mask inject pointer event x, y, button-mask ptr:x,y,mask inject pointer event x, y, button-mask
fakebuttonevent:button,down direct XTestFakeButtonEvent.
sleep:t sleep floating point time t. sleep:t sleep floating point time t.
get_xprop:p get X property named 'p'. get_xprop:p get X property named 'p'.
set_xprop:p:val set X property named 'p' to 'val'. set_xprop:p:val set X property named 'p' to 'val'.
@ -18155,8 +18177,8 @@ n
grabkbd nograbkbd grabptr nograbptr grabalways grabkbd nograbkbd grabptr nograbptr grabalways
nograbalways grablocal client_input ssltimeout nograbalways grablocal client_input ssltimeout
speeds wmdt debug_pointer dp nodebug_pointer nodp speeds wmdt debug_pointer dp nodebug_pointer nodp
debug_keyboard dk nodebug_keyboard nodk keycode debug_keyboard dk nodebug_keyboard nodk keycode keysym
keysym ptr sleep get_xprop set_xprop wininfo ptr fakebuttonevent sleep get_xprop set_xprop wininfo
bcx_xattach deferupdate defer setdefer extra_fbur bcx_xattach deferupdate defer setdefer extra_fbur
wait_ui wait_bog nowait_bog slow_fb xrefresh wait wait_ui wait_bog nowait_bog slow_fb xrefresh wait
readtimeout nap nonap sb screen_blank fbpm nofbpm dpms readtimeout nap nonap sb screen_blank fbpm nofbpm dpms

@ -664,6 +664,15 @@ void print_help(int mode) {
" X11VNC_REMOTE channel, and this option disables/enables\n" " X11VNC_REMOTE channel, and this option disables/enables\n"
" it as well. Default: %s\n" " it as well. Default: %s\n"
"\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" "-allow host1[,host2..] Only allow client connections from hosts matching\n"
" the comma separated list of hostnames or IP addresses.\n" " the comma separated list of hostnames or IP addresses.\n"
" Can also be a numerical IP prefix, e.g. \"192.168.100.\"\n" " Can also be a numerical IP prefix, e.g. \"192.168.100.\"\n"
@ -2834,6 +2843,12 @@ void print_help(int mode) {
"\n" "\n"
"-q, -quiet Be quiet by printing less informational output to\n" "-q, -quiet Be quiet by printing less informational output to\n"
" stderr. (use -noquiet to undo an earlier -quiet.)\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" "-v, -verbose Print out more information to stderr.\n"
"\n" "\n"
"-bg Go into the background after screen setup. Messages to\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 shared' will enable shared connections, and\n"
" 'x11vnc -R scale:3/4' will rescale the desktop.\n" " 'x11vnc -R scale:3/4' will rescale the desktop.\n"
"\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" " To run a bunch of commands in a sequence use something\n"
" like: x11vnc -R 'script:firstcmd;secondcmd;...'\n" " like: x11vnc -R 'script:firstcmd;secondcmd;...'\n"
"\n" "\n"
@ -4921,6 +4943,7 @@ void print_help(int mode) {
" keysym:str inject keystroke 'keysym' (number/name)\n" " keysym:str inject keystroke 'keysym' (number/name)\n"
" keysym:str,down inject 'keysym' (down=0,1)\n" " keysym:str,down inject 'keysym' (down=0,1)\n"
" ptr:x,y,mask inject pointer event x, y, button-mask\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" " sleep:t sleep floating point time t.\n"
" get_xprop:p get X property named 'p'.\n" " get_xprop:p get X property named 'p'.\n"
" set_xprop:p:val set X property named 'p' to 'val'.\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" " grabkbd nograbkbd grabptr nograbptr grabalways\n"
" nograbalways grablocal client_input ssltimeout\n" " nograbalways grablocal client_input ssltimeout\n"
" speeds wmdt debug_pointer dp nodebug_pointer nodp\n" " speeds wmdt debug_pointer dp nodebug_pointer nodp\n"
" debug_keyboard dk nodebug_keyboard nodk keycode\n" " debug_keyboard dk nodebug_keyboard nodk keycode keysym\n"
" keysym ptr sleep get_xprop set_xprop wininfo\n" " ptr fakebuttonevent sleep get_xprop set_xprop wininfo\n"
" bcx_xattach deferupdate defer setdefer extra_fbur\n" " bcx_xattach deferupdate defer setdefer extra_fbur\n"
" wait_ui wait_bog nowait_bog slow_fb xrefresh wait\n" " wait_ui wait_bog nowait_bog slow_fb xrefresh wait\n"
" readtimeout nap nonap sb screen_blank fbpm nofbpm dpms\n" " readtimeout nap nonap sb screen_blank fbpm nofbpm dpms\n"

@ -212,6 +212,7 @@ char *ident_username(rfbClientPtr client) {
char msg[128]; char msg[128];
int n, sock, ok = 0; int n, sock, ok = 0;
int block = 0; int block = 0;
int refused = 0;
/* /*
* need to check to see if the operation will block for * need to check to see if the operation will block for
@ -221,14 +222,24 @@ char *ident_username(rfbClientPtr client) {
{ pid_t pid, pidw; { pid_t pid, pidw;
int rc; int rc;
if ((pid = fork()) > 0) { 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); pidw = waitpid(pid, &rc, WNOHANG);
if (pidw <= 0) { if (pidw <= 0) {
usleep(1000 * 1000); /* 1.0 sec */ usleep(1500 * 1000); /* 1.5 sec */
pidw = waitpid(pid, &rc, WNOHANG); pidw = waitpid(pid, &rc, WNOHANG);
if (pidw <= 0) { if (pidw <= 0) {
int rc2;
rfbLog("ident_username: set block=1 (hung)\n");
block = 1; block = 1;
kill(pid, SIGTERM); 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) { } else if (pid == -1) {
@ -249,10 +260,10 @@ char *ident_username(rfbClientPtr client) {
} }
} }
#endif #endif
if (block) { if (block || refused) {
; ;
} else if ((sock = rfbConnectToTcpAddr(client->host, 113)) < 0) { } 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); client->host, 113);
} else { } else {
int ret; int ret;

@ -1,3 +1,3 @@
SUBDIRS = turbovnc SUBDIRS = turbovnc
DIST_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

@ -0,0 +1,422 @@
#!/usr/bin/perl
#
# Copyright (c) 2006-2009 by Karl J. Runge <runge@karlrunge.com>
#
# connect_switch is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.
#
# connect_switch is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with connect_switch; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA
# or see <http://www.gnu.org/licenses/>.
#
#
# connect_switch:
#
# A kludge script that sits between web clients and a mod_ssl (https)
# enabled apache webserver.
#
# If an incoming web client connection makes a proxy CONNECT request
# it is handled directly by this script (apache is not involved).
# Otherwise, all other connections are forwarded to the apache webserver.
#
# This can be useful for VNC redirection using an existing https (port
# 443) webserver, thereby not requiring a 2nd (non-https) port open on
# the firewall for the CONNECT requests.
#
# It does not seem possible (to me) to achieve this entirely within apache
# because the CONNECT request appears to be forwarded encrypted to
# the remote host and so the SSL dies immediately.
#
# Note: There is no need to use this script for a non-ssl apache webserver
# port because mod_proxy works fine for doing the switching all inside
# apache (see ProxyRequests and AllowCONNECT parameters).
#
# Apache configuration:
#
# The mod_ssl configuration is often in a file named ssl.conf. In the
# simplest case you change something like this:
#
# From:
#
# Listen 443
#
# <VirtualHost _default_:443>
# ...
# </VirtualHost>
#
# To:
#
# Listen 127.0.0.1:443
#
# <VirtualHost _default_:443>
# ...
# </VirtualHost>
#
# (i.e. just change the Listen directive).
#
# If you have mod_ssl listening on a different internal port, you do
# not need to specify the localhost Listen address.
#
# It is probably a good idea to set $listen_host below to the known
# IP address you want the service to listen on (to avoid localhost where
# apache is listening).
############################################################################
# The defaults for hosts and ports (you can override them below if needed):
#
# Look below for these environment variables that let you set the various
# parameters without needing to edit this script:
#
# CONNECT_SWITCH_LISTEN
# CONNECT_SWITCH_HTTPD
# CONNECT_SWITCH_ALLOWED
# CONNECT_SWITCH_ALLOW_FILE
# CONNECT_SWITCH_VERBOSE
# CONNECT_SWITCH_APPLY_VNC_OFFSET
# CONNECT_SWITCH_VNC_OFFSET
my $hostname = `hostname`;
chomp $hostname;
my $listen_host = $hostname;
my $listen_port = 443;
if (exists $ENV{CONNECT_SWITCH_LISTEN}) {
# E.g. CONNECT_SWITCH_LISTEN=192.168.0.32:443
($listen_host, $listen_port) = split(/:/, $ENV{CONNECT_SWITCH_LISTEN});
}
my $httpd_host = 'localhost';
my $httpd_port = 443;
if (exists $ENV{CONNECT_SWITCH_HTTPD}) {
# E.g. CONNECT_SWITCH_HTTPD=127.0.0.1:443
($httpd_host, $httpd_port) = split(/:/, $ENV{CONNECT_SWITCH_HTTPD});
}
############################################################################
# You can/should override the host/port settings here:
#
#$listen_host = '23.45.67.89'; # set to your interface IP number.
#$listen_port = 555; # and/or nonstandard port.
#$httpd_host = 'somehost'; # maybe you redir https to another machine.
#$httpd_port = 666; # and/or nonstandard port.
# You must set the allowed host:port CONNECT redirection list.
# Only these host:port pairs will be redirected to.
#
my @allowed = qw(
machine1:5915
machine2:5900
);
if (exists $ENV{CONNECT_SWITCH_ALLOWED}) {
#
# E.g. CONNECT_SWITCH_ALLOWED=machine1:5915,machine2:5900
#
@allowed = split(/,/, $ENV{CONNECT_SWITCH_ALLOWED});
}
# Or you could also use an external "allow file".
# They get added to the @allowed list.
# The file is re-read for each new connection.
#
# Format of $allow_file:
#
# host1 vncdisp
# host2 vncdisp
#
# where, e.g. vncdisp = 15 => port 5915, say
#
# joesbox 15
# fredsbox 15
# rupert 1
my $allow_file = '/dist/apache/2.0/conf/vnc.hosts';
$allow_file = '';
if (exists $ENV{CONNECT_SWITCH_ALLOW_FILE}) {
# E.g. CONNECT_SWITCH_ALLOW_FILE=/usr/local/etc/allow.txt
$allow_file = $ENV{CONNECT_SWITCH_ALLOW_FILE};
}
# Set to 1 to re-map to vnc port, e.g. 'hostname 15' to 'hostname 5915'
# i.e. assume a port 0 <= port < 200 is actually a VNC display
# and add 5900 to it. Set to 0 to not do the mapping.
# Note that negative ports, e.g. 'joesbox -22' go directly to -port.
#
my $apply_vnc_offset = 1;
my $vnc_offset = 5900;
if (exists $ENV{CONNECT_SWITCH_APPLY_VNC_OFFSET}) {
# E.g. CONNECT_SWITCH_APPLY_VNC_OFFSET=0
$apply_vnc_offset = $ENV{CONNECT_SWITCH_APPLY_VNC_OFFSET};
}
if (exists $ENV{CONNECT_SWITCH_VNC_OFFSET}) {
# E.g. CONNECT_SWITCH_VNC_OFFSET=6000
$vnc_offset = $ENV{CONNECT_SWITCH_VNC_OFFSET};
}
# Set to 1 for more debugging output:
#
my $verbose = 0;
if (exists $ENV{CONNECT_SWITCH_VERBOSE}) {
# E.g. CONNECT_SWITCH_VERBOSE=1
$verbose = $ENV{CONNECT_SWITCH_VERBOSE};
}
############################################################################
# No need for any changes below here.
use IO::Socket::INET;
use strict;
use warnings;
my $killpid = 1;
setpgrp(0, 0);
my $listen_sock = IO::Socket::INET->new(
Listen => 10,
LocalAddr => $listen_host,
LocalPort => $listen_port,
Proto => "tcp"
);
if (! $listen_sock) {
die "connect_switch: $!\n";
}
my $current_fh1 = '';
my $current_fh2 = '';
my $conn = 0;
while (1) {
$conn++;
print STDERR "listening for connection: $conn\n" if $verbose;
my ($client, $ip) = $listen_sock->accept();
if (! $client) {
fsleep(0.5);
next;
}
print STDERR "conn: $conn -- ", $client->peerhost(), "\n" if $verbose;
my $pid = fork();
if (! defined $pid) {
die "connect_switch: $!\n";
} elsif ($pid) {
wait;
next;
} else {
close $listen_sock;
if (fork) {
exit 0;
}
setpgrp(0, 0);
handle_conn($client);
}
}
exit 0;
sub handle_conn {
my $client = shift;
my $start = time();
my @allow = @allowed;
if ($allow_file && -f $allow_file) {
if (open(ALLOW, "<$allow_file")) {
while (<ALLOW>) {
next if /^\s*#/;
next if /^\s*$/;
chomp;
my ($host, $dpy) = split(' ', $_);
next if ! defined $host;
next if ! defined $dpy;
if ($dpy < 0) {
$dpy = -$dpy;
} elsif ($apply_vnc_offset) {
$dpy += $vnc_offset if $dpy < 200;
}
push @allow, "$host:$dpy";
}
close(ALLOW);
} else {
warn "$allow_file: $!\n";
}
}
my $str = '';
my $N = 0;
my $isconn = 1;
for (my $i = 0; $i < 7; $i++) {
my $b;
sysread($client, $b, 1);
$str .= $b;
$N++;
print STDERR "read: '$str'\n" if $verbose;
my $cstr = substr('CONNECT', 0, $i+1);
if ($str ne $cstr) {
$isconn = 0;
last;
}
}
my $sock = '';
if ($isconn) {
while ($str !~ /\r\n\r\n/) {
my $b;
sysread($client, $b, 1);
$str .= $b;
}
print STDERR "read: $str\n" if $verbose;
my $ok = 0;
my $hostport = '';
my $http_vers = '1.0';
if ($str =~ /^CONNECT\s+(\S+)\s+HTTP\/(\S+)/) {
$hostport = $1;
$http_vers = $2;
foreach my $hp (@allow) {
if ($hp eq $hostport) {
$ok = 1;
last;
}
}
}
if (! $ok) {
close $client;
exit 0;
}
my ($host, $port) = split(/:/, $hostport);
print STDERR "connecting to: $host:$port\n" if $verbose;
$sock = IO::Socket::INET->new(
PeerAddr => $host,
PeerPort => $port,
Proto => "tcp"
);
my $msg;
if ($sock) {
$msg = "HTTP/$http_vers 200 Connection Established\r\n"
. "Proxy-agent: connect_switch v0.2\r\n\r\n";
} else {
$msg = "HTTP/$http_vers 502 Bad Gateway\r\n"
. "Connection: close\r\n\r\n";
}
syswrite($client, $msg, length($msg));
$str = '';
} else {
print STDERR "connecting to: $httpd_host:$httpd_port\n"
if $verbose;
$sock = IO::Socket::INET->new(
PeerAddr => $httpd_host,
PeerPort => $httpd_port,
Proto => "tcp"
);
}
if (! $sock) {
close $client;
die "connect_switch: $!\n";
}
$current_fh1 = $client;
$current_fh2 = $sock;
$SIG{TERM} = sub {print STDERR "got sigterm\[$$]\n" if $verbose; close $current_fh1; close $current_fh2; exit 0};
my $parent = $$;
if (my $child = fork()) {
xfer($sock, $client, 'S->C');
if ($killpid) {
fsleep(0.5);
kill 'TERM', $child;
}
} else {
if ($str ne '' && $N > 0) {
syswrite($sock, $str, $N);
}
xfer($client, $sock, 'C->S');
if ($killpid) {
fsleep(0.75);
kill 'TERM', $parent;
}
}
if ($verbose) {
my $dt = time() - $start;
print STDERR "dt\[$$]: $dt\n";
}
exit 0;
}
sub xfer {
my($in, $out, $lab) = @_;
my ($RIN, $WIN, $EIN, $ROUT);
$RIN = $WIN = $EIN = "";
$ROUT = "";
vec($RIN, fileno($in), 1) = 1;
vec($WIN, fileno($in), 1) = 1;
$EIN = $RIN | $WIN;
my $buf;
while (1) {
my $nf = 0;
while (! $nf) {
$nf = select($ROUT=$RIN, undef, undef, undef);
}
my $len = sysread($in, $buf, 8192);
if (! defined($len)) {
next if $! =~ /^Interrupted/;
print STDERR "connect_switch\[$lab/$conn/$$]: $!\n";
last;
} elsif ($len == 0) {
print STDERR "connect_switch\[$lab/$conn/$$]: "
. "Input is EOF.\n";
last;
}
if (0) {
# verbose debugging of data:
syswrite(STDERR , "\n$lab: ", 6);
syswrite(STDERR , $buf, $len);
}
my $offset = 0;
my $quit = 0;
while ($len) {
my $written = syswrite($out, $buf, $len, $offset);
if (! defined $written) {
print STDERR "connect_switch\[$lab/$conn/$$]: "
. "Output is EOF. $!\n";
$quit = 1;
last;
}
$len -= $written;
$offset += $written;
}
last if $quit;
}
close($in);
close($out);
}
sub fsleep {
my ($time) = @_;
select(undef, undef, undef, $time) if $time;
}

@ -0,0 +1,424 @@
#!/usr/bin/env perl
#
# Copyright (c) 2009 by Karl J. Runge <runge@karlrunge.com>
#
# ultravnc_repeater.pl is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.
#
# ultravnc_repeater.pl is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with ultravnc_repeater.pl; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA
# or see <http://www.gnu.org/licenses/>.
#
my $usage = '
ultravnc_repeater.pl:
perl script implementing the ultravnc repeater
proxy protocol.
protocol: Listen on one port for vnc clients (default 5900.)
Listen on one port for vnc servers (default 5500.)
Read 250 bytes from connecting vnc client or server.
Accept ID:<string> from clients and servers, connect them
together once both are present.
The string "RFB 000.000\n" is sent to the client (the client
must understand this means send ID:... or host:port.)
Also accept <host>:<port> from clients and make the
connection to the vnc server immediately.
Note there is no authentication or security WRT ID names or
identities; it us up to the client and server to manage that
and whether to encrypt the session, etc.
usage: ultravnc_repeater.pl [-r] [client_port [server_port]]
Use -r to refuse new server/client connections with an existing
server/client ID. The default is to close the previous one.
Examples:
ultravnc_repeater.pl -r
ultravnc_repeater.pl 5901
ultravnc_repeater.pl 5901 5501
';
use warnings;
use strict;
use IO::Socket::INET;
use IO::Select;
my $prog = 'ultravnc_repeater.pl';
my %ID;
my $refuse = 0;
my $init_timeout = 3;
if (@ARGV && $ARGV[0] =~ /-h/) {
print $usage;
exit 0;
}
if (@ARGV && $ARGV[0] eq '-r') {
$refuse = 1;
shift;
}
my $client_port = shift;
my $server_port = shift;
$client_port = 5900 unless $client_port;
$server_port = 5500 unless $server_port;
my $repeater_bufsize = 250;
$repeater_bufsize = $ENV{BUFSIZE} if exists $ENV{BUFSIZE};
my ($RIN, $WIN, $EIN, $ROUT);
my $client_listen = IO::Socket::INET->new(
Listen => 10,
LocalPort => $client_port,
Proto => "tcp"
);
if (! $client_listen) {
cleanup();
die "$prog: error: client listen on port $client_port: $!\n";
}
my $server_listen = IO::Socket::INET->new(
Listen => 10,
LocalPort => $server_port,
Proto => "tcp"
);
if (! $server_listen) {
cleanup();
die "$prog: error: server listen on port $server_port: $!\n";
}
my $select = new IO::Select();
if (! select) {
cleanup();
die "$prog: select $!\n";
}
$select->add($client_listen);
$select->add($server_listen);
$SIG{INT} = sub {cleanup(); exit;};
$SIG{TERM} = sub {cleanup(); exit;};
my $SOCK1 = '';
my $SOCK2 = '';
my $CURR = '';
print "watching for connections on ports $server_port/server and $client_port/client\n";
select(STDERR); $| = 1;
select(STDOUT); $| = 1;
my $alarm_sock = '';
my $got_alarm = 0;
sub alarm_handler {
print "$prog: got sig alarm.\n";
if ($alarm_sock ne '') {
close $alarm_sock;
}
$alarm_sock = '';
$got_alarm = 1;
}
while (my @ready = $select->can_read()) {
foreach my $fh (@ready) {
if ($fh == $client_listen) {
print "new vnc client connecting at ", scalar(localtime), "\n";
} elsif ($fh == $server_listen) {
print "new vnc server connecting at ", scalar(localtime), "\n";
}
my $sock = $fh->accept();
if (! $sock) {
print "$prog: accept $!\n";
next;
}
if ($fh == $client_listen) {
my $str = "RFB 000.000\n";
my $len = length $str;
my $n = syswrite($sock, $str, $len, 0);
if ($n != $len) {
print "$prog: bad $str write: $n != $len $!\n";
close $sock;
}
}
my $buf = '';
my $size = $repeater_bufsize;
$size = 1024 unless $size;
$SIG{ALRM} = "alarm_handler";
$alarm_sock = $sock;
$got_alarm = 0;
alarm($init_timeout);
my $n = sysread($sock, $buf, $size);
alarm(0);
if ($got_alarm) {
print "$prog: read timed out: $!\n";
} elsif (! defined $n) {
print "$prog: read error: $!\n";
} elsif ($repeater_bufsize > 0 && $n != $size) {
print "$prog: short read $n != $size $!\n";
close $sock;
} elsif ($fh == $client_listen) {
do_new_client($sock, $buf);
} elsif ($fh == $server_listen) {
do_new_server($sock, $buf);
}
}
}
sub do_new_client {
my ($sock, $buf) = @_;
if ($buf =~ /^ID:(\w+)/) {
my $id = $1;
if (exists $ID{$id}) {
if ($ID{$id}{client}) {
print "refusing extra vnc client for ID:$id\n";
close $sock;
return;
if ($refuse) {
print "refusing extra vnc client for ID:$id\n";
close $sock;
return;
} else {
print "closing and deleting previous vnc client with ID:$id\n";
close $ID{$id}{sock};
print "storing new vnc client with ID:$id\n";
$ID{$id}{client} = 1;
$ID{$id}{sock} = $sock;
}
} else {
print "hooking up new vnc client with existing vnc server for ID:$id\n";
my $sock2 = $ID{$id}{sock};
delete $ID{$id};
hookup($sock, $sock2, "ID:$id");
}
} else {
print "storing new vnc client with ID:$id\n";
$ID{$id}{client} = 1;
$ID{$id}{sock} = $sock;
}
} else {
my $str = sprintf("%s", $buf);
my $host = '';
my $port = '';
if ($str =~ /^(.+):(\d+)/) {
$host = $1;
$port = $2;
} else {
$host = $str;
$port = 5900;
}
if ($port < 0) {
my $pnew = -$port;
print "resetting port from $port to $pnew\n";
$port = $pnew;
} elsif ($port < 200) {
my $pnew = $port + 5900;
print "resetting port from $port to $pnew\n";
$port = $pnew;
}
print "making vnc client connection directly to vnc server $host:$port\n";
my $sock2 = IO::Socket::INET->new(
PeerAddr => $host,
PeerPort => $port,
Proto => "tcp"
);
if (!$sock2) {
print "failed to connect to $host:$port\n";
close $sock;
return;
}
hookup($sock, $sock2, "$host:$port");
}
}
sub do_new_server {
my ($sock, $buf) = @_;
if ($buf =~ /^ID:(\w+)/) {
my $id = $1;
my $store = 1;
if (exists $ID{$id}) {
if (! $ID{$id}{client}) {
if ($refuse) {
print "refusing extra vnc server for ID:$id\n";
close $sock;
return;
} else {
print "closing and deleting previous vnc server with ID:$id\n";
close $ID{$id}{sock};
print "storing new vnc server with ID:$id\n";
$ID{$id}{client} = 0;
$ID{$id}{sock} = $sock;
}
} else {
print "hooking up new vnc server with existing vnc client for ID:$id\n";
my $sock2 = $ID{$id}{sock};
delete $ID{$id};
hookup($sock, $sock2, "ID:$id");
}
} else {
print "storing new vnc server with ID:$id\n";
$ID{$id}{client} = 0;
$ID{$id}{sock} = $sock;
}
} else {
print "invalid ID:NNNNN string for vnc server: $buf\n";
close $sock;
return;
}
}
sub handler {
print STDERR "$prog\[$$/$CURR]: got SIGTERM.\n";
close $SOCK1 if $SOCK1;
close $SOCK2 if $SOCK2;
exit;
}
sub hookup {
my ($sock1, $sock2, $tag) = @_;
my $worker = fork();
if (! defined $worker) {
print "failed to fork worker: $!\n";
close $sock1;
close $sock2;
return;
} elsif ($worker) {
close $sock1;
close $sock2;
wait;
} else {
cleanup();
if (fork) {
exit 0;
}
setpgrp(0, 0);
$SOCK1 = $sock1;
$SOCK2 = $sock2;
$CURR = $tag;
$SIG{TERM} = "handler";
$SIG{INT} = "handler";
xfer_both($sock1, $sock2);
exit 0;
}
}
sub xfer {
my ($in, $out) = @_;
$RIN = $WIN = $EIN = "";
$ROUT = "";
vec($RIN, fileno($in), 1) = 1;
vec($WIN, fileno($in), 1) = 1;
$EIN = $RIN | $WIN;
my $buf;
while (1) {
my $nf = 0;
while (! $nf) {
$nf = select($ROUT=$RIN, undef, undef, undef);
}
my $len = sysread($in, $buf, 8192);
if (! defined($len)) {
next if $! =~ /^Interrupted/;
print STDERR "$prog\[$$/$CURR]: $!\n";
last;
} elsif ($len == 0) {
print STDERR "$prog\[$$/$CURR]: Input is EOF.\n";
last;
}
my $offset = 0;
my $quit = 0;
while ($len) {
my $written = syswrite($out, $buf, $len, $offset);
if (! defined $written) {
print STDERR "$prog\[$$/$CURR]: Output is EOF. $!\n";
$quit = 1;
last;
}
$len -= $written;
$offset += $written;
}
last if $quit;
}
close($out);
close($in);
print STDERR "$prog\[$$/$CURR]: finished xfer.\n";
}
sub xfer_both {
my ($sock1, $sock2) = @_;
my $parent = $$;
my $child = fork();
if (! defined $child) {
print STDERR "$prog\[$$/$CURR] failed to fork: $!\n";
return;
}
$SIG{TERM} = "handler";
$SIG{INT} = "handler";
if ($child) {
print STDERR "$prog parent[$$/$CURR] 1 -> 2\n";
xfer($sock1, $sock2);
select(undef, undef, undef, 0.25);
if (kill 0, $child) {
select(undef, undef, undef, 0.9);
if (kill 0, $child) {
print STDERR "$prog\[$$/$CURR]: kill TERM child $child\n";
kill "TERM", $child;
} else {
print STDERR "$prog\[$$/$CURR]: child $child gone.\n";
}
}
} else {
select(undef, undef, undef, 0.05);
print STDERR "$prog child [$$/$CURR] 2 -> 1\n";
xfer($sock2, $sock1);
select(undef, undef, undef, 0.25);
if (kill 0, $parent) {
select(undef, undef, undef, 0.8);
if (kill 0, $parent) {
print STDERR "$prog\[$$/$CURR]: kill TERM parent $parent\n";
kill "TERM", $parent;
} else {
print STDERR "$prog\[$$/$CURR]: parent $parent gone.\n";
}
}
}
}
sub cleanup {
close $client_listen if defined $client_listen;
close $server_listen if defined $server_listen;
foreach my $id (keys %ID) {
close $ID{$id}{sock};
}
}

@ -111,6 +111,7 @@ int connect_once = 1; /* disconnect after first connection session. */
int connect_once = 0; int connect_once = 0;
#endif #endif
int got_connect_once = 0; int got_connect_once = 0;
int got_findauth = 0;
int deny_all = 0; /* global locking of new clients */ int deny_all = 0; /* global locking of new clients */
#ifndef REMOTE_DEFAULT #ifndef REMOTE_DEFAULT
#define REMOTE_DEFAULT 1 #define REMOTE_DEFAULT 1

@ -102,6 +102,7 @@ extern int opts_bg;
extern int shared; extern int shared;
extern int connect_once; extern int connect_once;
extern int got_connect_once; extern int got_connect_once;
extern int got_findauth;
extern int deny_all; extern int deny_all;
extern int accept_remote_cmds; extern int accept_remote_cmds;
extern char *remote_prefix; extern char *remote_prefix;

@ -265,9 +265,11 @@ void initialize_pointer_map(char *pointer_remap) {
X_LOCK; X_LOCK;
num_buttons = XGetPointerMapping(dpy, map, MAX_BUTTONS); num_buttons = XGetPointerMapping(dpy, map, MAX_BUTTONS);
X_UNLOCK; X_UNLOCK;
rfbLog("The X server says there are %d mouse buttons.\n", num_buttons);
#endif #endif
} else { } else {
num_buttons = 5; num_buttons = 5;
rfbLog("Manually set num_buttons to: %d\n", num_buttons);
} }
if (num_buttons < 0) { if (num_buttons < 0) {

@ -4233,6 +4233,21 @@ char *process_remote_cmd(char *cmd, int stringonly) {
goto done; 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) { if (strstr(p, "sleep") == p) {
NOTAPP NOTAPP
COLON_CHECK("sleep:") COLON_CHECK("sleep:")

@ -1652,7 +1652,7 @@ if (db) fprintf(stderr, "initialize_raw_fb reset\n");
} }
if (strstr(rstr, "solid=") == rstr) { if (strstr(rstr, "solid=") == rstr) {
char *n = rstr + strlen("solid="); char *n = rstr + strlen("solid=");
char tmp[] = "/tmp/solid.XXXXXX"; char tmp[] = "/tmp/rawfb_solid.XXXXXX";
char str[100]; char str[100];
unsigned int vals[1024], val; unsigned int vals[1024], val;
int x, y, fd, w = 1024, h = 768; 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); sprintf(str, "map:%s@%dx%dx32", tmp, w, h);
rstr = strdup(str); rstr = strdup(str);
} else if (strstr(rstr, "swirl") == rstr) { } else if (strstr(rstr, "swirl") == rstr) {
char tmp[] = "/tmp/solid.XXXXXX"; char tmp[] = "/tmp/rawfb_swirl.XXXXXX";
char str[100]; char str[100];
unsigned int val[1024]; unsigned int val[1024];
unsigned int c1, c2, c3, c4; unsigned int c1, c2, c3, c4;

@ -911,7 +911,7 @@ char find_display[] =
" dL=\"-h\"\n" " dL=\"-h\"\n"
"fi\n" "fi\n"
"\n" "\n"
"# a portable, but not absolutely safe, tmp file creator\n" "# a portable tmp file creator\n"
"mytmp() {\n" "mytmp() {\n"
" tf=$1\n" " tf=$1\n"
" if type mktemp > /dev/null 2>&1; then\n" " if type mktemp > /dev/null 2>&1; then\n"
@ -1462,7 +1462,26 @@ char create_display[] =
" fi\n" " fi\n"
" while [ $try -lt $sry ]\n" " while [ $try -lt $sry ]\n"
" do\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" " if echo \"$nsout\" | grep \"/tmp/.X11-unix/X${try}[ ]*\\$\" > /dev/null; then\n"
" :\n" " :\n"
" else\n" " else\n"
@ -1715,7 +1734,7 @@ char create_display[] =
" dL=\"-h\"\n" " dL=\"-h\"\n"
"fi\n" "fi\n"
"\n" "\n"
"# a portable, but not absolutely safe, tmp file creator\n" "# a portable tmp file creator\n"
"mytmp() {\n" "mytmp() {\n"
" tf=$1\n" " tf=$1\n"
" if type mktemp > /dev/null 2>&1; then\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_pass = NULL;
char *keep_unixpw_opts = NULL; char *keep_unixpw_opts = NULL;
///////
static unsigned char default6x13FontData[2899]={ static unsigned char default6x13FontData[2899]={
0x00,0x00,0xA8,0x00,0x88,0x00,0x88,0x00,0x88,0x00,0xA8,0x00,0x00, /* 0 */ 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 */ 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]={ 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,}; 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 rfbFontData default6x13Font={default6x13FontData, default6x13FontMetaData};
///////
static int in_login = 0, in_passwd = 0, tries = 0; static int in_login = 0, in_passwd = 0, tries = 0;
static int char_row = 0, char_col = 0; static int char_row = 0, char_col = 0;

@ -1895,11 +1895,20 @@ char *setup_cmd(char *str, int *vnc_redirect, char **vnc_redirect_host, int *vnc
char com[100]; char com[100];
int fd = mkstemp(tmp); int fd = mkstemp(tmp);
if (fd >= 0) { if (fd >= 0) {
int ret;
write(fd, find_display, strlen(find_display)); write(fd, find_display, strlen(find_display));
close(fd); close(fd);
set_env("FINDDISPLAY_run", "1"); set_env("FINDDISPLAY_run", "1");
sprintf(com, "/bin/sh %s -n; rm -f %s", tmp, tmp); sprintf(com, "/bin/sh %s -n", tmp);
system(com); 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); unlink(tmp);
exit(0); 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 internal_cmd = 0;
int tried_switch = 0; int tried_switch = 0;
memset(line1, 0, 1024); memset(line1, 0, sizeof(line1));
memset(line2, 0, 16384); memset(line2, 0, sizeof(line2));
if (users_list && strstr(users_list, "sslpeer=") == users_list) { if (users_list && strstr(users_list, "sslpeer=") == users_list) {
usslpeer = get_usslpeer(); 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; int res = 0, k, j, i;
char line[18000]; char line[18000];
memset(line, 0, 18000); memset(line, 0, sizeof(line));
if (unixpw_system_greeter_active == 2) { if (unixpw_system_greeter_active == 2) {
rfbLog("unixpw_system_greeter: forcing find display failure.\n"); rfbLog("unixpw_system_greeter: forcing find display failure.\n");
res = 0; res = 0;
} else if (keep_unixpw_user && keep_unixpw_pass) { } else if (keep_unixpw_user && keep_unixpw_pass) {
n = 18000; n = sizeof(line);
if (unixpw_cmd != NULL) { if (unixpw_cmd != NULL) {
res = unixpw_cmd_run(keep_unixpw_user, res = unixpw_cmd_run(keep_unixpw_user,
keep_unixpw_pass, cmd, line, &n); 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) { if (unixpw_cmd != NULL) {
/* let the external unixpw command do it: */ /* let the external unixpw command do it: */
n = 18000; n = sizeof(line);
close_exec_fds(); close_exec_fds();
res = unixpw_cmd_run(keep_unixpw_user, res = unixpw_cmd_run(keep_unixpw_user,
keep_unixpw_pass, create_cmd, line, &n); keep_unixpw_pass, create_cmd, line, &n);
} else if (getuid() != 0 && unixpw_system_greeter_active != 2) { } else if (getuid() != 0 && unixpw_system_greeter_active != 2) {
/* if not root, run as the other user... */ /* if not root, run as the other user... */
n = 18000; n = sizeof(line);
close_exec_fds(); close_exec_fds();
res = su_verify(keep_unixpw_user, res = su_verify(keep_unixpw_user,
keep_unixpw_pass, create_cmd, line, &n, nodisp); keep_unixpw_pass, create_cmd, line, &n, nodisp);

@ -2,7 +2,7 @@
.TH X11VNC "1" "December 2009" "x11vnc " "User Commands" .TH X11VNC "1" "December 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-12-06 version: 0.9.9, lastmod: 2009-12-14
.SH SYNOPSIS .SH SYNOPSIS
.B x11vnc .B x11vnc
[OPTION]... [OPTION]...
@ -728,6 +728,15 @@ instead of vncconnect may
work (see the FAQ). The \fB-remote\fR control mechanism uses work (see the FAQ). The \fB-remote\fR control mechanism uses
X11VNC_REMOTE channel, and this option disables/enables X11VNC_REMOTE channel, and this option disables/enables
it as well. Default: \fB-vncconnect\fR 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 .PP
\fB-allow\fR \fIhost1[,host2..]\fR \fB-allow\fR \fIhost1[,host2..]\fR
.IP .IP
@ -3159,6 +3168,11 @@ Instead of exiting after cleaning up, run a simple
.IP .IP
Be quiet by printing less informational output to Be quiet by printing less informational output to
stderr. (use \fB-noquiet\fR to undo an earlier \fB-quiet.)\fR 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 .PP
\fB-v,\fR \fB-verbose\fR \fB-v,\fR \fB-verbose\fR
.IP .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 shared' will enable shared connections, and
\'x11vnc \fB-R\fR scale:3/4' will rescale the desktop. \'x11vnc \fB-R\fR scale:3/4' will rescale the desktop.
.IP .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 To run a bunch of commands in a sequence use something
like: x11vnc \fB-R\fR 'script:firstcmd;secondcmd;...' like: x11vnc \fB-R\fR 'script:firstcmd;secondcmd;...'
.IP .IP
@ -5766,6 +5787,8 @@ keysym:str,down inject 'keysym' (down=0,1)
.IP .IP
ptr:x,y,mask inject pointer event x, y, button-mask ptr:x,y,mask inject pointer event x, y, button-mask
.IP .IP
fakebuttonevent:button,down direct XTestFakeButtonEvent.
.IP
sleep:t sleep floating point time t. sleep:t sleep floating point time t.
.IP .IP
get_xprop:p get X property named 'p'. 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 grabkbd nograbkbd grabptr nograbptr grabalways
nograbalways grablocal client_input ssltimeout nograbalways grablocal client_input ssltimeout
speeds wmdt debug_pointer dp nodebug_pointer nodp speeds wmdt debug_pointer dp nodebug_pointer nodp
debug_keyboard dk nodebug_keyboard nodk keycode debug_keyboard dk nodebug_keyboard nodk keycode keysym
keysym ptr sleep get_xprop set_xprop wininfo ptr fakebuttonevent sleep get_xprop set_xprop wininfo
bcx_xattach deferupdate defer setdefer extra_fbur bcx_xattach deferupdate defer setdefer extra_fbur
wait_ui wait_bog nowait_bog slow_fb xrefresh wait wait_ui wait_bog nowait_bog slow_fb xrefresh wait
readtimeout nap nonap sb screen_blank fbpm nofbpm dpms 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: "); fprintf(stderr, "Enter VNC password: ");
system("stty -echo"); system("stty -echo");
if (fgets(str1, 32, stdin) == NULL) { if (fgets(str1, 32, stdin) == NULL) {
perror("fgets");
system("stty echo"); system("stty echo");
exit(1); exit(1);
} }
@ -1744,6 +1745,7 @@ static void store_homedir_passwd(char *file) {
fprintf(stderr, "Verify password: "); fprintf(stderr, "Verify password: ");
if (fgets(str2, 32, stdin) == NULL) { if (fgets(str2, 32, stdin) == NULL) {
perror("fgets");
system("stty echo"); system("stty echo");
exit(1); exit(1);
} }
@ -1794,6 +1796,7 @@ static void store_homedir_passwd(char *file) {
fprintf(stderr, "Write password to %s? [y]/n ", f); fprintf(stderr, "Write password to %s? [y]/n ", f);
if (fgets(str2, 32, stdin) == NULL) { if (fgets(str2, 32, stdin) == NULL) {
perror("fgets");
exit(1); exit(1);
} }
if (str2[0] == 'n' || str2[0] == 'N') { if (str2[0] == 'n' || str2[0] == 'N') {
@ -1802,14 +1805,16 @@ static void store_homedir_passwd(char *file) {
} }
if (rfbEncryptAndStorePasswd(str1, f) != 0) { if (rfbEncryptAndStorePasswd(str1, f) != 0) {
fprintf(stderr, "** error creating password.\n"); fprintf(stderr, "** error creating password: %s\n", f);
perror("storepasswd"); perror("storepasswd");
exit(1); exit(1);
} }
fprintf(stderr, "Password written to: %s\n", f);
if (stat(f, &sbuf) != 0) { if (stat(f, &sbuf) != 0) {
fprintf(stderr, "** error creating password: %s\n", f);
perror("stat");
exit(1); exit(1);
} }
fprintf(stdout, "Password written to: %s\n", f);
exit(0); exit(0);
} }
@ -1945,7 +1950,7 @@ static void check_guess_auth_file(void) {
} }
cmd = (char *)malloc(100 + strlen(program_name) + strlen(disp)); 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"); p = popen(cmd, "r");
if (!p) { if (!p) {
rfbLog("-auth guess: could not run cmd '%s'\n", cmd); rfbLog("-auth guess: could not run cmd '%s'\n", cmd);
@ -1962,6 +1967,28 @@ static void check_guess_auth_file(void) {
disp = "unset"; 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, "")) { if (!strcmp(line, "")) {
rfbLog("-auth guess: failed for display='%s'\n", disp); rfbLog("-auth guess: failed for display='%s'\n", disp);
clean_up_exit(1); clean_up_exit(1);
@ -2013,7 +2040,6 @@ int main(int argc, char* argv[]) {
int got_tls = 0; int got_tls = 0;
int got_inetd = 0; int got_inetd = 0;
int got_noxrandr = 0; int got_noxrandr = 0;
int got_findauth = 0;
/* used to pass args we do not know about to rfbGetScreen(): */ /* used to pass args we do not know about to rfbGetScreen(): */
int argc_vnc_max = 1024; int argc_vnc_max = 1024;
@ -2890,10 +2916,12 @@ int main(int argc, char* argv[]) {
} }
if (argc >= i+4 || rfbEncryptAndStorePasswd(argv[i+1], if (argc >= i+4 || rfbEncryptAndStorePasswd(argv[i+1],
argv[i+2]) != 0) { argv[i+2]) != 0) {
fprintf(stderr, "-storepasswd failed\n"); perror("storepasswd");
fprintf(stderr, "-storepasswd failed for file: %s\n",
argv[i+2]);
exit(1); exit(1);
} else { } else {
fprintf(stderr, "stored passwd in file %s\n", fprintf(stderr, "stored passwd in file: %s\n",
argv[i+2]); argv[i+2]);
exit(0); exit(0);
} }
@ -2904,6 +2932,7 @@ int main(int argc, char* argv[]) {
char *f = argv[i+1]; char *f = argv[i+1];
char *s = rfbDecryptPasswdFromFile(f); char *s = rfbDecryptPasswdFromFile(f);
if (!s) { if (!s) {
perror("showrfbauth");
fprintf(stderr, "rfbDecryptPasswdFromFile failed: %s\n", f); fprintf(stderr, "rfbDecryptPasswdFromFile failed: %s\n", f);
exit(1); exit(1);
} }
@ -4801,13 +4830,6 @@ int main(int argc, char* argv[]) {
/* open the X display: */ /* open the X display: */
if (auth_file) {
check_guess_auth_file();
if (auth_file != NULL) {
set_env("XAUTHORITY", auth_file);
}
}
#if LIBVNCSERVER_HAVE_XKEYBOARD #if LIBVNCSERVER_HAVE_XKEYBOARD
/* /*
* Disable XKEYBOARD before calling XOpenDisplay() * Disable XKEYBOARD before calling XOpenDisplay()
@ -4874,6 +4896,9 @@ int main(int argc, char* argv[]) {
rfbLog("warning: -display does not make sense in " rfbLog("warning: -display does not make sense in "
"\"lurk=\" mode...\n"); "\"lurk=\" mode...\n");
} }
if (auth_file != NULL && strcmp(auth_file, "guess")) {
set_env("XAUTHORITY", auth_file);
}
lurk_loop(users_list); lurk_loop(users_list);
} else if (use_dpy && strstr(use_dpy, "WAIT:") == use_dpy) { } 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 #ifdef MACOSX
if (use_dpy && !strcmp(use_dpy, "console")) { if (use_dpy && !strcmp(use_dpy, "console")) {
; ;

@ -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-12-06"; char lastmod[] = "0.9.9 lastmod: 2009-12-14";
/* X display info */ /* X display info */

@ -771,6 +771,8 @@ void create_xdamage_if_needed(int force) {
RAWFB_RET_VOID RAWFB_RET_VOID
if (force) {}
#if LIBVNCSERVER_HAVE_LIBXDAMAGE #if LIBVNCSERVER_HAVE_LIBXDAMAGE
if (! xdamage || force) { if (! xdamage || force) {
X_LOCK; X_LOCK;

@ -87,18 +87,28 @@ static void grab_buster_watch(int parent, char *dstr);
void initialize_vnc_connect_prop(void) { void initialize_vnc_connect_prop(void) {
char *prop_str;
vnc_connect_str[0] = '\0'; vnc_connect_str[0] = '\0';
RAWFB_RET_VOID RAWFB_RET_VOID
#if !NO_X11 #if !NO_X11
prop_str = getenv("VNC_CONNECT");
if (prop_str == NULL) {
prop_str = "VNC_CONNECT";
}
vnc_connect_prop = XInternAtom(dpy, "VNC_CONNECT", False); vnc_connect_prop = XInternAtom(dpy, "VNC_CONNECT", False);
#endif #endif
} }
void initialize_x11vnc_remote_prop(void) { void initialize_x11vnc_remote_prop(void) {
char *prop_str;
x11vnc_remote_str[0] = '\0'; x11vnc_remote_str[0] = '\0';
RAWFB_RET_VOID RAWFB_RET_VOID
#if !NO_X11 #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 #endif
} }
@ -734,6 +744,7 @@ static void grab_buster_watch(int parent, char *dstr) {
char propval[200]; char propval[200];
int ev, er, maj, min; int ev, er, maj, min;
int db = 0; int db = 0;
char *ticker_str = "X11VNC_TICKER";
RAWFB_RET_VOID RAWFB_RET_VOID
@ -771,7 +782,10 @@ static void grab_buster_watch(int parent, char *dstr) {
usleep(3 * sleep); 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) { if (! ticker_atom) {
fprintf(stderr, "grab_buster_watch: no ticker atom\n"); fprintf(stderr, "grab_buster_watch: no ticker atom\n");
return; return;
@ -865,7 +879,11 @@ void sync_tod_with_servertime(void) {
} }
if (! ticker_atom) { 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) { if (! ticker_atom) {
return; return;

Loading…
Cancel
Save