diff --git a/ChangeLog b/ChangeLog index 4e14e7c09..ee2925b70 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ * Modified all tools to NOT check for SOGoUserSources as it'll break if we are in multi-domain with no master sources defined. + * Modified SOGoAuthenticator: -imapPasswordInContext: ... + to pass the server URL and not the host particle in order + to determine if we are using SSL or not. 2011-02-15 Ludovic Marcotte diff --git a/OpenChange/MAPIStoreAuthenticator.h b/OpenChange/MAPIStoreAuthenticator.h index 663d6d8ec..985de43b5 100644 --- a/OpenChange/MAPIStoreAuthenticator.h +++ b/OpenChange/MAPIStoreAuthenticator.h @@ -1,3 +1,4 @@ + /* MAPIStoreAuthenticator.h - this file is part of SOGo * * Copyright (C) 2010 Inverse inc. @@ -26,6 +27,7 @@ #import @class NSString; +@class NSURL; @class WOContext; @@ -41,7 +43,7 @@ - (void) setPassword: (NSString *) newPassword; - (NSString *) imapPasswordInContext: (WOContext *) context - forServer: (NSString *) imapServer + forURL: (NSURL *) server forceRenew: (BOOL) renew; @end diff --git a/OpenChange/MAPIStoreAuthenticator.m b/OpenChange/MAPIStoreAuthenticator.m index 36ea7d633..023a68e83 100644 --- a/OpenChange/MAPIStoreAuthenticator.m +++ b/OpenChange/MAPIStoreAuthenticator.m @@ -21,6 +21,7 @@ */ #import +#import #import #import @@ -58,7 +59,7 @@ } - (NSString *) imapPasswordInContext: (WOContext *) context - forServer: (NSString *) imapServer + forURL: (NSURL *) server forceRenew: (BOOL) renew { NSString *imapPassword; diff --git a/SoObjects/Mailer/SOGoMailAccount.m b/SoObjects/Mailer/SOGoMailAccount.m index d87c86fa2..8b8112742 100644 --- a/SoObjects/Mailer/SOGoMailAccount.m +++ b/SoObjects/Mailer/SOGoMailAccount.m @@ -645,7 +645,7 @@ static NSString *sieveScriptName = @"sogo"; password = [[self authenticatorInContext: context] imapPasswordInContext: context - forServer: [imapURL host] + forURL: imapURL forceRenew: renewed]; if (!password) [self errorWithFormat: @"no IMAP4 password available"]; diff --git a/SoObjects/SOGo/SOGoAuthenticator.h b/SoObjects/SOGo/SOGoAuthenticator.h index 0b37c87fa..46c4395af 100644 --- a/SoObjects/SOGo/SOGoAuthenticator.h +++ b/SoObjects/SOGo/SOGoAuthenticator.h @@ -1,6 +1,6 @@ /* SOGoAuthenticator.h - this file is part of SOGo * - * Copyright (C) 2007-2010 Inverse inc. + * Copyright (C) 2007-2011 Inverse inc. * * Author: Wolfgang Sourdeau * @@ -34,7 +34,7 @@ - (NSString *) passwordInContext: (WOContext *) context; - (SOGoUser *) userInContext: (WOContext *) context; - (NSString *) imapPasswordInContext: (WOContext *) context - forServer: (NSString *) imapServer + forURL: (NSURL *) server forceRenew: (BOOL) renew; @end diff --git a/SoObjects/SOGo/SOGoDAVAuthenticator.m b/SoObjects/SOGo/SOGoDAVAuthenticator.m index 89684cec2..0bd11e18d 100644 --- a/SoObjects/SOGo/SOGoDAVAuthenticator.m +++ b/SoObjects/SOGo/SOGoDAVAuthenticator.m @@ -22,6 +22,7 @@ #import #import +#import #import #import @@ -102,13 +103,13 @@ } - (NSString *) imapPasswordInContext: (WOContext *) context - forServer: (NSString *) imapServer + forURL: (NSURL *) server forceRenew: (BOOL) renew { - SOGoSystemDefaults *sd; + NSString *password, *service, *scheme; SOGoCASSession *session; - NSString *password, *service; - + SOGoSystemDefaults *sd; + password = [self passwordInContext: context]; if ([password length]) { @@ -117,7 +118,15 @@ { session = [SOGoCASSession CASSessionWithTicket: password fromProxy: YES]; - service = [NSString stringWithFormat: @"imap://%@", imapServer]; + + // We must NOT assume the scheme exists + scheme = [server scheme]; + + if (!scheme) + scheme = @"imap"; + + service = [NSString stringWithFormat: @"%@://%@", scheme, [server host]]; + if (renew) [session invalidateTicketForService: service]; password = [session ticketForService: service]; diff --git a/SoObjects/SOGo/SOGoProxyAuthenticator.m b/SoObjects/SOGo/SOGoProxyAuthenticator.m index 93df9d43d..08825fe98 100644 --- a/SoObjects/SOGo/SOGoProxyAuthenticator.m +++ b/SoObjects/SOGo/SOGoProxyAuthenticator.m @@ -139,7 +139,7 @@ } - (NSString *) imapPasswordInContext: (WOContext *) context - forServer: (NSString *) imapServer + forURL: (NSURL *) server forceRenew: (BOOL) renew { return (renew ? nil : [self passwordInContext: context]); diff --git a/SoObjects/SOGo/SOGoWebAuthenticator.m b/SoObjects/SOGo/SOGoWebAuthenticator.m index 9b202649f..8cd998c6e 100644 --- a/SoObjects/SOGo/SOGoWebAuthenticator.m +++ b/SoObjects/SOGo/SOGoWebAuthenticator.m @@ -23,6 +23,7 @@ #import #import #import +#import #import #import @@ -209,13 +210,13 @@ - (NSString *) imapPasswordInContext: (WOContext *) context - forServer: (NSString *) imapServer + forURL: (NSURL *) server forceRenew: (BOOL) renew { - SOGoSystemDefaults *sd; + NSString *password, *service, *scheme; SOGoCASSession *session; - NSString *password, *service; - + SOGoSystemDefaults *sd; + password = [self passwordInContext: context]; if ([password length]) { @@ -224,7 +225,15 @@ { session = [SOGoCASSession CASSessionWithIdentifier: password fromProxy: NO]; - service = [NSString stringWithFormat: @"imap://%@", imapServer]; + + // We must NOT assume the scheme exists + scheme = [server scheme]; + + if (!scheme) + scheme = @"imap"; + + service = [NSString stringWithFormat: @"%@://%@", scheme, [server host]]; + if (renew) [session invalidateTicketForService: service]; password = [session ticketForService: service];