From: Alan T. DeKok Date: Mon, 9 Oct 2023 13:06:08 +0000 (-0400) Subject: auto-convert LDAP X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b4af84428990140af855f5ca7a6ecbc7790cc4bf;p=thirdparty%2Ffreeradius-server.git auto-convert LDAP perl -p -i -e 's/"%{ldap:(.*?)}"/%ldap("$1")/' $(git grep -lE '%\{[a-z]+:' src/tests/modules/) --- diff --git a/src/tests/modules/ldap/acct.unlang b/src/tests/modules/ldap/acct.unlang index 0f7ab0582b..e7628d8bc6 100644 --- a/src/tests/modules/ldap/acct.unlang +++ b/src/tests/modules/ldap/acct.unlang @@ -8,7 +8,7 @@ if (!ok) { test_fail } -&Tmp-String-0 := "%{ldap:ldap://$ENV{TEST_SERVER}/uid=bob,ou=people,dc=example,dc=com?description}" +&Tmp-String-0 := %ldap("ldap://$ENV{TEST_SERVER}/uid=bob,ou=people,dc=example,dc=com?description") if (&Tmp-String-0 != "User bob is online") { test_fail diff --git a/src/tests/modules/ldap/auth.unlang b/src/tests/modules/ldap/auth.unlang index 525246b9bf..773cca3338 100644 --- a/src/tests/modules/ldap/auth.unlang +++ b/src/tests/modules/ldap/auth.unlang @@ -48,7 +48,7 @@ ldap.authenticate ldap.send -&Tmp-String-0 := "%{ldap:ldap://$ENV{TEST_SERVER}/uid=john,ou=people,dc=example,dc=com?description}" +&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")) { test_fail diff --git a/src/tests/modules/ldap/xlat.unlang b/src/tests/modules/ldap/xlat.unlang index da809471a6..93810fe5c9 100644 --- a/src/tests/modules/ldap/xlat.unlang +++ b/src/tests/modules/ldap/xlat.unlang @@ -45,63 +45,63 @@ 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)}" +&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")) { 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)}" +&Tmp-String-7 := %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 == "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}*)}" +&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")) { 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)}" +&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 == "")) { 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)}" +&Tmp-String-0 := %ldap("ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=notthere?displayName?sub?(uid=john)") if (!(&Tmp-String-0 == "")) { 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)}" +&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")) { 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)}" +&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)") 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)}" +&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")) { 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)}" +&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 == "")) { test_fail