From: Nick Porter Date: Wed, 13 Sep 2023 15:06:43 +0000 (+0100) Subject: Allow call_env to force quoting when parsing tmpls X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b7a37c5e7a85d72c96e89c18b941ff4fb9b4caf;p=thirdparty%2Ffreeradius-server.git Allow call_env to force quoting when parsing tmpls --- diff --git a/src/lib/unlang/call_env.c b/src/lib/unlang/call_env.c index 3c74fc4c40e..cf80205d71b 100644 --- a/src/lib/unlang/call_env.c +++ b/src/lib/unlang/call_env.c @@ -99,7 +99,7 @@ int call_env_parse(TALLOC_CTX *ctx, call_env_parsed_head_t *parsed, char const * if (cp) { value = cf_pair_value(cp); len = talloc_array_length(value) - 1; - quote = cf_pair_value_quote(cp); + quote = call_env->pair.force_quote ? call_env->dflt_quote : cf_pair_value_quote(cp); } else { value = call_env->dflt; len = strlen(value); diff --git a/src/lib/unlang/call_env.h b/src/lib/unlang/call_env.h index dce1d28df03..b785b356d75 100644 --- a/src/lib/unlang/call_env.h +++ b/src/lib/unlang/call_env.h @@ -80,6 +80,10 @@ struct call_env_s { bool multi; //!< Multiple instances of the conf pairs are allowed. Resulting ///< boxes are stored in an array - one entry per conf pair. bool nullable; //!< Tmpl expansions are allowed to produce no output. + bool force_quote; //!< Force quote method when parsing tmpl. This is for corner cases + ///< where tmpls should always be parsed with a particular quoting + ///< regardless of how they are in the config file. E.g. the `program` + ///< option of `rlm_exec` should always be parsed as T_BACK_QUOTED_STRING. call_env_dest_t type; //!< Type of structure boxes will be written to. size_t size; //!< Size of structure boxes will be written to. char const *type_name; //!< Name of structure type boxes will be written to.