From: Nick Porter Date: Thu, 13 Jul 2023 18:21:10 +0000 (+0100) Subject: Add tests of < and > comparison in rlm_files X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=52d1d5dea6d8eadc321907b539551ed7b9be8025;p=thirdparty%2Ffreeradius-server.git Add tests of < and > comparison in rlm_files And exercise use of $INCLUDE --- diff --git a/src/tests/modules/files/authorize b/src/tests/modules/files/authorize index 9c0ed395ddb..40bc94ba8ee 100644 --- a/src/tests/modules/files/authorize +++ b/src/tests/modules/files/authorize @@ -107,7 +107,7 @@ greaterthanreply Password.Cleartext := "testing123" # 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 Password.Cleartext := "testing123", Reply-Message := "success1" Fall-Through = yes @@ -120,5 +120,7 @@ regex NAS-Identifier =~ /der/, Password.Cleartext := "testing123" DEFAULT User-Name == "cmp_eq", Password.Cleartext := "hopping" Reply-Message := "success-cmp_eq" +$INCLUDE cmp + DEFAULT Password.Cleartext := "stuffnsuch" Reply-Message := "success-default" diff --git a/src/tests/modules/files/cmp b/src/tests/modules/files/cmp new file mode 100644 index 00000000000..7d798d2c6e0 --- /dev/null +++ b/src/tests/modules/files/cmp @@ -0,0 +1,11 @@ +DEFAULT User-Name == "cmp_lt", NAS-Port < 10, Password.Cleartext := "ltuser" + Reply-Message := "wrong-cmp_lt" + +DEFAULT User-Name == "cmp_lt", NAS-Port < 1000, Password.Cleartext := "ltuser" + Reply-Message := "success-cmp_lt" + +DEFAULT User-Name == "cmp_gt", NAS-Port > 1000, Password.Cleartext := "gtuser" + Reply-Message := "wrong-cmp_gt" + +DEFAULT User-Name == "cmp_gt", NAS-Port > 10, Password.Cleartext := "gtuser" + Reply-Message := "success-cmp_gt" diff --git a/src/tests/modules/files/cmp_gt.attrs b/src/tests/modules/files/cmp_gt.attrs new file mode 100644 index 00000000000..16b9f4d6723 --- /dev/null +++ b/src/tests/modules/files/cmp_gt.attrs @@ -0,0 +1,14 @@ +# +# Input packet +# +Packet-Type = Access-Request +User-Name = "cmp_gt" +User-Password = "gtuser" +NAS-Port = 100 + +# +# Expected answer +# +Packet-Type == Access-Accept +Reply-Message == 'success-cmp_gt' + diff --git a/src/tests/modules/files/cmp_gt.unlang b/src/tests/modules/files/cmp_gt.unlang new file mode 100644 index 00000000000..027271b9b22 --- /dev/null +++ b/src/tests/modules/files/cmp_gt.unlang @@ -0,0 +1 @@ +files diff --git a/src/tests/modules/files/cmp_lt.attrs b/src/tests/modules/files/cmp_lt.attrs new file mode 100644 index 00000000000..1e9008a81c2 --- /dev/null +++ b/src/tests/modules/files/cmp_lt.attrs @@ -0,0 +1,14 @@ +# +# Input packet +# +Packet-Type = Access-Request +User-Name = "cmp_lt" +User-Password = "ltuser" +NAS-Port = 100 + +# +# Expected answer +# +Packet-Type == Access-Accept +Reply-Message == 'success-cmp_lt' + diff --git a/src/tests/modules/files/cmp_lt.unlang b/src/tests/modules/files/cmp_lt.unlang new file mode 100644 index 00000000000..c12b2d10968 --- /dev/null +++ b/src/tests/modules/files/cmp_lt.unlang @@ -0,0 +1,2 @@ +files +