See ChangeLog

Monotone-Parent: 66896b19ddd5c88878bd3dc798a5ac3efee18a48
Monotone-Revision: 392bdd6ba9c324042c23ae3d8e26d2d328da895f

Monotone-Author: ludovic@Sophos.ca
Monotone-Date: 2011-02-17T20:55:19
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Ludovic Marcotte 2011-02-17 20:55:19 +00:00
parent 7e101767f8
commit 4ec6ab9f12
8 changed files with 40 additions and 16 deletions

View File

@ -3,6 +3,9 @@
* Modified all tools to NOT check for SOGoUserSources * Modified all tools to NOT check for SOGoUserSources
as it'll break if we are in multi-domain with no as it'll break if we are in multi-domain with no
master sources defined. 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 <lmarcotte@inverse.ca> 2011-02-15 Ludovic Marcotte <lmarcotte@inverse.ca>

View File

@ -1,3 +1,4 @@
/* MAPIStoreAuthenticator.h - this file is part of SOGo /* MAPIStoreAuthenticator.h - this file is part of SOGo
* *
* Copyright (C) 2010 Inverse inc. * Copyright (C) 2010 Inverse inc.
@ -26,6 +27,7 @@
#import <Foundation/NSObject.h> #import <Foundation/NSObject.h>
@class NSString; @class NSString;
@class NSURL;
@class WOContext; @class WOContext;
@ -41,7 +43,7 @@
- (void) setPassword: (NSString *) newPassword; - (void) setPassword: (NSString *) newPassword;
- (NSString *) imapPasswordInContext: (WOContext *) context - (NSString *) imapPasswordInContext: (WOContext *) context
forServer: (NSString *) imapServer forURL: (NSURL *) server
forceRenew: (BOOL) renew; forceRenew: (BOOL) renew;
@end @end

View File

@ -21,6 +21,7 @@
*/ */
#import <Foundation/NSArray.h> #import <Foundation/NSArray.h>
#import <Foundation/NSURL.h>
#import <SOGo/SOGoUser.h> #import <SOGo/SOGoUser.h>
#import <SOGo/SOGoPermissions.h> #import <SOGo/SOGoPermissions.h>
@ -58,7 +59,7 @@
} }
- (NSString *) imapPasswordInContext: (WOContext *) context - (NSString *) imapPasswordInContext: (WOContext *) context
forServer: (NSString *) imapServer forURL: (NSURL *) server
forceRenew: (BOOL) renew forceRenew: (BOOL) renew
{ {
NSString *imapPassword; NSString *imapPassword;

View File

@ -645,7 +645,7 @@ static NSString *sieveScriptName = @"sogo";
password = [[self authenticatorInContext: context] password = [[self authenticatorInContext: context]
imapPasswordInContext: context imapPasswordInContext: context
forServer: [imapURL host] forURL: imapURL
forceRenew: renewed]; forceRenew: renewed];
if (!password) if (!password)
[self errorWithFormat: @"no IMAP4 password available"]; [self errorWithFormat: @"no IMAP4 password available"];

View File

@ -1,6 +1,6 @@
/* SOGoAuthenticator.h - this file is part of SOGo /* SOGoAuthenticator.h - this file is part of SOGo
* *
* Copyright (C) 2007-2010 Inverse inc. * Copyright (C) 2007-2011 Inverse inc.
* *
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca> * Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* *
@ -34,7 +34,7 @@
- (NSString *) passwordInContext: (WOContext *) context; - (NSString *) passwordInContext: (WOContext *) context;
- (SOGoUser *) userInContext: (WOContext *) context; - (SOGoUser *) userInContext: (WOContext *) context;
- (NSString *) imapPasswordInContext: (WOContext *) context - (NSString *) imapPasswordInContext: (WOContext *) context
forServer: (NSString *) imapServer forURL: (NSURL *) server
forceRenew: (BOOL) renew; forceRenew: (BOOL) renew;
@end @end

View File

@ -22,6 +22,7 @@
#import <Foundation/NSArray.h> #import <Foundation/NSArray.h>
#import <Foundation/NSString.h> #import <Foundation/NSString.h>
#import <Foundation/NSURL.h>
#import <NGObjWeb/WOContext.h> #import <NGObjWeb/WOContext.h>
#import <NGObjWeb/WORequest.h> #import <NGObjWeb/WORequest.h>
@ -102,13 +103,13 @@
} }
- (NSString *) imapPasswordInContext: (WOContext *) context - (NSString *) imapPasswordInContext: (WOContext *) context
forServer: (NSString *) imapServer forURL: (NSURL *) server
forceRenew: (BOOL) renew forceRenew: (BOOL) renew
{ {
SOGoSystemDefaults *sd; NSString *password, *service, *scheme;
SOGoCASSession *session; SOGoCASSession *session;
NSString *password, *service; SOGoSystemDefaults *sd;
password = [self passwordInContext: context]; password = [self passwordInContext: context];
if ([password length]) if ([password length])
{ {
@ -117,7 +118,15 @@
{ {
session = [SOGoCASSession CASSessionWithTicket: password session = [SOGoCASSession CASSessionWithTicket: password
fromProxy: YES]; 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) if (renew)
[session invalidateTicketForService: service]; [session invalidateTicketForService: service];
password = [session ticketForService: service]; password = [session ticketForService: service];

View File

@ -139,7 +139,7 @@
} }
- (NSString *) imapPasswordInContext: (WOContext *) context - (NSString *) imapPasswordInContext: (WOContext *) context
forServer: (NSString *) imapServer forURL: (NSURL *) server
forceRenew: (BOOL) renew forceRenew: (BOOL) renew
{ {
return (renew ? nil : [self passwordInContext: context]); return (renew ? nil : [self passwordInContext: context]);

View File

@ -23,6 +23,7 @@
#import <Foundation/NSArray.h> #import <Foundation/NSArray.h>
#import <Foundation/NSCalendarDate.h> #import <Foundation/NSCalendarDate.h>
#import <Foundation/NSString.h> #import <Foundation/NSString.h>
#import <Foundation/NSURL.h>
#import <NGObjWeb/SoDefaultRenderer.h> #import <NGObjWeb/SoDefaultRenderer.h>
#import <NGObjWeb/WOApplication.h> #import <NGObjWeb/WOApplication.h>
@ -209,13 +210,13 @@
- (NSString *) imapPasswordInContext: (WOContext *) context - (NSString *) imapPasswordInContext: (WOContext *) context
forServer: (NSString *) imapServer forURL: (NSURL *) server
forceRenew: (BOOL) renew forceRenew: (BOOL) renew
{ {
SOGoSystemDefaults *sd; NSString *password, *service, *scheme;
SOGoCASSession *session; SOGoCASSession *session;
NSString *password, *service; SOGoSystemDefaults *sd;
password = [self passwordInContext: context]; password = [self passwordInContext: context];
if ([password length]) if ([password length])
{ {
@ -224,7 +225,15 @@
{ {
session = [SOGoCASSession CASSessionWithIdentifier: password session = [SOGoCASSession CASSessionWithIdentifier: password
fromProxy: NO]; 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) if (renew)
[session invalidateTicketForService: service]; [session invalidateTicketForService: service];
password = [session ticketForService: service]; password = [session ticketForService: service];