#!/bin/sh # tplogin_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 ENUSER=`perl -MMIME::Base64 -e "print encode_base64(\"$USER\");"` ENPASS=`perl -MMIME::Base64 -e "print encode_base64(\"$PASS\");"` echo $PASS | saslpasswd -p -c -u `postconf -h myhostname` $USER if [ "x$debug" = "xdebug" ] ; then sasldblistusers fi #(echo $PASS ; sleep 2 ; echo $PASS) | passwd $USER ( echo "EHLO $MYDOMAIN" echo "AUTH LOGIN" echo $ENUSER echo $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