OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: [PATCH] Add recipient count into policy checking

From: Guo Black (guo.blackgmail.com)
Date: Thu Jan 19 2006 - 15:05:46 CST


Hi,

On 1/20/06, Victor Duchovni <Victor.Duchovnimorganstanley.com> wrote:
> At what phase in the conversation are you applying the policy check?
> If in smtpd_recipient_checks, the count will only be correct when you
> reach the last recipient (but you won't know which one is last until
> later).

It was "DATA" (smtpd_data_restrictions), as state->recipient is
cleared in DATA and END-OF-DATA phases.

Since the rcpt count is not quite meaningful in earlier stages,
perhaps the following would be better? (Or state->act_size > 0, but
semantically we should already know rcpt_count in the DATA phase)

--- smtpd_check.c.orig Thu Dec 22 23:46:36 2005
+++ smtpd_check.c Fri Jan 20 05:02:00 2006
-3273,6 +3273,10
                           state->sender ? state->sender : "",
                           ATTR_TYPE_STR, MAIL_ATTR_RECIP,
                           state->recipient ? state->recipient : "",
+ ATTR_TYPE_LONG, MAIL_ATTR_RCPT_COUNT,
+ ((strcasecmp(state->where, "DATA") != 0) ||
+ (strcasecmp(state->where, "END-OF-DATA") != 0)) ?
+ state->rcpt_count : 0,
                           ATTR_TYPE_STR, MAIL_ATTR_QUEUEID,
                           state->queue_id ? state->queue_id : "",
                           ATTR_TYPE_STR, MAIL_ATTR_INSTANCE,

Best Regards,