ports/56987: [PATCH] ports net/openldap2[012]-server: misc. fixes

Oliver Eikemeier eikemeier at fillmore-labs.com
Thu Sep 18 23:20:18 UTC 2003


>Number:         56987
>Category:       ports
>Synopsis:       [PATCH] ports net/openldap2[012]-server: misc. fixes
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 18 16:20:15 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Oliver Eikemeier
>Release:        FreeBSD 5.1-CURRENT i386
>Organization:
Fillmore Labs - http://www.fillmore-labs.com
>Environment:
System: FreeBSD nuuk.fillmore-labs.com 5.1-CURRENT

>Description:

* openldap20-server:
  - ITS#2348: Index corruption and crash in back-ldbm

* openldap21-server:
  - ITS#2696: Tiny bugfix patch for ldappasswd
  - ITS#2649: deferring abandon op

* openldap2[12]-server:
  - wrong manual url in install message
    (reported by DavidB <odyseus at whatistruth.net>)

* all:
  - generate schemata list dynamically
  - additional links in client install message
  - added notification that an account 'ldap' has
    been created to the server install messages
  - give hints how to remove this account and the
    database in the server deinstall message

>How-To-Repeat:
>Fix:

--- openldap2X-server.patch begins here ---
diff -Nur openldap20-server/Makefile.orig openldap20-server/Makefile
--- openldap20-server/Makefile.orig	Sat Aug 30 11:11:50 2003
+++ openldap20-server/Makefile	Thu Sep 18 23:27:16 2003
@@ -6,7 +6,7 @@
 #
 
 PORTNAME=		openldap
-PORTVERSION=		${OPENLDAP_VERSION}
+PORTVERSION=		2.0.27
 PORTREVISION=		${OPENLDAP_PORTVERSION}
 CATEGORIES=		net databases
 MASTER_SITES=		ftp://ftp.OpenLDAP.org/pub/OpenLDAP/%SUBDIR%/ \
@@ -31,8 +31,6 @@
 MAINTAINER=		eikemeier at fillmore-labs.com
 COMMENT?=		Open source LDAP server implementation
 
-OPENLDAP_VERSION=	2.0.27
-
 LATEST_LINK=		${PKGNAMEPREFIX}openldap20${PKGNAMESUFFIX}
 CONFLICTS=		openldap12-* \
 			${PKGNAMEPREFIX}${PORTNAME}-client-2.[1-9].*
@@ -51,7 +49,7 @@
 .error You have `USE_OPENLDAP' defined either in your environment or in make(1) arguments.
 .endif
 .else
-OPENLDAP_PORTVERSION=	2
+OPENLDAP_PORTVERSION=	3
 OPENLDAP_PKGNAMESUFFIX?=-server
 OPENLDAP_PKGFILESUFX?=
 
@@ -59,14 +57,19 @@
 CONFLICTS+=		${PKGNAMEPREFIX}${PORTNAME}-server-2.[1-9].*
 .endif
 
-#USE_OPENSSL=		yes
+USE_OPENSSL=		yes
 USE_REINPLACE=		yes
 USE_LIBTOOL_VER=	13
 
 DESCR=			${PKGDIR}/pkg-descr${OPENLDAP_PKGFILESUFX}
-PLIST=			${WRKDIR}/pkg-plist
+PLIST=			${PKGDIR}/pkg-plist${OPENLDAP_PKGFILESUFX}
 PKGINSTALL=		${WRKDIR}/pkg-install
 PKGMESSAGE=		${WRKDIR}/pkg-message
+PKGDEINSTALL=		${WRKDIR}/pkg-deinstall
+
+SCHEMATA=		corba core cosine inetorgperson \
+			java krb5-kdc \
+			misc nis openldap
 
 LDAP_RUN_DIR?=		${DESTDIR}/var/run/openldap
 LOCALSTATEDIR?=		${DESTDIR}/var/db
@@ -79,7 +82,8 @@
 
 SED_SCRIPT=		-e 's,%%PREFIX%%,${PREFIX},g' \
 			-e 's,%%LDAP_RUN_DIR%%,${LDAP_RUN_DIR},g' \
-			-e 's,%%DATABASEDIR%%,${DATABASEDIR},g'
+			-e 's,%%DATABASEDIR%%,${DATABASEDIR},g' \
+			-e 's,%%SLURPDIR%%,${SLURPDIR},g'
 
 CONFIGURE_ARGS=		--with-threads \
 			--with-tls=openssl \
@@ -155,8 +159,7 @@
 # end of client/server specific configuration
 .endif
 
-# math.h uses _REENTRANT and stdio.h uses _THREAD_SAFE, so define both.
-CPPFLAGS+=		-D_REENTRANT ${PTHREAD_CFLAGS} \
+CPPFLAGS+=		${PTHREAD_CFLAGS} \
 			-I${LOCALBASE}/include
 LDFLAGS+=		-L${LOCALBASE}/lib
 
@@ -218,9 +221,9 @@
 .for script in slapd slurpd
 	@${SED} ${SED_SCRIPT} ${FILESDIR}/${script}.sh >${WRKDIR}/${script}.sh
 .endfor
-.for text in pkg-install pkg-message
-	@if [ -f ${MASTERDIR}/${text}${OPENLDAP_PKGFILESUFX} ]; then \
-		${SED} ${SED_SCRIPT} ${MASTERDIR}/${text}${OPENLDAP_PKGFILESUFX} \
+.for text in pkg-install pkg-message pkg-deinstall
+	@if [ -f ${PKGDIR}/${text}${OPENLDAP_PKGFILESUFX} ]; then \
+		${SED} ${SED_SCRIPT} ${PKGDIR}/${text}${OPENLDAP_PKGFILESUFX} \
 		>${WRKDIR}/${text}; \
 	fi
 .endfor
@@ -232,18 +235,6 @@
 .endif
 
 pre-install:
-	@${CP} ${MASTERDIR}/pkg-plist${OPENLDAP_PKGFILESUFX} ${PLIST}
-.if defined(CLIENT_ONLY)
-.if !defined(NOPORTDOCS)
-	@for dir in rfc drafts; do \
-		${FIND} ${WRKSRC}/doc/$${dir} -maxdepth 1 -type f \
-			| ${SED} -e "s,^${WRKSRC}/doc/,%%DOCSDIR%%/," \
-			>>${PLIST}; \
-		${ECHO_CMD} "@dirrm %%DOCSDIR%%/$${dir}" >>${PLIST}; \
-	done
-	@${ECHO_CMD} "@dirrm %%DOCSDIR%%" >>${PLIST}
-.endif
-.endif
 	@if [ -f ${PKGINSTALL} ]; then \
 		${SETENV} "PKG_PREFIX=${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL; \
 	fi
@@ -255,12 +246,27 @@
 	@for dir in rfc drafts; do \
 		${MKDIR} ${DOCSDIR}/$${dir}; \
 		${FIND} ${WRKSRC}/doc/$${dir} -maxdepth 1 -type f \
-			-exec ${INSTALL_DATA} {} ${DOCSDIR}/$${dir} \; ; \
+			-exec ${INSTALL_DATA} {} ${DOCSDIR}/$${dir} \; -print \
+			| ${SED} -e "s,^${WRKSRC}/doc/,${DOCSDIR:S,^${PREFIX}/,,}/," \
+			>>${TMPPLIST}; \
+		${ECHO_CMD} "@dirrm ${DOCSDIR:S,^${PREFIX}/,,}/$${dir}" >>${TMPPLIST}; \
 	done
+	@${ECHO_CMD} "@dirrm ${DOCSDIR:S,^${PREFIX}/,,}" >>${TMPPLIST}
 .endif
 .else
+	@for schema in ${SCHEMATA}; do \
+		${ECHO_CMD} "@unexec if cmp -s %D/etc/openldap/schema/$${schema}.schema" \
+			"%D/etc/openldap/schema/$${schema}.schema.default; then" \
+			"rm -f %D/etc/openldap/schema/$${schema}.schema; fi" >>${TMPPLIST}; \
+		${ECHO_CMD} "etc/openldap/schema/$${schema}.schema.default" >>${TMPPLIST}; \
+		${ECHO_CMD} "@exec [ -f %B/$${schema}.schema ] || cp %B/%f %B/$${schema}.schema" >>${TMPPLIST}; \
+	done
+	@${ECHO_CMD} "@unexec rmdir %D/etc/openldap/schema 2>/dev/null || true" >>${TMPPLIST}
+	@${ECHO_CMD} "@unexec rmdir %D/etc/openldap 2>/dev/null || true" >>${TMPPLIST}
+	@${ECHO_CMD} "@cwd ${RC_DIR}" >>${TMPPLIST}
 .for script in slapd slurpd
 	@${INSTALL_SCRIPT} ${WRKDIR}/${script}.sh ${RC_DIR}/${script}${RC_SUFX}
+	@${ECHO_CMD} "${script}${RC_SUFX}" >>${TMPPLIST}
 .endfor
 	@${MKDIR} ${LDAP_RUN_DIR}
 .endif
diff -Nur openldap20-server/files/patch-servers::slapd::back-ldbm::idl.c.orig openldap20-server/files/patch-servers::slapd::back-ldbm::idl.c
--- openldap20-server/files/patch-servers::slapd::back-ldbm::idl.c.orig	Thu Jan  1 01:00:00 1970
+++ openldap20-server/files/patch-servers::slapd::back-ldbm::idl.c	Thu Sep 18 18:15:37 2003
@@ -0,0 +1,106 @@
+#
+# ITS#2348: Index corruption and crash in back-ldbm
+#
+--- servers/slapd/back-ldbm/idl.c.orig	Fri Aug 23 20:09:40 2002
++++ servers/slapd/back-ldbm/idl.c	Wed Mar 12 12:42:29 2003
+@@ -478,9 +478,9 @@
+ 	 */
+ 
+ 	/* select the block to try inserting into *//* XXX linear search XXX */
+-	for ( i = 0; !ID_BLOCK_NOID(idl, i) && id > ID_BLOCK_ID(idl, i); i++ )
++	for ( i = 0; !ID_BLOCK_NOID(idl, i) && id >= ID_BLOCK_ID(idl, i); i++ )
+ 		;	/* NULL */
+-
++	
+ 	if ( i != 0 ) {
+ 		i--;
+ 		first = 0;
+@@ -488,6 +488,11 @@
+ 		first = 1;
+ 	}
+ 
++	/* At this point the following condition must be true:
++	 * ID_BLOCK_ID(idl, i) <= id && id < ID_BLOCK_ID(idl, i+1)
++	 * except when i is the first or the last block.
++	 */
++
+ 	/* get the block */
+ 	cont_alloc( &k2, &key );
+ 	cont_id( &k2, ID_BLOCK_ID(idl, i) );
+@@ -533,15 +538,16 @@
+ 
+ 		/* is there a next block? */
+ 		if ( !first && !ID_BLOCK_NOID(idl, i + 1) ) {
++			Datum k3;
+ 			/* read it in */
+-			cont_alloc( &k2, &key );
+-			cont_id( &k2, ID_BLOCK_ID(idl, i + 1) );
+-			if ( (tmp2 = idl_fetch_one( be, db, k2 )) == NULL ) {
++			cont_alloc( &k3, &key );
++			cont_id( &k3, ID_BLOCK_ID(idl, i + 1) );
++			if ( (tmp2 = idl_fetch_one( be, db, k3 )) == NULL ) {
+ 				Debug( LDAP_DEBUG_ANY,
+ 				    "idl_insert_key: idl_fetch_one returned NULL\n",
+ 				    0, 0, 0 );
+ 				/* split the original block */
+-				cont_free( &k2 );
++				cont_free( &k3 );
+ 				goto split;
+ 			}
+ 
+@@ -552,9 +558,6 @@
+ 			 */
+ 			if (id < ID_BLOCK_ID(tmp, ID_BLOCK_NIDS(tmp) - 1)) {
+ 			    ID id2 = ID_BLOCK_ID(tmp, ID_BLOCK_NIDS(tmp) - 1);
+-			    Datum k3;
+-
+-			    ldbm_datum_init( k3 );
+ 
+ 			    --ID_BLOCK_NIDS(tmp);
+ 			    /* This must succeed since we just popped one
+@@ -562,16 +565,11 @@
+ 			     */
+ 			    rc = idl_insert( &tmp, id, db->dbc_maxids );
+ 
+-				k3.dptr = ch_malloc(k2.dsize);
+-				k3.dsize = k2.dsize;
+-				AC_MEMCPY(k3.dptr, k2.dptr, k3.dsize);
+-			    if ( (rc = idl_store( be, db, k3, tmp )) != 0 ) {
++			    if ( (rc = idl_store( be, db, k2, tmp )) != 0 ) {
+ 				Debug( LDAP_DEBUG_ANY,
+ 			    "idl_insert_key: idl_store returned %d\n", rc, 0, 0 );
+ 			    }
+ 
+-				free( k3.dptr );
+-
+ 			    id = id2;
+ 			    /* This new id will necessarily be inserted
+ 			     * as the first id of the next block by the
+@@ -583,7 +581,7 @@
+ 			    db->dbc_maxids )) ) {
+ 			case 1:		/* id inserted first in block */
+ 				rc = idl_change_first( be, db, key, idl,
+-				    i + 1, k2, tmp2 );
++				    i + 1, k3, tmp2 );
+ 				/* FALL */
+ 
+ 			case 2:		/* id already there - how? */
+@@ -598,8 +596,10 @@
+ 					    id, 0, 0 );
+ 				}
+ 
++				cont_free( &k3 );
+ 				idl_free( tmp );
+ 				idl_free( tmp2 );
++				cont_free( &k2 );
+ 				idl_free( idl );
+ 				return( 0 );
+ 
+@@ -607,6 +607,7 @@
+ 				break;
+ 			}
+ 
++			cont_free( &k3 );
+ 			idl_free( tmp2 );
+ 		}
+ 
diff -Nur openldap20-server/pkg-deinstall.orig openldap20-server/pkg-deinstall
--- openldap20-server/pkg-deinstall.orig	Thu Jan  1 01:00:00 1970
+++ openldap20-server/pkg-deinstall	Thu Sep 18 23:34:03 2003
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+ECHO_CMD=echo
+
+case $2 in
+POST-DEINSTALL)
+  ${ECHO_CMD}
+  ${ECHO_CMD} "The OpenLDAP server package has been deleted."
+  ${ECHO_CMD} "If you're *not* upgrading and won't be using"
+  ${ECHO_CMD} "it any longer, you may want to issue the"
+  ${ECHO_CMD} "following commands:"
+  ${ECHO_CMD}
+  if [ -d %%DATABASEDIR%% ]; then
+    ${ECHO_CMD} "- to delete the OpenLDAP database permanently (losing all data):"
+    ${ECHO_CMD} "  rm -Rf %%DATABASEDIR%%"
+    ${ECHO_CMD}
+  fi
+  if [ -d %%SLURPDIR%% ]; then
+    ${ECHO_CMD} "- to remove the OpenLDAP replication directory:"
+    ${ECHO_CMD} "  rm -Rf %%SLURPDIR%%"
+    ${ECHO_CMD}
+  fi
+  ${ECHO_CMD} "- to remove the OpenLDAP user:"
+  ${ECHO_CMD} "  pw userdel ldap"
+  ${ECHO_CMD}
+  ${ECHO_CMD} "If you are upgrading, don't forget to restart"
+  ${ECHO_CMD} "slapd and slurpd."
+  ${ECHO_CMD}
+  ;;
+esac
diff -Nur openldap20-server/pkg-install.orig openldap20-server/pkg-install
--- openldap20-server/pkg-install.orig	Thu Aug 28 14:51:07 2003
+++ openldap20-server/pkg-install	Thu Sep 18 23:35:53 2003
@@ -13,9 +13,9 @@
 case $2 in
 PRE-INSTALL)
   if ! ${PW} usershow -n ldap >/dev/null 2>&1; then
+    ${ECHO_CMD}
     if ! ${PW} groupshow -n ldap >/dev/null 2>&1; then
       if ! ${PW} groupadd -n ldap -g 389; then
-        ${ECHO_CMD}
         ${ECHO_CMD} "*** Failed to add a group ldap with id 389."
         ${ECHO_CMD}
         ${ECHO_CMD} "Please add the ldap user manually with"
@@ -24,12 +24,10 @@
         ${ECHO_CMD} "and retry installing this package."
         exit 1
       fi
+      ${ECHO_CMD} "===>  Group 'ldap' created."
     fi
-    if ${PW} useradd -n ldap -u 389 -g ldap -c 'OpenLDAP Server' \
+    if ! ${PW} useradd -n ldap -u 389 -g ldap -c 'OpenLDAP Server' \
         -d /nonexistent -s /sbin/nologin -h -; then
-      ${GREP} -qs '^ldap$' ${FTPUSERS} || ${ECHO_CMD} ldap >> ${FTPUSERS}
-    else
-      ${ECHO_CMD}
       ${ECHO_CMD} "*** Failed to add an user ldap with id 389."
       ${ECHO_CMD}
       ${ECHO_CMD} "Please add the ldap user manually with"
@@ -38,6 +36,8 @@
       ${ECHO_CMD} "and retry installing this package."
       exit 1
     fi
+    ${GREP} -qs '^ldap$' ${FTPUSERS} || ${ECHO_CMD} ldap >> ${FTPUSERS}
+    ${ECHO_CMD} "===>  Account 'ldap' created."
   fi
   ;;
 esac
diff -Nur openldap20-server/pkg-message.client.orig openldap20-server/pkg-message.client
--- openldap20-server/pkg-message.client.orig	Thu Aug 14 05:55:19 2003
+++ openldap20-server/pkg-message.client	Fri Sep 19 00:12:09 2003
@@ -6,4 +6,8 @@
   %%PREFIX%%/etc/openldap/ldap.conf
 to change the system-wide client defaults.
 
+Try `man ldap.conf' and visit the OpenLDAP FAQ-O-Matic at
+  http://www.OpenLDAP.org/faq/index.cgi?file=3
+for more information.
+
 ************************************************************
diff -Nur openldap20-server/pkg-plist.orig openldap20-server/pkg-plist
--- openldap20-server/pkg-plist.orig	Sat Aug 30 11:11:50 2003
+++ openldap20-server/pkg-plist	Thu Sep 18 19:29:37 2003
@@ -1,38 +1,9 @@
 @comment $FreeBSD: ports/net/openldap20-server/pkg-plist,v 1.19 2003/08/30 09:11:50 edwin Exp $
- at unexec %%RC_DIR%%/slapd%%RC_SUFX%% stop 2>/dev/null || true
- at unexec %%RC_DIR%%/slurpd%%RC_SUFX%% stop 2>/dev/null || true
- at unexec if cmp -s %D/etc/openldap/schema/corba.schema %D/etc/openldap/schema/corba.schema.default; then rm -f %D/etc/openldap/schema/corba.schema; fi
-etc/openldap/schema/corba.schema.default
- at exec [ -f %B/corba.schema ] || cp %B/%f %B/corba.schema
- at unexec if cmp -s %D/etc/openldap/schema/core.schema %D/etc/openldap/schema/core.schema.default; then rm -f %D/etc/openldap/schema/core.schema; fi
-etc/openldap/schema/core.schema.default
- at exec [ -f %B/core.schema ] || cp %B/%f %B/core.schema
- at unexec if cmp -s %D/etc/openldap/schema/cosine.schema %D/etc/openldap/schema/cosine.schema.default; then rm -f %D/etc/openldap/schema/cosine.schema; fi
-etc/openldap/schema/cosine.schema.default
- at exec [ -f %B/cosine.schema ] || cp %B/%f %B/cosine.schema
- at unexec if cmp -s %D/etc/openldap/schema/inetorgperson.schema %D/etc/openldap/schema/inetorgperson.schema.default; then rm -f %D/etc/openldap/schema/inetorgperson.schema; fi
-etc/openldap/schema/inetorgperson.schema.default
- at exec [ -f %B/inetorgperson.schema ] || cp %B/%f %B/inetorgperson.schema
- at unexec if cmp -s %D/etc/openldap/schema/java.schema %D/etc/openldap/schema/java.schema.default; then rm -f %D/etc/openldap/schema/java.schema; fi
-etc/openldap/schema/java.schema.default
- at exec [ -f %B/java.schema ] || cp %B/%f %B/java.schema
- at unexec if cmp -s %D/etc/openldap/schema/krb5-kdc.schema %D/etc/openldap/schema/krb5-kdc.schema.default; then rm -f %D/etc/openldap/schema/krb5-kdc.schema; fi
-etc/openldap/schema/krb5-kdc.schema.default
- at exec [ -f %B/krb5-kdc.schema ] || cp %B/%f %B/krb5-kdc.schema
- at unexec if cmp -s %D/etc/openldap/schema/misc.schema %D/etc/openldap/schema/misc.schema.default; then rm -f %D/etc/openldap/schema/misc.schema; fi
-etc/openldap/schema/misc.schema.default
- at exec [ -f %B/misc.schema ] || cp %B/%f %B/misc.schema
- at unexec if cmp -s %D/etc/openldap/schema/nis.schema %D/etc/openldap/schema/nis.schema.default; then rm -f %D/etc/openldap/schema/nis.schema; fi
-etc/openldap/schema/nis.schema.default
- at exec [ -f %B/nis.schema ] || cp %B/%f %B/nis.schema
- at unexec if cmp -s %D/etc/openldap/schema/openldap.schema %D/etc/openldap/schema/openldap.schema.default; then rm -f %D/etc/openldap/schema/openldap.schema; fi
-etc/openldap/schema/openldap.schema.default
- at exec [ -f %B/openldap.schema ] || cp %B/%f %B/openldap.schema
+ at unexec %%RC_DIR%%/slapd%%RC_SUFX%% stop 2>&1 >/dev/null || true
+ at unexec %%RC_DIR%%/slurpd%%RC_SUFX%% stop 2>&1 >/dev/null || true
 @unexec if cmp -s %D/etc/openldap/slapd.conf %D/etc/openldap/slapd.conf.default; then rm -f %D/etc/openldap/slapd.conf; fi
 etc/openldap/slapd.conf.default
 @exec [ -f %B/slapd.conf ] || cp %B/%f %B/slapd.conf
- at unexec rmdir %D/etc/openldap/schema 2>/dev/null || true
- at unexec rmdir %D/etc/openldap 2>/dev/null || true
 libexec/slapd
 libexec/slurpd
 sbin/slapadd
@@ -42,9 +13,6 @@
 @exec mkdir -p %%LDAP_RUN_DIR%%
 @exec mkdir -p %%DATABASEDIR%%
 @exec mkdir -p %%SLURPDIR%%
- at unexec rmdir %%LDAP_RUN_DIR%%
+ at unexec rmdir %%LDAP_RUN_DIR%% 2>/dev/null || true
 @unexec rmdir %%DATABASEDIR%% 2>/dev/null || true
 @unexec rmdir %%SLURPDIR%% 2>/dev/null || true
- at cwd %%RC_DIR%%
-slapd%%RC_SUFX%%
-slurpd%%RC_SUFX%%
diff -Nur openldap21-server/Makefile.orig openldap21-server/Makefile
--- openldap21-server/Makefile.orig	Sat Aug 30 11:11:51 2003
+++ openldap21-server/Makefile	Thu Sep 18 23:23:14 2003
@@ -6,7 +6,7 @@
 #
 
 PORTNAME=		openldap
-PORTVERSION=		${OPENLDAP_VERSION}
+PORTVERSION=		2.1.22
 PORTREVISION=		${OPENLDAP_PORTVERSION}
 CATEGORIES=		net databases
 MASTER_SITES=		ftp://ftp.OpenLDAP.org/pub/OpenLDAP/%SUBDIR%/ \
@@ -31,8 +31,6 @@
 MAINTAINER=		eikemeier at fillmore-labs.com
 COMMENT?=		Open source LDAP server implementation
 
-OPENLDAP_VERSION=	2.1.22
-
 LATEST_LINK=		${PKGNAMEPREFIX}openldap21${PKGNAMESUFFIX}
 CONFLICTS=		openldap12-* \
 			${PKGNAMEPREFIX}${PORTNAME}-client-2.[02-9].*
@@ -51,7 +49,7 @@
 .error You have `USE_OPENLDAP' defined either in your environment or in make(1) arguments.
 .endif
 .else
-OPENLDAP_PORTVERSION=	2
+OPENLDAP_PORTVERSION=	3
 OPENLDAP_PKGNAMESUFFIX?=-server
 OPENLDAP_PKGFILESUFX?=
 
@@ -59,14 +57,19 @@
 CONFLICTS+=		${PKGNAMEPREFIX}${PORTNAME}-server-2.[02-9].*
 .endif
 
-#USE_OPENSSL=		yes
+USE_OPENSSL=		yes
 USE_REINPLACE=		yes
 USE_LIBTOOL_VER=	14
 
 DESCR=			${PKGDIR}/pkg-descr${OPENLDAP_PKGFILESUFX}
-PLIST=			${WRKDIR}/pkg-plist
+PLIST=			${PKGDIR}/pkg-plist${OPENLDAP_PKGFILESUFX}
 PKGINSTALL=		${WRKDIR}/pkg-install
 PKGMESSAGE=		${WRKDIR}/pkg-message
+PKGDEINSTALL=		${WRKDIR}/pkg-deinstall
+
+SCHEMATA=		corba core cosine inetorgperson \
+			java \
+			misc nis openldap
 
 LDAP_RUN_DIR?=		${DESTDIR}/var/run/openldap
 LOCALSTATEDIR?=		${DESTDIR}/var/db
@@ -79,7 +82,8 @@
 
 SED_SCRIPT=		-e 's,%%PREFIX%%,${PREFIX},g' \
 			-e 's,%%LDAP_RUN_DIR%%,${LDAP_RUN_DIR},g' \
-			-e 's,%%DATABASEDIR%%,${DATABASEDIR},g'
+			-e 's,%%DATABASEDIR%%,${DATABASEDIR},g' \
+			-e 's,%%SLURPDIR%%,${SLURPDIR},g'
 
 CONFIGURE_ARGS=		--with-threads \
 			--with-tls=openssl \
@@ -167,8 +171,7 @@
 # end of client/server specific configuration
 .endif
 
-# math.h uses _REENTRANT and stdio.h uses _THREAD_SAFE, so define both.
-CPPFLAGS+=		-D_REENTRANT ${PTHREAD_CFLAGS} \
+CPPFLAGS+=		${PTHREAD_CFLAGS} \
 			-I${LOCALBASE}/include
 LDFLAGS+=		-L${LOCALBASE}/lib
 
@@ -231,9 +234,9 @@
 .for script in slapd slurpd
 	@${SED} ${SED_SCRIPT} ${FILESDIR}/${script}.sh >${WRKDIR}/${script}.sh
 .endfor
-.for text in pkg-install pkg-message
-	@if [ -f ${MASTERDIR}/${text}${OPENLDAP_PKGFILESUFX} ]; then \
-		${SED} ${SED_SCRIPT} ${MASTERDIR}/${text}${OPENLDAP_PKGFILESUFX} \
+.for text in pkg-install pkg-message pkg-deinstall
+	@if [ -f ${PKGDIR}/${text}${OPENLDAP_PKGFILESUFX} ]; then \
+		${SED} ${SED_SCRIPT} ${PKGDIR}/${text}${OPENLDAP_PKGFILESUFX} \
 		>${WRKDIR}/${text}; \
 	fi
 .endfor
@@ -245,18 +248,6 @@
 .endif
 
 pre-install:
-	@${CP} ${MASTERDIR}/pkg-plist${OPENLDAP_PKGFILESUFX} ${PLIST}
-.if defined(CLIENT_ONLY)
-.if !defined(NOPORTDOCS)
-	@for dir in rfc drafts; do \
-		${FIND} ${WRKSRC}/doc/$${dir} -maxdepth 1 -type f \
-			| ${SED} -e "s,^${WRKSRC}/doc/,%%DOCSDIR%%/," \
-			>>${PLIST}; \
-		${ECHO_CMD} "@dirrm %%DOCSDIR%%/$${dir}" >>${PLIST}; \
-	done
-	@${ECHO_CMD} "@dirrm %%DOCSDIR%%" >>${PLIST}
-.endif
-.endif
 	@if [ -f ${PKGINSTALL} ]; then \
 		${SETENV} "PKG_PREFIX=${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL; \
 	fi
@@ -268,12 +259,27 @@
 	@for dir in rfc drafts; do \
 		${MKDIR} ${DOCSDIR}/$${dir}; \
 		${FIND} ${WRKSRC}/doc/$${dir} -maxdepth 1 -type f \
-			-exec ${INSTALL_DATA} {} ${DOCSDIR}/$${dir} \; ; \
+			-exec ${INSTALL_DATA} {} ${DOCSDIR}/$${dir} \; -print \
+			| ${SED} -e "s,^${WRKSRC}/doc/,${DOCSDIR:S,^${PREFIX}/,,}/," \
+			>>${TMPPLIST}; \
+		${ECHO_CMD} "@dirrm ${DOCSDIR:S,^${PREFIX}/,,}/$${dir}" >>${TMPPLIST}; \
 	done
+	@${ECHO_CMD} "@dirrm ${DOCSDIR:S,^${PREFIX}/,,}" >>${TMPPLIST}
 .endif
 .else
+	@for schema in ${SCHEMATA}; do \
+		${ECHO_CMD} "@unexec if cmp -s %D/etc/openldap/schema/$${schema}.schema" \
+			"%D/etc/openldap/schema/$${schema}.schema.default; then" \
+			"rm -f %D/etc/openldap/schema/$${schema}.schema; fi" >>${TMPPLIST}; \
+		${ECHO_CMD} "etc/openldap/schema/$${schema}.schema.default" >>${TMPPLIST}; \
+		${ECHO_CMD} "@exec [ -f %B/$${schema}.schema ] || cp %B/%f %B/$${schema}.schema" >>${TMPPLIST}; \
+	done
+	@${ECHO_CMD} "@unexec rmdir %D/etc/openldap/schema 2>/dev/null || true" >>${TMPPLIST}
+	@${ECHO_CMD} "@unexec rmdir %D/etc/openldap 2>/dev/null || true" >>${TMPPLIST}
+	@${ECHO_CMD} "@cwd ${RC_DIR}" >>${TMPPLIST}
 .for script in slapd slurpd
 	@${INSTALL_SCRIPT} ${WRKDIR}/${script}.sh ${RC_DIR}/${script}${RC_SUFX}
+	@${ECHO_CMD} "${script}${RC_SUFX}" >>${TMPPLIST}
 .endfor
 	@${MKDIR} ${LDAP_RUN_DIR}
 .endif
diff -Nur openldap21-server/files/patch-clients::tools::ldappasswd.c.orig openldap21-server/files/patch-clients::tools::ldappasswd.c
--- openldap21-server/files/patch-clients::tools::ldappasswd.c.orig	Thu Jan  1 01:00:00 1970
+++ openldap21-server/files/patch-clients::tools::ldappasswd.c	Thu Sep 18 18:40:52 2003
@@ -0,0 +1,56 @@
+#
+# ITS#2696: Tiny bugfix patch for ldappasswd
+#
+--- clients/tools/ldappasswd.c.orig	Mon Apr 14 15:37:27 2003
++++ clients/tools/ldappasswd.c	Mon Sep 15 17:07:15 2003
+@@ -168,7 +168,7 @@
+ 	}
+ 
+ 	if( oldpwfile ) {
+-		rc = lutil_get_filed_password( prog, &oldpw );
++		rc = lutil_get_filed_password( oldpwfile, &oldpw );
+ 		if( rc ) return EXIT_FAILURE;
+ 	}
+ 
+@@ -189,7 +189,7 @@
+ 	}
+ 
+ 	if( newpwfile ) {
+-		rc = lutil_get_filed_password( prog, &newpw );
++		rc = lutil_get_filed_password( newpwfile, &newpw );
+ 		if( rc ) return EXIT_FAILURE;
+ 	}
+ 
+@@ -209,23 +209,22 @@
+ 		newpw.bv_len = strlen( newpw.bv_val );
+ 	}
+ 
+-	if( want_bindpw && passwd.bv_val == NULL ) {
+-		/* handle bind password */
+-		if ( pw_file ) {
+-			rc = lutil_get_filed_password( pw_file, &passwd );
+-			if( rc ) return EXIT_FAILURE;
+-		} else {
+-			passwd.bv_val = getpassphrase( "Enter LDAP Password: " );
+-			passwd.bv_len = passwd.bv_val ? strlen( passwd.bv_val ) : 0;
+-		}
++	if ( pw_file ) {
++		rc = lutil_get_filed_password( pw_file, &passwd );
++		if( rc ) return EXIT_FAILURE;
++
++	} else if ( want_bindpw ) {
++		passwd.bv_val = getpassphrase( "Enter LDAP Password: " );
++		passwd.bv_len = passwd.bv_val ? strlen( passwd.bv_val ) : 0;
+ 	}
+ 
+ 	ld = tool_conn_setup( 0, 0 );
+ 
+ 	tool_bind( ld );
+ 
+-	if ( authzid || manageDSAit || noop )
++	if ( authzid || manageDSAit || noop ) {
+ 		tool_server_controls( ld, NULL, 0 );
++	}
+ 
+ 	if( user != NULL || oldpw.bv_val != NULL || newpw.bv_val != NULL ) {
+ 		/* build change password control */
diff -Nur openldap21-server/files/patch-servers::slapd::connection.c.orig openldap21-server/files/patch-servers::slapd::connection.c
--- openldap21-server/files/patch-servers::slapd::connection.c.orig	Thu Jan  1 01:00:00 1970
+++ openldap21-server/files/patch-servers::slapd::connection.c	Thu Sep 18 18:45:19 2003
@@ -0,0 +1,22 @@
+#
+# ITS#2649: deferring abandon op
+#
+--- servers/slapd/connection.c.orig	Sun May 18 19:58:56 2003
++++ servers/slapd/connection.c	Tue Sep 16 01:57:24 2003
+@@ -1475,12 +1475,14 @@
+ 	 * use up all the available threads, and don't execute if we're
+ 	 * currently blocked on output. And don't execute if there are
+ 	 * already pending ops, let them go first.
++	 *
++	 * But always allow Abandon through; it won't cost much.
+ 	 */
+-	if ( conn->c_conn_state == SLAP_C_BINDING
++	if ( tag != LDAP_REQ_ABANDON && (conn->c_conn_state == SLAP_C_BINDING
+ 		|| conn->c_conn_state == SLAP_C_CLOSING
+ 		|| conn->c_n_ops_executing >= connection_pool_max/2
+ 		|| conn->c_n_ops_pending
+-		|| conn->c_writewaiter)
++		|| conn->c_writewaiter))
+ 	{
+ 		int max = conn->c_dn.bv_len ? slap_conn_max_pending_auth
+ 			 : slap_conn_max_pending;
diff -Nur openldap21-server/pkg-deinstall.orig openldap21-server/pkg-deinstall
--- openldap21-server/pkg-deinstall.orig	Thu Jan  1 01:00:00 1970
+++ openldap21-server/pkg-deinstall	Thu Sep 18 23:34:03 2003
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+ECHO_CMD=echo
+
+case $2 in
+POST-DEINSTALL)
+  ${ECHO_CMD}
+  ${ECHO_CMD} "The OpenLDAP server package has been deleted."
+  ${ECHO_CMD} "If you're *not* upgrading and won't be using"
+  ${ECHO_CMD} "it any longer, you may want to issue the"
+  ${ECHO_CMD} "following commands:"
+  ${ECHO_CMD}
+  if [ -d %%DATABASEDIR%% ]; then
+    ${ECHO_CMD} "- to delete the OpenLDAP database permanently (losing all data):"
+    ${ECHO_CMD} "  rm -Rf %%DATABASEDIR%%"
+    ${ECHO_CMD}
+  fi
+  if [ -d %%SLURPDIR%% ]; then
+    ${ECHO_CMD} "- to remove the OpenLDAP replication directory:"
+    ${ECHO_CMD} "  rm -Rf %%SLURPDIR%%"
+    ${ECHO_CMD}
+  fi
+  ${ECHO_CMD} "- to remove the OpenLDAP user:"
+  ${ECHO_CMD} "  pw userdel ldap"
+  ${ECHO_CMD}
+  ${ECHO_CMD} "If you are upgrading, don't forget to restart"
+  ${ECHO_CMD} "slapd and slurpd."
+  ${ECHO_CMD}
+  ;;
+esac
diff -Nur openldap21-server/pkg-install.orig openldap21-server/pkg-install
--- openldap21-server/pkg-install.orig	Thu Aug 28 14:51:07 2003
+++ openldap21-server/pkg-install	Thu Sep 18 23:19:23 2003
@@ -13,9 +13,9 @@
 case $2 in
 PRE-INSTALL)
   if ! ${PW} usershow -n ldap >/dev/null 2>&1; then
+    ${ECHO_CMD}
     if ! ${PW} groupshow -n ldap >/dev/null 2>&1; then
       if ! ${PW} groupadd -n ldap -g 389; then
-        ${ECHO_CMD}
         ${ECHO_CMD} "*** Failed to add a group ldap with id 389."
         ${ECHO_CMD}
         ${ECHO_CMD} "Please add the ldap user manually with"
@@ -24,12 +24,10 @@
         ${ECHO_CMD} "and retry installing this package."
         exit 1
       fi
+      ${ECHO_CMD} "===>  Group 'ldap' created."
     fi
-    if ${PW} useradd -n ldap -u 389 -g ldap -c 'OpenLDAP Server' \
+    if ! ${PW} useradd -n ldap -u 389 -g ldap -c 'OpenLDAP Server' \
         -d /nonexistent -s /sbin/nologin -h -; then
-      ${GREP} -qs '^ldap$' ${FTPUSERS} || ${ECHO_CMD} ldap >> ${FTPUSERS}
-    else
-      ${ECHO_CMD}
       ${ECHO_CMD} "*** Failed to add an user ldap with id 389."
       ${ECHO_CMD}
       ${ECHO_CMD} "Please add the ldap user manually with"
@@ -38,6 +36,8 @@
       ${ECHO_CMD} "and retry installing this package."
       exit 1
     fi
+    ${GREP} -qs '^ldap$' ${FTPUSERS} || ${ECHO_CMD} ldap >> ${FTPUSERS}
+    ${ECHO_CMD} "===>  Account 'ldap' created."
   fi
   ;;
 esac
diff -Nur openldap21-server/pkg-message.orig openldap21-server/pkg-message
--- openldap21-server/pkg-message.orig	Thu Aug 28 14:51:07 2003
+++ openldap21-server/pkg-message	Fri Sep 19 00:29:05 2003
@@ -14,7 +14,7 @@
 or reboot.
 
 Try `man slapd' and the online manual at
-  http://www.OpenLDAP.org/doc/admin20/
+  http://www.OpenLDAP.org/doc/admin21/
 for more information.
   
 NOTE: Some variable names have been changed to conform with rc.subr(8)
diff -Nur openldap21-server/pkg-message.client.orig openldap21-server/pkg-message.client
--- openldap21-server/pkg-message.client.orig	Thu Aug 14 05:55:20 2003
+++ openldap21-server/pkg-message.client	Fri Sep 19 00:28:36 2003
@@ -6,4 +6,8 @@
   %%PREFIX%%/etc/openldap/ldap.conf
 to change the system-wide client defaults.
 
+Try `man ldap.conf' and visit the OpenLDAP FAQ-O-Matic at
+  http://www.OpenLDAP.org/faq/index.cgi?file=3
+for more information.
+
 ************************************************************
diff -Nur openldap21-server/pkg-plist.orig openldap21-server/pkg-plist
--- openldap21-server/pkg-plist.orig	Sat Aug 30 11:11:51 2003
+++ openldap21-server/pkg-plist	Thu Sep 18 19:29:44 2003
@@ -1,36 +1,10 @@
 @comment $FreeBSD: ports/net/openldap21-server/pkg-plist,v 1.22 2003/08/30 09:11:51 edwin Exp $
- at unexec %%RC_DIR%%/slapd%%RC_SUFX%% stop 2>/dev/null || true
- at unexec %%RC_DIR%%/slurpd%%RC_SUFX%% stop 2>/dev/null || true
+ at unexec %%RC_DIR%%/slapd%%RC_SUFX%% stop 2>&1 >/dev/null || true
+ at unexec %%RC_DIR%%/slurpd%%RC_SUFX%% stop 2>&1 >/dev/null || true
 etc/openldap/schema/README
- at unexec if cmp -s %D/etc/openldap/schema/corba.schema %D/etc/openldap/schema/corba.schema.default; then rm -f %D/etc/openldap/schema/corba.schema; fi
-etc/openldap/schema/corba.schema.default
- at exec [ -f %B/corba.schema ] || cp %B/%f %B/corba.schema
- at unexec if cmp -s %D/etc/openldap/schema/core.schema %D/etc/openldap/schema/core.schema.default; then rm -f %D/etc/openldap/schema/core.schema; fi
-etc/openldap/schema/core.schema.default
- at exec [ -f %B/core.schema ] || cp %B/%f %B/core.schema
- at unexec if cmp -s %D/etc/openldap/schema/cosine.schema %D/etc/openldap/schema/cosine.schema.default; then rm -f %D/etc/openldap/schema/cosine.schema; fi
-etc/openldap/schema/cosine.schema.default
- at exec [ -f %B/cosine.schema ] || cp %B/%f %B/cosine.schema
- at unexec if cmp -s %D/etc/openldap/schema/inetorgperson.schema %D/etc/openldap/schema/inetorgperson.schema.default; then rm -f %D/etc/openldap/schema/inetorgperson.schema; fi
-etc/openldap/schema/inetorgperson.schema.default
- at exec [ -f %B/inetorgperson.schema ] || cp %B/%f %B/inetorgperson.schema
- at unexec if cmp -s %D/etc/openldap/schema/java.schema %D/etc/openldap/schema/java.schema.default; then rm -f %D/etc/openldap/schema/java.schema; fi
-etc/openldap/schema/java.schema.default
- at exec [ -f %B/java.schema ] || cp %B/%f %B/java.schema
- at unexec if cmp -s %D/etc/openldap/schema/misc.schema %D/etc/openldap/schema/misc.schema.default; then rm -f %D/etc/openldap/schema/misc.schema; fi
-etc/openldap/schema/misc.schema.default
- at exec [ -f %B/misc.schema ] || cp %B/%f %B/misc.schema
- at unexec if cmp -s %D/etc/openldap/schema/nis.schema %D/etc/openldap/schema/nis.schema.default; then rm -f %D/etc/openldap/schema/nis.schema; fi
-etc/openldap/schema/nis.schema.default
- at exec [ -f %B/nis.schema ] || cp %B/%f %B/nis.schema
- at unexec if cmp -s %D/etc/openldap/schema/openldap.schema %D/etc/openldap/schema/openldap.schema.default; then rm -f %D/etc/openldap/schema/openldap.schema; fi
-etc/openldap/schema/openldap.schema.default
- at exec [ -f %B/openldap.schema ] || cp %B/%f %B/openldap.schema
 @unexec if cmp -s %D/etc/openldap/slapd.conf %D/etc/openldap/slapd.conf.default; then rm -f %D/etc/openldap/slapd.conf; fi
 etc/openldap/slapd.conf.default
 @exec [ -f %B/slapd.conf ] || cp %B/%f %B/slapd.conf
- at unexec rmdir %D/etc/openldap/schema 2>/dev/null || true
- at unexec rmdir %D/etc/openldap 2>/dev/null || true
 libexec/slapd
 libexec/slurpd
 sbin/slapadd
@@ -40,9 +14,6 @@
 @exec mkdir -p %%LDAP_RUN_DIR%%
 @exec mkdir -p %%DATABASEDIR%%
 @exec mkdir -p %%SLURPDIR%%
- at unexec rmdir %%LDAP_RUN_DIR%%
+ at unexec rmdir %%LDAP_RUN_DIR%% 2>/dev/null || true
 @unexec rmdir %%DATABASEDIR%% 2>/dev/null || true
 @unexec rmdir %%SLURPDIR%% 2>/dev/null || true
- at cwd %%RC_DIR%%
-slapd%%RC_SUFX%%
-slurpd%%RC_SUFX%%
diff -Nur openldap22-server/Makefile.orig openldap22-server/Makefile
--- openldap22-server/Makefile.orig	Tue Sep  9 17:19:36 2003
+++ openldap22-server/Makefile	Fri Sep 19 00:33:23 2003
@@ -6,7 +6,7 @@
 #
 
 PORTNAME=		openldap
-PORTVERSION=		${OPENLDAP_VERSION}.a
+PORTVERSION=		2.2.0.a
 PORTREVISION=		${OPENLDAP_PORTVERSION}
 CATEGORIES=		net databases
 MASTER_SITES=		ftp://ftp.OpenLDAP.org/pub/OpenLDAP/%SUBDIR%/ \
@@ -26,14 +26,12 @@
 			ftp://ftp.plig.org/pub/OpenLDAP/%SUBDIR%/
 MASTER_SITE_SUBDIR=	openldap-test
 PKGNAMESUFFIX=		${OPENLDAP_PKGNAMESUFFIX}
-DISTNAME=		openldap-${OPENLDAP_VERSION}alpha
+DISTNAME=		${PORTNAME}-${PORTVERSION:S/.a/alpha/}
 EXTRACT_SUFX=		.tgz
 
 MAINTAINER=		eikemeier at fillmore-labs.com
 COMMENT?=		Open source LDAP server implementation
 
-OPENLDAP_VERSION=	2.2.0
-
 LATEST_LINK=		${PKGNAMEPREFIX}openldap22${PKGNAMESUFFIX}
 CONFLICTS=		openldap12-* \
 			${PKGNAMEPREFIX}${PORTNAME}-client-2.[013-9].*
@@ -60,14 +58,19 @@
 CONFLICTS+=		${PKGNAMEPREFIX}${PORTNAME}-server-2.[013-9].*
 .endif
 
-#USE_OPENSSL=		yes
+USE_OPENSSL=		yes
 USE_REINPLACE=		yes
 USE_LIBTOOL_VER=	14
 
 DESCR=			${PKGDIR}/pkg-descr${OPENLDAP_PKGFILESUFX}
-PLIST=			${WRKDIR}/pkg-plist
+PLIST=			${PKGDIR}/pkg-plist${OPENLDAP_PKGFILESUFX}
 PKGINSTALL=		${WRKDIR}/pkg-install
 PKGMESSAGE=		${WRKDIR}/pkg-message
+PKGDEINSTALL=		${WRKDIR}/pkg-deinstall
+
+SCHEMATA=		corba core cosine inetorgperson \
+			java \
+			misc nis openldap
 
 LDAP_RUN_DIR?=		${DESTDIR}/var/run/openldap
 LOCALSTATEDIR?=		${DESTDIR}/var/db
@@ -80,7 +83,8 @@
 
 SED_SCRIPT=		-e 's,%%PREFIX%%,${PREFIX},g' \
 			-e 's,%%LDAP_RUN_DIR%%,${LDAP_RUN_DIR},g' \
-			-e 's,%%DATABASEDIR%%,${DATABASEDIR},g'
+			-e 's,%%DATABASEDIR%%,${DATABASEDIR},g' \
+			-e 's,%%SLURPDIR%%,${SLURPDIR},g'
 
 CONFIGURE_ARGS=		--with-threads \
 			--with-tls=openssl \
@@ -177,8 +181,7 @@
 # end of client/server specific configuration
 .endif
 
-# math.h uses _REENTRANT and stdio.h uses _THREAD_SAFE, so define both.
-CPPFLAGS+=		-D_REENTRANT ${PTHREAD_CFLAGS} \
+CPPFLAGS+=		${PTHREAD_CFLAGS} \
 			-I${LOCALBASE}/include
 LDFLAGS+=		-L${LOCALBASE}/lib
 
@@ -242,9 +245,9 @@
 .for script in slapd slurpd
 	@${SED} ${SED_SCRIPT} ${FILESDIR}/${script}.sh >${WRKDIR}/${script}.sh
 .endfor
-.for text in pkg-install pkg-message
-	@if [ -f ${MASTERDIR}/${text}${OPENLDAP_PKGFILESUFX} ]; then \
-		${SED} ${SED_SCRIPT} ${MASTERDIR}/${text}${OPENLDAP_PKGFILESUFX} \
+.for text in pkg-install pkg-message pkg-deinstall
+	@if [ -f ${PKGDIR}/${text}${OPENLDAP_PKGFILESUFX} ]; then \
+		${SED} ${SED_SCRIPT} ${PKGDIR}/${text}${OPENLDAP_PKGFILESUFX} \
 		>${WRKDIR}/${text}; \
 	fi
 .endfor
@@ -256,18 +259,6 @@
 .endif
 
 pre-install:
-	@${CP} ${MASTERDIR}/pkg-plist${OPENLDAP_PKGFILESUFX} ${PLIST}
-.if defined(CLIENT_ONLY)
-.if !defined(NOPORTDOCS)
-	@for dir in rfc drafts; do \
-		${FIND} ${WRKSRC}/doc/$${dir} -maxdepth 1 -type f \
-			| ${SED} -e "s,^${WRKSRC}/doc/,%%DOCSDIR%%/," \
-			>>${PLIST}; \
-		${ECHO_CMD} "@dirrm %%DOCSDIR%%/$${dir}" >>${PLIST}; \
-	done
-	@${ECHO_CMD} "@dirrm %%DOCSDIR%%" >>${PLIST}
-.endif
-.endif
 	@if [ -f ${PKGINSTALL} ]; then \
 		${SETENV} "PKG_PREFIX=${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL; \
 	fi
@@ -279,12 +270,27 @@
 	@for dir in rfc drafts; do \
 		${MKDIR} ${DOCSDIR}/$${dir}; \
 		${FIND} ${WRKSRC}/doc/$${dir} -maxdepth 1 -type f \
-			-exec ${INSTALL_DATA} {} ${DOCSDIR}/$${dir} \; ; \
+			-exec ${INSTALL_DATA} {} ${DOCSDIR}/$${dir} \; -print \
+			| ${SED} -e "s,^${WRKSRC}/doc/,${DOCSDIR:S,^${PREFIX}/,,}/," \
+			>>${TMPPLIST}; \
+		${ECHO_CMD} "@dirrm ${DOCSDIR:S,^${PREFIX}/,,}/$${dir}" >>${TMPPLIST}; \
 	done
+	@${ECHO_CMD} "@dirrm ${DOCSDIR:S,^${PREFIX}/,,}" >>${TMPPLIST}
 .endif
 .else
+	@for schema in ${SCHEMATA}; do \
+		${ECHO_CMD} "@unexec if cmp -s %D/etc/openldap/schema/$${schema}.schema" \
+			"%D/etc/openldap/schema/$${schema}.schema.default; then" \
+			"rm -f %D/etc/openldap/schema/$${schema}.schema; fi" >>${TMPPLIST}; \
+		${ECHO_CMD} "etc/openldap/schema/$${schema}.schema.default" >>${TMPPLIST}; \
+		${ECHO_CMD} "@exec [ -f %B/$${schema}.schema ] || cp %B/%f %B/$${schema}.schema" >>${TMPPLIST}; \
+	done
+	@${ECHO_CMD} "@unexec rmdir %D/etc/openldap/schema 2>/dev/null || true" >>${TMPPLIST}
+	@${ECHO_CMD} "@unexec rmdir %D/etc/openldap 2>/dev/null || true" >>${TMPPLIST}
+	@${ECHO_CMD} "@cwd ${RC_DIR}" >>${TMPPLIST}
 .for script in slapd slurpd
 	@${INSTALL_SCRIPT} ${WRKDIR}/${script}.sh ${RC_DIR}/${script}${RC_SUFX}
+	@${ECHO_CMD} "${script}${RC_SUFX}" >>${TMPPLIST}
 .endfor
 	@${MKDIR} ${LDAP_RUN_DIR}
 .endif
diff -Nur openldap22-server/pkg-deinstall.orig openldap22-server/pkg-deinstall
--- openldap22-server/pkg-deinstall.orig	Thu Jan  1 01:00:00 1970
+++ openldap22-server/pkg-deinstall	Thu Sep 18 23:34:03 2003
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+ECHO_CMD=echo
+
+case $2 in
+POST-DEINSTALL)
+  ${ECHO_CMD}
+  ${ECHO_CMD} "The OpenLDAP server package has been deleted."
+  ${ECHO_CMD} "If you're *not* upgrading and won't be using"
+  ${ECHO_CMD} "it any longer, you may want to issue the"
+  ${ECHO_CMD} "following commands:"
+  ${ECHO_CMD}
+  if [ -d %%DATABASEDIR%% ]; then
+    ${ECHO_CMD} "- to delete the OpenLDAP database permanently (losing all data):"
+    ${ECHO_CMD} "  rm -Rf %%DATABASEDIR%%"
+    ${ECHO_CMD}
+  fi
+  if [ -d %%SLURPDIR%% ]; then
+    ${ECHO_CMD} "- to remove the OpenLDAP replication directory:"
+    ${ECHO_CMD} "  rm -Rf %%SLURPDIR%%"
+    ${ECHO_CMD}
+  fi
+  ${ECHO_CMD} "- to remove the OpenLDAP user:"
+  ${ECHO_CMD} "  pw userdel ldap"
+  ${ECHO_CMD}
+  ${ECHO_CMD} "If you are upgrading, don't forget to restart"
+  ${ECHO_CMD} "slapd and slurpd."
+  ${ECHO_CMD}
+  ;;
+esac
diff -Nur openldap22-server/pkg-install.orig openldap22-server/pkg-install
--- openldap22-server/pkg-install.orig	Thu Aug 28 14:51:08 2003
+++ openldap22-server/pkg-install	Thu Sep 18 23:36:05 2003
@@ -13,9 +13,9 @@
 case $2 in
 PRE-INSTALL)
   if ! ${PW} usershow -n ldap >/dev/null 2>&1; then
+    ${ECHO_CMD}
     if ! ${PW} groupshow -n ldap >/dev/null 2>&1; then
       if ! ${PW} groupadd -n ldap -g 389; then
-        ${ECHO_CMD}
         ${ECHO_CMD} "*** Failed to add a group ldap with id 389."
         ${ECHO_CMD}
         ${ECHO_CMD} "Please add the ldap user manually with"
@@ -24,12 +24,10 @@
         ${ECHO_CMD} "and retry installing this package."
         exit 1
       fi
+      ${ECHO_CMD} "===>  Group 'ldap' created."
     fi
-    if ${PW} useradd -n ldap -u 389 -g ldap -c 'OpenLDAP Server' \
+    if ! ${PW} useradd -n ldap -u 389 -g ldap -c 'OpenLDAP Server' \
         -d /nonexistent -s /sbin/nologin -h -; then
-      ${GREP} -qs '^ldap$' ${FTPUSERS} || ${ECHO_CMD} ldap >> ${FTPUSERS}
-    else
-      ${ECHO_CMD}
       ${ECHO_CMD} "*** Failed to add an user ldap with id 389."
       ${ECHO_CMD}
       ${ECHO_CMD} "Please add the ldap user manually with"
@@ -38,6 +36,8 @@
       ${ECHO_CMD} "and retry installing this package."
       exit 1
     fi
+    ${GREP} -qs '^ldap$' ${FTPUSERS} || ${ECHO_CMD} ldap >> ${FTPUSERS}
+    ${ECHO_CMD} "===>  Account 'ldap' created."
   fi
   ;;
 esac
diff -Nur openldap22-server/pkg-message.orig openldap22-server/pkg-message
--- openldap22-server/pkg-message.orig	Thu Aug 28 14:51:08 2003
+++ openldap22-server/pkg-message	Fri Sep 19 00:31:39 2003
@@ -14,7 +14,7 @@
 or reboot.
 
 Try `man slapd' and the online manual at
-  http://www.OpenLDAP.org/doc/admin20/
+  http://www.OpenLDAP.org/devel/admin/
 for more information.
   
 NOTE: Some variable names have been changed to conform with rc.subr(8)
diff -Nur openldap22-server/pkg-message.client.orig openldap22-server/pkg-message.client
--- openldap22-server/pkg-message.client.orig	Thu Aug 14 05:55:20 2003
+++ openldap22-server/pkg-message.client	Fri Sep 19 00:28:31 2003
@@ -6,4 +6,8 @@
   %%PREFIX%%/etc/openldap/ldap.conf
 to change the system-wide client defaults.
 
+Try `man ldap.conf' and visit the OpenLDAP FAQ-O-Matic at
+  http://www.OpenLDAP.org/faq/index.cgi?file=3
+for more information.
+
 ************************************************************
diff -Nur openldap22-server/pkg-plist.orig openldap22-server/pkg-plist
--- openldap22-server/pkg-plist.orig	Sat Aug 30 11:11:51 2003
+++ openldap22-server/pkg-plist	Thu Sep 18 19:30:12 2003
@@ -1,36 +1,10 @@
 @comment $FreeBSD: ports/net/openldap22-server/pkg-plist,v 1.23 2003/08/30 09:11:51 edwin Exp $
- at unexec %%RC_DIR%%/slapd%%RC_SUFX%% stop 2>/dev/null || true
- at unexec %%RC_DIR%%/slurpd%%RC_SUFX%% stop 2>/dev/null || true
+ at unexec %%RC_DIR%%/slapd%%RC_SUFX%% stop 2>&1 >/dev/null || true
+ at unexec %%RC_DIR%%/slurpd%%RC_SUFX%% stop 2>&1 >/dev/null || true
 etc/openldap/schema/README
- at unexec if cmp -s %D/etc/openldap/schema/corba.schema %D/etc/openldap/schema/corba.schema.default; then rm -f %D/etc/openldap/schema/corba.schema; fi
-etc/openldap/schema/corba.schema.default
- at exec [ -f %B/corba.schema ] || cp %B/%f %B/corba.schema
- at unexec if cmp -s %D/etc/openldap/schema/core.schema %D/etc/openldap/schema/core.schema.default; then rm -f %D/etc/openldap/schema/core.schema; fi
-etc/openldap/schema/core.schema.default
- at exec [ -f %B/core.schema ] || cp %B/%f %B/core.schema
- at unexec if cmp -s %D/etc/openldap/schema/cosine.schema %D/etc/openldap/schema/cosine.schema.default; then rm -f %D/etc/openldap/schema/cosine.schema; fi
-etc/openldap/schema/cosine.schema.default
- at exec [ -f %B/cosine.schema ] || cp %B/%f %B/cosine.schema
- at unexec if cmp -s %D/etc/openldap/schema/inetorgperson.schema %D/etc/openldap/schema/inetorgperson.schema.default; then rm -f %D/etc/openldap/schema/inetorgperson.schema; fi
-etc/openldap/schema/inetorgperson.schema.default
- at exec [ -f %B/inetorgperson.schema ] || cp %B/%f %B/inetorgperson.schema
- at unexec if cmp -s %D/etc/openldap/schema/java.schema %D/etc/openldap/schema/java.schema.default; then rm -f %D/etc/openldap/schema/java.schema; fi
-etc/openldap/schema/java.schema.default
- at exec [ -f %B/java.schema ] || cp %B/%f %B/java.schema
- at unexec if cmp -s %D/etc/openldap/schema/misc.schema %D/etc/openldap/schema/misc.schema.default; then rm -f %D/etc/openldap/schema/misc.schema; fi
-etc/openldap/schema/misc.schema.default
- at exec [ -f %B/misc.schema ] || cp %B/%f %B/misc.schema
- at unexec if cmp -s %D/etc/openldap/schema/nis.schema %D/etc/openldap/schema/nis.schema.default; then rm -f %D/etc/openldap/schema/nis.schema; fi
-etc/openldap/schema/nis.schema.default
- at exec [ -f %B/nis.schema ] || cp %B/%f %B/nis.schema
- at unexec if cmp -s %D/etc/openldap/schema/openldap.schema %D/etc/openldap/schema/openldap.schema.default; then rm -f %D/etc/openldap/schema/openldap.schema; fi
-etc/openldap/schema/openldap.schema.default
- at exec [ -f %B/openldap.schema ] || cp %B/%f %B/openldap.schema
 @unexec if cmp -s %D/etc/openldap/slapd.conf %D/etc/openldap/slapd.conf.default; then rm -f %D/etc/openldap/slapd.conf; fi
 etc/openldap/slapd.conf.default
 @exec [ -f %B/slapd.conf ] || cp %B/%f %B/slapd.conf
- at unexec rmdir %D/etc/openldap/schema 2>/dev/null || true
- at unexec rmdir %D/etc/openldap 2>/dev/null || true
 %%SLAPI%%lib/libslapi.a
 %%SLAPI%%lib/libslapi.so
 %%SLAPI%%lib/libslapi.so.2
@@ -43,9 +17,6 @@
 @exec mkdir -p %%LDAP_RUN_DIR%%
 @exec mkdir -p %%DATABASEDIR%%
 @exec mkdir -p %%SLURPDIR%%
- at unexec rmdir %%LDAP_RUN_DIR%%
+ at unexec rmdir %%LDAP_RUN_DIR%% 2>/dev/null || true
 @unexec rmdir %%DATABASEDIR%% 2>/dev/null || true
 @unexec rmdir %%SLURPDIR%% 2>/dev/null || true
- at cwd %%RC_DIR%%
-slapd%%RC_SUFX%%
-slurpd%%RC_SUFX%%
--- openldap2X-server.patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list