return n;
}
-static int inside_section(cmd_parms *cmd) {
- return (cmd->directive->parent
- && !ap_cstr_casecmp(cmd->directive->parent->directive, "<ManagedDomain"));
+static int inside_section(cmd_parms *cmd, const char *section) {
+ ap_directive_t *d;
+ for (d = cmd->directive->parent; d; d = d->parent) {
+ if (!ap_cstr_casecmp(d->directive, section)) {
+ return 1;
+ }
+ }
+ return 0;
}
-static const char *md_section_check(cmd_parms *cmd) {
- if (!inside_section(cmd)) {
- return apr_pstrcat(cmd->pool, cmd->cmd->name,
- " is only valid inside a <ManagedDomain context, not ",
- cmd->directive->parent? cmd->directive->parent->directive : "root",
- NULL);
+static const char *md_section_check(cmd_parms *cmd, const char *section) {
+ if (!inside_section(cmd, section)) {
+ return apr_pstrcat(cmd->pool, cmd->cmd->name, " is only valid inside a '",
+ section, "' context, not here", NULL);
}
return NULL;
}
const char *err;
int i;
- if (NULL != (err = md_section_check(cmd))) {
+ if (NULL != (err = md_section_check(cmd, "<ManagedDomain"))) {
if (argc == 1) {
/* only allowed value outside a section */
return set_transitive(&config->transitive, argv[0]);
md_config_t *config = (md_config_t *)md_config_get(cmd->server);
const char *err;
- if (inside_section(cmd)) {
+ if (inside_section(cmd, "<ManagedDomain")) {
md_config_dir_t *dconf = dc;
dconf->md->ca_url = value;
}
md_config_t *config = (md_config_t *)md_config_get(cmd->server);
const char *err;
- if (inside_section(cmd)) {
+ if (inside_section(cmd, "<ManagedDomain")) {
md_config_dir_t *dconf = dc;
dconf->md->ca_proto = value;
}
md_config_t *config = (md_config_t *)md_config_get(cmd->server);
const char *err;
- if (inside_section(cmd)) {
+ if (inside_section(cmd, "<ManagedDomain")) {
md_config_dir_t *dconf = dc;
dconf->md->ca_agreement = value;
}
return apr_pstrcat(cmd->pool, "unknown MDDriveMode ", value, NULL);
}
- if (inside_section(cmd)) {
+ if (inside_section(cmd, "<ManagedDomain")) {
md_config_dir_t *dconf = dc;
dconf->md->drive_mode = drive_mode;
}
return "MDRenewWindow has wrong format";
}
- if (inside_section(cmd)) {
+ if (inside_section(cmd, "<ManagedDomain")) {
md_config_dir_t *dconf = dc;
dconf->md->renew_window = timeout;
}
const char *err;
int i;
- if (inside_section(cmd)) {
+ if (inside_section(cmd, "<ManagedDomain")) {
md_config_dir_t *dconf = dc;
pcha = &dconf->md->ca_challenges;
}