From 43e96ef7b9afe3a9ce693a2917836f337af76f2d Mon Sep 17 00:00:00 2001 From: helge Date: Mon, 14 Feb 2005 11:37:09 +0000 Subject: [PATCH] changed pwd encoding in Sieve client (OGo bug #1228) git-svn-id: http://svn.opengroupware.org/SOPE/trunk@556 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-core/NGExtensions/ChangeLog | 5 +++++ sope-core/NGExtensions/NGBase64Coding.m | 19 +++++++++++-------- .../NGExtensions/NGBase64Coding.h | 4 +++- sope-core/NGExtensions/Version | 2 +- sope-mime/ChangeLog | 5 +++++ sope-mime/NGImap4/ChangeLog | 5 +++++ sope-mime/NGImap4/NGSieveClient.m | 2 +- sope-mime/Version | 5 +++-- 8 files changed, 34 insertions(+), 13 deletions(-) diff --git a/sope-core/NGExtensions/ChangeLog b/sope-core/NGExtensions/ChangeLog index 45213e0e..416b9b76 100644 --- a/sope-core/NGExtensions/ChangeLog +++ b/sope-core/NGExtensions/ChangeLog @@ -1,3 +1,8 @@ +2005-02-14 Helge Hess + + * NGBase64Coding.m: added method -dataByEncodingBase64WithLineLength: + to support the fix for OGo bug #1228 (v4.5.146) + 2005-02-12 Marcus Mueller * NGCalendarDateRange.[hm]: new method -duration (v4.5.145) diff --git a/sope-core/NGExtensions/NGBase64Coding.m b/sope-core/NGExtensions/NGBase64Coding.m index 2105406f..3146101d 100644 --- a/sope-core/NGExtensions/NGBase64Coding.m +++ b/sope-core/NGExtensions/NGBase64Coding.m @@ -57,7 +57,7 @@ static int NSStringMaxLineWidth = 1024; return @""; destSize = (len + 2) / 3 * 4; // 3:4 conversion ratio - destSize += destSize / NSStringMaxLineWidth + 2; // space for newlines and '\0' + destSize += destSize / NSStringMaxLineWidth + 2; // space for '\n' and '\0' destSize += 64; dest = malloc(destSize + 4); if (dest == NULL) return nil; @@ -162,9 +162,10 @@ static int NSStringMaxLineWidth = 1024; @implementation NSData(Base64Coding) +// TODO: explain that size (which RFC specifies that?) static int NSDataMaxLineWidth = 72; -- (NSData *)dataByEncodingBase64 { +- (NSData *)dataByEncodingBase64WithLineLength:(unsigned)_lineLength { unsigned len; size_t destSize; size_t destLength = -1; @@ -174,7 +175,7 @@ static int NSDataMaxLineWidth = 72; return [NSData data]; destSize = (len + 2) / 3 * 4; // 3:4 conversion ratio - destSize += destSize / NSDataMaxLineWidth + 2; // space for newlines and '\0' + destSize += destSize / _lineLength + 2; // space for newlines and '\0' destSize += 64; dest = malloc(destSize + 4); @@ -183,13 +184,15 @@ static int NSDataMaxLineWidth = 72; NSAssert(dest, @"invalid buffer .."); if (encode_base64([self bytes], len, - dest, destSize, &destLength, NSDataMaxLineWidth) == 0) { + dest, destSize, &destLength, _lineLength) == 0) { return [NSData dataWithBytesNoCopy:dest length:destLength]; } - else { - if (dest) free((void *)dest); - return nil; - } + + if (dest != NULL) free((void *)dest); + return nil; +} +- (NSData *)dataByEncodingBase64 { + return [self dataByEncodingBase64WithLineLength:NSDataMaxLineWidth]; } - (NSData *)dataByDecodingBase64 { diff --git a/sope-core/NGExtensions/NGExtensions/NGBase64Coding.h b/sope-core/NGExtensions/NGExtensions/NGBase64Coding.h index 3d11f07b..746c17af 100644 --- a/sope-core/NGExtensions/NGExtensions/NGBase64Coding.h +++ b/sope-core/NGExtensions/NGExtensions/NGBase64Coding.h @@ -45,11 +45,13 @@ @interface NSData(Base64Coding) -- (NSData *)dataByEncodingBase64; +- (NSData *)dataByEncodingBase64; /* Note: inserts '\n' every 72 chars */ - (NSData *)dataByDecodingBase64; - (NSString *)stringByEncodingBase64; - (NSString *)stringByDecodingBase64; +- (NSData *)dataByEncodingBase64WithLineLength:(unsigned)_lineLength; + @end /* diff --git a/sope-core/NGExtensions/Version b/sope-core/NGExtensions/Version index 1b28f6da..476d3073 100644 --- a/sope-core/NGExtensions/Version +++ b/sope-core/NGExtensions/Version @@ -1,6 +1,6 @@ # version -SUBMINOR_VERSION:=145 +SUBMINOR_VERSION:=146 # v4.3.115 requires libFoundation v1.0.59 # v4.2.72 requires libEOControl v4.2.39 diff --git a/sope-mime/ChangeLog b/sope-mime/ChangeLog index aeaf6f9f..0bf8627f 100644 --- a/sope-mime/ChangeLog +++ b/sope-mime/ChangeLog @@ -1,3 +1,8 @@ +2005-02-14 Helge Hess + + * NGImap4: changed base64 encoding in Sieve client to fix OGo bug #1228 + (v4.5.214) + 2005-02-12 Helge Hess * NGImap4: reworked qualifier generation, fixed handling of OR diff --git a/sope-mime/NGImap4/ChangeLog b/sope-mime/NGImap4/ChangeLog index 672d3273..05ae3f40 100644 --- a/sope-mime/NGImap4/ChangeLog +++ b/sope-mime/NGImap4/ChangeLog @@ -1,3 +1,8 @@ +2005-02-14 Helge Hess + + * NGSieveClient.m: encode base64 with a large line break to fix OGo + bug #1228 + 2005-02-12 Helge Hess * EOQualifier+IMAPAdditions.m: more reworks in qualifier generation, diff --git a/sope-mime/NGImap4/NGSieveClient.m b/sope-mime/NGImap4/NGSieveClient.m index 1f4c673a..547c23ae 100644 --- a/sope-mime/NGImap4/NGSieveClient.m +++ b/sope-mime/NGImap4/NGSieveClient.m @@ -311,7 +311,7 @@ static BOOL debugImap4 = NO; buf[logLen * 2 + 1] = '\0'; auth = [NSData dataWithBytesNoCopy:buf length:bufLen]; - auth = [auth dataByEncodingBase64]; + auth = [auth dataByEncodingBase64WithLineLength:4096 /* 'unlimited' */]; if (LOG_PASSWORD) { NSString *s; diff --git a/sope-mime/Version b/sope-mime/Version index f1a8c404..8f5d80cb 100644 --- a/sope-mime/Version +++ b/sope-mime/Version @@ -2,6 +2,7 @@ MAJOR_VERSION:=4 MINOR_VERSION:=5 -SUBMINOR_VERSION:=213 +SUBMINOR_VERSION:=214 -# v4.2.149 requires libNGStreams v4.2.34 +# v4.5.214 requires libNGExtensions v4.5.146 +# v4.2.149 requires libNGStreams v4.2.34 -- 2.39.5