From: Sarah Day Date: Fri, 4 Dec 2015 17:36:33 +0000 (-0500) Subject: Search for LDAP core schema in t_kdb.py X-Git-Tag: krb5-1.15-beta1~308 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5069d75793e360463ecbd14e6593e245a7151b6;p=thirdparty%2Fkrb5.git Search for LDAP core schema in t_kdb.py The t_kdb.py python test was hardcoded to search for the LDAP core.schema file in a single place. OpenLDAP can be installed in more than one place. Add a check which looks in several of these common installation locations to find the core schema file. --- diff --git a/src/tests/t_kdb.py b/src/tests/t_kdb.py index 28c672ce34..2d2d675de3 100755 --- a/src/tests/t_kdb.py +++ b/src/tests/t_kdb.py @@ -1,6 +1,7 @@ #!/usr/bin/python from k5test import * import time +from itertools import imap # Run kdbtest against the BDB module. realm = K5Realm(create_kdb=False) @@ -41,9 +42,11 @@ os.mkdir(dbdir) shutil.copy(system_slapd, slapd) # Find the core schema file if we can. -core_schema = None -if os.path.isfile('/etc/ldap/schema/core.schema'): - core_schema = '/etc/ldap/schema/core.schema' +ldap_homes = ['/etc/ldap', '/etc/openldap', '/usr/local/etc/openldap', + '/usr/local/etc/ldap'] +local_schema_path = '/schema/core.schema' +core_schema = next((i for i in imap(lambda x:x+local_schema_path, ldap_homes) + if os.path.isfile(i)), None) # Make a slapd config file. This is deprecated in OpenLDAP 2.3 and # later, but it's easier than using LDIF and slapadd. Include some