if (call_env_is_subsection(rule->flags)) {
CONF_SECTION const *subcs;
subcs = cf_section_find(cs, rule->name, rule->section.ident2);
- if (!subcs) {
+ if (!subcs && !call_env_parse_missing(rule->flags)) {
if (!call_env_required(rule->flags)) goto next;
cf_log_err(cs, "Module %s missing required section \"%s\"", name, rule->name);
return -1;
///< option of `rlm_exec` should always be parsed as T_BACK_QUOTED_STRING.
CALL_ENV_FLAG_PARSE_ONLY = (1 << 6), //!< The result of parsing will not be evaluated at runtime.
CALL_ENV_FLAG_ATTRIBUTE = (1 << 7), //!< Tmpl must contain an attribute reference.
- CALL_ENV_FLAG_SUBSECTION = (1 << 8) //!< This is a subsection.
+ CALL_ENV_FLAG_SUBSECTION = (1 << 8), //!< This is a subsection.
+ CALL_ENV_FLAG_PARSE_MISSING = (1 << 9) //!< If this subsection is missing, still parse it. Useful for cases where
+ ///< there is a callback which always needs to be run to set up required
+ ///< data structures.
} call_env_flags_t;
DIAG_ON(attributes)
*
* @param[in] _flags to evaluate
*/
-#define call_env_subsection_flags(_flags) (((_flags) & (CALL_ENV_FLAG_CONCAT | CALL_ENV_FLAG_SINGLE | CALL_ENV_FLAG_MULTI | CALL_ENV_FLAG_NULLABLE | CALL_ENV_FLAG_FORCE_QUOTE | CALL_ENV_FLAG_ATTRIBUTE)) == 0)
+#define call_env_subsection_flags(_flags) (((_flags) & (CALL_ENV_FLAG_CONCAT | CALL_ENV_FLAG_SINGLE | CALL_ENV_FLAG_MULTI | CALL_ENV_FLAG_NULLABLE | CALL_ENV_FLAG_FORCE_QUOTE | CALL_ENV_FLAG_ATTRIBUTE | CALL_ENV_FLAG_PARSE_MISSING)) == 0)
#define call_env_required(_flags) ((_flags) & CALL_ENV_FLAG_REQUIRED)
#define call_env_attribute(_flags) ((_flags) & CALL_ENV_FLAG_ATTRIBUTE)
#define call_env_is_subsection(_flags) ((_flags) & CALL_ENV_FLAG_SUBSECTION)
+
+#define call_env_parse_missing(_flags) ((_flags) & CALL_ENV_FLAG_PARSE_MISSING)
/** @} */
/** Callback for performing custom parsing of a #CONF_PAIR