Debian Codegraph @

bin/mew-pinentry.in

raw
1 #!/bin/sh
2 #
3 # mew-pinentry:: a simple pinentry
4 #
5 # Author: Kazu Yamamoto <[email protected]>
6 # Author: Tadaaki Nagao <[email protected]>
7 # Created: Jul 24, 2006
8 # Revised: May 15, 2007
9
10 PROMPT="Enter passphrase:"
11 TTY=`tty`
12
13 echo "OK"
14 while read cmd arg; do
15 case $cmd in
16 "OPTION")
17 key=${arg%%=*}
18 val=${arg#*=}
19 if [ "X$key" = "Xttyname" ]; then
20 TTY=$val
21 fi
22 ;;
23 # "SETPROMPT")
24 # PROMPT=$arg
25 # ;;
26 "GETPIN")
27 echo @ECHO_N@ "$PROMPT @ECHO_C@" > $TTY
28 stty -echo < $TTY
29 read passwd < $TTY
30 stty echo < $TTY
31 echo "" > $TTY
32 echo "D $passwd"
33 ;;
34 "BYE")
35 # echo "OK"
36 exit 0
37 ;;
38 "SETERROR")
39 echo $arg > $TTY
40 ;;
41 esac
42 echo "OK"
43 done
44 exit 0
45
46 # Copyright (C) 2006-2007 Mew developing team.
47 # All rights reserved.
48 #
49 # Redistribution and use in source and binary forms, with or without
50 # modification, are permitted provided that the following conditions
51 # are met:
52 #
53 # 1. Redistributions of source code must retain the above copyright
54 # notice, this list of conditions and the following disclaimer.
55 # 2. Redistributions in binary form must reproduce the above copyright
56 # notice, this list of conditions and the following disclaimer in the
57 # documentation and/or other materials provided with the distribution.
58 # 3. Neither the name of the team nor the names of its contributors
59 # may be used to endorse or promote products derived from this software
60 # without specific prior written permission.
61 #
62 # THIS SOFTWARE IS PROVIDED BY THE TEAM AND CONTRIBUTORS ``AS IS'' AND
63 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
64 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
65 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE TEAM OR CONTRIBUTORS BE
66 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
67 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
68 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
69 # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
70 # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
71 # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
72 # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.