4 # Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5 # Use is subject to license terms.
10 #pragma ident "%Z%%M% %I% %E% SMI"
12 TEXTDOMAIN
=SUNW_OST_OSCMD
16 # returns a list of principals in the keytab
17 # sorted and uniquified
19 klist
-k $keytab |
tail +4 |
awk '{print $2}' |
sort |
uniq
23 if [ x
$command != x
] ; then
24 cmd_error
`gettext "Only one command can be specified"`
31 #interactive_prompt prompt princ
32 # If in interactive mode return true if the principal should be acted on
33 # otherwise return true all the time
35 # SUNW14resync: If in interactive mode the default is now to return false
36 # i.e. if in interactive mode unless the user types "Yes" or
37 # "yes" false will be returned.
39 interactive_prompt
() {
40 if [ $interactive = 0 ] ; then
43 PROMPT
=`gettext "%s for %s? [yes no] "`
46 printf "$PROMPT" "$1" "$2"
61 USAGE
=`gettext "Usage: $0 [-i] [-f file] list|change|delete|delold"`
69 for princ
in $princs; do
70 ACTION
=`gettext "Change key"`
71 if interactive_prompt
"$ACTION" $princ; then
72 kadmin
-k -t $keytab -p $princ -q "ktadd -k $keytab $princ"
79 for princ
in $princs; do
80 ACTION
=`gettext "Delete old keys"`
81 if interactive_prompt
"$ACTION" $princ; then
82 kadmin
-k -t $keytab -p $princ -q "ktrem -k $keytab $princ old"
90 for princ
in $princs; do
91 ACTION
=`gettext "Delete all keys"`
92 if interactive_prompt
"$ACTION" $princ; then
93 kadmin
-p $princ -k -t $keytab -q "ktrem -k $keytab $princ all"
99 keytab
=/etc
/krb
5/krb5.keytab
102 CHANGE
=`gettext "change"`
103 DELOLD
=`gettext "delold"`
104 DELETE
=`gettext "delete"`
105 LIST
=`gettext "list"`
107 while [ $# -gt 0 ] ; do
118 ${CHANGE}|${DELOLD}|${DELETE}|${LIST})
122 ILLEGAL
=`gettext "Illegal option: "`
123 cmd_error
$ILLEGAL $opt