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];