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

Function check_values

modules/md/md_reg.c:140–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138/* checks */
139
140static apr_status_t check_values(md_reg_t *reg, apr_pool_t *p, const md_t *md, int fields)
141{
142 apr_status_t rv = APR_SUCCESS;
143 const char *err = NULL;
144
145 if (MD_UPD_DOMAINS & fields) {
146 const md_t *other;
147 const char *domain;
148 int i;
149
150 if (!md->domains || md->domains->nelts <= 0) {
151 md_log_perror(MD_LOG_MARK, MD_LOG_DEBUG, APR_EINVAL, p,
152 "empty domain list: %s", md->name);
153 return APR_EINVAL;
154 }
155
156 for (i = 0; i < md->domains->nelts; ++i) {
157 domain = APR_ARRAY_IDX(md->domains, i, const char *);
158 if (!md_dns_is_name(p, domain, 1) && !md_dns_is_wildcard(p, domain)) {
159 md_log_perror(MD_LOG_MARK, MD_LOG_ERR, APR_EINVAL, p,
160 "md %s with invalid domain name: %s", md->name, domain);
161 return APR_EINVAL;
162 }
163 }
164
165 if (NULL != (other = md_reg_find_overlap(reg, md, &domain, p))) {
166 md_log_perror(MD_LOG_MARK, MD_LOG_ERR, APR_EINVAL, p,
167 "md %s shares domain '%s' with md %s",
168 md->name, domain, other->name);
169 return APR_EINVAL;
170 }
171 }
172
173 if (MD_UPD_CONTACTS & fields) {
174 const char *contact;
175 int i;
176
177 for (i = 0; i < md->contacts->nelts && !err; ++i) {
178 contact = APR_ARRAY_IDX(md->contacts, i, const char *);
179 rv = md_util_abs_uri_check(p, contact, &err);
180
181 if (err) {
182 md_log_perror(MD_LOG_MARK, MD_LOG_ERR, APR_EINVAL, p,
183 "contact for %s invalid (%s): %s", md->name, err, contact);
184 return APR_EINVAL;
185 }
186 }
187 }
188
189 if ((MD_UPD_CA_URL & fields) && md->ca_urls) { /* setting to empty is ok */
190 int i;
191 const char *url;
192 for (i = 0; i < md->ca_urls->nelts; ++i) {
193 url = APR_ARRAY_IDX(md->ca_urls, i, const char*);
194 rv = md_util_abs_uri_check(p, url, &err);
195 if (err) {
196 md_log_perror(MD_LOG_MARK, MD_LOG_ERR, APR_EINVAL, p,
197 "CA url for %s invalid (%s): %s", md->name, err, url);

Callers 2

p_md_addFunction · 0.85
p_md_updateFunction · 0.85

Calls 5

md_log_perrorFunction · 0.85
md_dns_is_nameFunction · 0.85
md_dns_is_wildcardFunction · 0.85
md_reg_find_overlapFunction · 0.85
md_util_abs_uri_checkFunction · 0.85

Tested by

no test coverage detected