]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Replace != with !( == ) in ldap module tests
authorNick Porter <nick@portercomputing.co.uk>
Tue, 31 Jan 2023 13:10:06 +0000 (13:10 +0000)
committerNick Porter <nick@portercomputing.co.uk>
Wed, 1 Feb 2023 18:35:30 +0000 (18:35 +0000)
src/tests/modules/ldap/auth.unlang
src/tests/modules/ldap/auth_ssl.unlang
src/tests/modules/ldap/auth_starttls.unlang
src/tests/modules/ldap/groups_rfc2307bis.unlang
src/tests/modules/ldap/map.unlang
src/tests/modules/ldap/xlat.unlang

index 680cc7c3edc1f704172de75b123f50a42e2a9298..bd5de988e7185bfb8917be10182a12c1c78c68e6 100644 (file)
@@ -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
 }
 
index 0fba61f7537ed3e23e862296721ddc769d261582..8ebaeafa130500c3d748b780c829be22e28d922d 100644 (file)
@@ -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
 }
 
index c8c327ee4a6f7e2b6b22baddcc654a1417c5486a..9a72d8c616d665903ce48ef497adb88135fbbd31 100644 (file)
@@ -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
 }
 
index 2150c77af6f1cfad0ba80ec15ae2da4b8b73169e..6c4738d5d40f775f7fd2617de700548cadf0f3d9 100644 (file)
@@ -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
 }
 
index 879d4851f102f8d54cae42936c4545f6ecbb836a..a08d60348f8acbc97a3ca23f2ffc0b255d61a2b9 100644 (file)
@@ -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
 }
 
index 8a5953879917b66c1bd9ae74fd1739e90f372bee..3193a87ce33170cd1ef35c1f5ff59ef460a1a14c 100644 (file)
@@ -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
 }