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

List:       kmail-devel
Subject:    Re: Fwd: Somebody inserting additional newlines into mail before sending?
From:       Karl-Heinz Zimmer <khz () kde ! org>
Date:       2002-05-31 18:43:03
[Download RAW message or body]

Hi Jan!

On Friday 31 May 2002 19:26, Jan-Oliver Wagner wrote:
> > From: Karl-Heinz Zimmer <khz@kde.org>
> >
> > the following phenomenon causes troubles when trying to verify
> > Multipart/Signed messages (or message parts, resp.) created by
> > KMail if they include one or more attachment(s):
>
> I am not a KDE programmer and I haven't quite understood mimelib,
> but it may be that I have sorted out the problem (sorry no diff prepared).
> Please give me feeback whether this is nonsense soon as it is a serious
> bug. (I have tested this with the kmail/mimelib version right before
> Karl-Heinz work-around).

Thanks for your patch, it solves the problem, I comitted entity.cpp
and took back my patch of kmail/kmcomposewin.cpp accordingly.

Cheers,
Karl-Heinz

> Here is the function I changed in kdenetwork/mimelib/entity.cpp:
>
> void DwEntity::Assemble()
> {
>     if (!mIsModified) return;
>     mBody->Assemble();
>     mHeaders->Assemble();
>     mString = "";
>     mString += mHeaders->AsString();
>
>     int len = mString.length();
> #if defined(DW_EOL_CRLF)
>     if (len>=3 && (mString[len-1]!='\n' || mString[len-3]!='\n'))
> #else
>     if (len>=2 && (mString[len-1]!='\n' || mString[len-2]!='\n'))
> #endif
>     {
> 	  if (mHeaders->HasContentType() &&
> 	      (mHeaders->ContentType().Type() == DwMime::kTypeMultipart) &&
> 	      (mHeaders->ContentType().Subtype() == DwMime::kSubtypeMixed))
> 		{
> 		    /* this is the case when we should not add an DW_EOL since
> 			   another newline is already added by DwBody::Assemble()
> 			   right before a boundary string.
> 			   Why is this bad for multipart-mixed? Well, multipart-
> 			   mixed can be part of a multipart-signed and an additional
> 			   empty line makes the mail invalid for a verification
> 			   (the signature was computed based on the same content,
> 			   but with a single newline).
> 			   It is very likely, that for multipart _in general_, there
> 			   should not be 2 newlines. In that case we might
>                drop the Subtype-test.
> 			   */
> 		}
> 	  else
>         mString += DW_EOL;
>     }
>     mString += mBody->AsString();
>     mIsModified = 0;
> }

-- 
Karl-Heinz Zimmer, Senior Software Engineer, Klarälvdalens Datakonsult AB
<mailto:khz@klaralvdalens-datakonsult.se>            <mailto:khz@kde.org>

_______________________________________________
KMail Developers mailing list
kmail@mail.kde.org
http://mail.kde.org/mailman/listinfo/kmail
[prev in list] [next in list] [prev in thread] [next in thread] 

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