aboutsummaryrefslogtreecommitdiffstats
path: root/security/cyrus-sasl2/files/saslauthd.sh
blob: 1ada300c3783b9b7e5a1ead7dce4343daa1dca56 (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
67
68
69
70
71
72
73
74
#!/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_saslauthd_* variables may be defined in rc.conf
#
#   sasl_saslauthd_enable  - Set to YES to enable saslauthd
#                Default: %%ENABLEPWCHECK%%
#
#   sasl_saslauthd_program - Path to saslauthd program
#                Default: ${PREFIX}/sbin/%%PWCHECK%%
#
#   sasl_saslauthd_flags   - Flags to saslauthd program
#                Default: -a pam

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

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

if [ -z "${sasl_saslauthd_flags}" ]; then
    sasl_saslauthd_flags="-a pam"
fi

rc=0

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

        start)
        if [ -x ${sasl_saslauthd_program} ] ; then
            ${sasl_saslauthd_program} ${sasl_saslauthd_flags} \
            && echo -n " saslauthd"
        fi
        ;;

        stop)
        if [ -r /var/state/saslauthd/saslauthd.pid ]; then
            kill `cat /var/state/saslauthd/saslauthd.pid` && \
            echo -n " saslauthd"
        fi
        ;;

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

exit $rc