aboutsummaryrefslogtreecommitdiffstats
path: root/security/cyrus-sasl/files/pwcheck.sh
blob: 3f4c903817a2cea271bf3466c7c13ed41070fb94 (plain) (blame)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/sh
#
# $FreeBSD$
#

action=$1

PREFIX=%%PREFIX%%

# Suck in the configuration variables.
if [ -z "${source_rc_confs_defined}" ]; then
        if [ -r /etc/defaults/rc.conf ]; then
                . /etc/defaults/rc.conf
                source_rc_confs
        elif [ -r /etc/rc.conf ]; then
                . /etc/rc.conf
        fi
fi

# The following sasl_pwcheck_* variables may be defined in rc.conf
#
#   sasl_pwcheck_enable  -  Set to YES to enable pwcheck
#               Default: %%ENABLEPWCHECK%%
#
#   sasl_pwcheck_program -  Path to pwcheck program (pwcheck/pwcheck_pam)
#               Default: ${PREFIX}/sbin/%%PWCHECK%%

if [ -z "${sasl_pwcheck_enable}" ] ; then
    sasl_pwcheck_enable=%%ENABLEPWCHECK%%
fi

if [ -z "${sasl_pwcheck_program}" ]; then
    sasl_pwcheck_program=${PREFIX}/sbin/%%PWCHECK%%
fi

rc=0

case "${sasl_pwcheck_enable}" in
    [Yy][Ee][Ss])
    case "${action}" in

        start)
        if [ -x ${sasl_pwcheck_program} ] ; then
            ${sasl_pwcheck_program} & && echo -n " pwcheck"
        fi
        ;;

        stop)
        if [ -r /var/run/pwcheck.pid ]; then
            kill `cat /var/run/pwcheck.pid` && echo -n " pwcheck"
            rm /var/run/pwcheck.pid
        fi
        ;;

        *)
        echo "usage: $0 {start|stop}" 1>&2
        rc=64
        ;;
    esac
    ;;
    *)
    rc=0
    ;;
esac

exit $rc