You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.3 KiB
67 lines
1.3 KiB
16 years ago
|
#!/bin/sh
|
||
|
# Tcl ignores the next line -*- tcl -*- \
|
||
|
exec wish "$0" -- "$@"
|
||
|
|
||
|
# This is a trivial implementation of an SSH_ASKPASS handler.
|
||
|
# Git-gui uses this script if none are already configured.
|
||
|
|
||
15 years ago
|
package require Tk
|
||
|
|
||
16 years ago
|
set answer {}
|
||
|
set yesno 0
|
||
|
set rc 255
|
||
|
|
||
|
if {$argc < 1} {
|
||
|
set prompt "Enter your OpenSSH passphrase:"
|
||
|
} else {
|
||
|
set prompt [join $argv " "]
|
||
|
if {[regexp -nocase {\(yes\/no\)\?\s*$} $prompt]} {
|
||
|
set yesno 1
|
||
|
}
|
||
|
}
|
||
|
|
||
|
message .m -text $prompt -justify center -aspect 4000
|
||
|
pack .m -side top -fill x -padx 20 -pady 20 -expand 1
|
||
|
|
||
|
entry .e -textvariable answer -width 50
|
||
|
pack .e -side top -fill x -padx 10 -pady 10
|
||
|
|
||
|
if {!$yesno} {
|
||
|
.e configure -show "*"
|
||
|
}
|
||
|
|
||
|
frame .b
|
||
|
button .b.ok -text OK -command finish
|
||
15 years ago
|
button .b.cancel -text Cancel -command cancel
|
||
16 years ago
|
|
||
|
pack .b.ok -side left -expand 1
|
||
|
pack .b.cancel -side right -expand 1
|
||
|
pack .b -side bottom -fill x -padx 10 -pady 10
|
||
|
|
||
|
bind . <Visibility> {focus -force .e}
|
||
15 years ago
|
bind . <Key-Return> [list .b.ok invoke]
|
||
|
bind . <Key-Escape> [list .b.cancel invoke]
|
||
|
bind . <Destroy> {set rc $rc}
|
||
|
|
||
|
proc cancel {} {
|
||
|
set ::rc 255
|
||
|
}
|
||
16 years ago
|
|
||
|
proc finish {} {
|
||
|
if {$::yesno} {
|
||
|
if {$::answer ne "yes" && $::answer ne "no"} {
|
||
|
tk_messageBox -icon error -title "Error" -type ok \
|
||
|
-message "Only 'yes' or 'no' input allowed."
|
||
|
return
|
||
|
}
|
||
|
}
|
||
|
|
||
|
puts $::answer
|
||
15 years ago
|
set ::rc 0
|
||
16 years ago
|
}
|
||
|
|
||
|
wm title . "OpenSSH"
|
||
|
tk::PlaceWindow .
|
||
15 years ago
|
vwait rc
|
||
|
exit $rc
|