mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-08 21:37:15 +00:00
merge of '887c25db6d397495f0b51cedfe52e01f2315a1db'
and 'a830e73fbed57c6ef30ede64ea5bfa6d85af8f74' Monotone-Parent: 887c25db6d397495f0b51cedfe52e01f2315a1db Monotone-Parent: a830e73fbed57c6ef30ede64ea5bfa6d85af8f74 Monotone-Revision: 6d0fa6e2fd8ea58ea9fdb11b3d3140f9f8c58538 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2011-02-03T18:51:16 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
commit
244fab36d6
16 files changed
+185
-113
No files matched your search
@@ -46,7 +46,7 @@ SOGo_HEADER_FILES = \
|
||||
NSURL+DAV.h \
|
||||
\
|
||||
SOGoAuthenticator.h \
|
||||
SOGoSession.h \
|
||||
SOGoSession.h \
|
||||
SOGoCASSession.h \
|
||||
SOGoDAVAuthenticator.h \
|
||||
SOGoProxyAuthenticator.h \
|
||||
@@ -60,6 +60,7 @@ SOGo_HEADER_FILES = \
|
||||
DOMNode+SOGo.h \
|
||||
\
|
||||
WORequest+SOGo.h \
|
||||
WOResourceManager+SOGo.h \
|
||||
WOResponse+SOGo.h \
|
||||
WOContext+SOGo.h
|
||||
|
||||
@@ -123,6 +124,7 @@ SOGo_OBJC_FILES = \
|
||||
DOMNode+SOGo.m \
|
||||
\
|
||||
WORequest+SOGo.m \
|
||||
WOResourceManager+SOGo.m \
|
||||
WOResponse+SOGo.m \
|
||||
WOContext+SOGo.m
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
|
||||
- (id) objectFromJSONString;
|
||||
|
||||
- (NSString *) asCryptString;
|
||||
- (NSString *) asCryptStringUsingSalt: (NSString *) theSalt;
|
||||
- (NSString *) asMD5String;
|
||||
- (NSString *) asSHA1String;
|
||||
|
||||
|
||||
@@ -545,13 +545,13 @@ static NSMutableCharacterSet *safeLDIFStartChars = nil;
|
||||
return object;
|
||||
}
|
||||
|
||||
- (NSString *) asCryptString
|
||||
- (NSString *) asCryptStringUsingSalt: (NSString *) theSalt
|
||||
{
|
||||
char *buf;
|
||||
|
||||
// The salt is weak here, but who cares anyway, crypt should not
|
||||
// be used anymore
|
||||
buf = (char *)crypt([self UTF8String], [self UTF8String]);
|
||||
buf = (char *)crypt([self UTF8String], [theSalt UTF8String]);
|
||||
return [NSString stringWithUTF8String: buf];
|
||||
}
|
||||
|
||||
|
||||
@@ -50,8 +50,7 @@
|
||||
#import "SOGoUserManager.h"
|
||||
#import "SOGoUserProfile.h"
|
||||
#import "SOGoUserSettings.h"
|
||||
|
||||
#import "../../Main/SOGo.h"
|
||||
#import "WOResourceManager+SOGo.h"
|
||||
|
||||
#import "SOGoUser.h"
|
||||
|
||||
@@ -283,12 +282,14 @@
|
||||
NSString *format;
|
||||
SOGoUserDefaults *ud;
|
||||
NSDictionary *locale;
|
||||
WOResourceManager *resMgr;
|
||||
|
||||
dateFormatter = [SOGoDateFormatter new];
|
||||
[dateFormatter autorelease];
|
||||
|
||||
ud = [self userDefaults];
|
||||
locale = [[WOApplication application] localeForLanguageNamed: [ud language]];
|
||||
resMgr = [[WOApplication application] resourceManager];
|
||||
locale = [resMgr localeForLanguageNamed: [ud language]];
|
||||
[dateFormatter setLocale: locale];
|
||||
format = [ud shortDateFormat];
|
||||
if (format)
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
}
|
||||
else if ([_userPasswordAlgorithm caseInsensitiveCompare: @"crypt"] == NSOrderedSame)
|
||||
{
|
||||
return [[plainPassword asCryptString] isEqualToString: encryptedPassword];
|
||||
return [[plainPassword asCryptStringUsingSalt: encryptedPassword] isEqualToString: encryptedPassword];
|
||||
}
|
||||
else if ([_userPasswordAlgorithm caseInsensitiveCompare: @"md5"] == NSOrderedSame)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/* WOResourceManager+SOGo.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011 Inverse inc
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef WORESOURCEMANAGER_SOGO_H
|
||||
#define WORESOURCEMANAGER_SOGO_H
|
||||
|
||||
#import <NGObjWeb/WOResourceManager.h>
|
||||
|
||||
@interface WOResourceManager (SOGoExtensions)
|
||||
|
||||
- (NSDictionary *) localeForLanguageNamed: (NSString *) _name;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* WORESOURCEMANAGER_SOGO_H */
|
||||
@@ -0,0 +1,106 @@
|
||||
/* WOResourceManager+SOGo.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011 Inverse inc
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSData.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
|
||||
#import "WOResourceManager+SOGo.h"
|
||||
|
||||
@implementation WOResourceManager (SOGoExtensions)
|
||||
|
||||
- (NSString *) pathToLocaleForLanguageNamed: (NSString *) _name
|
||||
{
|
||||
static Class MainProduct = Nil;
|
||||
NSString *lpath;
|
||||
|
||||
lpath = [self pathForResourceNamed: @"Locale"
|
||||
inFramework: nil
|
||||
languages: [NSArray arrayWithObject:_name]];
|
||||
if (![lpath length])
|
||||
{
|
||||
if (!MainProduct)
|
||||
{
|
||||
MainProduct = NSClassFromString (@"MainUIProduct");
|
||||
if (!MainProduct)
|
||||
[self errorWithFormat: @"did not find MainUIProduct class!"];
|
||||
}
|
||||
|
||||
lpath = [(id) MainProduct performSelector: NSSelectorFromString (@"pathToLocaleForLanguageNamed:")
|
||||
withObject: _name];
|
||||
if (![lpath length])
|
||||
lpath = nil;
|
||||
}
|
||||
|
||||
return lpath;
|
||||
}
|
||||
|
||||
- (NSDictionary *) localeForLanguageNamed: (NSString *) _name
|
||||
{
|
||||
NSString *lpath;
|
||||
id data;
|
||||
NSDictionary *locale;
|
||||
static NSMutableDictionary *localeLUT = nil;
|
||||
|
||||
locale = nil;
|
||||
if ([_name length] > 0)
|
||||
{
|
||||
if (!localeLUT)
|
||||
localeLUT = [NSMutableDictionary new];
|
||||
|
||||
locale = [localeLUT objectForKey: _name];
|
||||
if (!locale)
|
||||
{
|
||||
lpath = [self pathToLocaleForLanguageNamed:_name];
|
||||
if (lpath)
|
||||
{
|
||||
data = [NSData dataWithContentsOfFile: lpath];
|
||||
if (data)
|
||||
{
|
||||
data = [[[NSString alloc] initWithData: data
|
||||
encoding: NSUTF8StringEncoding] autorelease];
|
||||
locale = [data propertyList];
|
||||
if (locale)
|
||||
[localeLUT setObject: locale forKey: _name];
|
||||
else
|
||||
[self logWithFormat:@"%s couldn't load locale with name:%@",
|
||||
__PRETTY_FUNCTION__,
|
||||
_name];
|
||||
}
|
||||
else
|
||||
[self logWithFormat:@"%s didn't find locale with name: %@",
|
||||
__PRETTY_FUNCTION__,
|
||||
_name];
|
||||
}
|
||||
else
|
||||
[self errorWithFormat:@"did not find locale for language: %@", _name];
|
||||
}
|
||||
}
|
||||
else
|
||||
[self errorWithFormat:@"%s: name parameter must not be nil!",
|
||||
__PRETTY_FUNCTION__];
|
||||
|
||||
return locale;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in new issue
Block a user