Skip to content

Commit

Permalink
feat: collect unresolved published cert templates (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasBK authored May 2, 2024
1 parent 692c590 commit 53431a9
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/CommonLib/Processors/CertAbuseProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,23 @@ public async Task<EnrollmentAgentRegistryAPIResult> ProcessEAPermissions(string
return ret;
}

public IEnumerable<TypedPrincipal> ProcessCertTemplates(string[] templates, string domainName)
public (IEnumerable<TypedPrincipal> resolvedTemplates, IEnumerable<String> unresolvedTemplates) ProcessCertTemplates(string[] templates, string domainName)
{
var resolvedTemplates = new List<TypedPrincipal>();
var unresolvedTemplates = new List<String>();

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);
}

/// <summary>
Expand Down

0 comments on commit 53431a9

Please sign in to comment.