11d8fe861SBrian Somers#! /usr/local/bin/wish8.0 -f 21d8fe861SBrian Somers# 31d8fe861SBrian Somers# Copyright (c) 1999 Brian Somers <brian@Awfulhak.org> 41d8fe861SBrian Somers# All rights reserved. 51d8fe861SBrian Somers# 61d8fe861SBrian Somers# Redistribution and use in source and binary forms, with or without 71d8fe861SBrian Somers# modification, are permitted provided that the following conditions 81d8fe861SBrian Somers# are met: 91d8fe861SBrian Somers# 1. Redistributions of source code must retain the above copyright 101d8fe861SBrian Somers# notice, this list of conditions and the following disclaimer. 111d8fe861SBrian Somers# 2. Redistributions in binary form must reproduce the above copyright 121d8fe861SBrian Somers# notice, this list of conditions and the following disclaimer in the 131d8fe861SBrian Somers# documentation and/or other materials provided with the distribution. 141d8fe861SBrian Somers# 151d8fe861SBrian Somers# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 161d8fe861SBrian Somers# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 171d8fe861SBrian Somers# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 181d8fe861SBrian Somers# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 191d8fe861SBrian Somers# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 201d8fe861SBrian Somers# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 211d8fe861SBrian Somers# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 221d8fe861SBrian Somers# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 231d8fe861SBrian Somers# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 241d8fe861SBrian Somers# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 251d8fe861SBrian Somers# SUCH DAMAGE. 261d8fe861SBrian Somers# 271d8fe861SBrian Somers 281d8fe861SBrian Somers# 291d8fe861SBrian Somers# Display a window to request a users password, expecting a login name 301d8fe861SBrian Somers# as an argument and outputting the password to stdout. 311d8fe861SBrian Somers# 321d8fe861SBrian Somers 331d8fe861SBrian Somersset pwidth 11; # Prompt field width 341d8fe861SBrian Somersset vwidth 20; # Value field width 351d8fe861SBrian Somersset fxpad 7; # Value field width 361d8fe861SBrian Somersset fypad 3; # Value field width 371d8fe861SBrian Somers 381d8fe861SBrian Somerswm title . "PPP Login"; 391d8fe861SBrian Somers 401d8fe861SBrian Somers# Dump our password to stdout and exit 411d8fe861SBrian Somersproc done {} { 421d8fe861SBrian Somers puts [.p.value get]; 431d8fe861SBrian Somers exit 0; 441d8fe861SBrian Somers} 451d8fe861SBrian Somers 461d8fe861SBrian Somersframe .l; 471d8fe861SBrian Somerstext .l.prompt -width $pwidth -height 1 -relief flat; 481d8fe861SBrian Somers .l.prompt insert 1.0 "Login:"; 491d8fe861SBrian Somerspack .l.prompt -side left; 501d8fe861SBrian Somers .l.prompt configure -state disabled; 511d8fe861SBrian Somerstext .l.value -width $vwidth -height 1; 521d8fe861SBrian Somers .l.value insert 1.0 $argv; 531d8fe861SBrian Somerspack .l.value -side right; 541d8fe861SBrian Somers .l.value configure -state disabled; 551d8fe861SBrian Somerspack .l -side top -padx $fxpad -pady $fypad; 561d8fe861SBrian Somers 571d8fe861SBrian Somersframe .p; 581d8fe861SBrian Somerstext .p.prompt -width $pwidth -height 1 -relief flat; 591d8fe861SBrian Somers .p.prompt insert 1.0 "Password:"; 601d8fe861SBrian Somerspack .p.prompt -side left; 611d8fe861SBrian Somers .p.prompt configure -state disabled; 621d8fe861SBrian Somersentry .p.value -show "*" -width $vwidth; 631d8fe861SBrian Somerspack .p.value -side right; 641d8fe861SBrian Somersbind .p.value <Return> {done}; 651d8fe861SBrian Somersfocus .p.value; 661d8fe861SBrian Somerspack .p -side top -padx $fxpad -pady $fypad; 671d8fe861SBrian Somers 681d8fe861SBrian Somersframe .b; 691d8fe861SBrian Somersbutton .b.ok -default active -text "Ok" -takefocus 0 -command {done}; 701d8fe861SBrian Somerspack .b.ok -side left; 711d8fe861SBrian Somersbutton .b.cancel -default normal -text "Cancel" -takefocus 0 -command {exit 1}; 721d8fe861SBrian Somerspack .b.cancel -side right; 731d8fe861SBrian Somerspack .b -side top -padx $fxpad -pady $fypad; 74