summaryrefslogtreecommitdiff
path: root/tests/keyctl/add/useradd/runtest.sh
blob: 956fb984cf78bc81cf0653b4906a1bfee0660306 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash

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


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

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

# check that we can add a user key to the session keyring
marker "ADD USER KEY"
create_key --new=keyid user wibble stuff @s

# read back what we put in it
marker "PRINT PAYLOAD"
print_key $keyid
expect_payload payload "stuff"

# check that we can add a hex-encoded user key to the session keyring
marker "ADD HEX USER KEY"
create_key --update=$keyid -x user wibble "73  7475 66  66  " @s

# read back what we put in it
marker "PRINT PAYLOAD"
print_key $keyid
expect_payload payload "stuff"

# check that we can update a user key
marker "UPDATE USER KEY"
create_key --update=$keyid user wibble lizard @s

# read back what we changed it to
marker "PRINT UPDATED PAYLOAD"
print_key $keyid
expect_payload payload "lizard"

# attempt to add a key to that non-keyring key
marker "ADD KEY TO NON-KEYRING"
create_key --fail user lizard gizzards $keyid
expect_error ENOTDIR

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

keyctl show

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

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