RE: [dkim-milter-discuss] dkim_chunk() and CRLF

From: Stefan Schulze Frielinghaus <>
Date: Sat, 13 Mar 2010 13:52:27 +0100

On Fr, 2010-03-12 at 08:41 -0800, Murray S. Kucherawy wrote:
> > -----Original Message-----
> > From: Stefan Schulze Frielinghaus []
> > Sent: Friday, March 12, 2010 3:29 AM
> > To:
> > Subject: [dkim-milter-discuss] dkim_chunk() and CRLF
> >
> > Hi,
> >
> > I'm trying to feed dkim_chunk() with an email I receive from an
> > external
> > library. At the moment I always receive an DKIM_STAT_SYNTAX error.
> > Having a deeper look inside of dkim_chunk it seems to me that it
> > distinguishes between a \r and a \n. A quick search over the net broad
> > to me in mind that there was some kind line break separation which the
> > standard declared through \r and \n. Is this still true or do I miss
> > something? I went through the whole email I received from that library
> > and there was no \r at all, only \n's. If that violates the standard,
> > then I would be happy to found the problem and I could try to deal with
> > it. Otherwise any other ideas why I receive an DKIM_STAT_SYNTAX error.
> Hi Stefan,
> I'm the original author of dkim-milter. I've since left the company that sponsors that work, and they haven't added any new people to maintain it, so you probably won't get an answer on that list.
> I've since resurrected the project under the name OpenDKIM, I hope you'll check us out over there, especially since there has been at least one bug fixed in dkim_chunk() since we started up the new project.
> The dkim_chunk() interface does the work of splitting up a message into headers and body for you, and then calls dkim_header(), dkim_eoh() and dkim_body() for you as appropriate. Thus, the only time dkim_chunk() returns DKIM_STAT_SYNTAX is if one of those functions returned that.

Hi Murray,

Nice to hear that the project is still alive. I will drop by and have a
look at OpenDKIM.

> You're right, dkim_chunk() relies on the input having end-of-line being marked by the string "\r\n", just like the rest of the library does. This is standard email practice, and is stated in the documentation for that function (see libopendkim/docs/dkim_chunk.html). Without that, it will end up passing the entire message as a single header to the rest of the library, which will obviously result in a syntax error.

Yeah, this was exactly the behavior I noticed. I put a lot of printf's
into the libdkim and what I noticed was that the entire message was
recognized as one big header ;-) I will try to circumvent this problem
by feeding dkim_header and dkim_body myself. The feature called
"FIXCRLF" looks really promising.

For now I will check out OpenDKIM and probably migrate to this one.
Thanks for your detailed answer.

Received on Sat Mar 13 2010 - 12:52:51 PST

This archive was generated by hypermail 2.3.0 : Mon Oct 29 2012 - 23:19:46 PST