summaryrefslogtreecommitdiffstats
path: root/modules/md/md_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/md/md_core.c')
-rw-r--r--modules/md/md_core.c39
1 files changed, 5 insertions, 34 deletions
diff --git a/modules/md/md_core.c b/modules/md/md_core.c
index 080e542696..5d59b3d593 100644
--- a/modules/md/md_core.c
+++ b/modules/md/md_core.c
@@ -107,6 +107,7 @@ md_t *md_create_empty(apr_pool_t *p)
md->must_staple = -1;
md->transitive = -1;
md->acme_tls_1_domains = apr_array_make(p, 5, sizeof(const char *));
+ md->stapling = -1;
md->defn_name = "unknown";
md->defn_line_number = 0;
}
@@ -143,38 +144,6 @@ int md_contains_domains(const md_t *md1, const md_t *md2)
return 0;
}
-md_t *md_find_closest_match(apr_array_header_t *mds, const md_t *md)
-{
- md_t *candidate, *m;
- apr_size_t cand_n, n;
- int i;
-
- candidate = md_get_by_name(mds, md->name);
- if (!candidate) {
- /* try to find an instance that contains all domain names from md */
- for (i = 0; i < mds->nelts; ++i) {
- m = APR_ARRAY_IDX(mds, i, md_t *);
- if (md_contains_domains(m, md)) {
- return m;
- }
- }
- /* no matching name and no md in the list has all domains.
- * We consider that managed domain as closest match that contains at least one
- * domain name from md, ONLY if there is no other one that also has.
- */
- cand_n = 0;
- for (i = 0; i < mds->nelts; ++i) {
- m = APR_ARRAY_IDX(mds, i, md_t *);
- n = md_common_name_count(md, m);
- if (n > cand_n) {
- candidate = m;
- cand_n = n;
- }
- }
- }
- return candidate;
-}
-
md_t *md_get_by_name(struct apr_array_header_t *mds, const char *name)
{
int i;
@@ -268,6 +237,7 @@ md_t *md_clone(apr_pool_t *p, const md_t *src)
md->ca_challenges = md_array_str_clone(p, src->ca_challenges);
}
md->acme_tls_1_domains = md_array_str_compact(p, src->acme_tls_1_domains, 0);
+ md->stapling = src->stapling;
if (src->cert_file) md->cert_file = apr_pstrdup(p, src->cert_file);
if (src->pkey_file) md->pkey_file = apr_pstrdup(p, src->pkey_file);
}
@@ -315,10 +285,10 @@ md_json_t *md_to_json(const md_t *md, apr_pool_t *p)
break;
}
md_json_setb(md->must_staple > 0, json, MD_KEY_MUST_STAPLE, NULL);
- if (!apr_is_empty_array(md->acme_tls_1_domains))
- md_json_setsa(md->acme_tls_1_domains, json, MD_KEY_PROTO, MD_KEY_ACME_TLS_1, NULL);
+ md_json_setsa(md->acme_tls_1_domains, json, MD_KEY_PROTO, MD_KEY_ACME_TLS_1, NULL);
md_json_sets(md->cert_file, json, MD_KEY_CERT_FILE, NULL);
md_json_sets(md->pkey_file, json, MD_KEY_PKEY_FILE, NULL);
+ md_json_setb(md->stapling > 0, json, MD_KEY_STAPLING, NULL);
return json;
}
return NULL;
@@ -365,6 +335,7 @@ md_t *md_from_json(md_json_t *json, apr_pool_t *p)
md->cert_file = md_json_dups(p, json, MD_KEY_CERT_FILE, NULL);
md->pkey_file = md_json_dups(p, json, MD_KEY_PKEY_FILE, NULL);
+ md->stapling = (int)md_json_getb(json, MD_KEY_STAPLING, NULL);
return md;
}