summaryrefslogtreecommitdiff
path: root/tests/keyctl/session/valid2/runtest.sh
blob: 12ad2342a7d93f1fcc9e3e465aab9e5fbaea26e7 (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
#!/bin/bash

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


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

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

# Replace the script's session keyring with an anonymous keyring
marker "ANON SESSION TO PARENT"
id_key --to=ses1 @s
new_session_to_parent
id_key --to=ses2 @s

if [ $ses2 = $ses1 ]
then
    failed
fi

describe_key @s "@"
expect_key_rdesc rdesc "keyring@.*@.*@.*@_ses"

# Replace the script's session keyring with a named keyring
marker "NAMED SESSION TO PARENT"
new_session_to_parent lizard
id_key --to=ses3 @s

if [ $ses3 = $ses2 -o $ses3 = $ses1 ]
then
    failed
fi

describe_key @s "@"
expect_key_rdesc rdesc "keyring@.*@.*@.*@lizard"


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

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