[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:       Jan-Oliver Wagner <jan () intevation ! de>
Date:       2002-05-31 17:26:49
[Download RAW message or body]

> 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).

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;
}


-- 
Jan-Oliver Wagner               http://intevation.de/~jan/

Intevation GmbH	              	     http://intevation.de/
FreeGIS	                               http://freegis.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