From aa57ab48cc9df24ab756b5651959b36a2d81cad3 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Sat, 19 Jan 2008 00:37:31 +0000 Subject: When downloading a keytab to a file that already exists, merge the new keytab keys into that file rather than moving aside the old keytab and creating a new keytab with only the new keys. Also fix get handling in the client for all types other than keytabs. This isn't visible yet since the server doesn't yet support other types of objects. --- tests/data/cmd-fake | 30 +++++++++++++++++------------- tests/data/fake-keytab-2 | Bin 0 -> 334 bytes tests/data/fake-keytab-merge | Bin 0 -> 666 bytes 3 files changed, 17 insertions(+), 13 deletions(-) create mode 100644 tests/data/fake-keytab-2 create mode 100644 tests/data/fake-keytab-merge (limited to 'tests/data') diff --git a/tests/data/cmd-fake b/tests/data/cmd-fake index e9744a2..4b97f43 100755 --- a/tests/data/cmd-fake +++ b/tests/data/cmd-fake @@ -5,14 +5,14 @@ # the client test suite. It doesn't test any of the wallet server code. # # Written by Russ Allbery -# Copyright 2007 Board of Trustees, Leland Stanford Jr. University +# Copyright 2007, 2008 Board of Trustees, Leland Stanford Jr. University # See LICENSE for licensing terms. command="$1" shift type="$1" shift -if [ "$type" != "keytab" ] ; then +if [ "$type" != "keytab" ] && [ "$type" != "file" ] ; then echo "Unknown object type $type" >&2 exit 1 fi @@ -23,7 +23,7 @@ getattr) echo "Too many arguments" >&2 exit 1 fi - if [ "$2" != sync ] ; then + if [ "$type" != "keytab" ] || [ "$2" != sync ] ; then echo "Unknown attribute $2" >&2 exit 1 fi @@ -44,7 +44,7 @@ setattr) echo "Too many arguments" >&2 exit 1 fi - if [ "$2" != sync ] ; then + if [ "$type" != "keytab" ] || [ "$2" != sync ] ; then echo "Unknown attribute $2" >&2 exit 1 fi @@ -67,21 +67,25 @@ get) echo "Too many arguments" >&2 exit 1 fi - case "$1" in - service/fake-test) + case "${type}:${1}" in + file:fake-test) cat data/fake-data exit 0 ;; - service/fake-srvtab) + keytab:service/fake-srvtab) cat data/fake-keytab exit 0 ;; - service/fake-output) + keytab:service/fake-keytab) + cat data/fake-keytab-2 + exit 0 + ;; + keytab:service/fake-output) printf 'This is a fake keytab.' exit 0 ;; *) - echo "Unknown keytab $1" >&2 + echo "Unknown $type $1" >&2 exit 1 ;; esac @@ -91,11 +95,11 @@ show) echo "Too many arguments" >&2 exit 1 fi - if [ "$1" = "service/fake-test" ] ; then - echo "Some stuff about $1" + if [ "$type" = "file" ] && [ "$1" = "fake-test" ] ; then + echo "Some stuff about $type $1" exit 0 else - echo "Unknown keytab $1" >&2 + echo "Unknown $type $1" >&2 exit 1 fi ;; @@ -104,7 +108,7 @@ expires) echo "Too many arguments" >&2 exit 1 fi - echo "Expiration date of $1" + echo "Expiration date of $type $1" exit 0 ;; *) diff --git a/tests/data/fake-keytab-2 b/tests/data/fake-keytab-2 new file mode 100644 index 0000000..0440930 Binary files /dev/null and b/tests/data/fake-keytab-2 differ diff --git a/tests/data/fake-keytab-merge b/tests/data/fake-keytab-merge new file mode 100644 index 0000000..31ddc49 Binary files /dev/null and b/tests/data/fake-keytab-merge differ -- cgit v1.2.3