MCPcopy Create free account
hub / github.com/apache/httpd / md_dns_make_minimal

Function md_dns_make_minimal

modules/md/md_util.c:870–905  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

868}
869
870apr_array_header_t *md_dns_make_minimal(apr_pool_t *p, apr_array_header_t *domains)
871{
872 apr_array_header_t *minimal;
873 const char *domain, *pattern;
874 int i, j, duplicate;
875
876 minimal = apr_array_make(p, domains->nelts, sizeof(const char *));
877 for (i = 0; i < domains->nelts; ++i) {
878 domain = APR_ARRAY_IDX(domains, i, const char*);
879 duplicate = 0;
880 /* is it matched in minimal already? */
881 for (j = 0; j < minimal->nelts; ++j) {
882 pattern = APR_ARRAY_IDX(minimal, j, const char*);
883 if (md_dns_matches(pattern, domain)) {
884 duplicate = 1;
885 break;
886 }
887 }
888 if (!duplicate) {
889 if (!md_dns_is_wildcard(p, domain)) {
890 /* plain name, will we see a wildcard that replaces it? */
891 for (j = i+1; j < domains->nelts; ++j) {
892 pattern = APR_ARRAY_IDX(domains, j, const char*);
893 if (md_dns_is_wildcard(p, pattern) && md_dns_matches(pattern, domain)) {
894 duplicate = 1;
895 break;
896 }
897 }
898 }
899 if (!duplicate) {
900 APR_ARRAY_PUSH(minimal, const char *) = domain;
901 }
902 }
903 }
904 return minimal;
905}
906
907int md_dns_domains_match(const apr_array_header_t *domains, const char *name)
908{

Callers 1

acme_renewFunction · 0.85

Calls 2

md_dns_matchesFunction · 0.85
md_dns_is_wildcardFunction · 0.85

Tested by

no test coverage detected