See ChangeLog

Monotone-Parent: e1db6c4ec1e7a829a4976be2bd87d40d1d0a5d5f
Monotone-Revision: ada8e59dc2acdffd7634acc70f3387a0f8e4e671

Monotone-Author: ludovic@Sophos.ca
Monotone-Date: 2010-12-09T18:56:03
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Ludovic Marcotte
2010-12-09 18:56:03 +00:00
parent d87c24ccdc
commit 4cdb010230
3 changed files with 25 additions and 1 deletions
+5
View File
@@ -1,3 +1,8 @@
2010-12-09 Ludovic Marcotte <lmarcotte@inverse.ca>
* SoObject/SOGo/SQLSource.m - added SHA password
hash support for SQL authentication sources.
2010-12-08 Francis Lachapelle <flachapelle@inverse.ca>
* UI/WebServerResources/MailerUI.js (onMenuEmptyTrashCallback):
Binary file not shown.
+20 -1
View File
@@ -25,6 +25,7 @@
#include <openssl/evp.h>
#include <openssl/md5.h>
#include <openssl/sha.h>
#import <Foundation/NSArray.h>
#import <Foundation/NSObject.h>
@@ -50,7 +51,7 @@
*
* c_uid - will be used for authentication - it's a username or username@domain.tld)
* c_name - which can be identical to c_uid - will be used to uniquely identify entries)
* c_password - password of the user, plain-text or md5 encoded for now
* c_password - password of the user, plain-text, md5 or sha encoded for now
* c_cn - the user's common name
* mail - the user's mail address
*
@@ -170,6 +171,24 @@
s = [NSString stringWithUTF8String: buf];
return [s isEqualToString: encryptedPassword];
}
else if ([_userPasswordAlgorithm caseInsensitiveCompare: @"sha"] == NSOrderedSame)
{
NSString *s;
unsigned char sha[SHA_DIGEST_LENGTH];
char buf[80];
int i;
memset(sha, 0, SHA_DIGEST_LENGTH);
memset(buf, 0, 80);
SHA1((const void *)[plainPassword UTF8String], strlen([plainPassword UTF8String]), sha);
for (i = 0; i < SHA_DIGEST_LENGTH; i++)
sprintf(&(buf[i*2]), "%02x", sha[i]);
s = [NSString stringWithUTF8String: buf];
return [s isEqualToString: encryptedPassword];
}
[self errorWithFormat: @"Unsupported user-password algorithm: %@", _userPasswordAlgorithm];