Hello all,

I've been trying to enable mysql support for local aliases.

I'm using mail_version = 2.9.9

Postconf output:

   reddwarf:~ mikec$ postconf -m
   btree
   cidr
   environ
   fail
   hash
   internal
   memcache
   mysql
   pcre
   proxy
   regexp
   static
   tcp
   texthash
   unix

main.cf:

   reddwarf:~ mikec$ grep mysql /Library/Server/Mail/Config/postfix/main.cf
   alias_maps = hash:/etc/aliases hash:/usr/local/mailman/data/aliases 
hash:/Library/Server/Mail/Data/listserver/aliases/list_server_aliases 
mysql:/etc/postfix/tempaddress.cf

CREATE TABLE `addresses` (
  `username` varchar(32) NOT NULL,
  `local_user` varchar(32) NOT NULL,
  `create_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `expires` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `last_used` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `description` text
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

tempaddress.cf:

   reddwarf:~ mikec$ cat /etc/postfix/tempaddress.cf 
   # mysql config file for local(8) aliases(5) lookups.

   # hosts = localhost
   user = tempaddress
   password = frob7disk
   dbname = ********
   query = select lookup_address('%s');

mail.log:

   Jul  6 15:08:13 reddwarf.********.org postfix/smtpd[43525]: error: 
unsupported dictionary type: mysql
   Jul  6 15:08:13 reddwarf.********.org postfix/smtpd[43525]: connect from 
nk11p08mm-asmtpout001.mac.com[17.158.58.246]
   Jul  6 15:08:14 reddwarf.********.org postfix/smtpd[43525]: warning: 
mysql:/etc/postfix/tempaddress.cf is unavailable. unsupported dictionary type: 
mysql
   Jul  6 15:08:14 reddwarf.********.org postfix/smtpd[43525]: warning: 
mysql:/etc/postfix/tempaddress.cf lookup error for "zadanga@********.org"
   Jul  6 15:08:14 reddwarf.********.org postfix/smtpd[43525]: NOQUEUE: reject: 
RCPT from nk11p08mm-asmtpout001.mac.com[17.158.58.246]: 451 4.3.0 
<zadanga@********.org>: Temporary lookup failure; from=<[email protected]> 
to=<zadanga@********.org> proto=ESMTP helo=<nk11p08mm-asmtp001.mac.com>

I had a version that did not have mysql compiled in, so I re-compiled using the 
Postfix Mysql example on postfix.org.

make -f Makefile.init makefiles
     'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include'
     'AUXLIBS=-L/usr/local/mysql/lib -lmysqlclient -lz -lm -lresolv'

I then moved the new binaries into place (/usr/sbin). The expectation is that 
once compiled for mysql, this error wouldn't show up. There is only one postfix 
binary in /usr/sbin, so it's not that there's another rogue version somewhere. 
:)

I do get resolution from postmap:

   sh-3.2# postmap -q 'hostmaster@********.org' 
mysql:/etc/postfix/tempaddress.cf 
   mikec

But still get errors when I actually try to email to one of the aliases in the 
DB. I had used a MySQL function before, but I removed that in case it was the 
problem, replacing it with a simple query: query = select local_user from 
addresses where expires < time(now()) and username='%s'

Any ideas on what else I need to do?

Thanks,
#mikec

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to