From 53e125bd7a99d3a09598c0a0615f2aee072ae6ee Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Wed, 16 Nov 2011 15:13:53 +0000 Subject: [PATCH] See ChangeLog Monotone-Parent: 92cceaf860bbf56d983063471093858a3871ec23 Monotone-Revision: e38c570559610854b85c2c517053417779a76964 Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2011-11-16T15:13:53 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 5 +++++ SoObjects/SOGo/SOGoSieveManager.m | 22 ++++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index e00378f4f..1f0ab2025 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-11-16 Ludovic Marcotte + + * SoObjects/SOGo/SOGoSieveManager.m (-updateFiltersForLogin:...) + We now handle connection exceptions to avoid crashing sogod. + 2011-11-13 Wolfgang Sourdeau * OpenChange/MAPIStoreContactsMessage.m (-getPrBody:inMemCtx:): diff --git a/SoObjects/SOGo/SOGoSieveManager.m b/SoObjects/SOGo/SOGoSieveManager.m index 62c91f980..4f32f969e 100644 --- a/SoObjects/SOGo/SOGoSieveManager.m +++ b/SoObjects/SOGo/SOGoSieveManager.m @@ -629,7 +629,7 @@ static NSString *sieveScriptName = @"sogo"; NGSieveClient *client; NSString *filterScript, *v, *sieveServer; int sievePort; - BOOL b; + BOOL b, connected; dd = [user domainDefaults]; if (!([dd sieveScriptsEnabled] || [dd vacationEnabled] || [dd forwardEnabled])) @@ -637,6 +637,8 @@ static NSString *sieveScriptName = @"sogo"; req = [NSMutableArray arrayWithCapacity: 15]; ud = [user userDefaults]; + + connected = YES; b = NO; script = [NSMutableString string]; @@ -793,7 +795,23 @@ static NSString *sieveScriptName = @"sogo"; [client closeConnection]; return NO; } - result = [client login: theLogin authname: theAuthName password: thePassword]; + + NS_DURING + { + result = [client login: theLogin authname: theAuthName password: thePassword]; + } + NS_HANDLER + { + connected = NO; + } + NS_ENDHANDLER + + if (!connected) + { + NSLog(@"Sieve connection failed on %@", [address description]); + return NO; + } + if (![[result valueForKey:@"result"] boolValue]) { NSLog(@"failure. Attempting with a renewed password (no authname supported)"); thePassword = [theAccount imap4PasswordRenewed: YES];