]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
tests for paircmp() against strings and attributes
authorAlan T. DeKok <aland@freeradius.org>
Fri, 15 Jan 2021 15:19:49 +0000 (10:19 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 15 Jan 2021 15:20:07 +0000 (10:20 -0500)
src/lib/server/cond_tokenize.c
src/tests/keywords/paircmp [new file with mode: 0644]

index edb11e2435e52617aad467dd45a5e9a70e7d005f..50b55f147de67b78001666bb43bca69fbafeab46 100644 (file)
@@ -301,7 +301,7 @@ int fr_cond_promote_types(fr_cond_t *c, fr_sbuff_t *in, fr_sbuff_marker_t *m_lhs
         *      for attributes.
         */
        if (tmpl_is_attr(c->data.map->rhs) &&
-           !tmpl_is_attr(c->data.map->lhs)) {
+           !tmpl_contains_attr(c->data.map->lhs)) { /* also unresolved attributes! */
                tmpl_t *tmp;
                fr_sbuff_marker_t *m_tmp;
 
diff --git a/src/tests/keywords/paircmp b/src/tests/keywords/paircmp
new file mode 100644 (file)
index 0000000..c4a1f9c
--- /dev/null
@@ -0,0 +1,28 @@
+#
+#  PRE: if update
+#
+update request {
+       &NAS-Identifier = "yes"
+}
+
+#
+#  test raw values
+#
+if (&Test-Paircmp == 'yes') {
+       success
+
+}
+else {
+       test_fail
+}
+
+#
+#  test inter-attribute comparisons
+#
+if (&Test-Paircmp == &NAS-Identifier) {
+       success
+
+}
+else {
+       test_fail
+}