]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
allow (...) in xlat arguments
authorAlan T. DeKok <aland@freeradius.org>
Sun, 11 Dec 2022 14:47:26 +0000 (09:47 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 12 Dec 2022 15:27:38 +0000 (10:27 -0500)
src/lib/server/tmpl_tokenize.c
src/tests/keywords/expr-condition [new file with mode: 0644]

index 1f9af75ba6ef9ee5a031aaf21e2a3400a830643b..0ad0789654017ac751fcdaf4b21986cfceaffb04 100644 (file)
@@ -5235,6 +5235,15 @@ ssize_t tmpl_preparse(char const **out, size_t *outlen, char const *in, size_t i
                                continue;
                        }
 
+                       /*
+                        *      Allow (...) and {...}
+                        */
+                       if ((*p == '{') || (*p == '(')) {
+                               p++;
+                               depth++;
+                               continue;
+                       }
+
                        p++;
                }
 
diff --git a/src/tests/keywords/expr-condition b/src/tests/keywords/expr-condition
new file mode 100644 (file)
index 0000000..c57beb1
--- /dev/null
@@ -0,0 +1,17 @@
+#
+#  @todo - update the configuration file parse to allow this.
+#
+#
+#  @todo - allow just a bare
+#
+#      &NAS-Port := 5 + (&User-Name == "bob")
+#
+#  which means updating the config file parser, too.
+#
+&NAS-Port := %{expr:5 + (&User-Name == "bob")}
+
+if !(&NAS-Port == 6) {
+       test_fail
+}
+
+success