On 7/8/2010 10:58 AM, Philipp Leusmann wrote:
Hi all,

to stop backscattering I wrote a tcp_table server which checks quota 
availability for incoming messages.
I read<http://www.postfix.org/tcp_table.5.html>  over and over again, but still 
I am getting messages like

Jul  8 17:46:24 s15277780 postfix/smtpd[3325]: warning: read TCP map reply from 
localhost:1337: unexpected EOF (Success)
Jul  8 17:46:25 s15277780 postfix/smtpd[3325]: warning: tcp:localhost:1337: 
table lookup problem


in the logfile, when the server returns a 400 or 500 reply. For a 200-reply it 
works ok and the mail is delivered.

For a 400-reply, my server generates the following (from my logfile):

The encoded reply is [400 User%20over%20quota
]


The server sends everything between [ and ] . I think that should be ok. Or 
isn't it?


When I try a

postmap -vv -q "benny" tcp:localhost:1337

(benny is over quota)

the output ends with:

postmap: loaded dict_tcp_open = 7f50d057bd20
postmap: dict_open: calling tcp open routine
postmap: dict_open: tcp:localhost:1337
postmap: dict_tcp_lookup: key benny
postmap: trying... [127.0.0.1]
postmap: dict_tcp_lookup: send: get benny
postmap: dict_tcp_lookup: recv: 400 User%20over%20quota
postmap: dict_tcp_lookup: soft error: 400 User%20over%20quota

For a user having available space, it looks like:

postmap: loaded dict_tcp_open = 7f30f5c76d20
postmap: dict_open: calling tcp open routine
postmap: dict_open: tcp:localhost:1337
postmap: dict_tcp_lookup: key laus
postmap: trying... [127.0.0.1]
postmap: dict_tcp_lookup: send: get laus
postmap: dict_tcp_lookup: recv: 200 OK
postmap: dict_tcp_lookup: found: OK
OK



Can anybody tell me, what is wrong?

And what does postfix return the the delivering client in my current case? a 
500 ?

Regards,
  Philipp

The 200, 400, and 500 codes indicate the status of the lookup itself, and do not indicate the result.

200, the lookup found something, here it is: (OK, DEFER, REJECT ... other access(5) actions)
400, the lookup table is broken, try later
500, the key wasn't found

In the case of an over-quota user, your table should return
200 REJECT User over quota
or DEFER if that's the action you want.

This isn't documented explicitly in the README because tcp tables can be used for purposes other than access maps.

  -- Noel Jones

Reply via email to