]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Use attribute with non SQL safe characters in SQL map query
authorNick Porter <nick@portercomputing.co.uk>
Thu, 18 Jul 2024 09:58:28 +0000 (10:58 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Thu, 18 Jul 2024 10:02:19 +0000 (11:02 +0100)
src/tests/modules/sql/map.attrs
src/tests/modules/sql/map.unlang

index 10e11660cc784d896f1471722bf1e210426241f3..1555c2419b7185ddf46747dd29139cced23a809f 100644 (file)
@@ -3,6 +3,7 @@
 #
 Packet-Type = Access-Request
 User-Name = 'bob'
+NAS-Identifier = un'sa"fe;
 
 #
 #  Expected answer
index 210b33de6beaa6a8559b8631c8ce1b361dc05182..341256d15ec2ea69a05dd8805e5c27f4066893b2 100644 (file)
@@ -286,4 +286,13 @@ if !(&control.NAS-Port == 0) {
        test_fail
 }
 
+# NAS-Identifier has un-safe SQL characters - check escaping works
+map sql "SELECT attribute FROM radcheck WHERE username = '%{NAS-Identifier}'" {
+       &control.Filter-Id      = 'attribute'
+}
+
+if (!notfound) {
+       test_fail
+}
+
 test_pass