Skip to content

Commit c8fd708

Browse files
authored
fix: Alter ConverDomainSidToDomainNameFromLdap - BED-6095 (#287)
* fix: Alter ConverDomainSidToDomainNameFromLdap to return proper domain in cross forest scenario * test: Add WindowsOnlyFact to Test
1 parent 5f33cc5 commit c8fd708

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/CommonLib/LdapUtils.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -412,14 +412,14 @@ public IAsyncEnumerable<LdapResult<IDirectoryObject>> PagedQuery(LdapQueryParame
412412

413413
result = await Query(new LdapQueryParameters {
414414
DomainName = domain.Name,
415-
Attributes = new[] { LDAPProperties.DistinguishedName },
415+
Attributes = new[] { LDAPProperties.DistinguishedName, LDAPProperties.Name },
416416
GlobalCatalog = true,
417417
LDAPFilter = new LdapFilter().AddFilter("(objectclass=trusteddomain)", true)
418418
.AddFilter($"(securityidentifier={Helpers.ConvertSidToHexSid(domainSid)})", true).GetFilter()
419419
}).DefaultIfEmpty(LdapResult<IDirectoryObject>.Fail()).FirstOrDefaultAsync();
420420

421-
if (result.IsSuccess && result.Value.TryGetDistinguishedName(out distinguishedName)) {
422-
return (true, Helpers.DistinguishedNameToDomain(distinguishedName));
421+
if (result.IsSuccess && result.Value.TryGetProperty(LDAPProperties.Name, out var domainName)) {
422+
return (true, domainName.ToUpper());
423423
}
424424

425425
result = await Query(new LdapQueryParameters {

test/unit/WebClientServiceProcessorTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public WebClientServiceProcessorTest(ITestOutputHelper testOutputHelper) {
2626
public void Dispose() {
2727
}
2828

29-
[Fact]
29+
[WindowsOnlyFact]
3030
public async Task WebClientServiceProcessorTest_TestPathExists()
3131
{
3232
var processor = new WebClientServiceProcessor();

0 commit comments

Comments
 (0)