summaryrefslogtreecommitdiff
path: root/keyutils-1.5.6/tests/keyctl/update/bad-args/runtest.sh
blob: 9d7971a2ad00d0aacfcf9b474144ac34fe505462 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/sh

. ../../../prepare.inc.sh
. ../../../toolbox.inc.sh


# ---- do the actual testing ----

result=PASS
echo "++++ BEGINNING TEST" >$OUTPUTFILE

# attempt to update the session keyring
marker "CHECK UPDATE SESSION KEYRING"
update_key --fail @s a
expect_error EOPNOTSUPP

# attempt to update an invalid key
marker "CHECK UPDATE INVALID KEY"
update_key --fail 0 a
expect_error EINVAL

# add a user key to the session keyring for us to play with
marker "ADD USER KEY"
create_key user wibble stuff @s
expect_keyid keyid

# remove the key we just added
marker "UNLINK KEY"
unlink_key --wait $keyid @s

# it should fail when we attempt to update it
marker "UPDATE UNLINKED KEY"
update_key --fail $keyid @s
expect_error ENOKEY

echo "++++ FINISHED TEST: $result" >>$OUTPUTFILE

# --- then report the results in the database ---
toolbox_report_result $TEST $result