]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Allow slapd path configuration in t_kdb.py 570/head
authorGreg Hudson <ghudson@mit.edu>
Sun, 27 Nov 2016 23:37:12 +0000 (18:37 -0500)
committerGreg Hudson <ghudson@mit.edu>
Tue, 29 Nov 2016 17:34:45 +0000 (12:34 -0500)
The upstream OpenLDAP installs slapd in libexec, which is not
typically in the path.  Also, copying the binary can sometimes cause
it to fail; for instance, in the OpenCSW package,
/opt/csw/libexec/slapd is a script which chooses a binary based on the
system architecture and the path to the script.  Allow the test runner
to set the SLAPD environment variable to specify the slapd location
and avoid the copy.

src/tests/t_kdb.py

index 5c17257dd4765a81161fb8e71ec93027c3e6f1a9..185225afa5a3f622aed6513acac7f3447db6c320 100755 (executable)
@@ -13,12 +13,10 @@ if (not os.path.exists(os.path.join(plugins, 'kdb', 'kldap.so')) and
     not os.path.exists(os.path.join(buildtop, 'lib', 'libkdb_ldap.a'))):
     skip_rest('LDAP KDB tests', 'LDAP KDB module not built')
 
-system_slapd = which('slapd')
-if not system_slapd:
+if 'SLAPD' not in os.environ and not which('slapd'):
     skip_rest('LDAP KDB tests', 'slapd not found')
 
 ldapdir = os.path.abspath('ldap')
-slapd = os.path.join(ldapdir, 'slapd')
 dbdir = os.path.join(ldapdir, 'ldap')
 slapd_conf = os.path.join(ldapdir, 'slapd.conf')
 slapd_out = os.path.join(ldapdir, 'slapd.out')
@@ -36,10 +34,15 @@ shutil.rmtree(ldapdir, True)
 os.mkdir(ldapdir)
 os.mkdir(dbdir)
 
-# Some Linux installations have AppArmor or similar restrictions on
-# the slapd binary, which would prevent it from accessing the build
-# directory.  Try to defeat this by copying the binary.
-shutil.copy(system_slapd, slapd)
+if 'SLAPD' in os.environ:
+    slapd = os.environ['SLAPD']
+else:
+    # Some Linux installations have AppArmor or similar restrictions
+    # on the slapd binary, which would prevent it from accessing the
+    # build directory.  Try to defeat this by copying the binary.
+    system_slapd = which('slapd')
+    slapd = os.path.join(ldapdir, 'slapd')
+    shutil.copy(system_slapd, slapd)
 
 # Find the core schema file if we can.
 ldap_homes = ['/etc/ldap', '/etc/openldap', '/usr/local/etc/openldap',