diff options
Diffstat (limited to 'security/cyrus-sasl2/files/pwcheck.sh')
-rw-r--r-- | security/cyrus-sasl2/files/pwcheck.sh | 71 |
1 files changed, 53 insertions, 18 deletions
diff --git a/security/cyrus-sasl2/files/pwcheck.sh b/security/cyrus-sasl2/files/pwcheck.sh index ba07b9fc580a..3f4c903817a2 100644 --- a/security/cyrus-sasl2/files/pwcheck.sh +++ b/security/cyrus-sasl2/files/pwcheck.sh @@ -3,29 +3,64 @@ # $FreeBSD$ # +action=$1 + PREFIX=%%PREFIX%% -case "$1" in +# 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 -start) - if [ -x ${PREFIX}/sbin/pwcheck ] - then - ${PREFIX}/sbin/pwcheck & && echo -n " pwcheck" - 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%% -stop) - if [ -r /var/run/pwcheck.pid ] - then - kill `cat /var/run/pwcheck.pid` && echo -n " pwcheck" - rm /var/run/pwcheck.pid - fi - ;; +if [ -z "${sasl_pwcheck_enable}" ] ; then + sasl_pwcheck_enable=%%ENABLEPWCHECK%% +fi -*) - echo "usage: $0 {start|stop}" 1>&2 - exit 64 - ;; +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 |