#!/bin/sh -
# A sample "POP before SMTP"-enabler script for Postfix
# This script should be installed in /usr/local/etc.
# This script assumes 
# 
POSTFIXDIR=/etc/postfix
POSTFIXBIN=/usr/libexec/postfix
PATH=$POSTFIXBIN\:$PATH
OKDIR=/var/log
OKCLIENT=$OKDIR/ATMP
CLIENTACCESS=$POSTFIXDIR/client_access

case $0 in
  *record)
	echo "$RELAYCLIENT	OK" >> $OKCLIENT.1
	;;
  *age)
	rm -f $OKCLIENT.2
	[ -f $OKCLIENT.1 ] && mv -f $OKCLIENT.1 $OKCLIENT.2
	echo '' > $CLIENTACCESS
	# rm -f $CLIENTACCESS.db
	postmap hash:$CLIENTACCESS
	;;
  *)
	# else generate master client_access.db
	;;
esac
touch $OKCLIENT.1 $OKCLIENT.2
cat $OKCLIENT.1 $OKCLIENT.2 | postmap -r -i hash:$CLIENTACCESS
