[prev in list] [next in list] [prev in thread] [next in thread] 

List:       syslog-ng
Subject:    Re: [syslog-ng] [PATCH]: Experimental SMTP destination
From:       Gergely Nagy <algernon () balabit ! hu>
Date:       2011-03-11 15:25:05
Message-ID: 871v2dadda.fsf () balabit ! hu
[Download RAW message or body]

> > > First of all, it stores the headers we explicitly set in a separate
> > > structure, which is fine. When setting header values, libesmtp itself
> > > does not guard against embedded newlines, but we can either replace
> > > newlines with a space, to clean up headers, or add a space after each
> > > newline:
> > > 
> > > ,----
> > > > Header: blah blah
> > > > blah blah
> > > > blah
> > > `----
> > > 
> > > This is valid MIME. Replacing newlines is easier, though.
> > > 
> > > Anyway, when libesmtp gets around to process the body, it scans it for
> > > headers, in case some were set there too. Sadly, I couldn't find a way
> > > to stop it from doing so. Therefore, extra care will need to be taken to
> > > format the body correctly...
> > 
> > using \r\n would work. Let me see if I can create a patch to fix thes
> > problems.
> 
> Hrm, that's a possibility, yeah, I didn't check \r\n, nor that part of
> the libesmtp code (yet).

It appears that I fixed this issue by coincidence.. at least I can't
reproduce the problem I saw before.

An smtp destination like this:

,----
> destination d_smtp {
> smtp(  
> host("127.0.0.1")
> port(25)
> from("syslog-ng alert service <algernon@luthien>")
> to("algernon@luthien")
> subject("[ALERT] $PROGRAM[$PID]")
> body("Date: $S_DATA\nMsg: $MSG\n\nOh, hey there!\nWe received this message, and \
> thought you might be interested.")
> header("X-Program" "$PROGRAM")
> header("X-Facility" "$FACILITY")
> );
> };
`----

Did not produce extra headers, nor did it crash anymore.

Furthermore, I fixed the header injection bug by replacing any \rs and
\ns in the headers with a space. Also ported the driver to latest git
head.

It's available on my work/modules/afsmtp branch, and a consolidated
patch will be available on the integration/afsmtp branch soon, too.

This current code seems to be stable and reliable now, but a quick
review probably wouldn't hurt.

-- 
> 8]
______________________________________________________________________________
Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng
FAQ: http://www.campin.net/syslog-ng/faq.html


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic