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

Function merge_mds_with_conf

modules/md/mod_md.c:667–738  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

665}
666
667static apr_status_t merge_mds_with_conf(md_mod_conf_t *mc, apr_pool_t *p,
668 server_rec *base_server, int log_level)
669{
670 md_srv_conf_t *base_conf;
671 md_t *md, *omd;
672 const char *domain;
673 md_timeslice_t *ts;
674 apr_status_t rv = APR_SUCCESS;
675 int i, j;
676
677 /* The global module configuration 'mc' keeps a list of all configured MDomains
678 * in the server. This list is collected during configuration processing and,
679 * in the post config phase, get updated from all merged server configurations
680 * before the server starts processing.
681 */
682 base_conf = md_config_get(base_server);
683 md_config_get_timespan(&ts, base_conf, MD_CONFIG_RENEW_WINDOW);
684 if (ts) md_reg_set_renew_window_default(mc->reg, ts);
685 md_config_get_timespan(&ts, base_conf, MD_CONFIG_WARN_WINDOW);
686 if (ts) md_reg_set_warn_window_default(mc->reg, ts);
687
688 /* Complete the properties of the MDs, now that we have the complete, merged
689 * server configurations.
690 */
691 for (i = 0; i < mc->mds->nelts; ++i) {
692 md = APR_ARRAY_IDX(mc->mds, i, md_t*);
693 merge_srv_config(md, base_conf, p);
694
695 if (mc->match_mode == MD_MATCH_ALL) {
696 /* Check that we have no overlap with the MDs already completed */
697 for (j = 0; j < i; ++j) {
698 omd = APR_ARRAY_IDX(mc->mds, j, md_t*);
699 if ((domain = md_common_name(md, omd)) != NULL) {
700 ap_log_error(APLOG_MARK, APLOG_ERR, 0, base_server, APLOGNO(10038)
701 "two Managed Domains have an overlap in domain '%s'"
702 ", first definition in %s(line %d), second in %s(line %d)",
703 domain, md->defn_name, md->defn_line_number,
704 omd->defn_name, omd->defn_line_number);
705 return APR_EINVAL;
706 }
707 }
708 }
709
710 if (md->cert_files && md->cert_files->nelts) {
711 if (!md->pkey_files || (md->cert_files->nelts != md->pkey_files->nelts)) {
712 ap_log_error(APLOG_MARK, APLOG_ERR, 0, base_server, APLOGNO(10170)
713 "The Managed Domain '%s' "
714 "needs one MDCertificateKeyFile for each MDCertificateFile.",
715 md->name);
716 return APR_EINVAL;
717 }
718 }
719 else if (md->pkey_files && md->pkey_files->nelts
720 && (!md->cert_files || !md->cert_files->nelts)) {
721 ap_log_error(APLOG_MARK, APLOG_ERR, 0, base_server, APLOGNO(10171)
722 "The Managed Domain '%s' "
723 "has MDCertificateKeyFile(s) but no MDCertificateFile.",
724 md->name);

Callers 1

Calls 8

md_config_getFunction · 0.85
md_config_get_timespanFunction · 0.85
merge_srv_configFunction · 0.85
md_common_nameFunction · 0.85
md_timeslice_formatFunction · 0.85
ap_log_errorFunction · 0.50

Tested by

no test coverage detected