From dbf123ff388807248bf957e1fbead318e933795a Mon Sep 17 00:00:00 2001 From: JonasBK Date: Mon, 29 Apr 2024 02:42:29 -0700 Subject: [PATCH] feat: collect unresolved published cert templates --- src/CommonLib/Processors/CertAbuseProcessor.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/CommonLib/Processors/CertAbuseProcessor.cs b/src/CommonLib/Processors/CertAbuseProcessor.cs index 066965b5..005e08bf 100644 --- a/src/CommonLib/Processors/CertAbuseProcessor.cs +++ b/src/CommonLib/Processors/CertAbuseProcessor.cs @@ -170,14 +170,23 @@ public async Task ProcessEAPermissions(string return ret; } - public IEnumerable ProcessCertTemplates(string[] templates, string domainName) + public (IEnumerable resolvedTemplates, IEnumerable unresolvedTemplates) ProcessCertTemplates(string[] templates, string domainName) { + var resolvedTemplates = new List(); + var unresolvedTemplates = new List(); + var certTemplatesLocation = _utils.BuildLdapPath(DirectoryPaths.CertTemplateLocation, domainName); foreach (var templateCN in templates) { var res = _utils.ResolveCertTemplateByProperty(Encoder.LdapFilterEncode(templateCN), LDAPProperties.CanonicalName, certTemplatesLocation, domainName); - yield return res; + if (res != null) { + resolvedTemplates.Add(res); + } else { + unresolvedTemplates.Add(templateCN); + } } + + return (resolvedTemplates: resolvedTemplates, unresolvedTemplates: unresolvedTemplates); } ///