See ChangeLog

Monotone-Parent: 0ba5dc28795d933db244f667ecc927420db2ab60
Monotone-Revision: 44974f9cbdca49b2868f64f007241c5a79656662

Monotone-Author: ludovic@Sophos.ca
Monotone-Date: 2010-06-28T20:40:07
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Ludovic Marcotte 2010-06-28 20:40:07 +00:00
parent 11665b2024
commit 8d12bd2ff6
2 changed files with 56 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2010-06-28 Ludovic Marcotte <lmarcotte@inverse.ca>
* SOPE/sope-patchset-r1664.diff
Fixed the LF/CRLF encoding issue in NGSmtpClient.m
2010-06-28 Francis Lachapelle <flachapelle@inverse.ca>
* UI/Contacts/UIxContactEditor.m (-initSnapshot, -_saveSnapshot):

View File

@ -4001,6 +4001,57 @@ Index: sope-mime/NGMail/NGSmtpClient.m
if ([reply isPositive]) {
if ([reply code] != NGSmtpActionCompleted) {
NSLog(@"SMTP(RCPT TO): expected reply code %i, got code %i ..",
@@ -507,6 +522,10 @@
NGSmtpResponse *reply = nil;
NSMutableData *cleaned_data;
NSRange r1, r2;
+
+ const char *bytes;
+ char *mbytes;
+ int len, mlen;
[self requireState:NGSmtpState_TRANSACTION];
@@ -519,8 +538,38 @@
}
[self->text flush];
- cleaned_data = [NSMutableData dataWithData: _data];
+ //
+ // SOPE sucks in many ways and that is one of them. The headers are actually
+ // correctly encoded (trailing \r\n is inserted) but not the base64 encoded
+ // data since it uses GNUstep's dataByEncodingBase64 function which says:
+ //
+ // NGBase64Coding.h:- (NSData *)dataByEncodingBase64; /* Note: inserts '\n' every 72 chars */
+ //
+ len = [_data length];
+ mlen = 0;
+ cleaned_data = [NSMutableData dataWithLength: len*2];
+
+ bytes = [_data bytes];
+ mbytes = [cleaned_data mutableBytes];
+
+ while (len > 0)
+ {
+ if (*bytes == '\n' && *(bytes-1) != '\r' && mlen > 0)
+ {
+ *mbytes = '\r';
+ mbytes++;
+ mlen++;
+ }
+
+ *mbytes = *bytes;
+ mbytes++; bytes++;
+ len--;
+ mlen++;
+ }
+
+ [cleaned_data setLength: mlen];
+
//
// According to RFC 2821 section 4.5.2, we must check for the character
// sequence "<CRLF>.<CRLF>"; any occurrence have its period duplicated
Index: sope-mime/NGMail/NGMailAddressParser.h
===================================================================
--- sope-mime/NGMail/NGMailAddressParser.h (revision 1664)