#! /bin/sh

DIR=`dirname $0`

AUTHDAEMOND=authdaemond.plain

if test -x $DIR/authdaemond.ldap
then
	AUTHDAEMOND=authdaemond.ldap
fi

if test -x $DIR/authdaemond.mysql
then
	AUTHDAEMOND=authdaemond.mysql
fi

if test -x $DIR/authdaemond.pgsql
then
	AUTHDAEMOND=authdaemond.pgsql
fi

. /etc/courier-imap/authdaemonrc
if test "$version" != ""
then
	AUTHDAEMOND="$version"
fi

exec $DIR/$AUTHDAEMOND $1
