aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRuss Allbery <rra@stanford.edu>2007-10-05 20:34:30 +0000
committerRuss Allbery <rra@stanford.edu>2007-10-05 20:34:30 +0000
commit64cae8e20ec8756a4c8503466a8754cecf417aa6 (patch)
tree4f34a6f19df1974e2a223e55a67d20707e316557 /tests
parentdbd33500b645f9caaa6dbb7d18a3f4932b53847a (diff)
Fix the keytab attribute handling to call getattr and setattr instead of
just attr to match the actual API.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/data/cmd-fake65
1 files changed, 43 insertions, 22 deletions
diff --git a/tests/data/cmd-fake b/tests/data/cmd-fake
index e363651..7cde65e 100755
--- a/tests/data/cmd-fake
+++ b/tests/data/cmd-fake
@@ -7,12 +7,35 @@
command="$1"
shift
type="$1"
-if [ "$1" != "keytab" ] ; then
- echo "Unknown object type $1" >&2
+shift
+if [ "$type" != "keytab" ] ; then
+ echo "Unknown object type $type" >&2
exit 1
fi
-shift
-if [ "$command" = "attr" ] ; then
+
+case "$command" in
+getattr)
+ if [ -n "$3" ] ; then
+ echo "Too many arguments" >&2
+ exit 1
+ fi
+ if [ "$2" != sync ] ; then
+ echo "Unknown attribute $2" >&2
+ exit 1
+ fi
+ case "$1" in
+ service/fake-srvtab)
+ if [ -f sync-kaserver ] ; then
+ echo "kaserver"
+ fi
+ ;;
+ *)
+ echo "Looking at sync attribute of wrong keytab" >&2
+ exit 1
+ ;;
+ esac
+ ;;
+setattr)
if [ -n "$4" ] ; then
echo "Too many arguments" >&2
exit 1
@@ -21,27 +44,13 @@ if [ "$command" = "attr" ] ; then
echo "Unknown attribute $2" >&2
exit 1
fi
-fi
-if [ "$command" != "attr" ] && [ -n "$2" ] ; then
- echo "Too many arguments" >&2
- exit 1
-fi
-
-case "$command" in
-attr)
case "$1" in
service/fake-srvtab)
- if [ -n "$3" ] ; then
- if [ "$3" != "kaserver" ] ; then
- echo "Invalid attribute value $3" >&2
- exit 1
- fi
- touch sync-kaserver
- else
- if [ -f sync-kaserver ] ; then
- echo "kaserver"
- fi
+ if [ "$3" != "kaserver" ] ; then
+ echo "Invalid attribute value $3" >&2
+ exit 1
fi
+ touch sync-kaserver
;;
*)
echo "Looking at sync attribute of wrong keytab" >&2
@@ -50,6 +59,10 @@ attr)
esac
;;
get)
+ if [ -n "$2" ] ; then
+ echo "Too many arguments" >&2
+ exit 1
+ fi
case "$1" in
service/fake-test)
cat data/fake-data
@@ -66,6 +79,10 @@ get)
esac
;;
show)
+ if [ -n "$2" ] ; then
+ echo "Too many arguments" >&2
+ exit 1
+ fi
if [ "$1" = "service/fake-test" ] ; then
echo "Some stuff about $1"
exit 0
@@ -75,6 +92,10 @@ show)
fi
;;
expires)
+ if [ -n "$2" ] ; then
+ echo "Too many arguments" >&2
+ exit 1
+ fi
echo "Expiration date of $1"
exit 0
;;