fix(users): when using multi-domains configuration, only request the apopriate usersources.

This commit is contained in:
Hivert Quentin
2024-11-12 09:03:10 +01:00
parent 7ca0a7b5fb
commit 405703162e
2 changed files with 26 additions and 2 deletions
+10
View File
@@ -1434,6 +1434,16 @@ groupObjectClasses: (NSArray *) newGroupObjectClasses
contacts = [NSMutableArray array];
if(theDomain)
{
if ([_baseDN rangeOfString: @"%d"].location != NSNotFound)
{
s = [NSMutableString stringWithString: _baseDN];
[s replaceOccurrencesOfString: @"%d" withString: theDomain options: 0 range: NSMakeRange(0, [s length])];
ASSIGN(_baseDN, s);
}
}
if ([match length] > 0 || !_listRequiresDot)
{
ldapConnection = [self _ldapConnection];
+16 -2
View File
@@ -1118,10 +1118,12 @@ static const NSString *kObfuscatedSecondaryEmailKey = @"obfuscatedSecondaryEmail
}
if (infos == nil)
{
// If the user was not found using the domain or if no domain was detected,
// search using the original uid.
infos = [self contactInfosForUserWithUIDorEmail: uid
inDomain: nil];
}
return infos;
}
@@ -1150,8 +1152,7 @@ static const NSString *kObfuscatedSecondaryEmailKey = @"obfuscatedSecondaryEmail
if ([currentUser isKindOfClass: NSNullK])
currentUser = nil;
else if (!([currentUser objectForKey: @"emails"]
&& [currentUser objectForKey: @"cn"]))
else if (!([currentUser objectForKey: @"emails"] && [currentUser objectForKey: @"cn"]))
{
// We make sure that we either have no occurence of a cache entry or
// that we have an occurence with only a cached password. In the
@@ -1168,6 +1169,19 @@ static const NSString *kObfuscatedSecondaryEmailKey = @"obfuscatedSecondaryEmail
}
else
newUser = NO;
if(!domain)
{
//No domain provided is there one?
NSRange r;
r = [uid rangeOfString: @"@" options: NSBackwardsSearch];
if (r.location != NSNotFound)
{
domain = [uid substringFromIndex: (r.location + r.length)];
if (![self isDomainDefined: domain])
domain = nil;
}
}
[self _fillContactInfosForUser: currentUser
withUIDorEmail: aUID
inDomain: domain];