View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0002806 | SOGo | ActiveSync | public | 2014-06-07 22:10 | 2014-06-09 13:35 |
| Reporter | tfu | Assigned To | ludovic | ||
| Priority | normal | Severity | crash | Reproducibility | always |
| Status | resolved | Resolution | fixed | ||
| Product Version | 2.2.4 | ||||
| Target Version | 2.2.6 | Fixed in Version | 2.2.6 | ||
| Summary | 0002806: sogod crash (signal 6) when unflagging a mail | ||||
| Description | sogod crashes with signal 6 when unflagging a previously flagged mail: 2014-06-07 23:46:38.794 sogod[15394] -[WEClientCapabilities initWithRequest:]: Unknown WebClient: user-agent='Android-EAS/3.10.000.084109.166' Reproduced the issue on several android devices. | ||||
| Steps To Reproduce | Flag a mail | ||||
| Tags | No tags attached. | ||||
|
0001-Signal6onUnflag.patch (3,342 bytes)
From f83454d02eb3e79d2d7fa53b5fcdfd02ca6b33f8 Mon Sep 17 00:00:00 2001
From: root <root@example.com>
Date: Sat, 7 Jun 2014 23:57:12 +0200
Subject: [PATCH] Signal6onUnflag
---
ActiveSync/SOGoActiveSyncDispatcher.m | 1 +
ActiveSync/SOGoMailObject+ActiveSync.m | 22 ++++++++++++++++------
SoObjects/Mailer/SOGoMailObject.h | 1 +
SoObjects/Mailer/SOGoMailObject.m | 5 +++++
4 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/ActiveSync/SOGoActiveSyncDispatcher.m b/ActiveSync/SOGoActiveSyncDispatcher.m
index 63e4b54..9c52d79 100644
--- a/ActiveSync/SOGoActiveSyncDispatcher.m
+++ b/ActiveSync/SOGoActiveSyncDispatcher.m
@@ -848,6 +848,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
uids = [currentCollection fetchUIDsMatchingQualifier: qualifier
sortOrdering: @"REVERSE ARRIVAL"
threaded: NO];
+
count = [uids count];
}
else
diff --git a/ActiveSync/SOGoMailObject+ActiveSync.m b/ActiveSync/SOGoMailObject+ActiveSync.m
index 7b0a008..e5c5790 100644
--- a/ActiveSync/SOGoMailObject+ActiveSync.m
+++ b/ActiveSync/SOGoMailObject+ActiveSync.m
@@ -761,7 +761,7 @@ struct GlobalObjectId {
// Flags
[s appendString: @"<Flag xmlns=\"Email:\">"];
- [s appendFormat: @"<FlagStatus>%d</FlagStatus>", 0];
+ [s appendFormat: @"<FlagStatus>%d</FlagStatus>", ([self flagged] ? 2 : 0)];
[s appendString: @"</Flag>"];
// FIXME - support these in the future
@@ -799,12 +799,22 @@ struct GlobalObjectId {
if ((o = [theValues objectForKey: @"Flag"]))
{
- o = [o objectForKey: @"FlagStatus"];
-
- if ([o intValue])
- [self addFlags: @"\\Flagged"];
+ // handle empty flags -> {Flag = ""; }
+ if (([o isKindOfClass: [NSMutableDictionary class]])) {
+ if ((o = [o objectForKey: @"FlagStatus"])) {
+ // 0 = The flag is cleared.
+ // 1 = The status is set to complete.
+ // 2 = The status is set to active.
+ if (([o isEqualToString: @"2"])) {
+ [self addFlags: @"\\Flagged"];
+ }
+ else {
+ [self removeFlags: @"\\Flagged"];
+ }
+ }
+ }
else
- [self removeFlags: @"\\Flagged"];
+ [self removeFlags: @"\\Flagged"];
}
if ((o = [theValues objectForKey: @"Read"]))
diff --git a/SoObjects/Mailer/SOGoMailObject.h b/SoObjects/Mailer/SOGoMailObject.h
index 46c1d7c..af52334 100644
--- a/SoObjects/Mailer/SOGoMailObject.h
+++ b/SoObjects/Mailer/SOGoMailObject.h
@@ -114,6 +114,7 @@ NSArray *SOGoMailCoreInfoKeys;
- (NSException *) removeFlags:(id)_f;
- (BOOL) isNewMail; /* \Recent */
+- (BOOL) flagged; /* \Flagged */
- (BOOL) read; /* \Unseen */
- (BOOL) replied; /* \Answered */
- (BOOL) forwarded; /* $forwarded */
diff --git a/SoObjects/Mailer/SOGoMailObject.m b/SoObjects/Mailer/SOGoMailObject.m
index f2fa35e..f99bcf4 100644
--- a/SoObjects/Mailer/SOGoMailObject.m
+++ b/SoObjects/Mailer/SOGoMailObject.m
@@ -1464,6 +1464,11 @@ static BOOL debugSoParts = NO;
return [self _hasFlag: @"seen"];
}
+- (BOOL) flagged
+{
+ return [self _hasFlag: @"flagged"];
+}
+
- (BOOL) replied
{
return [self _hasFlag: @"answered"];
--
1.7.9.5
|
|
|
On my end, I don't get a crash when setting/clearings flags on IMAP messages: Breakpoint 2, -[SOGoMailObject(ActiveSync) takeActiveSyncValues:inContext:] (self=0x555556362970, _cmd=0x7fffea1103b0, theValues=0x55555635db50, _context=0x5555561ff2d0) Are you sure you don't have changes in NGDOMElement+ActiveSync.m? |
|
|
I can repoduce it on e.g. htc desire. It sends |
|
|
Ok, so the client sends "broken" content. We should indeed handle this better. I'll apply the patch and add some comments in the code. |
|
|
Patch applied: https://github.com/inverse-inc/sogo/commit/f48839bf55917cb3a9756134930206b7b15d0279 Nice catch! |
|
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2014-06-07 22:10 | tfu | New Issue | |
| 2014-06-07 22:10 | tfu | File Added: 0001-Signal6onUnflag.patch | |
| 2014-06-09 12:50 | ludovic | Note Added: 0007160 | |
| 2014-06-09 13:23 | tfu | Note Added: 0007162 | |
| 2014-06-09 13:29 | ludovic | Note Added: 0007164 | |
| 2014-06-09 13:34 | ludovic | Target Version | => 2.2.6 |
| 2014-06-09 13:35 | ludovic | Note Added: 0007165 | |
| 2014-06-09 13:35 | ludovic | Status | new => resolved |
| 2014-06-09 13:35 | ludovic | Fixed in Version | => 2.2.6 |
| 2014-06-09 13:35 | ludovic | Resolution | open => fixed |
| 2014-06-09 13:35 | ludovic | Assigned To | => ludovic |