I've changed the hook system for mod_smtpd a little to allow more
flexibility and module cooperation. Basically it works like this now:
When a hook is called smtpd_run_*, each registered hook is called until
one returns something other than SMTPD_DECLINED or SMTPD_OK. If all the
hooks return SMTPD_DECLINED, then the call to smtpd_run_* returns
SMTPD_DECLINED. If all hooks return SMTPD_DECLINED but one or more
return SMTPD_OK, then the call to smtpd_run_* returns SMTPD_OK.

This is different from the conventional "run all" hook we have where the
call to smtpd_run_* returns SMTPD_OK even if it was declined by all the
hooks. This is also different from a "run first" hook, where calling
hooks stop as soon as one returns something other than declined.

The purpose of this change was to allow the call to smtpd_run_queue to
call all the hooks even if one already accepted it with SMTPD_OK (so
other modules can process other recipients), and to know that at least
one accepted the message. If they all returned SMTPD_DECLINED then tell
the client that the message was not queued. Of course the other
SMTPD_DENY* return codes still apply.

This required a new run implementor macro that I've dubbed
APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL_MOD and defined in smtpd.h, but
would something like this make it into the APR release? It seems silly
and hackish within smtpd.h. Also should a
APR_IMPLEMENT_OPTIONAL_HOOK_RUN_FIRST also be defined in APR? Thanks.
-rian

Reply via email to