From f0bde61f5ecfc6a58a2c0ec0ccadbdd1332b64f8 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Thu, 7 Feb 2008 23:33:23 +0000 Subject: Add new exists and autocreate wallet server interfaces. The first states whether a given object exists and the second attempts to create the object using the default owner rules. Remove default owner handling from the create interface, which is now for administrators only. Remove server-side auto-creation of objects on get or store and instead have the client check for object existence and call autocreate if necessary. This removes confusion between default ACLs and administrative object creation for users who are also on the ADMIN ACL. --- tests/client/basic-t.in | 12 +++++++++--- tests/data/cmd-fake | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/client/basic-t.in b/tests/client/basic-t.in index 807d9e9..67d7a3a 100644 --- a/tests/client/basic-t.in +++ b/tests/client/basic-t.in @@ -12,7 +12,7 @@ . "@abs_top_srcdir@/tests/libtest.sh" # Print the number of tests. -total=30 +total=31 count=1 echo "$total" @@ -78,7 +78,8 @@ if [ -z "$krb5conf" ] ; then fi # Make sure everything's clean. -rm -f output output.bak keytab keytab.bak srvtab srvtab.bak sync-kaserver +rm -f output output.bak keytab keytab.bak srvtab srvtab.bak sync-kaserver \ + autocreated # Now, we can finally run our tests. First, basic operations. runsuccess "" "$wallet" -k "$principal" -p 14373 -s localhost -c fake-wallet \ @@ -93,6 +94,11 @@ if [ -f output.bak ] || [ -f output.new ] ; then else printcount "ok" fi +if [ -f autocreated ] ; then + printcount "ok" +else + printcount "not ok" +fi runsuccess "" "$wallet" -k "$principal" -p 14373 -s localhost -c fake-wallet \ -f output get file fake-test if cmp output data/fake-data >/dev/null 2>&1 ; then @@ -220,7 +226,7 @@ runsuccess "Expiration date of keytab service/fake-test" \ # Clean up. KRB5_CONFIG= rm krb5.conf -rm -f data/test.cache +rm -f autocreated data/test.cache if [ -f data/pid ] ; then kill `cat data/pid` rm -f data/pid diff --git a/tests/data/cmd-fake b/tests/data/cmd-fake index a8d979a..17bbb90 100755 --- a/tests/data/cmd-fake +++ b/tests/data/cmd-fake @@ -67,6 +67,41 @@ setattr) ;; esac ;; +exists) + if [ -n "$2" ] ; then + echo "Too many arguments" >&2 + exit 1 + fi + case "${type}:${1}" in + file:fake-test) + if [ -f autocreated ] ; then + echo 'yes' + else + echo 'no' + fi + ;; + *) + echo 'yes' + ;; + esac + exit 0 + ;; +autocreate) + if [ -n "$2" ] ; then + echo "Too many arguments" >&2 + exit 1 + fi + case "${type}:${1}" in + file:fake-test) + touch autocreated + exit 0 + ;; + *) + echo "Autocreate called for existing object" >&2 + exit 1 + ;; + esac + ;; get) if [ -n "$2" ] ; then echo "Too many arguments" >&2 -- cgit v1.2.3