From: Nick Porter Date: Tue, 31 Jan 2023 13:10:06 +0000 (+0000) Subject: Replace != with !( == ) in ldap module tests X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a18d0ea3c5e3eef6142531eeeb85ff7f5696c58d;p=thirdparty%2Ffreeradius-server.git Replace != with !( == ) in ldap module tests --- diff --git a/src/tests/modules/ldap/auth.unlang b/src/tests/modules/ldap/auth.unlang index 680cc7c3edc..bd5de988e71 100644 --- a/src/tests/modules/ldap/auth.unlang +++ b/src/tests/modules/ldap/auth.unlang @@ -3,11 +3,11 @@ # ldap -if (&control.NAS-IP-Address != 1.2.3.4) { +if (!(&control.NAS-IP-Address == 1.2.3.4)) { test_fail } -if (&control.Reply-Message != "Hello world") { +if (!(&control.Reply-Message == "Hello world")) { test_fail } @@ -17,19 +17,19 @@ if (&control.Framed-IP-Address) { } # IP netmask defined in profile1 should overwrite radprofile value. -if (&reply.Framed-IP-Netmask != 255.255.0.0) { +if (!(&reply.Framed-IP-Netmask == 255.255.0.0)) { test_fail } -if (&reply.Acct-Interim-Interval != 1800) { +if (!(&reply.Acct-Interim-Interval == 1800)) { test_fail } -if (&reply.Idle-Timeout != 3600) { +if (!(&reply.Idle-Timeout == 3600)) { test_fail } -if (&reply.Session-Timeout != 7200) { +if (!(&reply.Session-Timeout == 7200)) { test_fail } @@ -44,7 +44,7 @@ ldap.send &Tmp-String-0 := "%{ldap:ldap://$ENV{TEST_SERVER}/uid=john,ou=people,dc=example,dc=com?description}" -if (&Tmp-String-0 != "User %{User-Name} authenticated") { +if (!(&Tmp-String-0 == "User %{User-Name} authenticated")) { test_fail } diff --git a/src/tests/modules/ldap/auth_ssl.unlang b/src/tests/modules/ldap/auth_ssl.unlang index 0fba61f7537..8ebaeafa130 100644 --- a/src/tests/modules/ldap/auth_ssl.unlang +++ b/src/tests/modules/ldap/auth_ssl.unlang @@ -3,7 +3,7 @@ # ldapssl -if (&control.NAS-IP-Address != 1.2.3.4) { +if (!(&control.NAS-IP-Address == 1.2.3.4)) { test_fail } @@ -12,11 +12,11 @@ if (&control.Framed-IP-Address) { test_fail } -if (&reply.Idle-Timeout != 3600) { +if (!(&reply.Idle-Timeout == 3600)) { test_fail } -if (&reply.Session-Timeout != 7200) { +if (!(&reply.Session-Timeout == 7200)) { test_fail } @@ -31,7 +31,7 @@ ldapssl.send &Tmp-String-0 := "%{ldapssl:ldaps:///uid=fred,ou=people,dc=subdept,dc=example,dc=com?description}" -if (&Tmp-String-0 != "User %{User-Name} authenticated") { +if (!(&Tmp-String-0 == "User %{User-Name} authenticated")) { test_fail } diff --git a/src/tests/modules/ldap/auth_starttls.unlang b/src/tests/modules/ldap/auth_starttls.unlang index c8c327ee4a6..9a72d8c616d 100644 --- a/src/tests/modules/ldap/auth_starttls.unlang +++ b/src/tests/modules/ldap/auth_starttls.unlang @@ -4,7 +4,7 @@ ldaptls -if (&control.NAS-IP-Address != 1.2.3.4) { +if (!(&control.NAS-IP-Address == 1.2.3.4)) { test_fail } @@ -13,11 +13,11 @@ if (&control.Framed-IP-Address) { test_fail } -if (&reply.Idle-Timeout != 3600) { +if (!(&reply.Idle-Timeout == 3600)) { test_fail } -if (&reply.Session-Timeout != 7200) { +if (!(&reply.Session-Timeout == 7200)) { test_fail } @@ -32,7 +32,7 @@ ldaptls.send &Tmp-String-0 := "%{ldaptls:ldap:///uid=fred,ou=people,dc=subdept,dc=example,dc=com?description}" -if (&Tmp-String-0 != "User %{User-Name} authenticated") { +if (!(&Tmp-String-0 == "User %{User-Name} authenticated")) { test_fail } diff --git a/src/tests/modules/ldap/groups_rfc2307bis.unlang b/src/tests/modules/ldap/groups_rfc2307bis.unlang index 2150c77af6f..6c4738d5d40 100644 --- a/src/tests/modules/ldap/groups_rfc2307bis.unlang +++ b/src/tests/modules/ldap/groups_rfc2307bis.unlang @@ -6,11 +6,11 @@ ldap # # Resolve using group name attribute # -if (&LDAP-Group != 'foo') { +if (!(&LDAP-Group == 'foo')) { test_fail } -if (&LDAP-Group != 'foo') { +if (!(&LDAP-Group == 'foo')) { test_fail } @@ -18,25 +18,25 @@ if (&LDAP-Group != 'foo') { # Using paircmp xlat expansion. This is only for internal use, # and will be removed before v4 alpha. # -if (!%{paircmp:&LDAP-Group foo}) { +if (!%(paircmp:&LDAP-Group foo)) { test_fail } # # Resolve using group DN # -if (&LDAP-Group != 'cn=foo,ou=groups,dc=example,dc=com') { +if (!(&LDAP-Group == 'cn=foo,ou=groups,dc=example,dc=com')) { test_fail } # # Check we have these values cached # -if (&control.LDAP-Cached-Membership[*] != 'foo') { +if (!(&control.LDAP-Cached-Membership[*] == 'foo')) { test_fail } -if (&control.LDAP-Cached-Membership[*] != 'cn=foo,ou=groups,dc=example,dc=com') { +if (!(&control.LDAP-Cached-Membership[*] == 'cn=foo,ou=groups,dc=example,dc=com')) { test_fail } diff --git a/src/tests/modules/ldap/map.unlang b/src/tests/modules/ldap/map.unlang index 879d4851f10..a08d60348f8 100644 --- a/src/tests/modules/ldap/map.unlang +++ b/src/tests/modules/ldap/map.unlang @@ -7,15 +7,15 @@ if (!updated) { test_fail } -if (&Tmp-String-0 != '255.255.255.0') { +if (!(&Tmp-String-0 == '255.255.255.0')) { test_fail } -if (&Tmp-String-1[*] != 'cn=radprofile,ou=profiles,dc=example,dc=com') { +if (!(&Tmp-String-1[*] == 'cn=radprofile,ou=profiles,dc=example,dc=com')) { test_fail } -if (&Tmp-String-1[*] != 'cn=profile1,ou=profiles,dc=example,dc=com') { +if (!(&Tmp-String-1[*] == 'cn=profile1,ou=profiles,dc=example,dc=com')) { test_fail } diff --git a/src/tests/modules/ldap/xlat.unlang b/src/tests/modules/ldap/xlat.unlang index 8a595387991..3193a87ce33 100644 --- a/src/tests/modules/ldap/xlat.unlang +++ b/src/tests/modules/ldap/xlat.unlang @@ -9,73 +9,73 @@ # String with no escaping &control.Tmp-String-0 := "%{ldap_escape:%{Tmp-String-0}}" -if (&control.Tmp-String-0 != "safe string") { +if (!(&control.Tmp-String-0 == "safe string")) { test_fail } # String with some characters to escape &control.Tmp-String-1 := "%{ldap_escape:%{Tmp-String-1}}" -if (&control.Tmp-String-1 != 'non safe\2c\2b\22\5c\3c\3e\3b\2a\3d\28\29 string') { +if (!(&control.Tmp-String-1 == 'non safe\2c\2b\22\5c\3c\3e\3b\2a\3d\28\29 string')) { test_fail } # String where all characters require escaping &control.Tmp-String-2 := "%{ldap_escape:%{Tmp-String-2}}" -if (&control.Tmp-String-2 != '\2c\2b\22\5c\3c\3e\3b\2a\3d\28\29') { +if (!(&control.Tmp-String-2 == '\2c\2b\22\5c\3c\3e\3b\2a\3d\28\29')) { test_fail } &Tmp-String-3 := "%{ldap_unescape:%{control.Tmp-String-0}}" -if (&Tmp-String-3 != 'safe string') { +if (!(&Tmp-String-3 == 'safe string')) { test_fail } &Tmp-String-4 := "%{ldap_unescape:%{control.Tmp-String-1}}" -if (&Tmp-String-4 != 'non safe,+"\<>;*=() string') { +if (!(&Tmp-String-4 == 'non safe,+"\<>;*=() string')) { test_fail } &Tmp-String-5 := "%{ldap_unescape:%{control.Tmp-String-2}}" -if (&Tmp-String-5 != ',+"\<>;*=()') { +if (!(&Tmp-String-5 == ',+"\<>;*=()')) { 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)}" -if (&Tmp-String-6 != "John Doe") { +if (!(&Tmp-String-6 == "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?radiusClientIdentifier?sub?(objectClass=radiusClient)}" -if ((&Tmp-String-7 != "1.1.1.12.2.2.2") && (&Tmp-String-7 != "2.2.2.21.1.1.1")) { +if (!(&Tmp-String-7 == "1.1.1.12.2.2.2") && !(&Tmp-String-7 == "2.2.2.21.1.1.1")) { 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}*)}" -if (&Tmp-String-8 != "Bob Smith") { +if (!(&Tmp-String-8 == "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)}" -if (&Tmp-String-0 != "") { +if (!(&Tmp-String-0 == "")) { 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)}" -if (&Tmp-String-0 != "") { +if (!(&Tmp-String-0 == "")) { test_fail } @@ -86,32 +86,32 @@ if (&Module-Failure-Message != "LDAP server returned an error: lib error: No suc # 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)}" -if (&Tmp-String-0 != "Fred Jones") { +if (!(&Tmp-String-0 == "Fred Jones")) { test_fail } # Reference an alternative LDAP server in the xlat &Tmp-String-1 := "%{ldap:ldap://$ENV{LDAP_TEST_SERVER}:%{expr:$ENV{LDAP_TEST_SERVER_PORT} + 1}/dc=subdept,dc=example,dc=com?displayName?sub?(uid=fred)}" -if (&Tmp-String-1 != "Fred Jones") { +if (!(&Tmp-String-1 == "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)}" -if (&Tmp-String-2 != "John Doe") { +if (!(&Tmp-String-2 == "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)}" -if (&Tmp-String-3 != "") { +if (!(&Tmp-String-3 == "")) { test_fail } -if (&Module-Failure-Message != "Maximum LDAP referral depth (2) exceeded") { +if (!(&Module-Failure-Message == "Maximum LDAP referral depth (2) exceeded")) { test_fail }