]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
auto-convert LDAP
authorAlan T. DeKok <aland@freeradius.org>
Mon, 9 Oct 2023 13:06:08 +0000 (09:06 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 9 Oct 2023 13:06:08 +0000 (09:06 -0400)
perl -p -i -e 's/"%{ldap:(.*?)}"/%ldap("$1")/' $(git grep -lE '%\{[a-z]+:' src/tests/modules/)

src/tests/modules/ldap/acct.unlang
src/tests/modules/ldap/auth.unlang
src/tests/modules/ldap/xlat.unlang

index 0f7ab0582b3219efa73863ed2316be9d9e0fa766..e7628d8bc6980383029094a9875374d1d2a46267 100644 (file)
@@ -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
index 525246b9bf41015fc58116af726591eb7a638532..773cca3338c0801c0287c9922c88e05afa0d4d25 100644 (file)
@@ -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
index da809471a647d8826b98a625cd535b8905686239..93810fe5c9fd108a807e0b94efc978f06b19ca5d 100644 (file)
@@ -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