Revision 20276,
1.3 KB
checked in by zacheiss, 21 years ago
(diff) |
Add ktconvert, a script for converting /etc/athena/srvtab to
/etc/krb5.keytab, and its build system (such as it is).
|
-
Property svn:executable set to
*
|
Line | |
---|
1 | #!/bin/sh |
---|
2 | # $Id: ktconvert.sh,v 1.1 2004-03-14 22:39:24 zacheiss Exp $ |
---|
3 | # |
---|
4 | # Convert /etc/athena/srvtab to /etc/krb5.keytab, removing the srvtab |
---|
5 | # when we're done. |
---|
6 | |
---|
7 | usage="Usage: ktconvert [ -r ] |
---|
8 | -r indicates /etc/krb5.keytab should be converted back into /etc/athena/srvtab." |
---|
9 | |
---|
10 | fromfile=/etc/athena/srvtab |
---|
11 | tofile=/etc/krb5.keytab |
---|
12 | readop=rst |
---|
13 | writeop=wkt |
---|
14 | |
---|
15 | while getopts r opt; do |
---|
16 | case "$opt" in |
---|
17 | r) |
---|
18 | fromfile=/etc/krb5.keytab |
---|
19 | tofile=/etc/athena/srvtab |
---|
20 | readop=rkt |
---|
21 | writeop=wst |
---|
22 | ;; |
---|
23 | \?) |
---|
24 | echo "$usage" >&2 |
---|
25 | exit 1 |
---|
26 | ;; |
---|
27 | esac |
---|
28 | done |
---|
29 | |
---|
30 | case `id` in |
---|
31 | "uid=0("*) |
---|
32 | ;; |
---|
33 | *) |
---|
34 | echo "You are not root. This script must be run as root." |
---|
35 | exit 1 |
---|
36 | ;; |
---|
37 | esac |
---|
38 | |
---|
39 | if [ ! -f $fromfile ]; then |
---|
40 | echo "$fromfile does not exist." |
---|
41 | exit 1 |
---|
42 | fi |
---|
43 | |
---|
44 | if [ -f $tofile ]; then |
---|
45 | echo "$tofile already exists." |
---|
46 | exit 1 |
---|
47 | fi |
---|
48 | |
---|
49 | # We redirect stderr below because libreadline spews warnings |
---|
50 | # we don't care about. |
---|
51 | /usr/athena/etc/ktutil <<EOF >/dev/null 2>&1 |
---|
52 | $readop $fromfile |
---|
53 | $writeop $tofile |
---|
54 | quit |
---|
55 | EOF |
---|
56 | |
---|
57 | if [ $? != 0 ]; then |
---|
58 | echo "Failed to run ktutil." |
---|
59 | exit 1 |
---|
60 | fi |
---|
61 | |
---|
62 | # Ensure file we're removing is writable so saferm will remove it. |
---|
63 | chmod 600 $fromfile |
---|
64 | /bin/athena/saferm -z $fromfile |
---|
65 | |
---|
66 | if [ $? != 0 ]; then |
---|
67 | echo "saferm failed to remove $fromfile." |
---|
68 | exit 1 |
---|
69 | fi |
---|
70 | |
---|
71 | echo "Converted $fromfile to $tofile." |
---|
72 | exit 0 |
---|
Note: See
TracBrowser
for help on using the repository browser.