]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
reset to dict_def if we're at the root of internal
authorAlan T. DeKok <aland@freeradius.org>
Wed, 20 Jul 2022 20:09:15 +0000 (16:09 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 20 Jul 2022 20:13:52 +0000 (16:13 -0400)
which lets us do &request.Reply-Message, where normally "reply"
is in the internal dictionary.  But we want "Reply-Message" to
be in the RADIUS dictionary.

src/lib/server/tmpl_tokenize.c
src/tests/keywords/edit-nested

index bc5ac582266e4e877e9f6239b555fb83f396f810..0d3101a11dd8dc9c6386191b7eab7957d8aab08c 100644 (file)
@@ -1848,6 +1848,14 @@ do_suffix:
                 */
                case FR_TYPE_GROUP:
                        our_parent = namespace = fr_dict_attr_ref(da);
+
+                       /*
+                        *      if there's a real dictionary, and this reference is to group which is in fact
+                        *      the internal dict, then just keep using our dict_def.
+                        */
+                       if (t_rules->dict_def && (namespace == fr_dict_root(fr_dict_internal()))) {
+                               our_parent = namespace = fr_dict_root(t_rules->dict_def);
+                       }
                        break;
 
                case FR_TYPE_STRUCT:
index e81de6dc16dd758960037cb3c2d123153eddb0f4..159ea7ae427c844321380dd8b89630dcabd91710 100644 (file)
@@ -11,22 +11,16 @@ update control {
 #  @todo - we only support ONE layer of nesting under &control,
 #  &request, etc. for now.  We should support more.
 #
-#  i.e. &control.Tmp-Group-0.Tmp-Group-1 := { ... } will NOT work.
-#
-#  There are also issues with changing dictionaries.  Putting RADIUS
-#  attributes into a Tmp-Group (internal dict) will work, but they
-#  cannot be referenced.
-#
 &control.Tmp-Group-0 := {
        &Tmp-Integer-0 = 1
 }
 
 if (!&control.Tmp-Group-0.Tmp-Integer-0) {
-       test_fail;
+       test_fail
 }
 
 if (&control.Tmp-Group-0.Tmp-Integer-0 != 1) {
-       test_fail;
+       test_fail
 }
 
 #
@@ -35,7 +29,7 @@ if (&control.Tmp-Group-0.Tmp-Integer-0 != 1) {
 &control.Tmp-Group-0.Tmp-Integer-0 += 5
 
 if (&control.Tmp-Group-0.Tmp-Integer-0 != 6) {
-       test_fail;
+       test_fail
 }
 
 #
@@ -44,7 +38,7 @@ if (&control.Tmp-Group-0.Tmp-Integer-0 != 6) {
 &control.Tmp-Group-0 -= &Tmp-Integer-0
 
 if (&control.Tmp-Group-0.Tmp-Integer-0) {
-       test_fail;
+       test_fail
 }
 
 #
@@ -59,7 +53,7 @@ if (&control.Tmp-Group-0.Tmp-Integer-0) {
 }
 
 if (&control.Tmp-Group-0.Tmp-IP-Address-0 != 127.0.0.1) {
-       test_fail;
+       test_fail
 }
 
 #
@@ -70,11 +64,11 @@ if (&control.Tmp-Group-0.Tmp-IP-Address-0 != 127.0.0.1) {
 }
 
 if (&control.Tmp-Group-0.Tmp-IP-Address-0 != 127.0.0.1) {
-       test_fail;
+       test_fail
 }
 
 if (&control.Tmp-Group-0.Tmp-Octets-0 != 0xabcdef) {
-       test_fail;
+       test_fail
 }
 
 success