]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Extend module tests for rlm_files (#3342)
authorTerry Burton <tez@terryburton.co.uk>
Fri, 27 Mar 2020 16:46:31 +0000 (16:46 +0000)
committerGitHub <noreply@github.com>
Fri, 27 Mar 2020 16:46:31 +0000 (10:46 -0600)
Test control and reply list modification operations.

Align with v4 by using Reply-Message rather than Filter-Id.

14 files changed:
src/tests/modules/files/addcontrol.attrs [new file with mode: 0644]
src/tests/modules/files/addcontrol.unlang [new file with mode: 0644]
src/tests/modules/files/addreply.attrs [new file with mode: 0644]
src/tests/modules/files/addreply.unlang [new file with mode: 0644]
src/tests/modules/files/authorize
src/tests/modules/files/bob.attrs [new file with mode: 0644]
src/tests/modules/files/bob.unlang [new file with mode: 0644]
src/tests/modules/files/doug.attrs
src/tests/modules/files/fall-through.attrs
src/tests/modules/files/files.unlang [deleted file]
src/tests/modules/files/filterreply.attrs [new file with mode: 0644]
src/tests/modules/files/filterreply.unlang [new file with mode: 0644]
src/tests/modules/files/subreply.attrs [new file with mode: 0644]
src/tests/modules/files/subreply.unlang [new file with mode: 0644]

diff --git a/src/tests/modules/files/addcontrol.attrs b/src/tests/modules/files/addcontrol.attrs
new file mode 100644 (file)
index 0000000..7588b9c
--- /dev/null
@@ -0,0 +1,13 @@
+#
+#  Input packet
+#
+User-Name = "addcontrol"
+User-Password = "testing123"
+
+#
+#  Expected answer
+#
+Response-Packet-Type == Access-Accept
+Cleartext-Password == 'testing123'
+Reply-Message == "success1"
+Reply-Message == "success2"
diff --git a/src/tests/modules/files/addcontrol.unlang b/src/tests/modules/files/addcontrol.unlang
new file mode 100644 (file)
index 0000000..8d8620d
--- /dev/null
@@ -0,0 +1,8 @@
+#
+#  PRE: files
+#
+files
+
+update {
+    &reply: += &control:[*]
+}
diff --git a/src/tests/modules/files/addreply.attrs b/src/tests/modules/files/addreply.attrs
new file mode 100644 (file)
index 0000000..69e1a19
--- /dev/null
@@ -0,0 +1,12 @@
+#
+#  Input packet
+#
+User-Name = "addreply"
+User-Password = "testing123"
+
+#
+#  Expected answer
+#
+Response-Packet-Type == Access-Accept
+Reply-Message == 'success1'
+Reply-Message == 'success2'
diff --git a/src/tests/modules/files/addreply.unlang b/src/tests/modules/files/addreply.unlang
new file mode 100644 (file)
index 0000000..7ddaaf5
--- /dev/null
@@ -0,0 +1,4 @@
+#
+#  PRE: files
+#
+files
index 51dbdd73aac0598e554506ac1c4a5a4fadb768e2..b85f6a2a49a34ab56b0f0c42b75b1a9e7aec5579 100644 (file)
@@ -1,23 +1,92 @@
 #
 #  Test if the "users" file works
 #
-bob    Cleartext-Password := "hello"
-       Filter-Id := "success"
 
-doug   Cleartext-Password := "goodbye"
-       Filter-Id := "success"
 
-famous Cleartext-Password := "bradpitt"
-       Fall-Through = yes
+#
+#  Basic syntax tests with comments. Parsing only.
+#
 
-unused Cleartext-Password := "jabberwocky"
-       Filter-Id := "fail"
+user    Cleartext-Password := "hello" # comment!
 
-famous 
-       Filter-Id := "success"
 
-user   Cleartext-Password := "hello" # comment!
+user2   # comment!
+        Reply-Message := "24"
 
 
-user2   # comment!
-       Filter-Id := "24"
+#
+#  Setting ":=" of reply and control items
+#
+
+bob  Cleartext-Password := "hello"
+     Reply-Message := "success"
+
+
+#
+#  Detect erroneous Fall-Through
+#
+
+doug  Cleartext-Password := "goodbye"
+      Reply-Message := "success"
+
+doug
+      Reply-Message := "unreachable"
+
+
+#
+#  Fall-Through across a non-matching entry
+#
+
+famous  Cleartext-Password := "bradpitt"
+        Fall-Through = yes
+
+unused  Cleartext-Password := "jabberwocky"
+        Reply-Message := "fail"
+
+famous
+        Reply-Message := "success"
+
+
+#
+#  Modification of the reply list
+#
+
+addreply  Cleartext-Password := "testing123"
+          Reply-Message := "success1",
+          Fall-Through = yes
+
+addreply
+          Reply-Message += "success2"
+
+
+subreply  Cleartext-Password := "testing123"
+          Reply-Message := "success1",
+          Reply-Message += "success2",
+          Reply-Message += "success3",
+          Fall-Through = yes
+
+subreply  Cleartext-Password := "testing123"
+          Reply-Message -= "success2"
+
+
+filterreply  Cleartext-Password := "testing123"
+             Reply-Message := "success1",
+             Reply-Message += "success2",
+             Fall-Through = yes
+
+filterreply  Cleartext-Password := "testing123"
+             Reply-Message !* ANY
+
+
+#
+#  Addition "+=" to the control list
+#
+#  Note: Set ":=" of control items is already tested with Cleartext-Password
+#  Note: Filtering "!*" does not apply to control items as this would overload
+#        the operator syntax since "!*" checks that no such attribute in the
+#        request.
+
+addcontrol  Cleartext-Password := "testing123", Reply-Message := "success1"
+            Fall-Through = yes
+
+addcontrol  Reply-Message += "success2"
diff --git a/src/tests/modules/files/bob.attrs b/src/tests/modules/files/bob.attrs
new file mode 100644 (file)
index 0000000..a4acfab
--- /dev/null
@@ -0,0 +1,11 @@
+#
+#  Input packet
+#
+User-Name = "doug"
+User-Password = "goodbye"
+
+#
+#  Expected answer
+#
+Response-Packet-Type == Access-Accept
+Reply-Message == 'success'
diff --git a/src/tests/modules/files/bob.unlang b/src/tests/modules/files/bob.unlang
new file mode 100644 (file)
index 0000000..7ddaaf5
--- /dev/null
@@ -0,0 +1,4 @@
+#
+#  PRE: files
+#
+files
index 116921cc1adb87290fcd2ae3a93b666035b35eeb..a4acfab62a15575923d87610308fd2b2fe4f8330 100644 (file)
@@ -8,4 +8,4 @@ User-Password = "goodbye"
 #  Expected answer
 #
 Response-Packet-Type == Access-Accept
-Filter-Id == 'success'
+Reply-Message == 'success'
index 47881bd61491c8a8ce0114e915bfbbe817747770..899d3d9b2133c3c0bbec287ec15b55d98b107f78 100644 (file)
@@ -8,4 +8,4 @@ User-Password = "bradpitt"
 #  Expected answer
 #
 Response-Packet-Type == Access-Accept
-Filter-Id == 'success'
+Reply-Message == 'success'
diff --git a/src/tests/modules/files/files.unlang b/src/tests/modules/files/files.unlang
deleted file mode 100644 (file)
index 456c666..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-#  Run the "files" module
-#
-files
diff --git a/src/tests/modules/files/filterreply.attrs b/src/tests/modules/files/filterreply.attrs
new file mode 100644 (file)
index 0000000..c1add29
--- /dev/null
@@ -0,0 +1,10 @@
+#
+#  Input packet
+#
+User-Name = "filterreply"
+User-Password = "testing123"
+
+#
+#  Expected answer
+#
+Response-Packet-Type == Access-Accept
diff --git a/src/tests/modules/files/filterreply.unlang b/src/tests/modules/files/filterreply.unlang
new file mode 100644 (file)
index 0000000..7ddaaf5
--- /dev/null
@@ -0,0 +1,4 @@
+#
+#  PRE: files
+#
+files
diff --git a/src/tests/modules/files/subreply.attrs b/src/tests/modules/files/subreply.attrs
new file mode 100644 (file)
index 0000000..6fe6237
--- /dev/null
@@ -0,0 +1,12 @@
+#
+#  Input packet
+#
+User-Name = "subreply"
+User-Password = "testing123"
+
+#
+#  Expected answer
+#
+Response-Packet-Type == Access-Accept
+Reply-Message == 'success1'
+Reply-Message == 'success3'
diff --git a/src/tests/modules/files/subreply.unlang b/src/tests/modules/files/subreply.unlang
new file mode 100644 (file)
index 0000000..7ddaaf5
--- /dev/null
@@ -0,0 +1,4 @@
+#
+#  PRE: files
+#
+files