x11vnc: more gui fixes, gui requests via client_sock, PASSWD_REQUIRED build opt.

pull/1/head
runge 20 years ago
parent 57d2ea6591
commit 37f23b2c07

@ -1,3 +1,7 @@
2005-07-17 Karl Runge <runge@karlrunge.com>
* more improvements to gui UE. gui requests via client_sock
PASSWD_REQUIRED and PASSWD_UNLESS_NOPW build options.
2005-07-12 Karl Runge <runge@karlrunge.com>
* gui: remove nevershared etc., parse cmd line, bug fixes.
* x11vnc: fix pointer queue buildup under -viewonly.

File diff suppressed because it is too large Load Diff

@ -22,7 +22,7 @@ catch {rename send {}}
# USA.
#
# tkx11vnc v0.1
# tkx11vnc v0.2
# This is a simple frontend to x11vnc. It uses the remote control
# and query features (-remote/-query aka -R/-Q) to interact with it.
# It is just a quick-n-dirty hack (it parses -help output, etc), but
@ -559,7 +559,9 @@ of actions:
Pressing \"OK\" will initiate the reverse
connection. Use a blank hostname to skip it.
Disconnect All - Disconnects all current VNC viewers.
Disconnect - Shows a popup menu of connected clients. Click on
one to disconnect it, or click on \"All Clients\"
disconnect all clients.
Window View - Switch between the \"full\" gui (also known as
\"Advanced\"), \"icon\" mode (small icon window with
@ -571,11 +573,29 @@ of actions:
and then exit. The tray/icon GUI then exits as well.
Termination:
If the x11vnc server stops for any reason, the tray/icon gui will exit.
If you delete the tray/icon (e.g. X out button), that is the same
as the \"Stop x11vnc\" action in the menu. (This will disconnect any
VNC viewer you are currently using to access the display).
VNC viewer you are currently using to access the display since the
x11vnc server is terminated).
To terminate the tray/icon gui window but not the x11vnc server press
Control-C on the tray/icon window. You can also do this (and much
more) via Properties -> Advanced -> Actions -> Quit
"
set helptext(NewClient) "
New Client - Presents an entry box where you type in the name
of a computer that is running a VNC viewer in
\"listen\" mode (e.g. vncviewer -listen). For a
non-standard listening port use \"host:port\".
Pressing \"OK\" will initiate the reverse
connection. Use a blank hostname to skip it.
"
set helptext(Properties) "
@ -622,6 +642,38 @@ the ViewOnly log in aspect: \"Password\" is still required to log in.
- The \"Advanced ...\" button replaces the Properties dialog with the full
tkx11vnc GUI. All dynamic settings can be modified in the full GUI.
--------------------------------------------------------------------
Don't Lock Yourself Out:
If you are sitting at the physical X display you cannot get into too
much trouble setting the Properties dialog values.
However IF you are using a VNC Viewer to REMOTELY access the X display
some items in the Properties dialog can lock you out of further access:
\"Accept Connections\" if you disable this remotely, and
accidentally disconnect your VNC viewer then you will not be
able to reconnect.
\"Ask for Confirmation\" if you enable this only someone
sitting at the X display can confirm any new VNC connections.
Furthermore, any current VNC viewers will be blocked while
waiting for the confirmation (times out in 120 sec by default).
\"All Clients ViewOnly\" if you enable this remotely, well
you can no longer provide input to disable it.
If you do lock yourself out you could log in remotely and start up
a second x11vnc and connect to that one to try to fix things in the
first one.
Note that if there are two or more x11vnc's on the same display the
use of the GUI may be ill-behaved. Terminate the second x11vnc as
soon as you have fixed the setting in the first one. Use of a remote
control command, e.g. \"x11vnc -R noviewonly\" or \"x11vnc -R unlock\"
is a good way to avoid this problem.
"
set helptext(all) $helpall
@ -1099,10 +1151,11 @@ proc set_name {name} {
if {![info exists full_win]} {
return
}
set w "."
if {$icon_mode} {
wm title $w "$name"
wm iconname $w "$name"
set w $full_win
} else {
set w "."
}
wm title $w "$name"
wm iconname $w "$name"
@ -2635,14 +2688,32 @@ proc append_text {str} {
proc show_all_settings {} {
global all_settings
set txt "\nRead-Write setting:\n\n"
global client_sock client_tail
global x11vnc_client_file
set txt "\nRead-Write settings:\n\n"
foreach item [split_query $all_settings] {
regsub {:} $item {: } item
append txt " $item\n"
if {[regexp {noremote} $item]} {
append txt "\nRead-Only setting:\n\n"
append txt "\nRead-Only settings:\n\n"
}
}
append txt "\nInternal settings:\n\n"
append txt "x11vnc_client_file: $x11vnc_client_file\n"
if {[info exists client_tail]} {
append txt "client_tail: $client_tail\n"
} else {
append txt "client_tail: unset\n"
}
if {[info exists client_sock]} {
append txt "client_sock: $client_sock\n"
} else {
append txt "client_sock: unset\n"
}
set estr ""
catch {set estr [exec env | grep -i X11VNC]}
append txt "$estr\n"
textwin "Settings" "All Current Settings" $txt
}
@ -3573,16 +3644,15 @@ proc make_menu_items {} {
}
}
proc menu_posted {} {
proc check_update_vars {} {
global last_query_all_time query_all_freq icon_mode
global connected_to_x11vnc client_tail
global connected_to_x11vnc client_tail client_sock
set now [clock seconds]
if {$icon_mode && $client_tail != ""} {
set delay $query_all_freq
if {$client_tail != "" && $client_sock == ""} {
set delay [expr 2 * $query_all_freq]
} else {
set delay $query_all_freq
}
if {$connected_to_x11vnc} {
@ -3602,6 +3672,10 @@ proc menu_posted {} {
}
}
proc menu_posted {} {
check_update_vars
}
proc props_widgets {state} {
global props_buttons
foreach w $props_buttons {
@ -3616,20 +3690,30 @@ proc props_apply {} {
global prop0_accept prop0_confirm prop0_viewonly prop0_shared
global prop0_passwd prop0_viewpasswd
global menu_var
global client_sock
props_widgets disabled
set aft 500
if {[info exists client_sock]} {
if {$client_sock != ""} {
set aft 150
}
}
set did 0
if {$props_accept != $prop0_accept} {
if {$did > 0} {after $aft}; incr did
if {$props_accept} {
push_new_value "unlock" "unlock" 1 0
} else {
push_new_value "lock" "lock" 1 0
}
set prop0_accept $props_accept
after 500
}
if {$props_confirm != $prop0_confirm} {
if {$did > 0} {after $aft}; incr did
if {$props_confirm} {
push_new_value "accept" "accept" "popup" 1
} else {
@ -3641,10 +3725,10 @@ proc props_apply {} {
set props_confirm 0
}
set prop0_confirm $props_confirm
after 500
}
if {$props_viewonly != $prop0_viewonly} {
if {$did > 0} {after $aft}; incr did
if {$props_viewonly} {
push_new_value "viewonly" "viewonly" 1 1
} else {
@ -3656,10 +3740,10 @@ proc props_apply {} {
set props_viewonly 0
}
set prop0_viewonly $props_viewonly
after 500
}
if {$props_shared != $prop0_shared} {
if {$did > 0} {after $aft}; incr did
if {$props_shared} {
push_new_value "shared" "shared" 1 1
} else {
@ -3671,7 +3755,6 @@ proc props_apply {} {
set props_shared 0
}
set prop0_shared $props_shared
after 500
}
set fpw 0
@ -3736,14 +3819,14 @@ proc props_apply {} {
foreach case $pw_ord {
if {$case == "fpw"} {
if {$did > 0} {after $aft}; incr did
push_new_value "passwd" "passwd" "$props_passwd" 1
set prop0_passwd $props_passwd
after 500
}
if {$case == "vpw"} {
if {$did > 0} {after $aft}; incr did
push_new_value "viewpasswd" "viewpasswd" "$props_viewpasswd" 1
set prop0_viewpasswd $props_viewpasswd
after 500
}
}
@ -3779,6 +3862,8 @@ proc do_props {{msg ""}} {
global have_labelframes ffont bfont
global props_buttons icon_noadvanced
check_update_vars
if [info exists menu_var(deny)] {
if {$menu_var(deny) == $unset_str || $menu_var(deny) == 0} {
set props_accept 1
@ -3856,6 +3941,8 @@ proc do_props {{msg ""}} {
button $b1.cancel -text Cancel -command "destroy $w" -font $bfont
button $b1.apply -text Apply -command "props_apply" -font $bfont
bind $w <KeyPress-Escape> "destroy $w"
pack $b1.apply $b1.cancel $b1.ok -side right -expand 1
lappend props_buttons $b1.apply $b1.cancel $b1.ok
@ -3965,11 +4052,12 @@ proc do_new_client {} {
set newclient ""
entry $w.e -width 16 -textvariable newclient -font $bfont
button $w.b -text OK -command "destroy $w" -font $bfont
button $w.h -text Help -command "menu_help NewClient" -font $bfont
bind $w.e <Return> "update; after 100; destroy $w"
wm title $w "New Client"
pack $w.l $w.e $w.b -side left -pady 1m -padx 1m
pack $w.l $w.e $w.h $w.b -side left -pady 1m -padx 0.5m
focus $w.e
center_win $w
update
@ -3987,6 +4075,43 @@ proc do_disconnect_all {} {
push_new_value "disconnect" "disconnect" "all" 1
}
proc do_disconnect_client {id} {
push_new_value "disconnect" "disconnect" "$id" 1
}
proc popup_post {m} {
global popup_cascade_posted client_balloon
global client_id_list
set popup_cascade_posted 0
set wd "$m.disconnect"
if {![winfo exists $wd]} {
return
}
catch {$wd delete 0 end}
$wd add command -label "Disconnect client:"
$wd add separator
$wd add command -label "All Clients" -command do_disconnect_all
if {![info exists client_id_list]} {
return
}
foreach client $client_id_list {
if {$client == ""} {
continue
}
if {[regexp {^([^:]*):(.*)$} $client mat id lab]} {
$wd add command -label "$lab" \
-command "do_disconnect_client $id"
}
}
}
proc pmenu {m x y} {
if {![winfo exists $m]} {
return
@ -3998,6 +4123,9 @@ proc pmenu {m x y} {
proc set_client_balloon {str} {
global client_balloon vnc_display
global client_id_list
set client_id_list [list]
set client_balloon "$vnc_display"
set count 0
@ -4023,8 +4151,10 @@ proc set_client_balloon {str} {
set client_balloon "${client_balloon}\n$user\@$host"
if {$vo == "1"} {
set client_balloon "${client_balloon} - view"
lappend client_id_list "$id:$user\@$host - view"
} else {
set client_balloon "${client_balloon} - full"
lappend client_id_list "$id:$user\@$host - full"
}
} else {
set i [expr $count+1]
@ -4038,26 +4168,37 @@ proc set_client_balloon {str} {
icon_win_cfg $count
}
proc read_client_info {} {
global x11vnc_client_file client_tail client_str
global client_tail_read
proc read_client_info {channel} {
global x11vnc_client_file client_str client_info_read
global read_client_info_lock
set db 0
if {$client_tail != ""} {
if {![info exists read_client_info_lock]} {
set read_client_info_lock 0
}
if {$channel != ""} {
if {$read_client_info_lock} {
return
}
set read_client_info_lock 1
after 100
set str ""
set count [gets $client_tail str]
if {$db} {puts stderr "read_client_info: $str"}
set count [gets $channel str]
if {$db} {puts stderr "read_client_info-$channel: $str"}
if {$count == -1 || [eof $client_tail]} {
close $client_tail
if {$count == -1 || [eof $channel]} {
close $channel
catch {file delete $x11vnc_client_file}
set read_client_info_lock 0
clean_icon_exit
}
if {$count > 0 && ![regexp {^[ ]*$} $str]} {
set client_tail_read 1
set client_info_read 1
if {$str == "quit"} {
catch {file delete $x11vnc_client_file}
set read_client_info_lock 0
clean_icon_exit
} elseif {$str != "skip"} {
if {$str == "none"} {
@ -4068,6 +4209,23 @@ proc read_client_info {} {
set_client_balloon $str
}
}
set read_client_info_lock 0
}
}
proc read_client_tail {} {
global client_tail
if {$client_tail != ""} {
read_client_info $client_tail
}
}
proc read_client_sock {} {
global client_sock
if {$client_sock != ""} {
read_client_info $client_sock
}
}
@ -4129,20 +4287,30 @@ proc kill_client_balloon {} {
}
proc icon_win_cfg {clients} {
global icon_win client_tail client_tail_read
global icon_win client_tail client_sock client_info_read
if {![info exists icon_win]} {
return
}
if {$icon_win == ""} {
return
}
if {$clients > 0} {
$icon_win configure -bg black -fg white
} else {
$icon_win configure -bg white -fg black
}
if {$client_tail == "" || !$client_tail_read} {
$icon_win configure -fg red
if {$client_tail == "" || !$client_info_read} {
if {$client_sock == ""} {
$icon_win configure -fg red
}
}
}
proc server_accept {sock addr port} {
global socket_cookie server socket_got_callback
global client_tail
global client_tail client_sock
set db 0
if {$db} {puts stderr "sock=$sock addr=$addr port=$port"}
@ -4156,8 +4324,8 @@ proc server_accept {sock addr port} {
set str [string trim $str]
if {$db} {puts stderr "server_accept: \"$str\""}
if {$str == "COOKIE:$socket_cookie"} {
set client_tail $sock
if {$db} {puts stderr "cookie matched. $client_tail"}
set client_sock $sock
if {$db} {puts stderr "cookie matched. $client_sock"}
} else {
if {$db} {puts stderr "cookie NO matched."}
}
@ -4169,17 +4337,39 @@ proc server_accept {sock addr port} {
proc try_client_info_sock {} {
global socket_cookie server socket_got_callback
global x11vnc_started hostname
global x11vnc_started x11vnc_xdisplay hostname client_sock
global x11vnc_xdisplay0 menu_var
set db 0
set start 13037
set tries 100
set socket_got_callback 0
set xd $x11vnc_xdisplay
if {$xd == "" && $x11vnc_xdisplay0 != ""} {
set xd $x11vnc_xdisplay0
}
if {$xd == "" && [info exists menu_var(display)]} {
set xd $menu_var(display)
}
set myaddr ""
regsub {\..*$} $hostname "" shost
if {$x11vnc_started} {
set myaddr "127.0.0.1"
} elseif {$xd != ""} {
if {[regexp {^:} $xd]} {
set myaddr "127.0.0.1"
} elseif {[regexp -nocase "^$shost" $xd]} {
set myaddr "127.0.0.1"
} elseif {[regexp -nocase "^localhost" $xd]} {
set myaddr "127.0.0.1"
} else {
set myaddr $hostname
}
} else {
set myaddr $hostname
}
set socket_cookie [clock clicks]
for {set i 0} {$i <= $tries} {incr i} {
set port [expr $start + $i]
@ -4203,8 +4393,25 @@ proc try_client_info_sock {} {
}
run_remote_cmd [list "-nosync" "-R" "noop"]
after 500
# set the cookie to some obscured randomness
set socket_cookie [clock clicks]
set r [expr rand()]
if {$r != ""} {
append socket_cookie $r
}
set r ""
catch {set r [winfo id .]}
if {$r != ""} {
append socket_cookie $r
}
if {[regexp {([0-9])([0-9])$} [clock clicks] m m1 m2]} {
regsub -all {\.} $socket_cookie $m1 socket_cookie
regsub -all {x} $socket_cookie $m2 socket_cookie
}
run_remote_cmd [list "-nosync" "-R" \
"client_info_sock:$myaddr:$port:$socket_cookie"]
if {$db} {puts "client_info_sock:$myaddr:$port:$socket_cookie"}
after 500
set aftid ""
@ -4221,7 +4428,7 @@ proc try_client_info_sock {} {
puts stderr "try_client_info_sock failed: no callback\n"
catch {close $server}
} else {
setup_client_tail
setup_client_sock 1
}
}
@ -4252,11 +4459,11 @@ proc get_icon_label {{set 0}} {
}
proc lmenu {menu} {
global window_view_posted
global popup_cascade_posted
after 100
if {!$window_view_posted} {
if {!$popup_cascade_posted} {
after 100
if {!$window_view_posted} {
if {!$popup_cascade_posted} {
$menu unpost
return
}
@ -4286,11 +4493,11 @@ proc old_balloon {} {
proc make_icon {} {
global icon_mode icon_embed_id icon_win props_win full_win
global tray_embed tray_running env
global x11vnc_client_file client_tail client_str saved_clients_str
global x11vnc_client_file client_tail client_sock client_str saved_clients_str
global client_balloon_id
global bfont sfont snfont ffont
global icon_minimal gui_start_mode
global window_view_posted menu_var x11vnc_gui_geom
global popup_cascade_posted menu_var x11vnc_gui_geom
set min_x 24
set min_y 24
@ -4331,28 +4538,37 @@ proc make_icon {} {
icon_win_cfg 0
set window_view_posted 0
set popup_cascade_posted 0
pack $l -fill both -expand 1
set menu "$l.menu"
menu $menu -tearoff 0 -postcommand {set window_view_posted 0}
menu $menu -tearoff 0 -postcommand "popup_post $menu"
$menu add command -font $mfont -label "Properties" -command do_props
$menu add command -font $mfont -label "Help" -command "menu_help Tray"
$menu add separator
$menu add command -font $mfont -label "New Client" -command do_new_client
$menu add command -font $mfont -label "Disconnect All" -command do_disconnect_all
set wd "$menu.disconnect"
catch {destroy $wd}
menu $wd -tearoff 0 -font $ffont \
-postcommand {set popup_cascade_posted 1}
$wd add command -label "Disconnect client:"
$wd add separator
$wd add command -label "All Clients" -command do_disconnect_all
$menu add cascade -font $mfont -label "Disconnect:" -menu $wd
$menu add separator
set wv "$menu.casc1"
set wv "$menu.windowview"
catch {destroy $wv}
menu $wv -tearoff 0 -font $ffont \
-postcommand {set window_view_posted 1}
-postcommand {set popup_cascade_posted 1}
foreach val {full icon tray} {
$wv add radiobutton -label "$val" \
-value "$val" -font $ffont \
-command "do_var WindowView" \
-variable menu_var(WindowView)
}
$menu add cascade -font $mfont -label "Window View" -menu $wv
$menu add cascade -font $mfont -label "Window View:" -menu $wv
$menu add command -font $mfont -label "Stop x11vnc" -command clean_icon_exit
@ -4363,7 +4579,9 @@ proc make_icon {} {
bind $icon_win <Leave> {kill_client_balloon}
bind $icon_win <ButtonPress-2> {kill_client_balloon; show_client_balloon}
bind $menu <Leave> "lmenu $menu"
bind $menu <KeyPress-Escape> "$menu unpost"
## bind $menu <KeyPress-Escape> "$menu unpost"
bind . <Control-KeyPress-c> {destroy .; exit 0}
if {!$tray_embed || !$tray_running} {
global x11vnc_gui_geom
@ -4379,18 +4597,27 @@ proc make_icon {} {
}
}
}
wm iconname . "tkx11vnc"
wm title . "tkx11vnc"
wm deiconify .
if {$client_tail == "" } {
old_balloon
}
proc setup_client_channel {} {
global client_sock client_tail
# XXX/setup_client_channel
if {$client_sock == "" } {
stop_watch on
try_client_info_sock
if {$client_tail == "" } {
if {$client_sock == "" } {
after 500
try_client_info_sock
}
stop_watch off
}
if {$client_tail == "" } {
if {$client_tail == "" && $client_sock == ""} {
set m "\n"
set m "${m}tkx11vnc:\n"
set m "${m}\n"
@ -4405,12 +4632,10 @@ proc make_icon {} {
textwin "Warning" "Warning" $m
update
}
old_balloon
}
proc clean_client_tail {} {
global client_tail client_tail_read
global client_tail client_info_read
if [info exists client_tail] {
if {$client_tail != ""} {
set p ""
@ -4422,7 +4647,7 @@ proc clean_client_tail {} {
set client_tail ""
}
}
set client_tail_read 0
set client_info_read 0
}
proc clean_icon_exit {} {
@ -4521,6 +4746,7 @@ proc make_gui {mode} {
center_win .
}
if {$make_gui_count == 1} {
copy_default_vars
if {$x11vnc_connect} {
@ -4531,13 +4757,13 @@ proc make_gui {mode} {
} else {
set_name "RESTORE"
}
setup_client_tail
set_widgets
if {$mode == "icon" || $mode == "tray"} {
setup_client_tail
if {$mode == "tray"} {
setup_tray_embed
}
if {$mode == "tray"} {
setup_tray_embed
}
}
@ -4776,7 +5002,7 @@ proc key_bindings {} {
global env menus_disabled
if {[info exists env(USER)] && $env(USER) == "runge"} {
# quick restart
bind . <Control-KeyPress-c> {exec $argv0 $argv &; destroy .}
bind . <Control-KeyPress-k> {exec $argv0 $argv &; destroy .}
}
bind . <Control-KeyPress-p> { \
global menus_disabled; \
@ -5172,9 +5398,67 @@ proc start_x11vnc {} {
}
}
proc run_remote_cmd_via_sock {opts} {
global client_sock
set db 0
if {[eof $client_sock]} {
close $client_sock
set client_sock ""
return "fail"
}
set result ""
setup_client_sock 0
set docmd ""
foreach opt $opts {
if {$opt == "-R"} {
set docmd "-R"
continue
} elseif {$opt == "-Q"} {
set docmd "-Q"
continue
}
if {$docmd == ""} {
continue
} elseif {$docmd == "-R"} {
set str "cmd=$opt"
} elseif {$docmd == "-Q"} {
set str "qry=$opt"
} else {
set docmd ""
continue
}
if {$db} {puts stderr "run_remote_cmd_via_sock: $docmd \"$str\""}
puts $client_sock $str
if {$db} {puts stderr "run_remote_cmd_via_sock: flush"}
flush $client_sock
if {$db} {puts stderr "run_remote_cmd_via_sock: gets"}
gets $client_sock res
if {$db} {puts stderr "run_remote_cmd_via_sock: \"$res\""}
set res [string trim $res]
set docmd ""
if {$res != ""} {
append result "$res\n"
}
}
setup_client_sock 1
set result [string trim $result]
return $result
}
proc run_remote_cmd {opts} {
global menu_var x11vnc_prog x11vnc_cmdline x11vnc_xdisplay
global x11vnc_auth_file x11vnc_connect_file
global client_sock
set debug [in_debug_mode]
@ -5189,6 +5473,17 @@ proc run_remote_cmd {opts} {
}
}
if {$client_sock != ""} {
menus_disable
stop_watch on
set result [run_remote_cmd_via_sock $opts]
stop_watch off
menus_enable
if {$result != "fail"} {
return $result
}
}
set cmd ""
lappend cmd $x11vnc_prog;
@ -5212,7 +5507,6 @@ proc run_remote_cmd {opts} {
}
lappend cmd "2>"
lappend cmd "/dev/null"
# lappend cmd "/tmp/nono"
if {0 || $debug} {
set str [join $cmd]
@ -5228,7 +5522,6 @@ proc run_remote_cmd {opts} {
stop_watch on
catch {set output [eval exec $cmd]}
stop_watch off
#puts stderr [exec cat /tmp/nono]
menus_enable
if {$debug} {
@ -5259,6 +5552,8 @@ proc try_connect {} {
global x11vnc_xdisplay connected_to_x11vnc reply_xdisplay
global menu_var unset_str
set db 0
if {! $connected_to_x11vnc} {
if {[info exists menu_var(display)]} {
set d $menu_var(display)
@ -5273,12 +5568,19 @@ proc try_connect {} {
set rargs [list "-Q" "ping"]
set result [run_remote_cmd $rargs]
if {$db} {puts "try_connect: \"$result\""}
if {[regexp {^ans=ping:} $result]} {
regsub {^ans=ping:} $result {} reply_xdisplay
set msg "Connected to $reply_xdisplay"
set_info $msg
append_text "$msg\n"
set_connected yes
setup_client_channel
setup_client_sock 1
setup_client_tail
fetch_displays
return 1
} else {
@ -5344,7 +5646,18 @@ proc change_view_state {} {
proc setup_client_tail {} {
global client_tail
if {$client_tail != ""} {
fileevent $client_tail readable read_client_info
fileevent $client_tail readable read_client_tail
}
}
proc setup_client_sock {{enable 1}} {
global client_sock
if {$client_sock != ""} {
if {$enable} {
fileevent $client_sock readable read_client_sock
} else {
fileevent $client_sock readable ""
}
}
}
@ -5438,6 +5751,7 @@ proc undo_tray_embed {} {
# main:
global env x11vnc_prog x11vnc_cmdline x11vnc_xdisplay x11vnc_connect;
global x11vnc_xdisplay0
global x11vnc_client_file x11vnc_gui_geom x11vnc_started vnc_url
global x11vnc_gui_params
global x11vnc_auth_file x11vnc_connect_file beginner_mode simple_gui_created
@ -5449,7 +5763,7 @@ global bfont ffont sfont snfont old_labels have_labelframes
global connected_to_x11vnc
global delay_sleep extra_sleep extra_sleep_split
global cache_all_query_vars
global last_query_all_time query_all_freq client_tail client_tail_read
global last_query_all_time query_all_freq client_tail client_sock client_info_read
global icon_mode tray_embed tray_running icon_setpasswd icon_embed_id
global icon_noadvanced icon_minimal
global make_gui_count text_area_str
@ -5473,7 +5787,8 @@ set cache_all_query_vars ""
set query_all_freq 120
set last_query_all_time [clock seconds]
set client_tail ""
set client_tail_read 0
set client_sock ""
set client_info_read 0
set make_gui_count 0
set text_area_str ""
set gui_argv0 $argv0
@ -5539,6 +5854,7 @@ if {[info exists env(X11VNC_CLIENT_FILE)]} {
if {$client_tail != ""} {
gets $client_tail tmp
if [eof $client_tail] {
puts "eof $client_tail"
clean_client_tail
set client_tail ""
}
@ -5586,6 +5902,7 @@ if {[info exists env(X11VNC_STARTED)]} {
set x11vnc_started 1
}
set x11vnc_xdisplay ""
if {[info exists env(X11VNC_XDISPLAY)]} {
set x11vnc_xdisplay $env(X11VNC_XDISPLAY);
set x11vnc_connect 1
@ -5600,6 +5917,7 @@ if {[info exists env(X11VNC_XDISPLAY)]} {
} else {
set x11vnc_xdisplay ":0";
}
set x11vnc_xdisplay0 $x11vnc_xdisplay
if {[info exists env(X11VNC_AUTH_FILE)]} {
set x11vnc_auth_file $env(X11VNC_AUTH_FILE)

@ -28,7 +28,7 @@
"# USA.\n"
"\n"
"#\n"
"# tkx11vnc v0.1\n"
"# tkx11vnc v0.2\n"
"# This is a simple frontend to x11vnc. It uses the remote control\n"
"# and query features (-remote/-query aka -R/-Q) to interact with it. \n"
"# It is just a quick-n-dirty hack (it parses -help output, etc), but\n"
@ -565,7 +565,9 @@
" Pressing \\\"OK\\\" will initiate the reverse\n"
" connection. Use a blank hostname to skip it.\n"
" \n"
" Disconnect All - Disconnects all current VNC viewers.\n"
" Disconnect - Shows a popup menu of connected clients. Click on\n"
" one to disconnect it, or click on \\\"All Clients\\\"\n"
" disconnect all clients.\n"
"\n"
" Window View - Switch between the \\\"full\\\" gui (also known as\n"
" \\\"Advanced\\\"), \\\"icon\\\" mode (small icon window with\n"
@ -577,11 +579,29 @@
" and then exit. The tray/icon GUI then exits as well.\n"
"\n"
"\n"
"Termination:\n"
"\n"
"If the x11vnc server stops for any reason, the tray/icon gui will exit.\n"
"\n"
"If you delete the tray/icon (e.g. X out button), that is the same\n"
"as the \\\"Stop x11vnc\\\" action in the menu. (This will disconnect any\n"
"VNC viewer you are currently using to access the display).\n"
"VNC viewer you are currently using to access the display since the\n"
"x11vnc server is terminated).\n"
"\n"
"To terminate the tray/icon gui window but not the x11vnc server press\n"
"Control-C on the tray/icon window. You can also do this (and much\n"
"more) via Properties -> Advanced -> Actions -> Quit\n"
"\"\n"
"\n"
" set helptext(NewClient) \"\n"
" New Client - Presents an entry box where you type in the name\n"
" of a computer that is running a VNC viewer in\n"
" \\\"listen\\\" mode (e.g. vncviewer -listen). For a\n"
" non-standard listening port use \\\"host:port\\\".\n"
"\n"
" Pressing \\\"OK\\\" will initiate the reverse\n"
" connection. Use a blank hostname to skip it.\n"
" \n"
"\"\n"
"\n"
" set helptext(Properties) \"\n"
@ -628,7 +648,39 @@
" \n"
" - The \\\"Advanced ...\\\" button replaces the Properties dialog with the full\n"
" tkx11vnc GUI. All dynamic settings can be modified in the full GUI.\n"
"\" \n"
"\n"
"\n"
"--------------------------------------------------------------------\n"
"Don't Lock Yourself Out:\n"
"\n"
" If you are sitting at the physical X display you cannot get into too\n"
" much trouble setting the Properties dialog values.\n"
"\n"
" However IF you are using a VNC Viewer to REMOTELY access the X display\n"
" some items in the Properties dialog can lock you out of further access:\n"
"\n"
" \\\"Accept Connections\\\" if you disable this remotely, and\n"
" accidentally disconnect your VNC viewer then you will not be\n"
" able to reconnect.\n"
" \n"
" \\\"Ask for Confirmation\\\" if you enable this only someone\n"
" sitting at the X display can confirm any new VNC connections.\n"
" Furthermore, any current VNC viewers will be blocked while\n"
" waiting for the confirmation (times out in 120 sec by default). \n"
" \n"
" \\\"All Clients ViewOnly\\\" if you enable this remotely, well\n"
" you can no longer provide input to disable it.\n"
" \n"
" If you do lock yourself out you could log in remotely and start up\n"
" a second x11vnc and connect to that one to try to fix things in the\n"
" first one.\n"
"\n"
" Note that if there are two or more x11vnc's on the same display the\n"
" use of the GUI may be ill-behaved. Terminate the second x11vnc as\n"
" soon as you have fixed the setting in the first one. Use of a remote\n"
" control command, e.g. \\\"x11vnc -R noviewonly\\\" or \\\"x11vnc -R unlock\\\"\n"
" is a good way to avoid this problem.\n"
"\"\n"
"\n"
" set helptext(all) $helpall\n"
"\n"
@ -1105,10 +1157,11 @@
" if {![info exists full_win]} {\n"
" return\n"
" }\n"
" set w \".\"\n"
" if {$icon_mode} {\n"
" wm title $w \"$name\"\n"
" wm iconname $w \"$name\"\n"
" set w $full_win\n"
" } else {\n"
" set w \".\"\n"
" }\n"
" wm title $w \"$name\"\n"
" wm iconname $w \"$name\"\n"
@ -2641,14 +2694,32 @@
"\n"
"proc show_all_settings {} {\n"
" global all_settings\n"
" set txt \"\\nRead-Write setting:\\n\\n\"\n"
" global client_sock client_tail\n"
" global x11vnc_client_file\n"
"\n"
" set txt \"\\nRead-Write settings:\\n\\n\"\n"
" foreach item [split_query $all_settings] {\n"
" regsub {:} $item {: } item\n"
" append txt \" $item\\n\"\n"
" if {[regexp {noremote} $item]} {\n"
" append txt \"\\nRead-Only setting:\\n\\n\"\n"
" append txt \"\\nRead-Only settings:\\n\\n\"\n"
" }\n"
" }\n"
" append txt \"\\nInternal settings:\\n\\n\"\n"
" append txt \"x11vnc_client_file: $x11vnc_client_file\\n\"\n"
" if {[info exists client_tail]} {\n"
" append txt \"client_tail: $client_tail\\n\"\n"
" } else {\n"
" append txt \"client_tail: unset\\n\"\n"
" }\n"
" if {[info exists client_sock]} {\n"
" append txt \"client_sock: $client_sock\\n\"\n"
" } else {\n"
" append txt \"client_sock: unset\\n\"\n"
" }\n"
" set estr \"\"\n"
" catch {set estr [exec env | grep -i X11VNC]}\n"
" append txt \"$estr\\n\"\n"
" textwin \"Settings\" \"All Current Settings\" $txt\n"
"}\n"
"\n"
@ -3579,16 +3650,15 @@
" }\n"
"}\n"
"\n"
"proc menu_posted {} {\n"
"proc check_update_vars {} {\n"
" global last_query_all_time query_all_freq icon_mode\n"
" global connected_to_x11vnc client_tail\n"
" global connected_to_x11vnc client_tail client_sock\n"
"\n"
" set now [clock seconds]\n"
"\n"
" if {$icon_mode && $client_tail != \"\"} {\n"
" set delay $query_all_freq\n"
" if {$client_tail != \"\" && $client_sock == \"\"} {\n"
" set delay [expr 2 * $query_all_freq]\n"
" } else {\n"
" set delay $query_all_freq\n"
" }\n"
"\n"
" if {$connected_to_x11vnc} {\n"
@ -3608,6 +3678,10 @@
" }\n"
"}\n"
"\n"
"proc menu_posted {} {\n"
" check_update_vars\n"
"}\n"
"\n"
"proc props_widgets {state} {\n"
" global props_buttons\n"
" foreach w $props_buttons {\n"
@ -3622,20 +3696,30 @@
" global prop0_accept prop0_confirm prop0_viewonly prop0_shared\n"
" global prop0_passwd prop0_viewpasswd\n"
" global menu_var\n"
" global client_sock\n"
"\n"
" props_widgets disabled\n"
"\n"
" set aft 500\n"
" if {[info exists client_sock]} {\n"
" if {$client_sock != \"\"} {\n"
" set aft 150\n"
" }\n"
" }\n"
" set did 0\n"
"\n"
" if {$props_accept != $prop0_accept} {\n"
" if {$did > 0} {after $aft}; incr did\n"
" if {$props_accept} {\n"
" push_new_value \"unlock\" \"unlock\" 1 0\n"
" } else {\n"
" push_new_value \"lock\" \"lock\" 1 0\n"
" }\n"
" set prop0_accept $props_accept\n"
" after 500\n"
" }\n"
"\n"
" if {$props_confirm != $prop0_confirm} {\n"
" if {$did > 0} {after $aft}; incr did\n"
" if {$props_confirm} {\n"
" push_new_value \"accept\" \"accept\" \"popup\" 1\n"
" } else {\n"
@ -3647,10 +3731,10 @@
" set props_confirm 0\n"
" }\n"
" set prop0_confirm $props_confirm\n"
" after 500\n"
" }\n"
"\n"
" if {$props_viewonly != $prop0_viewonly} {\n"
" if {$did > 0} {after $aft}; incr did\n"
" if {$props_viewonly} {\n"
" push_new_value \"viewonly\" \"viewonly\" 1 1\n"
" } else {\n"
@ -3662,10 +3746,10 @@
" set props_viewonly 0\n"
" }\n"
" set prop0_viewonly $props_viewonly\n"
" after 500\n"
" }\n"
"\n"
" if {$props_shared != $prop0_shared} {\n"
" if {$did > 0} {after $aft}; incr did\n"
" if {$props_shared} {\n"
" push_new_value \"shared\" \"shared\" 1 1\n"
" } else {\n"
@ -3677,7 +3761,6 @@
" set props_shared 0\n"
" }\n"
" set prop0_shared $props_shared\n"
" after 500\n"
" }\n"
"\n"
" set fpw 0\n"
@ -3742,14 +3825,14 @@
"\n"
" foreach case $pw_ord {\n"
" if {$case == \"fpw\"} {\n"
" if {$did > 0} {after $aft}; incr did\n"
" push_new_value \"passwd\" \"passwd\" \"$props_passwd\" 1\n"
" set prop0_passwd $props_passwd\n"
" after 500\n"
" }\n"
" if {$case == \"vpw\"} {\n"
" if {$did > 0} {after $aft}; incr did\n"
" push_new_value \"viewpasswd\" \"viewpasswd\" \"$props_viewpasswd\" 1\n"
" set prop0_viewpasswd $props_viewpasswd\n"
" after 500\n"
" }\n"
" }\n"
"\n"
@ -3785,6 +3868,8 @@
" global have_labelframes ffont bfont\n"
" global props_buttons icon_noadvanced\n"
"\n"
" check_update_vars\n"
"\n"
" if [info exists menu_var(deny)] {\n"
" if {$menu_var(deny) == $unset_str || $menu_var(deny) == 0} {\n"
" set props_accept 1\n"
@ -3862,6 +3947,8 @@
" button $b1.cancel -text Cancel -command \"destroy $w\" -font $bfont\n"
" button $b1.apply -text Apply -command \"props_apply\" -font $bfont\n"
"\n"
" bind $w <KeyPress-Escape> \"destroy $w\"\n"
"\n"
" pack $b1.apply $b1.cancel $b1.ok -side right -expand 1\n"
" lappend props_buttons $b1.apply $b1.cancel $b1.ok\n"
"\n"
@ -3971,11 +4058,12 @@
" set newclient \"\"\n"
" entry $w.e -width 16 -textvariable newclient -font $bfont \n"
" button $w.b -text OK -command \"destroy $w\" -font $bfont\n"
" button $w.h -text Help -command \"menu_help NewClient\" -font $bfont\n"
" bind $w.e <Return> \"update; after 100; destroy $w\"\n"
"\n"
" wm title $w \"New Client\"\n"
"\n"
" pack $w.l $w.e $w.b -side left -pady 1m -padx 1m\n"
" pack $w.l $w.e $w.h $w.b -side left -pady 1m -padx 0.5m\n"
" focus $w.e\n"
" center_win $w\n"
" update \n"
@ -3993,6 +4081,43 @@
" push_new_value \"disconnect\" \"disconnect\" \"all\" 1\n"
"}\n"
"\n"
"proc do_disconnect_client {id} {\n"
" push_new_value \"disconnect\" \"disconnect\" \"$id\" 1\n"
"}\n"
"\n"
"proc popup_post {m} {\n"
" global popup_cascade_posted client_balloon\n"
" global client_id_list\n"
"\n"
" set popup_cascade_posted 0\n"
" \n"
" set wd \"$m.disconnect\"\n"
"\n"
" if {![winfo exists $wd]} {\n"
" return\n"
" }\n"
"\n"
" catch {$wd delete 0 end}\n"
"\n"
" $wd add command -label \"Disconnect client:\"\n"
" $wd add separator\n"
" $wd add command -label \"All Clients\" -command do_disconnect_all\n"
"\n"
" if {![info exists client_id_list]} {\n"
" return\n"
" }\n"
"\n"
" foreach client $client_id_list {\n"
" if {$client == \"\"} {\n"
" continue\n"
" }\n"
" if {[regexp {^([^:]*):(.*)$} $client mat id lab]} {\n"
" $wd add command -label \"$lab\" \\\n"
" -command \"do_disconnect_client $id\"\n"
" }\n"
" }\n"
"}\n"
"\n"
"proc pmenu {m x y} {\n"
" if {![winfo exists $m]} {\n"
" return\n"
@ -4004,6 +4129,9 @@
"\n"
"proc set_client_balloon {str} {\n"
" global client_balloon vnc_display\n"
" global client_id_list\n"
"\n"
" set client_id_list [list]\n"
" \n"
" set client_balloon \"$vnc_display\"\n"
" set count 0\n"
@ -4029,8 +4157,10 @@
" set client_balloon \"${client_balloon}\\n$user\\@$host\"\n"
" if {$vo == \"1\"} {\n"
" set client_balloon \"${client_balloon} - view\"\n"
" lappend client_id_list \"$id:$user\\@$host - view\"\n"
" } else {\n"
" set client_balloon \"${client_balloon} - full\"\n"
" lappend client_id_list \"$id:$user\\@$host - full\"\n"
" }\n"
" } else {\n"
" set i [expr $count+1]\n"
@ -4044,26 +4174,37 @@
" icon_win_cfg $count\n"
"}\n"
"\n"
"proc read_client_info {} {\n"
" global x11vnc_client_file client_tail client_str\n"
" global client_tail_read\n"
"proc read_client_info {channel} {\n"
" global x11vnc_client_file client_str client_info_read\n"
" global read_client_info_lock\n"
" set db 0\n"
"\n"
" if {$client_tail != \"\"} {\n"
" if {![info exists read_client_info_lock]} {\n"
" set read_client_info_lock 0\n"
" }\n"
"\n"
" if {$channel != \"\"} {\n"
"\n"
" if {$read_client_info_lock} {\n"
" return\n"
" }\n"
" set read_client_info_lock 1\n"
" after 100\n"
" set str \"\"\n"
" set count [gets $client_tail str]\n"
" if {$db} {puts stderr \"read_client_info: $str\"}\n"
" set count [gets $channel str]\n"
" if {$db} {puts stderr \"read_client_info-$channel: $str\"}\n"
"\n"
" if {$count == -1 || [eof $client_tail]} {\n"
" close $client_tail\n"
" if {$count == -1 || [eof $channel]} {\n"
" close $channel\n"
" catch {file delete $x11vnc_client_file}\n"
" set read_client_info_lock 0\n"
" clean_icon_exit\n"
" }\n"
" if {$count > 0 && ![regexp {^[ ]*$} $str]} {\n"
" set client_tail_read 1\n"
" set client_info_read 1\n"
" if {$str == \"quit\"} {\n"
" catch {file delete $x11vnc_client_file}\n"
" set read_client_info_lock 0\n"
" clean_icon_exit\n"
" } elseif {$str != \"skip\"} {\n"
" if {$str == \"none\"} {\n"
@ -4074,6 +4215,23 @@
" set_client_balloon $str\n"
" }\n"
" }\n"
" set read_client_info_lock 0\n"
" }\n"
"}\n"
"\n"
"proc read_client_tail {} {\n"
" global client_tail\n"
"\n"
" if {$client_tail != \"\"} {\n"
" read_client_info $client_tail\n"
" }\n"
"}\n"
"\n"
"proc read_client_sock {} {\n"
" global client_sock\n"
"\n"
" if {$client_sock != \"\"} {\n"
" read_client_info $client_sock\n"
" }\n"
"}\n"
"\n"
@ -4135,20 +4293,30 @@
"}\n"
"\n"
"proc icon_win_cfg {clients} {\n"
" global icon_win client_tail client_tail_read\n"
" global icon_win client_tail client_sock client_info_read\n"
"\n"
" if {![info exists icon_win]} {\n"
" return\n"
" }\n"
" if {$icon_win == \"\"} {\n"
" return\n"
" }\n"
" if {$clients > 0} {\n"
" $icon_win configure -bg black -fg white\n"
" } else {\n"
" $icon_win configure -bg white -fg black\n"
" }\n"
" if {$client_tail == \"\" || !$client_tail_read} {\n"
" $icon_win configure -fg red\n"
"\n"
" if {$client_tail == \"\" || !$client_info_read} {\n"
" if {$client_sock == \"\"} {\n"
" $icon_win configure -fg red\n"
" }\n"
" }\n"
"}\n"
"\n"
"proc server_accept {sock addr port} {\n"
" global socket_cookie server socket_got_callback\n"
" global client_tail\n"
" global client_tail client_sock\n"
" set db 0\n"
"\n"
" if {$db} {puts stderr \"sock=$sock addr=$addr port=$port\"}\n"
@ -4162,8 +4330,8 @@
" set str [string trim $str]\n"
" if {$db} {puts stderr \"server_accept: \\\"$str\\\"\"}\n"
" if {$str == \"COOKIE:$socket_cookie\"} {\n"
" set client_tail $sock\n"
" if {$db} {puts stderr \"cookie matched. $client_tail\"}\n"
" set client_sock $sock\n"
" if {$db} {puts stderr \"cookie matched. $client_sock\"}\n"
" } else {\n"
" if {$db} {puts stderr \"cookie NO matched.\"}\n"
" }\n"
@ -4175,17 +4343,39 @@
"\n"
"proc try_client_info_sock {} {\n"
" global socket_cookie server socket_got_callback\n"
" global x11vnc_started hostname\n"
" global x11vnc_started x11vnc_xdisplay hostname client_sock\n"
" global x11vnc_xdisplay0 menu_var\n"
"\n"
" set db 0\n"
" set start 13037\n"
" set tries 100\n"
" set socket_got_callback 0\n"
"\n"
" set xd $x11vnc_xdisplay\n"
" if {$xd == \"\" && $x11vnc_xdisplay0 != \"\"} {\n"
" set xd $x11vnc_xdisplay0\n"
" }\n"
" if {$xd == \"\" && [info exists menu_var(display)]} {\n"
" set xd $menu_var(display)\n"
" }\n"
"\n"
" set myaddr \"\"\n"
" regsub {\\..*$} $hostname \"\" shost\n"
" if {$x11vnc_started} {\n"
" set myaddr \"127.0.0.1\"\n"
" } elseif {$xd != \"\"} {\n"
" if {[regexp {^:} $xd]} {\n"
" set myaddr \"127.0.0.1\"\n"
" } elseif {[regexp -nocase \"^$shost\" $xd]} {\n"
" set myaddr \"127.0.0.1\"\n"
" } elseif {[regexp -nocase \"^localhost\" $xd]} {\n"
" set myaddr \"127.0.0.1\"\n"
" } else {\n"
" set myaddr $hostname\n"
" }\n"
" } else {\n"
" set myaddr $hostname\n"
" }\n"
" set socket_cookie [clock clicks]\n"
" \n"
" for {set i 0} {$i <= $tries} {incr i} {\n"
" set port [expr $start + $i]\n"
@ -4209,8 +4399,25 @@
" }\n"
" run_remote_cmd [list \"-nosync\" \"-R\" \"noop\"]\n"
" after 500\n"
"\n"
" # set the cookie to some obscured randomness\n"
" set socket_cookie [clock clicks]\n"
" set r [expr rand()]\n"
" if {$r != \"\"} {\n"
" append socket_cookie $r\n"
" }\n"
" set r \"\"\n"
" catch {set r [winfo id .]}\n"
" if {$r != \"\"} {\n"
" append socket_cookie $r\n"
" }\n"
" if {[regexp {([0-9])([0-9])$} [clock clicks] m m1 m2]} {\n"
" regsub -all {\\.} $socket_cookie $m1 socket_cookie\n"
" regsub -all {x} $socket_cookie $m2 socket_cookie\n"
" }\n"
" run_remote_cmd [list \"-nosync\" \"-R\" \\\n"
" \"client_info_sock:$myaddr:$port:$socket_cookie\"]\n"
" if {$db} {puts \"client_info_sock:$myaddr:$port:$socket_cookie\"}\n"
" after 500\n"
"\n"
" set aftid \"\"\n"
@ -4227,7 +4434,7 @@
" puts stderr \"try_client_info_sock failed: no callback\\n\"\n"
" catch {close $server}\n"
" } else {\n"
" setup_client_tail\n"
" setup_client_sock 1\n"
" }\n"
"}\n"
"\n"
@ -4258,11 +4465,11 @@
"}\n"
"\n"
"proc lmenu {menu} {\n"
" global window_view_posted\n"
" global popup_cascade_posted\n"
" after 100\n"
" if {!$window_view_posted} {\n"
" if {!$popup_cascade_posted} {\n"
" after 100\n"
" if {!$window_view_posted} {\n"
" if {!$popup_cascade_posted} {\n"
" $menu unpost\n"
" return\n"
" }\n"
@ -4292,11 +4499,11 @@
"proc make_icon {} {\n"
" global icon_mode icon_embed_id icon_win props_win full_win\n"
" global tray_embed tray_running env\n"
" global x11vnc_client_file client_tail client_str saved_clients_str\n"
" global x11vnc_client_file client_tail client_sock client_str saved_clients_str\n"
" global client_balloon_id\n"
" global bfont sfont snfont ffont\n"
" global icon_minimal gui_start_mode\n"
" global window_view_posted menu_var x11vnc_gui_geom\n"
" global popup_cascade_posted menu_var x11vnc_gui_geom\n"
" set min_x 24\n"
" set min_y 24\n"
" \n"
@ -4337,28 +4544,37 @@
" icon_win_cfg 0\n"
"\n"
"\n"
" set window_view_posted 0\n"
" set popup_cascade_posted 0\n"
" pack $l -fill both -expand 1\n"
" set menu \"$l.menu\"\n"
" menu $menu -tearoff 0 -postcommand {set window_view_posted 0}\n"
" menu $menu -tearoff 0 -postcommand \"popup_post $menu\"\n"
" $menu add command -font $mfont -label \"Properties\" -command do_props\n"
" $menu add command -font $mfont -label \"Help\" -command \"menu_help Tray\"\n"
" $menu add separator\n"
" $menu add command -font $mfont -label \"New Client\" -command do_new_client\n"
" $menu add command -font $mfont -label \"Disconnect All\" -command do_disconnect_all\n"
"\n"
" set wd \"$menu.disconnect\"\n"
" catch {destroy $wd}\n"
" menu $wd -tearoff 0 -font $ffont \\\n"
" -postcommand {set popup_cascade_posted 1}\n"
" $wd add command -label \"Disconnect client:\"\n"
" $wd add separator\n"
" $wd add command -label \"All Clients\" -command do_disconnect_all\n"
" $menu add cascade -font $mfont -label \"Disconnect:\" -menu $wd\n"
"\n"
" $menu add separator\n"
"\n"
" set wv \"$menu.casc1\"\n"
" set wv \"$menu.windowview\"\n"
" catch {destroy $wv}\n"
" menu $wv -tearoff 0 -font $ffont \\\n"
" -postcommand {set window_view_posted 1}\n"
" -postcommand {set popup_cascade_posted 1}\n"
" foreach val {full icon tray} {\n"
" $wv add radiobutton -label \"$val\" \\\n"
" -value \"$val\" -font $ffont \\\n"
" -command \"do_var WindowView\" \\\n"
" -variable menu_var(WindowView)\n"
" }\n"
" $menu add cascade -font $mfont -label \"Window View\" -menu $wv\n"
" $menu add cascade -font $mfont -label \"Window View:\" -menu $wv\n"
"\n"
" $menu add command -font $mfont -label \"Stop x11vnc\" -command clean_icon_exit\n"
"\n"
@ -4369,7 +4585,9 @@
" bind $icon_win <Leave> {kill_client_balloon}\n"
" bind $icon_win <ButtonPress-2> {kill_client_balloon; show_client_balloon}\n"
" bind $menu <Leave> \"lmenu $menu\"\n"
" bind $menu <KeyPress-Escape> \"$menu unpost\"\n"
"## bind $menu <KeyPress-Escape> \"$menu unpost\"\n"
"\n"
" bind . <Control-KeyPress-c> {destroy .; exit 0}\n"
"\n"
" if {!$tray_embed || !$tray_running} {\n"
" global x11vnc_gui_geom\n"
@ -4385,18 +4603,27 @@
" }\n"
" }\n"
" }\n"
" wm iconname . \"tkx11vnc\"\n"
" wm title . \"tkx11vnc\"\n"
" wm deiconify .\n"
"\n"
" if {$client_tail == \"\" } {\n"
" old_balloon\n"
"}\n"
"\n"
"proc setup_client_channel {} {\n"
" global client_sock client_tail\n"
"\n"
"# XXX/setup_client_channel\n"
" if {$client_sock == \"\" } {\n"
" stop_watch on\n"
" try_client_info_sock\n"
" if {$client_tail == \"\" } {\n"
" if {$client_sock == \"\" } {\n"
" after 500\n"
" try_client_info_sock\n"
" }\n"
" stop_watch off\n"
" }\n"
" if {$client_tail == \"\" } {\n"
" if {$client_tail == \"\" && $client_sock == \"\"} {\n"
" set m \"\\n\"\n"
" set m \"${m}tkx11vnc:\\n\"\n"
" set m \"${m}\\n\"\n"
@ -4411,12 +4638,10 @@
" textwin \"Warning\" \"Warning\" $m\n"
" update\n"
" }\n"
"\n"
" old_balloon\n"
"}\n"
"\n"
"proc clean_client_tail {} {\n"
" global client_tail client_tail_read\n"
" global client_tail client_info_read\n"
" if [info exists client_tail] {\n"
" if {$client_tail != \"\"} {\n"
" set p \"\"\n"
@ -4428,7 +4653,7 @@
" set client_tail \"\"\n"
" }\n"
" }\n"
" set client_tail_read 0\n"
" set client_info_read 0\n"
"}\n"
"\n"
"proc clean_icon_exit {} {\n"
@ -4527,6 +4752,7 @@
" center_win .\n"
" }\n"
"\n"
"\n"
" if {$make_gui_count == 1} {\n"
" copy_default_vars\n"
" if {$x11vnc_connect} {\n"
@ -4537,13 +4763,13 @@
" } else {\n"
" set_name \"RESTORE\"\n"
" }\n"
"\n"
" setup_client_tail\n"
"\n"
" set_widgets\n"
"\n"
" if {$mode == \"icon\" || $mode == \"tray\"} {\n"
" setup_client_tail\n"
" if {$mode == \"tray\"} {\n"
" setup_tray_embed\n"
" }\n"
" if {$mode == \"tray\"} {\n"
" setup_tray_embed\n"
" }\n"
"}\n"
"\n"
@ -4782,7 +5008,7 @@
" global env menus_disabled\n"
" if {[info exists env(USER)] && $env(USER) == \"runge\"} {\n"
" # quick restart\n"
" bind . <Control-KeyPress-c> {exec $argv0 $argv &; destroy .}\n"
" bind . <Control-KeyPress-k> {exec $argv0 $argv &; destroy .}\n"
" }\n"
" bind . <Control-KeyPress-p> { \\\n"
" global menus_disabled; \\\n"
@ -5178,9 +5404,67 @@
" }\n"
"}\n"
"\n"
"proc run_remote_cmd_via_sock {opts} {\n"
" global client_sock\n"
"\n"
" set db 0\n"
" if {[eof $client_sock]} {\n"
" close $client_sock\n"
" set client_sock \"\"\n"
" return \"fail\"\n"
" }\n"
" set result \"\"\n"
" \n"
" setup_client_sock 0\n"
"\n"
" set docmd \"\"\n"
" foreach opt $opts {\n"
" if {$opt == \"-R\"} {\n"
" set docmd \"-R\"\n"
" continue\n"
" } elseif {$opt == \"-Q\"} {\n"
" set docmd \"-Q\"\n"
" continue\n"
" }\n"
"\n"
" if {$docmd == \"\"} {\n"
" continue\n"
" } elseif {$docmd == \"-R\"} {\n"
" set str \"cmd=$opt\"\n"
" } elseif {$docmd == \"-Q\"} {\n"
" set str \"qry=$opt\"\n"
" } else {\n"
" set docmd \"\"\n"
" continue\n"
" }\n"
"\n"
" if {$db} {puts stderr \"run_remote_cmd_via_sock: $docmd \\\"$str\\\"\"}\n"
" puts $client_sock $str\n"
" if {$db} {puts stderr \"run_remote_cmd_via_sock: flush\"}\n"
" flush $client_sock\n"
" if {$db} {puts stderr \"run_remote_cmd_via_sock: gets\"}\n"
" gets $client_sock res\n"
" if {$db} {puts stderr \"run_remote_cmd_via_sock: \\\"$res\\\"\"}\n"
" set res [string trim $res]\n"
"\n"
" set docmd \"\"\n"
"\n"
" if {$res != \"\"} {\n"
" append result \"$res\\n\"\n"
" }\n"
" }\n"
" \n"
" setup_client_sock 1\n"
"\n"
" set result [string trim $result]\n"
"\n"
" return $result\n"
"}\n"
"\n"
"proc run_remote_cmd {opts} {\n"
" global menu_var x11vnc_prog x11vnc_cmdline x11vnc_xdisplay\n"
" global x11vnc_auth_file x11vnc_connect_file\n"
" global client_sock\n"
"\n"
" set debug [in_debug_mode]\n"
"\n"
@ -5195,6 +5479,17 @@
" }\n"
" }\n"
"\n"
" if {$client_sock != \"\"} {\n"
" menus_disable\n"
" stop_watch on\n"
" set result [run_remote_cmd_via_sock $opts]\n"
" stop_watch off\n"
" menus_enable\n"
" if {$result != \"fail\"} {\n"
" return $result\n"
" }\n"
" }\n"
"\n"
" set cmd \"\"\n"
"\n"
" lappend cmd $x11vnc_prog;\n"
@ -5218,7 +5513,6 @@
" }\n"
" lappend cmd \"2>\"\n"
" lappend cmd \"/dev/null\"\n"
"# lappend cmd \"/tmp/nono\"\n"
"\n"
" if {0 || $debug} {\n"
" set str [join $cmd]\n"
@ -5234,7 +5528,6 @@
" stop_watch on\n"
" catch {set output [eval exec $cmd]}\n"
" stop_watch off\n"
"#puts stderr [exec cat /tmp/nono]\n"
"\n"
" menus_enable\n"
" if {$debug} {\n"
@ -5265,6 +5558,8 @@
" global x11vnc_xdisplay connected_to_x11vnc reply_xdisplay\n"
" global menu_var unset_str\n"
"\n"
" set db 0\n"
"\n"
" if {! $connected_to_x11vnc} {\n"
" if {[info exists menu_var(display)]} {\n"
" set d $menu_var(display)\n"
@ -5279,12 +5574,19 @@
" set rargs [list \"-Q\" \"ping\"]\n"
" set result [run_remote_cmd $rargs]\n"
"\n"
" if {$db} {puts \"try_connect: \\\"$result\\\"\"}\n"
"\n"
" if {[regexp {^ans=ping:} $result]} {\n"
" regsub {^ans=ping:} $result {} reply_xdisplay\n"
" set msg \"Connected to $reply_xdisplay\"\n"
" set_info $msg\n"
" append_text \"$msg\\n\"\n"
" set_connected yes\n"
"\n"
" setup_client_channel\n"
" setup_client_sock 1\n"
" setup_client_tail\n"
"\n"
" fetch_displays\n"
" return 1\n"
" } else {\n"
@ -5350,7 +5652,18 @@
"proc setup_client_tail {} {\n"
" global client_tail\n"
" if {$client_tail != \"\"} {\n"
" fileevent $client_tail readable read_client_info\n"
" fileevent $client_tail readable read_client_tail\n"
" }\n"
"}\n"
"\n"
"proc setup_client_sock {{enable 1}} {\n"
" global client_sock\n"
" if {$client_sock != \"\"} {\n"
" if {$enable} {\n"
" fileevent $client_sock readable read_client_sock\n"
" } else {\n"
" fileevent $client_sock readable \"\"\n"
" }\n"
" }\n"
"}\n"
"\n"
@ -5444,6 +5757,7 @@
"# main:\n"
"\n"
"global env x11vnc_prog x11vnc_cmdline x11vnc_xdisplay x11vnc_connect;\n"
"global x11vnc_xdisplay0\n"
"global x11vnc_client_file x11vnc_gui_geom x11vnc_started vnc_url\n"
"global x11vnc_gui_params\n"
"global x11vnc_auth_file x11vnc_connect_file beginner_mode simple_gui_created\n"
@ -5455,7 +5769,7 @@
"global connected_to_x11vnc\n"
"global delay_sleep extra_sleep extra_sleep_split\n"
"global cache_all_query_vars\n"
"global last_query_all_time query_all_freq client_tail client_tail_read\n"
"global last_query_all_time query_all_freq client_tail client_sock client_info_read\n"
"global icon_mode tray_embed tray_running icon_setpasswd icon_embed_id\n"
"global icon_noadvanced icon_minimal\n"
"global make_gui_count text_area_str\n"
@ -5479,7 +5793,8 @@
"set query_all_freq 120\n"
"set last_query_all_time [clock seconds]\n"
"set client_tail \"\"\n"
"set client_tail_read 0\n"
"set client_sock \"\"\n"
"set client_info_read 0\n"
"set make_gui_count 0\n"
"set text_area_str \"\"\n"
"set gui_argv0 $argv0\n"
@ -5545,6 +5860,7 @@
" if {$client_tail != \"\"} {\n"
" gets $client_tail tmp\n"
" if [eof $client_tail] {\n"
"puts \"eof $client_tail\"\n"
" clean_client_tail\n"
" set client_tail \"\"\n"
" }\n"
@ -5592,6 +5908,7 @@
" set x11vnc_started 1\n"
"}\n"
"\n"
"set x11vnc_xdisplay \"\"\n"
"if {[info exists env(X11VNC_XDISPLAY)]} {\n"
" set x11vnc_xdisplay $env(X11VNC_XDISPLAY);\n"
" set x11vnc_connect 1\n"
@ -5606,6 +5923,7 @@
"} else {\n"
" set x11vnc_xdisplay \":0\";\n"
"}\n"
"set x11vnc_xdisplay0 $x11vnc_xdisplay\n"
"\n"
"if {[info exists env(X11VNC_AUTH_FILE)]} {\n"
" set x11vnc_auth_file $env(X11VNC_AUTH_FILE)\n"

@ -2,7 +2,7 @@
.TH X11VNC "1" "July 2005" "x11vnc " "User Commands"
.SH NAME
x11vnc - allow VNC connections to real X11 displays
version: 0.7.3, lastmod: 2005-07-13
version: 0.7.3, lastmod: 2005-07-17
.SH SYNOPSIS
.B x11vnc
[OPTION]...

@ -167,6 +167,8 @@
* -DHARDWIRE_PASSWD=... hardwired passwords, quoting necessary.
* -DHARDWIRE_VIEWPASSWD=...
* -DNOPW=1 make -nopw the default (skip warning)
* -DPASSWD_REQUIRED=1 exit unless a password is supplied.
* -DPASSWD_UNLESS_NOPW=1 exit unless a password is supplied and no -nopw.
*
* -DWIREFRAME=0 to have -nowireframe as the default.
* -DWIREFRAME_COPYRECT=0 to have -nowirecopyrect as the default.
@ -199,6 +201,14 @@
#define NOPW 0
#endif
#ifndef PASSWD_REQUIRED
#define PASSWD_REQUIRED 0
#endif
#ifndef PASSWD_UNLESS_NOPW
#define PASSWD_UNLESS_NOPW 0
#endif
/*
* Beginning of support for small binary footprint build for embedded
* systems, PDA's etc. It currently just cuts out the low-hanging
@ -387,7 +397,7 @@ double xdamage_scheduled_mark = 0.0;
sraRegionPtr xdamage_scheduled_mark_region = NULL;
/* date +'lastmod: %Y-%m-%d' */
char lastmod[] = "0.7.3 lastmod: 2005-07-13";
char lastmod[] = "0.7.3 lastmod: 2005-07-17";
int hack_val = 0;
/* X display info */
@ -579,6 +589,7 @@ char *bitprint(unsigned int, int);
void blackout_tiles(void);
void solid_bg(int);
void check_connect_inputs(void);
void check_gui_inputs(void);
void check_padded_fb(void);
void clean_up_exit(int);
void clear_modifiers(int init);
@ -6758,6 +6769,8 @@ void read_vnc_connect_prop(void) {
;
} else if (strstr(vnc_connect_str, "qry=stop,quit,exit")) {
;
} else if (strstr(vnc_connect_str, "ack=") == vnc_connect_str) {
;
} else if (strstr(vnc_connect_str, "cmd=") &&
strstr(vnc_connect_str, "passwd")) {
rfbLog("read VNC_CONNECT: *\n");
@ -6780,7 +6793,8 @@ static void send_client_connect(void) {
char *str = client_connect;
if (strstr(str, "cmd=") == str || strstr(str, "qry=") == str) {
process_remote_cmd(client_connect, 0);
} else if (strstr(str, "ans=") || strstr(str, "aro=") == str) {
} else if (strstr(str, "ans=") == str
|| strstr(str, "aro=") == str) {
;
} else if (strstr(str, "ack=") == str) {
;
@ -6814,6 +6828,77 @@ void check_connect_inputs(void) {
send_client_connect();
}
void check_gui_inputs(void) {
int i, nmax = 0, n = 0, nfds;
int socks[ICON_MODE_SOCKS];
fd_set fds;
struct timeval tv;
char buf[VNC_CONNECT_MAX+1];
ssize_t nbytes;
for (i=0; i<ICON_MODE_SOCKS; i++) {
if (icon_mode_socks[i] >= 0) {
socks[n++] = i;
if (icon_mode_socks[i] > nmax) {
nmax = icon_mode_socks[i];
}
}
}
if (! n) {
return;
}
FD_ZERO(&fds);
for (i=0; i<n; i++) {
FD_SET(icon_mode_socks[socks[i]], &fds);
}
tv.tv_sec = 0;
tv.tv_usec = 0;
nfds = select(nmax+1, &fds, NULL, NULL, &tv);
if (nfds <= 0) {
return;
}
for (i=0; i<n; i++) {
int k, fd = icon_mode_socks[socks[i]];
char *p;
if (! FD_ISSET(fd, &fds)) {
continue;
}
for (k=0; k<=VNC_CONNECT_MAX; k++) {
buf[k] = '\0';
}
nbytes = read(fd, buf, VNC_CONNECT_MAX);
if (nbytes <= 0) {
close(fd);
icon_mode_socks[socks[i]] = -1;
continue;
}
p = strtok(buf, "\r\n");
while (p) {
if (strstr(p, "cmd=") == p ||
strstr(p, "qry=") == p) {
char *str = process_remote_cmd(p, 1);
if (! str) {
str = strdup("");
}
nbytes = write(fd, str, strlen(str));
write(fd, "\n", 1);
free(str);
if (nbytes < 0) {
close(fd);
icon_mode_socks[socks[i]] = -1;
break;
}
}
p = strtok(NULL, "\r\n");
}
}
}
/*
* libvncserver callback for when a new client connects
*/
@ -23991,8 +24076,8 @@ char gui_code[] = "";
#include "tkx11vnc.h"
#endif
void run_gui(char *gui_xdisplay, int connect_to_x11vnc, int simple_gui,
pid_t parent, char *gui_opts) {
void run_gui(char *gui_xdisplay, int connect_to_x11vnc, int start_x11vnc,
int simple_gui, pid_t parent, char *gui_opts) {
char *x11vnc_xdisplay = NULL;
char extra_path[] = ":/usr/local/bin:/usr/bin/X11:/usr/sfw/bin"
":/usr/X11R6/bin:/usr/openwin/bin:/usr/dt/bin";
@ -24145,7 +24230,7 @@ void run_gui(char *gui_xdisplay, int connect_to_x11vnc, int simple_gui,
if (gui_geometry) {
set_env("X11VNC_GUI_GEOM", gui_geometry);
}
if (connect_to_x11vnc) {
if (start_x11vnc) {
set_env("X11VNC_STARTED", "1");
}
if (icon_mode) {
@ -24416,8 +24501,8 @@ void do_gui(char *opts, int sleep) {
if (sleep > 0) {
usleep(sleep * 1000 * 1000);
}
run_gui(gui_xdisplay, connect_to_x11vnc, simple_gui,
parent, opts);
run_gui(gui_xdisplay, connect_to_x11vnc, start_x11vnc,
simple_gui, parent, opts);
exit(1);
}
#else
@ -24427,7 +24512,8 @@ void do_gui(char *opts, int sleep) {
#endif
}
if (!start_x11vnc) {
run_gui(gui_xdisplay, connect_to_x11vnc, simple_gui, 0, opts);
run_gui(gui_xdisplay, connect_to_x11vnc, start_x11vnc,
simple_gui, 0, opts);
exit(1);
}
if (old_xauth) {
@ -29715,6 +29801,7 @@ if (debug_scroll) fprintf(stderr, "watch_loop: LOOP-BACK: %d\n", ret);
check_autorepeat();
check_keycode_state();
check_connect_inputs();
check_gui_inputs();
check_padded_fb();
check_fixscreen();
check_xdamage_state();
@ -32273,6 +32360,175 @@ void xopen_display_fail_message(char *disp) {
fprintf(stderr, "See also: http://www.karlrunge.com/x11vnc/#faq\n");
}
void print_settings(int try_http, int bg, char *gui_str) {
fprintf(stderr, "\n");
fprintf(stderr, "Settings:\n");
fprintf(stderr, " display: %s\n", use_dpy ? use_dpy
: "null");
fprintf(stderr, " authfile: %s\n", auth_file ? auth_file
: "null");
fprintf(stderr, " subwin: 0x%lx\n", subwin);
fprintf(stderr, " -sid mode: %d\n", rootshift);
fprintf(stderr, " clip: %s\n", clip_str ? clip_str
: "null");
fprintf(stderr, " flashcmap: %d\n", flash_cmap);
fprintf(stderr, " shiftcmap: %d\n", shift_cmap);
fprintf(stderr, " force_idx: %d\n", force_indexed_color);
fprintf(stderr, " visual: %s\n", visual_str ? visual_str
: "null");
fprintf(stderr, " overlay: %d\n", overlay);
fprintf(stderr, " ovl_cursor: %d\n", overlay_cursor);
fprintf(stderr, " scaling: %d %.4f\n", scaling, scale_fac);
fprintf(stderr, " viewonly: %d\n", view_only);
fprintf(stderr, " shared: %d\n", shared);
fprintf(stderr, " conn_once: %d\n", connect_once);
fprintf(stderr, " timeout: %d\n", first_conn_timeout);
fprintf(stderr, " inetd: %d\n", inetd);
fprintf(stderr, " http: %d\n", try_http);
fprintf(stderr, " connect: %s\n", client_connect
? client_connect : "null");
fprintf(stderr, " connectfile %s\n", client_connect_file
? client_connect_file : "null");
fprintf(stderr, " vnc_conn: %d\n", vnc_connect);
fprintf(stderr, " allow: %s\n", allow_list ? allow_list
: "null");
fprintf(stderr, " input: %s\n", allowed_input_str
? allowed_input_str : "null");
fprintf(stderr, " passfile: %s\n", passwdfile ? passwdfile
: "null");
fprintf(stderr, " accept: %s\n", accept_cmd ? accept_cmd
: "null");
fprintf(stderr, " gone: %s\n", gone_cmd ? gone_cmd
: "null");
fprintf(stderr, " users: %s\n", users_list ? users_list
: "null");
fprintf(stderr, " using_shm: %d\n", using_shm);
fprintf(stderr, " flipbytes: %d\n", flip_byte_order);
fprintf(stderr, " onetile: %d\n", single_copytile);
fprintf(stderr, " solid: %s\n", solid_str
? solid_str : "null");
fprintf(stderr, " blackout: %s\n", blackout_str
? blackout_str : "null");
fprintf(stderr, " xinerama: %d\n", xinerama);
fprintf(stderr, " xtrap: %d\n", xtrap_input);
fprintf(stderr, " xrandr: %d\n", xrandr);
fprintf(stderr, " xrandrmode: %s\n", xrandr_mode ? xrandr_mode
: "null");
fprintf(stderr, " padgeom: %s\n", pad_geometry
? pad_geometry : "null");
fprintf(stderr, " logfile: %s\n", logfile ? logfile
: "null");
fprintf(stderr, " logappend: %d\n", logfile_append);
fprintf(stderr, " flag: %s\n", flagfile ? flagfile
: "null");
fprintf(stderr, " rc_file: \"%s\"\n", rc_rcfile ? rc_rcfile
: "null");
fprintf(stderr, " norc: %d\n", rc_norc);
fprintf(stderr, " dbg: %d\n", crash_debug);
fprintf(stderr, " bg: %d\n", bg);
fprintf(stderr, " mod_tweak: %d\n", use_modifier_tweak);
fprintf(stderr, " isolevel3: %d\n", use_iso_level3);
fprintf(stderr, " xkb: %d\n", use_xkb_modtweak);
fprintf(stderr, " skipkeys: %s\n",
skip_keycodes ? skip_keycodes : "null");
fprintf(stderr, " sloppykeys: %d\n", sloppy_keys);
fprintf(stderr, " skip_dups: %d\n", skip_duplicate_key_events);
fprintf(stderr, " addkeysyms: %d\n", add_keysyms);
fprintf(stderr, " xkbcompat: %d\n", xkbcompat);
fprintf(stderr, " clearmods: %d\n", clear_mods);
fprintf(stderr, " remap: %s\n", remap_file ? remap_file
: "null");
fprintf(stderr, " norepeat: %d\n", no_autorepeat);
fprintf(stderr, " norepeatcnt:%d\n", no_repeat_countdown);
fprintf(stderr, " nofb: %d\n", nofb);
fprintf(stderr, " watchbell: %d\n", watch_bell);
fprintf(stderr, " watchsel: %d\n", watch_selection);
fprintf(stderr, " watchprim: %d\n", watch_primary);
fprintf(stderr, " seldir: %s\n", sel_direction ?
sel_direction : "null");
fprintf(stderr, " cursor: %d\n", show_cursor);
fprintf(stderr, " multicurs: %d\n", show_multiple_cursors);
fprintf(stderr, " curs_mode: %s\n", multiple_cursors_mode
? multiple_cursors_mode : "null");
fprintf(stderr, " arrow: %d\n", alt_arrow);
fprintf(stderr, " xfixes: %d\n", use_xfixes);
fprintf(stderr, " alphacut: %d\n", alpha_threshold);
fprintf(stderr, " alphafrac: %.2f\n", alpha_frac);
fprintf(stderr, " alpharemove:%d\n", alpha_remove);
fprintf(stderr, " alphablend: %d\n", alpha_blend);
fprintf(stderr, " cursorshape:%d\n", cursor_shape_updates);
fprintf(stderr, " cursorpos: %d\n", cursor_pos_updates);
fprintf(stderr, " xwarpptr: %d\n", use_xwarppointer);
fprintf(stderr, " buttonmap: %s\n", pointer_remap
? pointer_remap : "null");
fprintf(stderr, " dragging: %d\n", show_dragging);
fprintf(stderr, " wireframe: %s\n", wireframe_str ?
wireframe_str : WIREFRAME_PARMS);
fprintf(stderr, " wirecopy: %s\n", wireframe_copyrect ?
wireframe_copyrect : wireframe_copyrect_default);
fprintf(stderr, " scrollcopy: %s\n", scroll_copyrect ?
scroll_copyrect : scroll_copyrect_default);
fprintf(stderr, " scr_area: %d\n", scrollcopyrect_min_area);
fprintf(stderr, " scr_skip: %s\n", scroll_skip_str ?
scroll_skip_str : scroll_skip_str0);
fprintf(stderr, " scr_inc: %s\n", scroll_good_str ?
scroll_good_str : scroll_good_str0);
fprintf(stderr, " scr_keys: %s\n", scroll_key_list_str ?
scroll_key_list_str : "null");
fprintf(stderr, " scr_term: %s\n", scroll_term_str ?
scroll_term_str : "null");
fprintf(stderr, " scr_keyrep: %s\n", max_keyrepeat_str ?
max_keyrepeat_str : "null");
fprintf(stderr, " scr_parms: %s\n", scroll_copyrect_str ?
scroll_copyrect_str : SCROLL_COPYRECT_PARMS);
fprintf(stderr, " fixscreen: %s\n", screen_fixup_str ?
screen_fixup_str : "null");
fprintf(stderr, " noxrecord: %d\n", noxrecord);
fprintf(stderr, " grabbuster: %d\n", grab_buster);
fprintf(stderr, " ptr_mode: %d\n", pointer_mode);
fprintf(stderr, " inputskip: %d\n", ui_skip);
fprintf(stderr, " speeds: %s\n", speeds_str
? speeds_str : "null");
fprintf(stderr, " wmdt: %s\n", wmdt_str
? wmdt_str : "null");
fprintf(stderr, " debug_ptr: %d\n", debug_pointer);
fprintf(stderr, " debug_key: %d\n", debug_keyboard);
fprintf(stderr, " defer: %d\n", defer_update);
fprintf(stderr, " waitms: %d\n", waitms);
fprintf(stderr, " wait_ui: %.2f\n", wait_ui);
fprintf(stderr, " nowait_bog: %d\n", !wait_bog);
fprintf(stderr, " readtimeout: %d\n", rfbMaxClientWait/1000);
fprintf(stderr, " take_naps: %d\n", take_naps);
fprintf(stderr, " sb: %d\n", screen_blank);
fprintf(stderr, " xdamage: %d\n", use_xdamage);
fprintf(stderr, " xd_area: %d\n", xdamage_max_area);
fprintf(stderr, " xd_mem: %.3f\n", xdamage_memory);
fprintf(stderr, " sigpipe: %s\n", sigpipe
? sigpipe : "null");
fprintf(stderr, " threads: %d\n", use_threads);
fprintf(stderr, " fs_frac: %.2f\n", fs_frac);
fprintf(stderr, " gaps_fill: %d\n", gaps_fill);
fprintf(stderr, " grow_fill: %d\n", grow_fill);
fprintf(stderr, " tile_fuzz: %d\n", tile_fuzz);
fprintf(stderr, " snapfb: %d\n", use_snapfb);
fprintf(stderr, " rawfb: %s\n", raw_fb_str
? raw_fb_str : "null");
fprintf(stderr, " pipeinput: %s\n", pipeinput_str
? pipeinput_str : "null");
fprintf(stderr, " gui: %d\n", launch_gui);
fprintf(stderr, " gui_mode: %s\n", gui_str
? gui_str : "null");
fprintf(stderr, " noremote: %d\n", !accept_remote_cmds);
fprintf(stderr, " unsafe: %d\n", !safe_remote_only);
fprintf(stderr, " privremote: %d\n", priv_remote);
fprintf(stderr, " safer: %d\n", more_safe);
fprintf(stderr, " nocmds: %d\n", no_external_cmds);
fprintf(stderr, " deny_all: %d\n", deny_all);
fprintf(stderr, "\n");
rfbLog("x11vnc version: %s\n", lastmod);
}
void nopassword_warning_msg(int gotloc) {
char str1[] =
@ -32308,8 +32564,15 @@ void nopassword_warning_msg(int gotloc) {
"#@ Make sure any -rfbauth and -passwdfile password files @#\n"
"#@ cannot be read by untrusted users. @#\n"
"#@ @#\n"
"#@ Even with a password, the subsequent VNC traffic is @#\n"
"#@ sent in the clear. Consider tunnelling via ssh(1): @#\n"
"#@ @#\n"
"#@ http://www.karlrunge.com/x11vnc/#tunnelling @#\n"
"#@ @#\n"
"#@ Please Read the documention for more info about @#\n"
"#@ passwords, security, and encryption. @#\n"
"#@ @#\n"
"#@ http://www.karlrunge.com/x11vnc/#faq-passwd @#\n"
;
char str3[] =
"#@ @#\n"
@ -32333,15 +32596,18 @@ void nopassword_warning_msg(int gotloc) {
fprintf(stderr, "%s", str1);
fflush(stderr);
#if !PASSWD_REQUIRED
usleep(2000 * 1000);
#endif
fprintf(stderr, "%s", str2);
if (gotloc) {
fprintf(stderr, "%s", str3);
}
fprintf(stderr, "%s", str4);
fflush(stderr);
#if !PASSWD_REQUIRED
usleep(500 * 1000);
#endif
}
int main(int argc, char* argv[]) {
@ -32355,7 +32621,6 @@ int main(int argc, char* argv[]) {
char *gui_str = NULL;
int pw_loc = -1, got_passwd = 0, got_rfbauth = 0, nopw = NOPW;
int got_viewpasswd = 0, got_localhost = 0, got_passwdfile = 0;
int running_without_passwd = 0;
int vpw_loc = -1;
int dt = 0, bg = 0;
int got_rfbwait = 0;
@ -33018,16 +33283,16 @@ int main(int argc, char* argv[]) {
}
}
}
if (!got_passwd && !got_rfbauth && !got_passwdfile && !nopw) {
running_without_passwd = 1;
}
if (launch_gui && (query_cmd || remote_cmd)) {
launch_gui = 0;
gui_str = NULL;
}
if (more_safe) {
launch_gui = 0;
}
if (launch_gui) {
int sleep = 0;
if (running_without_passwd && !quiet) {
if (!got_passwd && !got_rfbauth && !got_passwdfile && !nopw) {
sleep = 3;
}
do_gui(gui_str, sleep);
@ -33207,8 +33472,23 @@ int main(int argc, char* argv[]) {
exit(1);
}
if (!got_passwd && !got_rfbauth && !got_passwdfile && !nopw) {
nopassword_warning_msg(got_localhost);
if (!got_passwd && !got_rfbauth && !got_passwdfile) {
char message[] =
"-rfbauth, -passwdfile, or -passwd password required.";
if (! nopw) {
nopassword_warning_msg(got_localhost);
}
#if PASSWD_REQUIRED
rfbLog("%s\n", message);
exit(1);
#endif
#if PASSWD_UNLESS_NOPW
if (! nopw) {
rfbLog("%s\n", message);
exit(1);
}
#endif
if (0) message[0] = '\0';
}
if (more_safe) {
@ -33340,171 +33620,7 @@ int main(int argc, char* argv[]) {
initialize_crash_handler();
if (! quiet) {
fprintf(stderr, "\n");
fprintf(stderr, "Settings:\n");
fprintf(stderr, " display: %s\n", use_dpy ? use_dpy
: "null");
fprintf(stderr, " authfile: %s\n", auth_file ? auth_file
: "null");
fprintf(stderr, " subwin: 0x%lx\n", subwin);
fprintf(stderr, " -sid mode: %d\n", rootshift);
fprintf(stderr, " clip: %s\n", clip_str ? clip_str
: "null");
fprintf(stderr, " flashcmap: %d\n", flash_cmap);
fprintf(stderr, " shiftcmap: %d\n", shift_cmap);
fprintf(stderr, " force_idx: %d\n", force_indexed_color);
fprintf(stderr, " visual: %s\n", visual_str ? visual_str
: "null");
fprintf(stderr, " overlay: %d\n", overlay);
fprintf(stderr, " ovl_cursor: %d\n", overlay_cursor);
fprintf(stderr, " scaling: %d %.5f\n", scaling, scale_fac);
fprintf(stderr, " viewonly: %d\n", view_only);
fprintf(stderr, " shared: %d\n", shared);
fprintf(stderr, " conn_once: %d\n", connect_once);
fprintf(stderr, " timeout: %d\n", first_conn_timeout);
fprintf(stderr, " inetd: %d\n", inetd);
fprintf(stderr, " http: %d\n", try_http);
fprintf(stderr, " connect: %s\n", client_connect
? client_connect : "null");
fprintf(stderr, " connectfile %s\n", client_connect_file
? client_connect_file : "null");
fprintf(stderr, " vnc_conn: %d\n", vnc_connect);
fprintf(stderr, " allow: %s\n", allow_list ? allow_list
: "null");
fprintf(stderr, " input: %s\n", allowed_input_str
? allowed_input_str : "null");
fprintf(stderr, " passfile: %s\n", passwdfile ? passwdfile
: "null");
fprintf(stderr, " accept: %s\n", accept_cmd ? accept_cmd
: "null");
fprintf(stderr, " gone: %s\n", gone_cmd ? gone_cmd
: "null");
fprintf(stderr, " users: %s\n", users_list ? users_list
: "null");
fprintf(stderr, " using_shm: %d\n", using_shm);
fprintf(stderr, " flipbytes: %d\n", flip_byte_order);
fprintf(stderr, " onetile: %d\n", single_copytile);
fprintf(stderr, " solid: %s\n", solid_str
? solid_str : "null");
fprintf(stderr, " blackout: %s\n", blackout_str
? blackout_str : "null");
fprintf(stderr, " xinerama: %d\n", xinerama);
fprintf(stderr, " xtrap: %d\n", xtrap_input);
fprintf(stderr, " xrandr: %d\n", xrandr);
fprintf(stderr, " xrandrmode: %s\n", xrandr_mode ? xrandr_mode
: "null");
fprintf(stderr, " padgeom: %s\n", pad_geometry
? pad_geometry : "null");
fprintf(stderr, " logfile: %s\n", logfile ? logfile
: "null");
fprintf(stderr, " logappend: %d\n", logfile_append);
fprintf(stderr, " flag: %s\n", flagfile ? flagfile
: "null");
fprintf(stderr, " rc_file: \"%s\"\n", rc_rcfile ? rc_rcfile
: "null");
fprintf(stderr, " norc: %d\n", rc_norc);
fprintf(stderr, " dbg: %d\n", crash_debug);
fprintf(stderr, " bg: %d\n", bg);
fprintf(stderr, " mod_tweak: %d\n", use_modifier_tweak);
fprintf(stderr, " isolevel3: %d\n", use_iso_level3);
fprintf(stderr, " xkb: %d\n", use_xkb_modtweak);
fprintf(stderr, " skipkeys: %s\n",
skip_keycodes ? skip_keycodes : "null");
fprintf(stderr, " sloppykeys: %d\n", sloppy_keys);
fprintf(stderr, " skip_dups: %d\n", skip_duplicate_key_events);
fprintf(stderr, " addkeysyms: %d\n", add_keysyms);
fprintf(stderr, " xkbcompat: %d\n", xkbcompat);
fprintf(stderr, " clearmods: %d\n", clear_mods);
fprintf(stderr, " remap: %s\n", remap_file ? remap_file
: "null");
fprintf(stderr, " norepeat: %d\n", no_autorepeat);
fprintf(stderr, " norepeatcnt:%d\n", no_repeat_countdown);
fprintf(stderr, " nofb: %d\n", nofb);
fprintf(stderr, " watchbell: %d\n", watch_bell);
fprintf(stderr, " watchsel: %d\n", watch_selection);
fprintf(stderr, " watchprim: %d\n", watch_primary);
fprintf(stderr, " seldir: %s\n", sel_direction ?
sel_direction : "null");
fprintf(stderr, " cursor: %d\n", show_cursor);
fprintf(stderr, " multicurs: %d\n", show_multiple_cursors);
fprintf(stderr, " curs_mode: %s\n", multiple_cursors_mode
? multiple_cursors_mode : "null");
fprintf(stderr, " arrow: %d\n", alt_arrow);
fprintf(stderr, " xfixes: %d\n", use_xfixes);
fprintf(stderr, " alphacut: %d\n", alpha_threshold);
fprintf(stderr, " alphafrac: %.2f\n", alpha_frac);
fprintf(stderr, " alpharemove:%d\n", alpha_remove);
fprintf(stderr, " alphablend: %d\n", alpha_blend);
fprintf(stderr, " cursorshape:%d\n", cursor_shape_updates);
fprintf(stderr, " cursorpos: %d\n", cursor_pos_updates);
fprintf(stderr, " xwarpptr: %d\n", use_xwarppointer);
fprintf(stderr, " buttonmap: %s\n", pointer_remap
? pointer_remap : "null");
fprintf(stderr, " dragging: %d\n", show_dragging);
fprintf(stderr, " wireframe: %s\n", wireframe_str ?
wireframe_str : WIREFRAME_PARMS);
fprintf(stderr, " wirecopy: %s\n", wireframe_copyrect ?
wireframe_copyrect : wireframe_copyrect_default);
fprintf(stderr, " scrollcopy: %s\n", scroll_copyrect ?
scroll_copyrect : scroll_copyrect_default);
fprintf(stderr, " scr_area: %d\n", scrollcopyrect_min_area);
fprintf(stderr, " scr_skip: %s\n", scroll_skip_str ?
scroll_skip_str : scroll_skip_str0);
fprintf(stderr, " scr_inc: %s\n", scroll_good_str ?
scroll_good_str : scroll_good_str0);
fprintf(stderr, " scr_keys: %s\n", scroll_key_list_str ?
scroll_key_list_str : "null");
fprintf(stderr, " scr_term: %s\n", scroll_term_str ?
scroll_term_str : "null");
fprintf(stderr, " scr_keyrep: %s\n", max_keyrepeat_str ?
max_keyrepeat_str : "null");
fprintf(stderr, " scr_parms: %s\n", scroll_copyrect_str ?
scroll_copyrect_str : SCROLL_COPYRECT_PARMS);
fprintf(stderr, " fixscreen: %s\n", screen_fixup_str ?
screen_fixup_str : "null");
fprintf(stderr, " noxrecord: %d\n", noxrecord);
fprintf(stderr, " grabbuster: %d\n", grab_buster);
fprintf(stderr, " ptr_mode: %d\n", pointer_mode);
fprintf(stderr, " inputskip: %d\n", ui_skip);
fprintf(stderr, " speeds: %s\n", speeds_str
? speeds_str : "null");
fprintf(stderr, " wmdt: %s\n", wmdt_str
? wmdt_str : "null");
fprintf(stderr, " debug_ptr: %d\n", debug_pointer);
fprintf(stderr, " debug_key: %d\n", debug_keyboard);
fprintf(stderr, " defer: %d\n", defer_update);
fprintf(stderr, " waitms: %d\n", waitms);
fprintf(stderr, " wait_ui: %.2f\n", wait_ui);
fprintf(stderr, " nowait_bog: %d\n", !wait_bog);
fprintf(stderr, " readtimeout: %d\n", rfbMaxClientWait/1000);
fprintf(stderr, " take_naps: %d\n", take_naps);
fprintf(stderr, " sb: %d\n", screen_blank);
fprintf(stderr, " xdamage: %d\n", use_xdamage);
fprintf(stderr, " xd_area: %d\n", xdamage_max_area);
fprintf(stderr, " xd_mem: %.3f\n", xdamage_memory);
fprintf(stderr, " sigpipe: %s\n", sigpipe
? sigpipe : "null");
fprintf(stderr, " threads: %d\n", use_threads);
fprintf(stderr, " fs_frac: %.2f\n", fs_frac);
fprintf(stderr, " gaps_fill: %d\n", gaps_fill);
fprintf(stderr, " grow_fill: %d\n", grow_fill);
fprintf(stderr, " tile_fuzz: %d\n", tile_fuzz);
fprintf(stderr, " snapfb: %d\n", use_snapfb);
fprintf(stderr, " rawfb: %s\n", raw_fb_str
? raw_fb_str : "null");
fprintf(stderr, " pipeinput: %s\n", pipeinput_str
? pipeinput_str : "null");
fprintf(stderr, " gui: %d\n", launch_gui);
fprintf(stderr, " gui_mode: %s\n", gui_str
? gui_str : "null");
fprintf(stderr, " noremote: %d\n", !accept_remote_cmds);
fprintf(stderr, " unsafe: %d\n", !safe_remote_only);
fprintf(stderr, " privremote: %d\n", priv_remote);
fprintf(stderr, " safer: %d\n", more_safe);
fprintf(stderr, " nocmds: %d\n", no_external_cmds);
fprintf(stderr, " deny_all: %d\n", deny_all);
fprintf(stderr, "\n");
rfbLog("x11vnc version: %s\n", lastmod);
print_settings(try_http, bg, gui_str);
} else {
rfbLogEnable(0);
}

Loading…
Cancel
Save