> Atm it looks like the StoredFunc approach is *always* returning a
> valid result.  Not useful.
>
> Alos, not sure if it's my query, or what Postfix does with the result.
>
> Needs more work.

Making a minor change to the StoredFunctions' DECLARE,

 - DECLARE `result` TINYINT(1) DEFAULT <anything>;
 + DECLARE `result` TINYINT(1);

so that 'bad' queries do NOT return a '0'

mysql> SELECT DomainCheckFUNC('BAD_DOMAIN.com');
        +-----------------------------------+
        | DomainCheckFUNC('BAD_DOMAIN.com') |
        +-----------------------------------+
        |                                 0 |
        +-----------------------------------+
        1 row in set, 1 warning (0.00 sec)

but rather, a NULL,

mysql> SELECT DomainCheckFUNC('BAD_DOMAIN.com');
        +-----------------------------------+
        | DomainCheckFUNC('BAD_DOMAIN.com') |
        +-----------------------------------+
        |                              NULL |
        +-----------------------------------+
        1 row in set, 1 warning (0.00 sec)

and Postfix's "existence" check is happy.

Testing the Stored*Functions*, and the associated lookups,

 > postmap -q GOOD_DOMAIN proxy:mysql:/etc/postfix/virtual_mailbox_domains.cf
 1
 > postmap -q BAD_USER    proxy:mysql:/etc/postfix/virtual_mailbox_maps.cf
 1
 > postmap -q GOOD_USER   proxy:mysql:/etc/postfix/virtual_mailbox_maps.cf
 >
 > postmap -q BAD_DOMAIN  proxy:mysql:/etc/postfix/virtual_mailbox_domains.cf
 >

looks good.

A test email to a 'BAD' address is rejected,

        Oct 15 19:35:16 mx postfix/smtpd[324]: proxy-reject: END-OF-MESSAGE:
550 5.1.1 <bad_addre...@postfix.pg.lan>: Recipient address rejected:
User unknown in virtual mailbox table; from=<t...@mailsource.pg.lan>
to=<bad_addr...@postfix.pg.lan> proto=ESMTP helo=<mailsource.pg.lan>

and to a 'GOOD' address is accepted,

        Oct 15 19:43:23 mx postfix/smtpd[342]: proxy-accept: END-OF-MESSAGE:
250 2.0.0 Ok: queued as 01C1A22891; from=<t...@mailsource.pg.lan>
to=<good_addr...@postfix.pg.lan> proto=ESMTP helo=<mailsource.pg.lan>

WORKSFORME.

Rich

Reply via email to