aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRuss Allbery <rra@stanford.edu>2010-02-20 19:55:05 -0800
committerRuss Allbery <rra@stanford.edu>2010-02-20 19:55:05 -0800
commita3ee976840e97d37022ec117bae09fef25ac4385 (patch)
treea2422d730079e2ce72f0245f5497685f27377960 /tests
parent77581a6a1620118ca17e26ec8b549603ab67b91b (diff)
Add support in the wallet client for store of binary data
Refactor the wallet client code to use remctl_commandv and send stores with data containing nul.
Diffstat (limited to 'tests')
-rw-r--r--tests/client/basic-t.in9
-rw-r--r--tests/data/basic.conf1
-rwxr-xr-xtests/data/cmd-fake9
3 files changed, 16 insertions, 3 deletions
diff --git a/tests/client/basic-t.in b/tests/client/basic-t.in
index 30bc004..1ae3a70 100644
--- a/tests/client/basic-t.in
+++ b/tests/client/basic-t.in
@@ -50,7 +50,7 @@ if [ $? != 0 ] ; then
elif [ -z '@REMCTLD@' ] ; then
skip_all 'No remctld found'
else
- plan 34
+ plan 36
fi
remctld_start '@REMCTLD@' "$SOURCE/data/basic.conf"
wallet="$BUILD/../client/wallet"
@@ -141,6 +141,13 @@ ok_program 'store from a file' 0 '' \
"$wallet" -f store-input store file fake-test
ok '...and the correct data was stored' cmp store-output store-correct
rm -f store-input store-output store-correct
+printf 'This is store input\000with a nul character' > store-input
+echo 'file fake-nul' > store-correct
+cat store-input >> store-correct
+ok_program 'store from a file with a nul' 0 '' \
+ "$wallet" -f store-input store file fake-nul
+ok '...and the correct data was stored' cmp store-output store-correct
+rm -f store-input store-output store-correct
# Test various other client functions and errors.
ok_program 'get output to stdout' 0 'This is a fake keytab.' \
diff --git a/tests/data/basic.conf b/tests/data/basic.conf
index 3280ce9..5f3c2a3 100644
--- a/tests/data/basic.conf
+++ b/tests/data/basic.conf
@@ -1,3 +1,4 @@
# remctl configuration for wallet client tests.
+fake-wallet store data/cmd-fake stdin=last ANYUSER
fake-wallet ALL data/cmd-fake ANYUSER
diff --git a/tests/data/cmd-fake b/tests/data/cmd-fake
index 199bd57..add72fc 100755
--- a/tests/data/cmd-fake
+++ b/tests/data/cmd-fake
@@ -82,10 +82,15 @@ get)
;;
store)
if [ -n "$3" ] ; then
- echo "Too many arguments" >&2
+ echo 'Too many arguments' >&2
+ exit 1
+ fi
+ if [ -n "$2" ] ; then
+ echo 'stdin remctld configuration not supported' >&2
exit 1
fi
- printf "$type $1\n$2" > store-output
+ printf "$type $1\n" > store-output
+ cat >> store-output
;;
show)
if [ -n "$2" ] ; then