]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Remove Tmp- attributes from ldap module tests
authorNick Porter <nick@portercomputing.co.uk>
Mon, 8 Jan 2024 11:48:34 +0000 (11:48 +0000)
committerNick Porter <nick@portercomputing.co.uk>
Mon, 8 Jan 2024 11:48:34 +0000 (11:48 +0000)
src/tests/modules/ldap/acct.unlang
src/tests/modules/ldap/auth.unlang
src/tests/modules/ldap/auth_ssl.unlang
src/tests/modules/ldap/auth_starttls.unlang
src/tests/modules/ldap/map.unlang
src/tests/modules/ldap/xlat.attrs
src/tests/modules/ldap/xlat.unlang

index e7628d8bc6980383029094a9875374d1d2a46267..07f1eeca867e2e4d84fc9dc904c550aaad009f16 100644 (file)
@@ -1,3 +1,4 @@
+string test_string
 #
 #  Run the "ldap" module
 #  PRE: auth
@@ -8,9 +9,9 @@ if (!ok) {
         test_fail
 }
 
-&Tmp-String-0 := %ldap("ldap://$ENV{TEST_SERVER}/uid=bob,ou=people,dc=example,dc=com?description")
+&test_string := %ldap("ldap://$ENV{TEST_SERVER}/uid=bob,ou=people,dc=example,dc=com?description")
 
-if (&Tmp-String-0 != "User bob is online") {
+if (&test_string != "User bob is online") {
         test_fail
 }
 
index 773cca3338c0801c0287c9922c88e05afa0d4d25..b148419d899aa30f7df236152994623706743fe4 100644 (file)
@@ -1,3 +1,5 @@
+string test_string
+
 #
 #  Run the "ldap" module
 #
@@ -48,9 +50,9 @@ ldap.authenticate
 
 ldap.send
 
-&Tmp-String-0 := %ldap("ldap://$ENV{TEST_SERVER}/uid=john,ou=people,dc=example,dc=com?description")
+&test_string := %ldap("ldap://$ENV{TEST_SERVER}/uid=john,ou=people,dc=example,dc=com?description")
 
-if (!(&Tmp-String-0 == "User %{User-Name} authenticated")) {
+if (!(&test_string == "User %{User-Name} authenticated")) {
        test_fail
 }
 
index d76271fea0017d3521f45f1a2af19a962f82238d..c55f4e01b36079ead7201a9dc901afeb3a88e7ab 100644 (file)
@@ -1,3 +1,5 @@
+string test_string
+
 #
 #  Run the "ldapssl" module - an instance of ldap using an ssl connection
 #  PRE: acct
@@ -26,9 +28,9 @@ ldapssl.authenticate
 
 ldapssl.send
 
-&Tmp-String-0 := %ldapssl("ldaps:///uid=fred,ou=people,dc=subdept,dc=example,dc=com?description")
+&test_string := %ldapssl("ldaps:///uid=fred,ou=people,dc=subdept,dc=example,dc=com?description")
 
-if (!(&Tmp-String-0 == "User %{User-Name} authenticated")) {
+if (!(&test_string == "User %{User-Name} authenticated")) {
        test_fail
 }
 
index a0fb23138f86571bfb3795d3f1a8fd793e1bf50d..1c1fb55403759587f8dbe4d480189bce8315cda1 100644 (file)
@@ -1,3 +1,5 @@
+string test_string
+
 #
 #  Run the "ldapssl" module - an instance of ldap using an ssl connection
 #  PRE: auth_ssl
@@ -27,9 +29,9 @@ ldaptls.authenticate
 
 ldaptls.send
 
-&Tmp-String-0 := %ldaptls("ldap:///uid=joe,ou=people,dc=subdept,dc=example,dc=com?description")
+&test_string := %ldaptls("ldap:///uid=joe,ou=people,dc=subdept,dc=example,dc=com?description")
 
-if (!(&Tmp-String-0 == "User %{User-Name} authenticated")) {
+if (!(&test_string == "User %{User-Name} authenticated")) {
        test_fail
 }
 
index 06313edb4cfecc7d25e8a75a9f4e3d06d9c32f6b..3a62f320e63a872b0ef8dfd10e36aa775a87eaba 100644 (file)
@@ -1,27 +1,27 @@
 map ldap "ldap:///ou=profiles,dc=example,dc=com??sub?(objectClass=radiusprofile)" {
-       &Tmp-String-0 := 'radiusFramedIPNetmask'
-       &Tmp-String-1 += 'entryDN'
+       &Framed-IP-Netmask := 'radiusFramedIPNetmask'
+       &Filter-Id += 'entryDN'
 }
 
 if (!updated) {
        test_fail
 }
 
-if (!(&Tmp-String-0 == '255.255.255.0')) {
+if (!(&Framed-IP-Netmask == '255.255.255.0')) {
        test_fail
 }
 
-if (!(&Tmp-String-1[*] == 'cn=radprofile,ou=profiles,dc=example,dc=com')) {
+if (!(&Filter-Id[*] == 'cn=radprofile,ou=profiles,dc=example,dc=com')) {
        test_fail
 }
 
-if (!(&Tmp-String-1[*] == 'cn=profile1,ou=profiles,dc=example,dc=com')) {
+if (!(&Filter-Id[*] == 'cn=profile1,ou=profiles,dc=example,dc=com')) {
        test_fail
 }
 
 map ldap "ldap:///ou=profiles,dc=example,dc=com??sub?(objectClass=notARealObject)" {
-       &Tmp-String-0 := 'radiusFramedIPNetmask'
-       &Tmp-String-1 += 'entryDN'
+       &Framed-IP-Netmask := 'radiusFramedIPNetmask'
+       &Filter-Id += 'entryDN'
 }
 
 if (!notfound) {
@@ -29,14 +29,14 @@ if (!notfound) {
 }
 
 map ldapldapi "ldapi://%%2Ftmp%%2Fldap%%2Fsocket/ou=people,dc=example,dc=com??sub?(uid=John)" {
-       &Tmp-String-2 := 'displayName'
+       &Filter-Id := 'displayName'
 }
 
 if (!updated) {
        test_fail
 }
 
-if !(&Tmp-String-2 == 'John Doe') {
+if !(&Filter-Id == 'John Doe') {
        test_fail
 }
 
index c12b9e965d1bd4799fede6e4b10ac5e2c6d38618..8e5aecb579442ecb8927f1809de8fe3178fd7030 100644 (file)
@@ -5,7 +5,7 @@ Packet-Type = Access-Request
 User-Name = "john"
 User-Password = "password"
 NAS-IP-Address = 1.2.3.5
-Tmp-String-9 = "(manager)"
+Filter-Id = "(manager)"
 
 #
 #  Expected answer
index 9bebce63b1bd30554940ab5e9de4e81e9fce04a6..b8aa18259b930dd10e4b7f57c69ece4de6cb6878 100644 (file)
+string test_string
+string result_string
+
 #
 #  Test the "ldap" module xlat escape functions
 #
 
-&Tmp-String-0 := "safe string"
-&Tmp-String-1 := 'non safe,+"\<>;*=() string'
-&Tmp-String-2 := ',+"\<>;*=()'
+&test_string := "safe string"
 
 # String with no escaping
-&control.Tmp-String-0 := %ldap_escape(%{Tmp-String-0})
+&result_string := %ldap_escape(%{test_string})
 
-if (!(&control.Tmp-String-0 == "safe string")) {
+if (!(&result_string == "safe string")) {
         test_fail
 }
 
-# String with some characters to escape
-&control.Tmp-String-1 := %ldap_escape(%{Tmp-String-1})
+&result_string := %ldap_unescape(%{result_string})
 
-if (!(&control.Tmp-String-1 == 'non safe\2c\2b\22\5c\3c\3e\3b\2a\3d\28\29 string')) {
+if (!(&result_string == 'safe string')) {
         test_fail
 }
 
-# String where all characters require escaping
-&control.Tmp-String-2 := %ldap_escape(%{Tmp-String-2})
+# String with some characters to escape
+&test_string := 'non safe,+"\<>;*=() string'
+&result_string := %ldap_escape(%{test_string})
 
-if (!(&control.Tmp-String-2 == '\2c\2b\22\5c\3c\3e\3b\2a\3d\28\29')) {
+if (!(&result_string == 'non safe\2c\2b\22\5c\3c\3e\3b\2a\3d\28\29 string')) {
         test_fail
 }
 
-&Tmp-String-3 := %ldap_unescape(%{control.Tmp-String-0})
+&result_string := %ldap_unescape(%{result_string})
 
-if (!(&Tmp-String-3 == 'safe string')) {
+if (!(&result_string == 'non safe,+"\<>;*=() string')) {
         test_fail
 }
 
-&Tmp-String-4 := %ldap_unescape(%{control.Tmp-String-1})
+# String where all characters require escaping
+&test_string := ',+"\<>;*=()'
+&result_string := %ldap_escape(%{test_string})
 
-if (!(&Tmp-String-4 == 'non safe,+"\<>;*=() string')) {
+if (!(&result_string == '\2c\2b\22\5c\3c\3e\3b\2a\3d\28\29')) {
         test_fail
 }
 
-&Tmp-String-5 := %ldap_unescape(%{control.Tmp-String-2})
+&result_string := %ldap_unescape(%{result_string})
 
-if (!(&Tmp-String-5 == ',+"\<>;*=()')) {
+if (!(&result_string == ',+"\<>;*=()')) {
         test_fail
 }
 
-&Tmp-String-6 := %ldap("ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=people,dc=example,dc=com?displayName?sub?(uid=john)")
+&result_string := %ldap("ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=people,dc=example,dc=com?displayName?sub?(uid=john)")
 
-if (!(&Tmp-String-6 == "John Doe")) {
+if (!(&result_string == "John Doe")) {
         test_fail
 }
 
 # Return multiple values - could be in any sequence
-&Tmp-String-7 := %ldap("ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=clients,dc=example,dc=com?freeradiusClientIdentifier?sub?(objectClass=freeradiusClient)")
+&Framed-IP-Address := %ldap("ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=clients,dc=example,dc=com?freeradiusClientIdentifier?sub?(objectClass=freeradiusClient)")
 
-if !((&Tmp-String-7[0] == "1.1.1.1") && (&Tmp-String-7[1] == "2.2.2.2")) {
+if !((&Framed-IP-Address[0] == "1.1.1.1") && (&Framed-IP-Address[1] == "2.2.2.2")) {
         test_fail
 }
 
 # Use tainted string in filter - with special characters
-&Tmp-String-8 := %ldap("ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=people,dc=example,dc=com?cn?sub?(displayName=*%{Tmp-String-9}*)")
+&result_string := %ldap("ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=people,dc=example,dc=com?cn?sub?(displayName=*%{Filter-Id}*)")
 
-if (!(&Tmp-String-8 == "Bob Smith")) {
+if (!(&result_string == "Bob Smith")) {
         test_fail
 }
 
 # A query which should return no results
-&Tmp-String-0 := %ldap("ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=people,dc=example,dc=com?displayName?sub?(uid=notknown)")
+&result_string := %ldap("ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=people,dc=example,dc=com?displayName?sub?(uid=notknown)")
 
-if (&Tmp-String-0) {
+if (&result_string) {
         test_fail
 }
 
 # Request an invalid DN
-&Tmp-String-0 := %ldap("ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=notthere?displayName?sub?(uid=john)")
+&result_string := %ldap("ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=notthere?displayName?sub?(uid=john)")
 
-if (&Tmp-String-0) {
+if (&result_string) {
         test_fail
 }
 
 # Query within a dn which will prompt a referral
-&Tmp-String-0 := %ldap("ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/dc=subdept,dc=example,dc=com?displayName?sub?(uid=fred)")
+&result_string := %ldap("ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/dc=subdept,dc=example,dc=com?displayName?sub?(uid=fred)")
 
-if (!(&Tmp-String-0 == "Fred Jones")) {
+if (!(&result_string == "Fred Jones")) {
         test_fail
 }
 
 # Reference an alternative LDAP server in the xlat
-&Tmp-String-1 := %ldap("ldap://$ENV{LDAP_TEST_SERVER}:%{$ENV{LDAP_TEST_SERVER_PORT} + 1}/dc=subdept,dc=example,dc=com?displayName?sub?(uid=fred)")
+&result_string := %ldap("ldap://$ENV{LDAP_TEST_SERVER}:%{$ENV{LDAP_TEST_SERVER_PORT} + 1}/dc=subdept,dc=example,dc=com?displayName?sub?(uid=fred)")
 
-if (!(&Tmp-String-1 == "Fred Jones")) {
+if (!(&result_string == "Fred Jones")) {
         test_fail
 }
 
 # This query will follow 2 referrals, the second will present an alternate search base
-&Tmp-String-2 := %ldap("ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=offsite,dc=subdept,dc=example,dc=com?displayName?sub?(uid=john)")
+&result_string := %ldap("ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=offsite,dc=subdept,dc=example,dc=com?displayName?sub?(uid=john)")
 
-if (!(&Tmp-String-2 == "John Doe")) {
+if (!(&result_string == "John Doe")) {
         test_fail
 }
 
 # This query will follow 3 referrals - more than our max referral depth
-&Tmp-String-3 := %ldap("ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=bounce1,dc=subdept,dc=example,dc=com?displayName?sub?(uid=fred)")
+&result_string := %ldap("ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=bounce1,dc=subdept,dc=example,dc=com?displayName?sub?(uid=fred)")
 
-if (&Tmp-String-3) {
+if (&result_string) {
         test_fail
 }
 
@@ -112,9 +115,9 @@ if (!(&Module-Failure-Message == "Maximum LDAP referral depth (2) exceeded")) {
 }
 
 # Use an ldapi:// connection
-&Tmp-String-4 := %ldapldapi("ldapi:///ou=people,dc=example,dc=com?displayName?sub?(uid=john)")
+&result_string := %ldapldapi("ldapi:///ou=people,dc=example,dc=com?displayName?sub?(uid=john)")
 
-if !(&Tmp-String-4 == 'John Doe') {
+if !(&result_string == 'John Doe') {
        test_fail
 }