]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Search for LDAP core schema in t_kdb.py
authorSarah Day <sarahday@mit.edu>
Fri, 4 Dec 2015 17:36:33 +0000 (12:36 -0500)
committerGreg Hudson <ghudson@mit.edu>
Wed, 23 Dec 2015 17:40:49 +0000 (12:40 -0500)
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.

src/tests/t_kdb.py

index 28c672ce340ef20a2e3616f67fa9b624fa19e299..2d2d675de3cc6b71317aac49b020c25190e28fb2 100755 (executable)
@@ -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