summaryrefslogtreecommitdiff
path: root/keyutils-1.5.6/tests/keyctl/session/valid/runtest.sh
blob: 172343ab538e03129913ecd48cb4cdc4d778125c (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
#!/bin/sh

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


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

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

# describe the keyring created for an anonymous session
if [ $OSDIST = RHEL -a $OSRELEASE -le 5 ]
then
    marker "ANON SESSION"
    new_session - keyctl rdescribe @s "@"
    expect_key_rdesc rdesc "keyring@.*@.*@.*@_ses[^@]*\$"

    # check the session keyring ID is shown
    seskeyring="`tail -2 $OUTPUTFILE | head -1`"
    if ! expr "$seskeyring" : "Joined session keyring: [0-9]*" >&/dev/null
    then
	failed
    fi
fi

# describe the keyring created for a named session
marker "NAMED SESSION"
new_session qwerty keyctl rdescribe @s "@"
expect_key_rdesc rdesc "keyring@.*@.*@.*@qwerty"

# check the session keyring ID is shown
seskeyring="`tail -2 $OUTPUTFILE | head -1`"
if ! expr "$seskeyring" : "Joined session keyring: [0-9]*" >&/dev/null
then
    failed
fi

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

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