#!/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="/var/run/saslauthd"	# Working directory
#saslauthd_program="/usr/local/sbin/saslauthd"	# Location of saslauthd

. /etc/rc.subr

name="saslauthd"
rcvar=saslauthd_enable
command="/usr/local/sbin/${name}"

load_rc_config $name

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

run_rc_command "$1"
