]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
move non-protocol policies into their own file
authorAlan T. DeKok <aland@freeradius.org>
Thu, 21 Jan 2021 15:25:05 +0000 (10:25 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 21 Jan 2021 15:25:05 +0000 (10:25 -0500)
We should really have src/tests/modules do this, too

src/tests/keywords/dhcpv6.conf
src/tests/keywords/policy.conf [new file with mode: 0644]
src/tests/keywords/radius.conf

index 96759a146697e5f64d297f1bd5ebdb1cc02d0f0b..c37bc8549c9b734353fbbbf83b0b6a911b1dfa61 100644 (file)
@@ -21,64 +21,7 @@ modules {
 }
 
 policy {
-       #
-       #  Outputs the contents of the control list in debugging (-X) mode
-       #
-       debug_control {
-               if("%{debug_attr:control[*]}" == '') {
-                       noop
-               }
-       }
-
-       #
-       #  Outputs the contents of the request list in debugging (-X) mode
-       #
-       debug_request {
-               if("%{debug_attr:request[*]}" == '') {
-                       noop
-               }
-       }
-
-       #
-       #  Outputs the contents of the reply list in debugging (-X) mode
-       #
-       debug_reply {
-               if("%{debug_attr:reply[*]}" == '') {
-                       noop
-               }
-       }
-
-       #
-       #  Outputs the contents of the main lists in debugging (-X) mode
-       #
-       debug_all {
-               debug_control
-               debug_request
-               debug_reply
-       }
-
-       #
-       #  Set the test to successful, but only if there are no failures.
-       #
-       success {
-               if (!&reply.Result-Status) {
-                       update reply {
-                               &Result-Status := "success"
-                       }
-               }
-       }
-
-       test_fail {
-               update reply {
-                       &Result-Status += "Failure in test at line %{interpreter:...line}"
-               }
-
-               if (&parent.request.User-Name) {
-                       update parent.reply {
-                               &Result-Status += "Failure in test at line %{interpreter:...line}"
-                       }
-               }
-       }
+$INCLUDE policy.conf
 }
 
 instantiate {
diff --git a/src/tests/keywords/policy.conf b/src/tests/keywords/policy.conf
new file mode 100644 (file)
index 0000000..0f3c4eb
--- /dev/null
@@ -0,0 +1,79 @@
+#
+#  Common policies for the test cases.
+#
+
+#
+#  Outputs the contents of the control list in debugging (-X) mode
+#
+debug_control {
+       if("%{debug_attr:control[*]}" == '') {
+               noop
+       }
+}
+
+#
+#  Outputs the contents of the request list in debugging (-X) mode
+#
+debug_request {
+       if("%{debug_attr:request[*]}" == '') {
+               noop
+       }
+}
+
+#
+#  Outputs the contents of the reply list in debugging (-X) mode
+#
+debug_reply {
+       if("%{debug_attr:reply[*]}" == '') {
+               noop
+       }
+}
+
+#
+#  Outputs the contents of the main lists in debugging (-X) mode
+#
+debug_all {
+       debug_control
+       debug_request
+       debug_reply
+}
+
+#
+#  Just check that this can be referred to as "virtual_policy.post-auth"
+#
+virtual_policy {
+       ok
+}
+
+with.dots {
+       ok
+}
+
+#
+#  Set the test to successful, but only if there are no failures.
+#
+success {
+       if (!&reply.Result-Status) {
+               update reply {
+                       &Result-Status := "success"
+               }
+       }
+
+       if (&parent.request.User-Name && !&parent.reply.Result-Status) {
+               update parent.reply {
+                       &Result-Status := "success"
+               }
+       }
+}
+
+test_fail {
+       update reply {
+               &Result-Status += "Failure in test at line %{interpreter:...line}"
+       }
+
+       if (&parent.request.User-Name) {
+               update parent.reply {
+                       &Result-Status += "Failure in test at line %{interpreter:...line}"
+               }
+       }
+}
index 0e022fea0c2b9653030d30a5901627e2661937db..88c4f12a9ced8d028ea5fe8ff9bdd3e1c7e1beb1 100644 (file)
@@ -33,81 +33,7 @@ modules {
 }
 
 policy {
-       #
-       #  Outputs the contents of the control list in debugging (-X) mode
-       #
-       debug_control {
-               if("%{debug_attr:control[*]}" == '') {
-                       noop
-               }
-       }
-
-       #
-       #  Outputs the contents of the request list in debugging (-X) mode
-       #
-       debug_request {
-               if("%{debug_attr:request[*]}" == '') {
-                       noop
-               }
-       }
-
-       #
-       #  Outputs the contents of the reply list in debugging (-X) mode
-       #
-       debug_reply {
-               if("%{debug_attr:reply[*]}" == '') {
-                       noop
-               }
-       }
-
-       #
-       #  Outputs the contents of the main lists in debugging (-X) mode
-       #
-       debug_all {
-               debug_control
-               debug_request
-               debug_reply
-       }
-
-       #
-       #  Just check that this can be referred to as "virtual_policy.post-auth"
-       #
-       virtual_policy {
-               ok
-       }
-
-       with.dots {
-               ok
-       }
-
-       #
-       #  Set the test to successful, but only if there are no failures.
-       #
-       success {
-               if (!&reply.Result-Status) {
-                       update reply {
-                               &Result-Status := "success"
-                       }
-               }
-
-               if (&parent.request.User-Name && !&parent.reply.Result-Status) {
-                       update parent.reply {
-                               &Result-Status := "success"
-                       }
-               }
-       }
-
-       test_fail {
-               update reply {
-                       &Result-Status += "Failure in test at line %{interpreter:...line}"
-               }
-
-               if (&parent.request.User-Name) {
-                       update parent.reply {
-                               &Result-Status += "Failure in test at line %{interpreter:...line}"
-                       }
-               }
-       }
+$INCLUDE policy.conf
 
        #
        #  Return within a policy