postfix-users

pgsql, reject_unlisted_recipient, and what returncode is needed?

Subject: pgsql, reject_unlisted_recipient, and what returncode is needed?
From: Michael Monnerie <michael.monnerie AT it-management DOT at>
To: postfix-users AT postfix DOT org
Date: Wed, 8 Aug 2007 14:41:02 +0200
My head's exploding soon, and before that happens, I'll try to ask here. 
I have postfix with dbmail, and want to check if a given user exists:

main.cf:
virtual_mailbox_maps = pgsql:/etc/postfix/recipients-all.sql
smtpd_recipient_restrictions = permit_sasl_authenticated, 
reject_unlisted_recipient, reject_unauth_destination

I would expect this to return OK or REJECT, depending on user exists or not.
But that doesn't help with reject_unlisted_recipient:

Aug  8 13:49:03 mailsrv2.zmi.at postfix/smtpd[3689]: dict_pgsql_lookup: 
retrieved 1 rows
Aug  8 13:49:03 mailsrv2.zmi.at postfix/smtpd[3689]: maps_find: 
virtual_mailbox_maps: pgsql:/etc/postfix/recipients-all.sql(0,lock|fold_fix): 
asdfff AT monnerie DOT at = REJECT
Aug  8 13:49:03 mailsrv2.zmi.at postfix/smtpd[3689]: mail_addr_find: asdfff AT 
monnerie DOT at -> REJECT
Aug  8 13:49:03 mailsrv2.zmi.at postfix/smtpd[3689]: generic_checks: 
name=reject_unlisted_recipient status=0

Lookups are OK:

# postmap -q asdfff AT monnerie DOT at `postconf -h virtual_mailbox_maps`
REJECT
# postmap -q test AT monnerie DOT at `postconf -h virtual_mailbox_maps`
OK

Only if I return an empty string '' instead of REJECT, postfix correctly says:
550 5.1.1 <asdfff AT monnerie DOT at>: Recipient address rejected: User unknown 
in virtual mailbox table

but in the same time it logs:
warning: table "pgsql:/etc/postfix/recipients-all.sql": empty lookup result 
for: "asdfff AT monnerie DOT at" -- ignored

Now how can I make reject_unlisted_recipient work ?

mfg zmi
-- 
// Michael Monnerie, Ing.BSc    -----      http://it-management.at
// Tel: 0676/846 914 666                      .network.your.ideas.
// PGP Key:         "curl -s http://zmi.at/zmi.asc | gpg --import"
// Fingerprint: EA39 8918 EDFF 0A68 ACFB  11B7 BA2D 060F 1C6F E6B0
// Keyserver: www.keyserver.net                   Key-ID: 1C6FE6B0

Attachment: signature.asc
Description: This is a digitally signed message part.

<Prev in Thread] Current Thread [Next in Thread>