(fix) improved previous commit for attributes stripping and UID generation (fixes #3695 and #3696)

This commit is contained in:
Ludovic Marcotte
2016-05-27 10:53:16 -04:00
parent 604705960e
commit 875a4aca32
3 changed files with 54 additions and 20 deletions
+27 -1
View File
@@ -1,6 +1,6 @@
/* SOGoUserSettings.m - this file is part of SOGo
*
* Copyright (C) 2009-2014 Inverse inc.
* Copyright (C) 2009-2016 Inverse inc.
*
* 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
@@ -19,9 +19,11 @@
*/
#import <Foundation/NSDictionary.h>
#import <Foundation/NSProcessInfo.h>
#import <Foundation/NSString.h>
#import "SOGoUserProfile.h"
#import "NSString+Crypto.h"
#import "SOGoUserSettings.h"
@@ -68,4 +70,28 @@ static Class SOGoUserProfileKlass = Nil;
return [self _subscribedFoldersForModule: @"Contacts"];
}
- (NSString *) userSalt
{
NSMutableDictionary *values;
NSString *salt;
salt = [[self dictionaryForKey: @"General"] objectForKey: @"Salt"];
if (!salt)
{
salt = [[[NSProcessInfo processInfo] globallyUniqueString] asSHA1String];
values = [self objectForKey: @"General"];
if (!values)
values = [NSMutableDictionary dictionary];
[values setObject: salt forKey: @"Salt"];
[self setObject: values forKey: @"General"];
[self synchronize];
}
return salt;
}
@end