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.
https://bugs.openldap.org/show_bug.cgi?id=9843
--- Comment #1 from Howard Chu hyc@openldap.org --- Just change your config to use relative paths instead of absolute.
https://bugs.openldap.org/show_bug.cgi?id=9843
--- Comment #2 from dpa-openldap@aegee.org dpa-openldap@aegee.org --- This is a duplicate of https://bugs.openldap.org/show_bug.cgi?id=9702 .
While using relative paths in olcDbDirectory and changing to the root-base before calling slapcat/slapadd does help, and creating a symlink outside the chrooted environment pointing to the data-directory inside the chrooted environment (e.g /var/openldap-data symlinked to /zzz/chroot/var/openldap-data) also helps, it would be better, if slapadd/slapcat had the -r option.
This avoids the need to change to a particular directory, before calling slapcat/slapadd. I call slapcat/slapadd only when upgrading 2.4→2.5→2.6, so once a year and I really forget the details (calling “cd” )when operations are performed that seldom. With an -r option, slapcat/slapadd will be more coherent to slapd.
https://bugs.openldap.org/show_bug.cgi?id=9843
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |DUPLICATE
--- Comment #3 from Quanah Gibson-Mount quanah@openldap.org ---
*** This issue has been marked as a duplicate of issue 9702 ***
https://bugs.openldap.org/show_bug.cgi?id=9843
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |VERIFIED Keywords|needs_review |