https://bugs.openldap.org/show_bug.cgi?id=9843
Issue ID: 9843 Summary: slapcat and slapadd have no -r option Product: OpenLDAP Version: 2.5.12 Hardware: All OS: Linux Status: UNCONFIRMED Keywords: needs_review Severity: normal Priority: --- Component: slapd Assignee: bugs@openldap.org Reporter: dpa-openldap@aegee.org Target Milestone: ---
I run openldap in a chrooted environment, by calling
/usr/local/libexec/slapd -d0 -u openldap -r /home/openldap -F /etc/openldap/ -h 'ldap://zzz'
I want to migrate 2.5 → 2.6. The manual says first to call slapcat on the databases. In the /home/openldap/etc/openldap directory are the configurations of the databases. The path there:
olcDbDirectory: /var/openldap-data/yyy
obviously references the path within the chrooted environment, the path is /home/openldap/var/openldap-data/yyy outside the chrooted environment. Slapcat has no -r option. So there is no way to export the databases by using slapcat -n 0 -F /home/openldap/etc/openldap/ . Strace(1) shows that the file
openat(AT_FDCWD, "/var/openldap-data/yyy/DUMMY"
is missing and the error message is
slapcat: bad configuration directory!
In fact there is a way: symlinking /var/openldap-data outside the chrooted environment to /var/openldap-data inside the chrooted environment. This way does work, but it requires expert magic like using strace.
Please add -r option to slapcat and slapadd, which performs chroot to the directory, after opening the file specified by the -l parameter.