#!/bin/sh

# PROVIDE: saslauthd
# REQUIRE: DAEMON
# BEFORE: mail imap
# KEYWORD: shutdown

# Define these saslauthd_* variables in one of these files:
#	/etc/rc.conf
#	/etc/rc.conf.local
#	/etc/rc.conf.d/saslauthd
#
# DO NOT CHANGE THESE DEFAULT VALUES HERE
#
saslauthd_enable=${saslauthd_enable:-"NO"}	# Enable saslauthd
saslauthd_flags=${saslauthd_flags:-"-a pam"}	# Flags to saslauthd program
#saslauthd_runpath="%%SASLAUTHD_RUNPATH%%"	# Working directory
#saslauthd_program="%%PREFIX%%/sbin/saslauthd"	# Location of saslauthd

. /etc/rc.subr

name="saslauthd"
rcvar=saslauthd_enable
command="%%PREFIX%%/sbin/${name}"

load_rc_config $name

if [ -z "$saslauthd_runpath" ]; then
	pidfile="%%SASLAUTHD_RUNPATH%%/${name}.pid"
else
	pidfile="${saslauthd_runpath}/${name}.pid"
	command_args="-m ${saslauthd_runpath}"
fi

run_rc_command "$1"
