From uspoerlein@gmail.com  Sun Dec 21 10:54:06 2008
Return-Path: <uspoerlein@gmail.com>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3794910656DC;
	Sun, 21 Dec 2008 10:54:06 +0000 (UTC)
	(envelope-from uspoerlein@gmail.com)
Received: from acme.spoerlein.net (cl-43.dus-01.de.sixxs.net [IPv6:2a01:198:200:2a::2])
	by mx1.freebsd.org (Postfix) with ESMTP id D1EE68FC21;
	Sun, 21 Dec 2008 10:54:05 +0000 (UTC)
	(envelope-from uspoerlein@gmail.com)
Received: from roadrunner.spoerlein.net (e180158076.adsl.alicedsl.de [85.180.158.76])
	by acme.spoerlein.net (8.14.2/8.14.2) with ESMTP id mBLAs2Tv042930
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Sun, 21 Dec 2008 11:54:03 +0100 (CET)
	(envelope-from uspoerlein@gmail.com)
Received: from roadrunner.spoerlein.net (localhost [127.0.0.1])
	by roadrunner.spoerlein.net (8.14.3/8.14.3) with ESMTP id mBLArY8O003072
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Sun, 21 Dec 2008 11:53:34 +0100 (CET)
	(envelope-from uqs@roadrunner.spoerlein.net)
Received: (from uqs@localhost)
	by roadrunner.spoerlein.net (8.14.3/8.14.3/Submit) id mBLArYXU003071;
	Sun, 21 Dec 2008 11:53:34 +0100 (CET)
	(envelope-from uqs)
Message-Id: <200812211053.mBLArYXU003071@roadrunner.spoerlein.net>
Date: Sun, 21 Dec 2008 11:53:34 +0100 (CET)
From: Ulrich Spoerlein <uspoerlein@gmail.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc: delphij@freebsd.org
Subject: [PATCH] net/openldap-server: RC script assumes too much
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         129813
>Category:       ports
>Synopsis:       [PATCH] net/openldap24-server: RC script assumes too much
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    delphij
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Dec 21 11:00:04 UTC 2008
>Closed-Date:    Mon Sep 07 09:47:02 UTC 2009
>Last-Modified:  Mon Sep 07 09:47:02 UTC 2009
>Originator:     Ulrich Spoerlein
>Release:        FreeBSD 7.1-PRERELEASE i386
>Organization:
>Environment:
System: FreeBSD roadrunner.spoerlein.net 7.1-PRERELEASE FreeBSD 7.1-PRERELEASE #0: Sat Nov  8 20:43:48 CET
>Description:
With OpenLDAP 2.4 the slapd.conf configuration can be replaced by storing the
configuration inside the LDAP database itself. Bootstrap parameters are stored
under the directory slapd.d/. Thus, slapd.conf is no longer a strict
requirement and the start script should reflect this.

This removes some of the hand-holding the script does.

Port maintainer (delphij@FreeBSD.org) is cc'd.
Generated with FreeBSD Port Tools 0.77
>How-To-Repeat:
>Fix:

--- openldap-server-2.4.11_3.patch begins here ---
Index: Makefile
===================================================================
RCS file: /tank/ncvs/ports/net/openldap24-server/Makefile,v
retrieving revision 1.161
diff -u -p -u -r1.161 Makefile
--- Makefile	30 Sep 2008 15:38:52 -0000	1.161
+++ Makefile	21 Dec 2008 10:48:44 -0000
@@ -39,7 +39,7 @@ BROKEN=			incompatible OpenLDAP version:
 .endif
 
 PORTREVISION_CLIENT=	0
-PORTREVISION_SERVER=	2
+PORTREVISION_SERVER=	3
 
 .if !defined(CLIENT_ONLY)
 OPTIONS=	SASL "With (Cyrus) SASL2 support" off \
Index: files/slapd.sh.in
===================================================================
RCS file: /tank/ncvs/ports/net/openldap24-server/files/slapd.sh.in,v
retrieving revision 1.8
diff -u -p -u -r1.8 slapd.sh.in
--- files/slapd.sh.in	30 Sep 2008 15:38:53 -0000	1.8
+++ files/slapd.sh.in	21 Dec 2008 10:48:44 -0000
@@ -32,15 +32,10 @@ rcvar=`set_rcvar`
 command="%%PREFIX%%/libexec/slapd"
 pidfile="%%LDAP_RUN_DIR%%/slapd.pid"
 required_dirs="%%LDAP_RUN_DIR%%"
-required_files="%%PREFIX%%/etc/openldap/slapd.conf"
 
 start_precmd=start_precmd
 start_postcmd=start_postcmd
 
-# extract user and group, adjust ownership of directories and database
-
-DATABASEDIR=`awk '$1 == "directory" {print $2}' "%%PREFIX%%/etc/openldap/slapd.conf"`
-
 start_precmd()
 {
   local slapd_ownername slapd_groupname
@@ -49,17 +44,7 @@ start_precmd()
   ""|[Nn][Oo][Nn][Ee]|[Dd][Ee][Ff][Aa][Uu][Ll][Tt])
     ;;
   *)
-    local DBDIR
-    for DBDIR in ${DATABASEDIR}; do
-       if [ ! -d "${DBDIR}" ]; then
-          mkdir -p "${DBDIR}"
-          cp "%%PREFIX%%/etc/openldap/DB_CONFIG.example" "${DBDIR}/DB_CONFIG"
-       fi
-       chown -RL "$slapd_owner" "${DBDIR}"
-       chmod 700 "${DBDIR}"
-    done
     chown "$slapd_owner" "%%LDAP_RUN_DIR%%"
-    chown "$slapd_owner" "%%PREFIX%%/etc/openldap/slapd.conf"
 
     slapd_ownername="${slapd_owner%:*}"
     slapd_groupname="${slapd_owner#*:}"
--- openldap-server-2.4.11_3.patch ends here ---

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->delphij 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Mon Dec 22 10:52:14 UTC 2008 
Responsible-Changed-Why:  
Over to maintainer (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=129813 

From: Leon =?iso-8859-15?Q?Me=DFner?= <l.messner@physik.tu-berlin.de>
To: bug-followup@FreeBSD.org, uspoerlein@gmail.com
Cc:  
Subject: Re: ports/129813: [PATCH] net/openldap24-server: RC script assumes
	too much
Date: Tue, 9 Jun 2009 15:12:43 +0200

 Hi,
 also the port/package copies slapd.conf.default to slapd.conf on
 installation/upgrade if the latter does not exist. This breaks
 configuration via slapd.d .
 
 Regards,
 Leon

From: "basis wien, Nikolai Nespor" <nikolai.nespor@basis-wien.at>
To: bug-followup@FreeBSD.org, uspoerlein@gmail.com
Cc:  
Subject: Re: ports/129813: [PATCH] net/openldap24-server: RC script assumes
 too much
Date: Fri, 04 Sep 2009 13:00:15 +0200

 Hi,
 
 I'm using the following patch to slapd.sh.in to run slapd with cn=3Dconfig
 style configuration. I added a new option 'slapd_cn_config'. If it is
 unset nothing changes to not break upgrades.
 
 Regards, Nikolai
 
 --- slapd.sh.in.patch begins here ---
 --- slapd.sh.in.orig    2009-09-04 12:21:58.063653138 +0200
 +++ slapd.sh.in 2009-09-04 12:41:32.000000000 +0200
 @@ -23,24 +23,48 @@
  #
  #slapd_owner=3D"DEFAULT"
  #
 +# To use the cn=3Dconfig style configuration add the following
 +# line to /etc/rc.conf:
 +#
 +#slapd_cn_config=3D"YES"
 +#
 =20
  . "%%RC_SUBR%%"
 =20
  name=3D"slapd"
  rcvar=3D`set_rcvar`
 =20
 +# read settings, set defaults
 +load_rc_config ${name}
 +
 +: ${slapd_enable=3D"NO"}
 +if [ -n "${slapd_args+set}" ]; then
 +  warn "slapd_args is deprecated, use slapd_flags"
 +  : ${slapd_flags=3D"$slapd_args"}
 +fi
 +: ${slapd_owner=3D"ldap:ldap"}
 +: ${slapd_sockets_mode=3D"666"}
 +: ${slapd_cn_config=3D"NO"}
 +
  command=3D"%%PREFIX%%/libexec/slapd"
  pidfile=3D"%%LDAP_RUN_DIR%%/slapd.pid"
 -required_dirs=3D"%%LDAP_RUN_DIR%%"
 -required_files=3D"%%PREFIX%%/etc/openldap/slapd.conf"
 +
 +# set required_dirs, required_files and DATABASEDIR
 +if checkyesno slapd_cn_config; then
 +  required_dirs=3D"%%PREFIX%%/etc/openldap/slapd.d"
 +  required_files=3D"%%PREFIX%%/etc/openldap/slapd.d/cn=3Dconfig.ldif"
 +  DATABASEDIR=3D`grep olcDbDirectory %%PREFIX%
 %/etc/openldap/slapd.d/cn=3Dconfig/olcDatabase=3D* | awk '{ print $2 }'`
 +else
 +  required_dirs=3D"%%LDAP_RUN_DIR%%"
 +  required_files=3D"%%PREFIX%%/etc/openldap/slapd.conf"
 +  DATABASEDIR=3D`awk '$1 =3D=3D "directory" { print $2 }' "%%PREFIX%%
 etc/openldap/slapd.conf" 2>&1 /dev/null`
 +fi
 =20
  start_precmd=3Dstart_precmd
  start_postcmd=3Dstart_postcmd
 =20
  # extract user and group, adjust ownership of directories and database
 =20
 -DATABASEDIR=3D`awk '$1 =3D=3D "directory" {print $2}' "%%PREFIX%
 %/etc/openldap/slapd.conf"`
 -
  start_precmd()
  {
    local slapd_ownername slapd_groupname
 @@ -59,7 +83,12 @@
         chmod 700 "${DBDIR}"
      done
      chown "$slapd_owner" "%%LDAP_RUN_DIR%%"
 -    chown "$slapd_owner" "%%PREFIX%%/etc/openldap/slapd.conf"
 +
 +    if checkyesno slapd_cn_config; then
 +        chown -R $slapd_owner "%%PREFIX%%/etc/openldap/slapd.d"
 +    else
 +        chown $slapd_owner "%%PREFIX%%/etc/openldap/slapd.conf"
 +    fi
 =20
      slapd_ownername=3D"${slapd_owner%:*}"
      slapd_groupname=3D"${slapd_owner#*:}"
 @@ -100,14 +129,4 @@
    done
  }
 =20
 -# read settings, set defaults
 -load_rc_config $name
 -: ${slapd_enable=3D"NO"}
 -if [ -n "${slapd_args+set}" ]; then
 -  warn "slapd_args is deprecated, use slapd_flags"
 -  : ${slapd_flags=3D"$slapd_args"}
 -fi
 -: ${slapd_owner=3D"ldap:ldap"}
 -: ${slapd_sockets_mode=3D"666"}
 -
  run_rc_command "$1"
 --- slapd.sh.in.patch ends here ---
 
 --=20
 Nikolai Nespor                              |  www.basis-wien.at
 basisarchiv:kunst                           |  EU-Projekt: www.vektor.at
 basis wien - Kunst, Information und Archiv  |  Europ=C3=A4isches Kunstporta=
 l:
 T/F +43 1 522 67 95                         |  www.european-art.net
 
State-Changed-From-To: open->closed 
State-Changed-By: delphij 
State-Changed-When: Mon Sep 7 09:46:38 UTC 2009 
State-Changed-Why:  
Patch from Nikolai has been committed, thanks for your submission! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=129813 
>Unformatted:
