#!/bin/sh # tpplain_sasldb.sh 1.00 ########################################################################## # Postfix SASL Test Script # Copyright (C) 2002, Hiroaki Izumi. All right reserved. ########################################################################## debug="debug" # debug option #debug="" # no debug # ------------------------------------------------------------------------ PRE_SLEEP=2 POST_SLEEP=8 SMTPSERVER=localhost MYDOMAIN=localhost.localdomain USER=test PASS=testpass ENPASS=`perl -MMIME::Base64 -e "print encode_base64(\"$USER\0$USER\0$PASS\");"` echo $PASS | saslpasswd -p -c -u `postconf -h myhostname` $USER if [ "x$debug" = "xdebug" ] ; then sasldblistusers fi ( echo "EHLO $MYDOMAIN" echo "AUTH PLAIN $ENPASS" echo "QUIT" ) | while read cmd ; do sleep $PRE_SLEEP echo $cmd 1>&2 echo $cmd sleep $POST_SLEEP done | telnet $SMTPSERVER smtp 2>&1 | tee result.$$ echo "#" if grep "235 Authentication successful" result.$$ ; then echo "Test Ok! Congratulations." else echo "Test NG. Check your setting." fi rm -f result.$$ saslpasswd -d -u `postconf -h myhostname` $USER if [ "x$debug" = "xdebug" ] ; then sasldblistusers fi exit 1