OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: header_if_reject

From: Victor Duchovni (Victor.DuchovniMorganStanley.com)
Date: Mon Feb 07 2005 - 08:11:45 CST


On Mon, Feb 07, 2005 at 02:45:47PM +0100, Piotr KUCHARSKI wrote:

> Instead of adding header_if_reject, I reused warn_if_reject -- if it
> warns in system logs, it can warn in mails, too, right?
>
> --- smtpd_check.c.org Sat Dec 27 03:54:03 2003
> +++ smtpd_check.c Mon Feb 7 14:34:55 2005
> -793,6 +793,17
> */
> log_whatsup(state, whatsup, STR(error_text));
>
> + if (warn_if_reject) {
> + VSTRING *hbuf = vstring_alloc(100);
> +
> + if (state->prepend == 0)
> + state->prepend = argv_alloc(1);
> +
> + vstring_sprintf(hbuf, "X-Reject-Warning: %s", STR(error_text));
> + argv_add(state->prepend, STR(hbuf), (char *) 0);
> + vstring_free(hbuf);
> + }
> +
> return (warn_if_reject ? 0 : SMTPD_CHECK_REJECT);
> }
>
>
> It does what I want, but perhaps someone could improve it? I am not
> quite sure about vstring* stuff.
>

Issues:

- It is in principle possible for "error_text" to get moderately long,
  you should ensure that the resulting header is less than "var_line_limit"
  in length, since later code in smtpd does not split long input into
  multiple records.

- You should perhaps use ARGV_END instead of (char *)0, but existing code
  is already not consistent in this regard.

--
        Viktor.

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the "Reply-To" header.

To unsubscribe from the postfix-users list, visit
http://www.postfix.org/lists.html or click the link below:
<mailto:majordomopostfix.org?body=unsubscribe%20postfix-users>