]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Allow call_env to force quoting when parsing tmpls
authorNick Porter <nick@portercomputing.co.uk>
Wed, 13 Sep 2023 15:06:43 +0000 (16:06 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Mon, 25 Sep 2023 13:41:20 +0000 (14:41 +0100)
src/lib/unlang/call_env.c
src/lib/unlang/call_env.h

index 3c74fc4c40eccaed8e817ae0ddaa16970a09c820..cf80205d71bebfcbab2c22dfaaeaec9f86d7dbaa 100644 (file)
@@ -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);
index dce1d28df03c3d77445e760064063a5e792cab5d..b785b356d75096ba23572da25efe55f46c35d277 100644 (file)
@@ -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.