From ff684810f577d3893258e1acf67257e2b7f9b1e4 Mon Sep 17 00:00:00 2001 From: rvazarkar Date: Wed, 29 Nov 2023 11:44:24 -0500 Subject: [PATCH] fix: bad filter sneaking into configurations NC --- src/Producers/BaseProducer.cs | 2 +- src/Producers/LdapProducer.cs | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Producers/BaseProducer.cs b/src/Producers/BaseProducer.cs index a75f5c7..08e0610 100644 --- a/src/Producers/BaseProducer.cs +++ b/src/Producers/BaseProducer.cs @@ -151,7 +151,7 @@ protected LDAPData CreateConfigNCData() props.AddRange(CommonProperties.TypeResolutionProps); var methods = Context.ResolvedCollectionMethods; - var allObjectTypesQuery = query.AddContainers().AddConfiguration().AddCertificateTemplates().AddCertificateAuthorities().AddEnterpriseCertificationAuthorities(); + var allObjectTypesQuery = new LDAPFilter().AddContainers().AddConfiguration().AddCertificateTemplates().AddCertificateAuthorities().AddEnterpriseCertificationAuthorities(); if ((methods & ResolvedCollectionMethod.ObjectProps) != 0) { diff --git a/src/Producers/LdapProducer.cs b/src/Producers/LdapProducer.cs index 335d100..7ee79ab 100644 --- a/src/Producers/LdapProducer.cs +++ b/src/Producers/LdapProducer.cs @@ -94,9 +94,12 @@ public override async Task ProduceConfigNC() { var cancellationToken = Context.CancellationTokenSource.Token; var configNcData = CreateConfigNCData(); - List configurationNCsCollected = new List(); + var configurationNCsCollected = new List(); - foreach (EnumerationDomain domain in Context.Domains) + if (string.IsNullOrEmpty(configNcData.Filter.GetFilter())) + return; + + foreach (var domain in Context.Domains) { var configAdsPath = Context.LDAPUtils.GetConfigurationPath(domain.Name); if (!configurationNCsCollected.Contains(configAdsPath)) @@ -121,8 +124,6 @@ public override async Task ProduceConfigNC() Context.Logger.LogTrace("Skipping already collected config NC '{path}' for domain {Domain}", configAdsPath, domain.Name); } } - } - } } \ No newline at end of file