From c3121c50d5b99996029a4e06e63df7802b262fad Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Mon, 8 May 2017 10:44:12 -0400 Subject: [PATCH] (fix) make sure to use crypt as the scheme for md5/sha256/sha512 (fixes #4137) --- SoObjects/SOGo/LDAPSource.m | 7 +++++++ SoObjects/SOGo/SQLSource.m | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/SoObjects/SOGo/LDAPSource.m b/SoObjects/SOGo/LDAPSource.m index c8198fa9b..f1bb094d3 100644 --- a/SoObjects/SOGo/LDAPSource.m +++ b/SoObjects/SOGo/LDAPSource.m @@ -606,6 +606,13 @@ groupObjectClasses: (NSArray *) newGroupObjectClasses return nil; } + if ([_userPasswordAlgorithm caseInsensitiveCompare: @"md5-crypt"] == NSOrderedSame || + [_userPasswordAlgorithm caseInsensitiveCompare: @"sha256-crypt"] == NSOrderedSame || + [_userPasswordAlgorithm caseInsensitiveCompare: @"sha512-crypt"] == NSOrderedSame) + { + _userPasswordAlgorithm = @"crypt"; + } + return [NSString stringWithFormat: @"{%@}%@", _userPasswordAlgorithm, pass]; } diff --git a/SoObjects/SOGo/SQLSource.m b/SoObjects/SOGo/SQLSource.m index f3503be45..3ee912ff7 100644 --- a/SoObjects/SOGo/SQLSource.m +++ b/SoObjects/SOGo/SQLSource.m @@ -197,6 +197,13 @@ return nil; } + if ([_userPasswordAlgorithm caseInsensitiveCompare: @"md5-crypt"] == NSOrderedSame || + [_userPasswordAlgorithm caseInsensitiveCompare: @"sha256-crypt"] == NSOrderedSame || + [_userPasswordAlgorithm caseInsensitiveCompare: @"sha512-crypt"] == NSOrderedSame) + { + _userPasswordAlgorithm = @"crypt"; + } + if (_prependPasswordScheme) result = [NSString stringWithFormat: @"{%@}%@", _userPasswordAlgorithm, pass]; else