krb5 commit: Search for LDAP core schema in t_kdb.py

Greg Hudson ghudson at mit.edu
Wed Dec 23 12:54:30 EST 2015


https://github.com/krb5/krb5/commit/c5069d75793e360463ecbd14e6593e245a7151b6
commit c5069d75793e360463ecbd14e6593e245a7151b6
Author: Sarah Day <sarahday at mit.edu>
Date:   Fri Dec 4 12:36:33 2015 -0500

    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.

 src/tests/t_kdb.py |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/tests/t_kdb.py b/src/tests/t_kdb.py
index 28c672c..2d2d675 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


More information about the cvs-krb5 mailing list