File: pam

package info (click to toggle)
courier-authlib 0.71.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 14,416 kB
  • sloc: ansic: 15,778; sh: 4,565; cpp: 4,205; makefile: 793; perl: 739
file content (41 lines) | stat: -rwxr-xr-x 1,028 bytes parent folder | download | duplicates (5)
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
#!/bin/sh

# autopkgtest check: test two local users via PAM authentication.
# Author: Markus Wanner <markus@bluegap.ch>

set -eu

. debian/tests/common.sh

export LANG=C
unset LANGUAGE LC_ALL LC_CTYPE

test_enumeration() {
    ENUM_OUTPUT="$AUTOPKGTEST_ARTIFACTS/authenumerate.out"

    # test authenumerate
    (
        authenumerate_as_courier > $ENUM_OUTPUT 2> $AUTOPKGTEST_ARTIFACTS/authenumerate.err
    )
    echo $? > $AUTOPKGTEST_ARTIFACTS/authenumerate.exitcode

    # the three test users should appear in the output of authenumerate
    echo -n "checking for alice: "
    grep "alice" $ENUM_OUTPUT > /dev/null && echo "ok" || echo "FAILED"
    echo -n "checking for bob:   "
    grep "bob"   $ENUM_OUTPUT > /dev/null && echo "ok" || echo "FAILED"
    echo -n "checking for carol: "
    grep "carol" $ENUM_OUTPUT > /dev/null && echo "ok" || echo "FAILED"
}

# Actual tests start here

backup_config_files
create_test_users

start_authdaemon

echo "== check enumeration..."
test_enumeration

echo "== test completed"