[Bug 261792] net/openldap26-server /usr/local/etc/rc.d/slapd assumes cn=config/olcDatabase=* are files

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 08 Feb 2022 15:30:38 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=261792

            Bug ID: 261792
           Summary: net/openldap26-server /usr/local/etc/rc.d/slapd
                    assumes cn=config/olcDatabase=* are files
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: delphij@FreeBSD.org
          Reporter: gray@nxg.name
          Assignee: delphij@FreeBSD.org
             Flags: maintainer-feedback?(delphij@FreeBSD.org)

The slapd startup script searches for the location of the database directory
with the line

    DATABASEDIR=`grep olcDbDirectory
/usr/local/etc/openldap/slapd.d/cn=config/olcDatabase=* | awk '{ print $2 }'`

This assumes that the objects olcDatabase=* are files, but they needn't be. 
For example

    % ls -d1 /usr/local/etc/openldap/slapd.d/cn=config/olcDatabase=*
    /usr/local/etc/openldap/slapd.d/cn=config/olcDatabase={-1}frontend.ldif
    /usr/local/etc/openldap/slapd.d/cn=config/olcDatabase={0}config.ldif
    /usr/local/etc/openldap/slapd.d/cn=config/olcDatabase={1}mdb/
    /usr/local/etc/openldap/slapd.d/cn=config/olcDatabase={1}mdb.ldif
    /usr/local/etc/openldap/slapd.d/cn=config/olcDatabase={2}mdb/
    /usr/local/etc/openldap/slapd.d/cn=config/olcDatabase={2}mdb.ldif

(the extra databases are for accesslog and syncprov)

This produces warnings when the script is used:

    % service slapd stop
    grep: /usr/local/etc/openldap/slapd.d/cn=config/olcDatabase={1}mdb: Is a
directory
    grep: /usr/local/etc/openldap/slapd.d/cn=config/olcDatabase={2}mdb: Is a
directory
    Stopping slapd.
    Waiting for PIDS: 72659.

A suitable alternative might be:

    % find /usr/local/etc/openldap/slapd.d/cn=config -name
olcDatabase=\*.ldif|xargs grep olcDbDirectory

This is in the port of openldap26-server-2.6.0, in 13.0-RELEASE.

-- 
You are receiving this mail because:
You are the assignee for the bug.