Skip to content

Commit

Permalink
Allow slapd path configuration in t_kdb.py
Browse files Browse the repository at this point in the history
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.

(cherry picked from commit 9290e52)

ticket: 8521 (new)
tags: pullup
target_version: 1.15-next
target_version: 1.14-next
version_fixed: 1.15
  • Loading branch information
greghudson authored and tlyu committed Nov 30, 2016
1 parent e9004b4 commit 4bda951
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/tests/t_kdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@
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')
Expand All @@ -36,10 +34,15 @@
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',
Expand Down

0 comments on commit 4bda951

Please sign in to comment.