diff options
author | Ben Boeckel <mathstuf@gmail.com> | 2019-08-29 16:43:17 -0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2019-09-04 10:47:39 +0100 |
commit | 1dec0d243fe77b8b5ea41df022c6ff122ab545b6 (patch) | |
tree | ba3088d7c4455bd4a56bcabb5a3be82cdc60da27 | |
parent | e9606f54857b585bedab29994a5c023bbe4b6696 (diff) | |
download | keyutils-1dec0d243fe77b8b5ea41df022c6ff122ab545b6.tar.gz |
test/instantiating: test bad arguments for `keyctl reject`
Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
-rw-r--r-- | tests/keyctl/instantiating/bad-args/runtest.sh | 14 | ||||
-rw-r--r-- | tests/toolbox.inc.sh | 22 |
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/keyctl/instantiating/bad-args/runtest.sh b/tests/keyctl/instantiating/bad-args/runtest.sh index d611fb9..21bbf10 100644 --- a/tests/keyctl/instantiating/bad-args/runtest.sh +++ b/tests/keyctl/instantiating/bad-args/runtest.sh @@ -17,6 +17,8 @@ pinstantiate_key --fail a 0 @p expect_error EPERM negate_key --fail 0 10 @p expect_error EPERM +reject_key --fail 0 10 rejected @p +expect_error EPERM # create a non-keyring marker "CREATE KEY" @@ -28,9 +30,19 @@ instantiate_key --fail $keyid a @p expect_error EPERM pinstantiate_key --fail a $keyid @p expect_error EPERM +reject_key --fail $keyid 10 rejected @p +expect_error EPERM negate_key --fail $keyid 10 @p expect_error EPERM +# check reject key timeout must be a number +marker "CHECK REJECT TIMEOUT" +expect_args_error keyctl reject $keyid aa rejected @p + +# check reject key timeout must be a number +marker "CHECK REJECT ERRORS" +expect_args_error keyctl reject $keyid 10 notanerror @p + # check negative key timeout must be a number marker "CHECK NEGATE TIMEOUT" expect_args_error keyctl negate $keyid aa @p @@ -45,6 +57,8 @@ instantiate_key --fail $keyid a @p expect_error EPERM pinstantiate_key --fail a $keyid @p expect_error EPERM +reject_key --fail $keyid 10 rejected @p +expect_error EPERM negate_key --fail $keyid 10 @p expect_error EPERM diff --git a/tests/toolbox.inc.sh b/tests/toolbox.inc.sh index ef7b691..63175d9 100644 --- a/tests/toolbox.inc.sh +++ b/tests/toolbox.inc.sh @@ -1380,6 +1380,28 @@ function pinstantiate_key () ############################################################################### # +# reject a key +# +############################################################################### +function reject_key () +{ + my_exitval=0 + if [ "x$1" = "x--fail" ] + then + my_exitval=1 + shift + fi + + echo keyctl reject "$@" >>$OUTPUTFILE + keyctl reject "$@" >>$OUTPUTFILE 2>&1 + if [ $? != $my_exitval ] + then + failed + fi +} + +############################################################################### +# # negate a key # ############################################################################### |