(fix) EAS fix on qp-encoded subjects (#3390)

pull/101/head^2
Ludovic Marcotte 2015-11-25 15:08:24 -05:00
parent 5f54ee09f1
commit faa5d83cf6
2 changed files with 19 additions and 3 deletions

View File

@ -2573,7 +2573,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
NSString *fullName, *email;
const char *bytes;
int i, len;
int i, e, len;
BOOL found_header;
// We get the mail's data
@ -2622,6 +2622,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
{
found_header = YES;
i = i + 2; // \r\n
bytes = bytes + 2;
break;
}
@ -2629,12 +2630,26 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
i++;
}
// We search for the first \r\n AFTER the From: header to get the length of the string to replace.
e = i;
while (e < len)
{
if ((*bytes == '\r') && (*(bytes+1) == '\n'))
{
e = e + 2;
break;
}
bytes++;
e++;
}
// Update/Add the From header in the MIMEBody of the SendMail request.
// Any other way to modify the mail body would break s/mime emails.
if (found_header)
{
// Change the From header
[data replaceBytesInRange: NSMakeRange(i, [[message headerForKey: @"from"] length]+8) // start of the From header found - length of the parsed from-header-value + 8 (From:+\r\n+1)
[data replaceBytesInRange: NSMakeRange(i, (NSUInteger)(e-i))
withBytes: [new_from_header bytes]
length: [new_from_header length]];
}
@ -3160,7 +3175,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
nil]];
#endif
s = [NSString stringWithFormat: @"Date: %@\n%@", value, [theRequest contentAsString]];
s = [NSString stringWithFormat: @"Date: %@\r\n%@", value, [theRequest contentAsString]];
}
else
{

1
NEWS
View File

@ -11,6 +11,7 @@ Enhancements
Bug fixes
- JavaScript exception when printing events from calendars with no assigned color (#3203)
- EAS fix for wrong charset being used (#3392)
- EAS fix on qp-encoded subjects (#3390)
2.3.3a (2015-11-18)
-------------------