summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-nds/openldap')
-rw-r--r--net-nds/openldap/Manifest5
-rw-r--r--net-nds/openldap/files/openldap-2.3.34-slapd-conf64
-rw-r--r--net-nds/openldap/files/openldap-2.4.15-ppolicy.patch12
-rw-r--r--net-nds/openldap/files/openldap-2.4.33-gnutls.patch60
-rw-r--r--net-nds/openldap/files/openldap-2.4.40-mdb-unbundle.patch136
-rw-r--r--net-nds/openldap/files/openldap-2.4.40-slapd-conf64
-rw-r--r--net-nds/openldap/files/slapd-initd-2.4.4051
-rw-r--r--net-nds/openldap/files/slapd-initd-2.4.40-r165
-rw-r--r--net-nds/openldap/files/slapd-initd-2.4.40-r265
-rw-r--r--net-nds/openldap/openldap-2.4.38-r2.ebuild761
-rw-r--r--net-nds/openldap/openldap-2.4.39.ebuild760
-rw-r--r--net-nds/openldap/openldap-2.4.40-r2.ebuild821
-rw-r--r--net-nds/openldap/openldap-2.4.40-r4.ebuild821
-rw-r--r--net-nds/openldap/openldap-2.4.40.ebuild822
-rw-r--r--net-nds/openldap/openldap-2.4.42-r1.ebuild828
-rw-r--r--net-nds/openldap/openldap-2.4.42.ebuild818
-rw-r--r--net-nds/openldap/openldap-2.4.43-r1.ebuild830
-rw-r--r--net-nds/openldap/openldap-2.4.43.ebuild825
18 files changed, 0 insertions, 7808 deletions
diff --git a/net-nds/openldap/Manifest b/net-nds/openldap/Manifest
index d299ef0718bf..0f5b7b5f5787 100644
--- a/net-nds/openldap/Manifest
+++ b/net-nds/openldap/Manifest
@@ -1,8 +1,3 @@
DIST openldap-2.3.43.tgz 3803011 SHA256 d7d2dea05362c8ac7e11bb7bf1da4cdeb07225ba8dc16974bff9f51a9f3d37e1 SHA512 2b0ebb35adbeed34673e1a55cc7a89b348ddee7ad6ce7f915ca3745198cee992aba7281bf0d56197dcfd59665935d5d3764db0ba487975e4dbc2a2507d6ea7a6 WHIRLPOOL 7457112bbad83d75f7ad01230da97511a8d983a98f7e31357dbffd79a7ed7e53057af781002cae8c610d3ad7834dfeefbd7f223798d45aea8cd00b70f5ee0e39
-DIST openldap-2.4.38.tgz 5506085 SHA256 88209a3599ec5d9354fc09bbe29b99db1ffa1b612127c06bad0c5265d0b31fd1 SHA512 df7b6b2b84102ba996f84575396c7505ada851b5f09841fd821d34fd8d62580f85ecc655e2cd3965730b44d6919d64864f56b23791f38b411d142d345f250666 WHIRLPOOL bb6a19b353f9dcde07afe78052ce9d5db5a2aaa09236b69d22da0879e74c4de8587312bad66939702db30af779f7ee9720ad792b73d225f004a1a90d80a6fed1
-DIST openldap-2.4.39.tgz 5509060 SHA256 8267c87347103fef56b783b24877c0feda1063d3cb85d070e503d076584bf8a7 SHA512 7b5ef2a69f79f0901a06f8be4ab50afc3b3e98ab1ea74a421569443d32cb43d3cf773d3f028fb5fb39908c09ee172cb4770ecc5882754877a59d29bf8f8cc059 WHIRLPOOL 90ac4cff185855d569a8033a3e35a251d75e4a2805bcfa5ba5b3605ec88b2fc244b0e95aabd33c47c9846f29c95a17e1be43650442987f6abc043667e06f15cd
-DIST openldap-2.4.40.tgz 5641865 SHA256 d12611a5c25b6499293c2bb7b435dc2b174db73e83f5a8cb7e34f2ce5fa6dadb SHA512 c803c4a82878891d60414d64dcb54a7c3f08675106ba13f50cba06034a97b3eee1c238761dd5ddad97d8c3f6675d9bbbec176d0340eb4a3bcd808f940baabab5 WHIRLPOOL 82cb6033798ac69faf4a0d1f5d7716316f5fbfc67e0f3a013b5bae461a01e3029aa6fb7d510bc14eed4f40ef83632561a3fa39aebf2be2785e3d0e0038db048c
-DIST openldap-2.4.42.tgz 5645925 SHA256 eeb7b0e2c5852bfd2650e83909bb6152835c0b862fab10b63954dc1bcbba8e63 SHA512 52d6af7610c4fdc8f965ebea04d09c38f73773a02c2e484dc111100f3d472f8b2f766ca32d9c80f5815a57745095cc7c33ad62d9165eec5b9e252ae172e7782c WHIRLPOOL e151c63bfd10f5e96c60f216925315ed788d426ba2c15ee2793a4de4bb25d01717e7bb5144814a0e6a053a5d5a0aab75213a495aa47aa13f7c3e70716c01633e
-DIST openldap-2.4.43.tgz 5654057 SHA256 34d78e5598a2b0360d26a9050fcdbbe198c65493b013bb607839d5598b6978c8 SHA512 1306206bf22fcec2ccf4b91fd7eadf0207e7015f20d761a4055b0e0213fe1f4c275eec933d86220b03b558650439e74cdca07db05e8debb54d38be4e983b3631 WHIRLPOOL 0d4dc1c1f36f85c4711d0ec1d11107dac242f1d69b4f183e7762cc3ed3d7221c45bd44777e7441afe10156abc487da18f9bdf748244123dd62a241aefe7bca3f
DIST openldap-2.4.44.tgz 5658830 SHA256 d7de6bf3c67009c95525dde3a0212cc110d0a70b92af2af8e3ee800e81b88400 SHA512 132eb81798f59a364c9246d08697e1c7ebb6c2c3b983f786b14ec0233df09696cbad33a1f35f3076348b5efb77665a076ab854a24122c31e8b58310b7c7fd136 WHIRLPOOL 37399793d681a6489c369d663772970c62a4e1e370d4dc306bcb6fa3b9cb680139c9d940d9218aaac4618f50a63bc391b10f2aec0a134f84094ce4f7378c88ff
DIST rfc2307bis.schema-20140524 12262 SHA256 6cd8154ad86be1d6bb88a79c303dc10a49bce4ce7d21bb417a951d6496df30b1 SHA512 83b89a1deeefc8566b97e7e865b9b6d04541099cbdf719e24538a7d27d61b6209e87ab9003a9f140bd9afd018ec569e71721e3a24090e1902c8b6659d2ba103e WHIRLPOOL 40cef24529fb4bfc1661d03088eccdb17d9056d696b2bf0e698fa248d03f508ba776784bf8abbaffb5f4c2c59b59b29525b4be2babc978fed681e5e3c88073de
diff --git a/net-nds/openldap/files/openldap-2.3.34-slapd-conf b/net-nds/openldap/files/openldap-2.3.34-slapd-conf
deleted file mode 100644
index ad767cfdeb7c..000000000000
--- a/net-nds/openldap/files/openldap-2.3.34-slapd-conf
+++ /dev/null
@@ -1,64 +0,0 @@
-#
-# See slapd.conf(5) for details on configuration options.
-# This file should NOT be world readable.
-#
-include /etc/openldap/schema/core.schema
-
-# Define global ACLs to disable default read access.
-
-# Do not enable referrals until AFTER you have a working directory
-# service AND an understanding of referrals.
-#referral ldap://root.openldap.org
-
-pidfile /var/run/openldap/slapd.pid
-argsfile /var/run/openldap/slapd.args
-
-# Load dynamic backend modules:
-###INSERTDYNAMICMODULESHERE###
-
-# Sample security restrictions
-# Require integrity protection (prevent hijacking)
-# Require 112-bit (3DES or better) encryption for updates
-# Require 63-bit encryption for simple bind
-# security ssf=1 update_ssf=112 simple_bind=64
-
-# Sample access control policy:
-# Root DSE: allow anyone to read it
-# Subschema (sub)entry DSE: allow anyone to read it
-# Other DSEs:
-# Allow self write access
-# Allow authenticated users read access
-# Allow anonymous users to authenticate
-# Directives needed to implement policy:
-# access to dn.base="" by * read
-# access to dn.base="cn=Subschema" by * read
-# access to *
-# by self write
-# by users read
-# by anonymous auth
-#
-# if no access controls are present, the default policy
-# allows anyone and everyone to read anything but restricts
-# updates to rootdn. (e.g., "access to * by * read")
-#
-# rootdn can always read and write EVERYTHING!
-
-#######################################################################
-# BDB database definitions
-#######################################################################
-
-database hdb
-suffix "dc=my-domain,dc=com"
-# <kbyte> <min>
-checkpoint 32 30
-rootdn "cn=Manager,dc=my-domain,dc=com"
-# Cleartext passwords, especially for the rootdn, should
-# be avoid. See slappasswd(8) and slapd.conf(5) for details.
-# Use of strong authentication encouraged.
-rootpw secret
-# The database directory MUST exist prior to running slapd AND
-# should only be accessible by the slapd and slap tools.
-# Mode 700 recommended.
-directory /var/lib/openldap-data
-# Indices to maintain
-index objectClass eq
diff --git a/net-nds/openldap/files/openldap-2.4.15-ppolicy.patch b/net-nds/openldap/files/openldap-2.4.15-ppolicy.patch
deleted file mode 100644
index 3195ee550f68..000000000000
--- a/net-nds/openldap/files/openldap-2.4.15-ppolicy.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- openldap-2.4.15/clients/tools/common.c.orig 2009-02-05 15:05:03.000000000 -0800
-+++ openldap-2.4.15/clients/tools/common.c 2009-03-21 01:45:14.000000000 -0700
-@@ -1315,8 +1315,8 @@
- int nsctrls = 0;
-
- #ifdef LDAP_CONTROL_PASSWORDPOLICYREQUEST
-+ LDAPControl c;
- if ( ppolicy ) {
-- LDAPControl c;
- c.ldctl_oid = LDAP_CONTROL_PASSWORDPOLICYREQUEST;
- c.ldctl_value.bv_val = NULL;
- c.ldctl_value.bv_len = 0;
diff --git a/net-nds/openldap/files/openldap-2.4.33-gnutls.patch b/net-nds/openldap/files/openldap-2.4.33-gnutls.patch
deleted file mode 100644
index 2b07c85c04aa..000000000000
--- a/net-nds/openldap/files/openldap-2.4.33-gnutls.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-From 98de912932732f1441300eb64ca3070ff1469fcf Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <petr.pisar@atlas.cz>
-Date: Sun, 30 Dec 2012 21:11:06 +0100
-Subject: [PATCH] GnuTLS 3.0 removed gnutls_certificate_get_x509_cas()
-
----
- libraries/libldap/tls_g.c | 23 +++++++++++++++++++++++
- 1 file changed, 23 insertions(+)
-
-diff --git a/libraries/libldap/tls_g.c b/libraries/libldap/tls_g.c
-index 40616f5..374514d 100644
---- a/libraries/libldap/tls_g.c
-+++ b/libraries/libldap/tls_g.c
-@@ -60,6 +60,12 @@
- #undef HAVE_GCRYPT_RAND
- #endif
-
-+#if LIBGNUTLS_VERSION_NUMBER >= 0x030000
-+#define HAVE_GNUTLS_CERTIFICATE_GET_ISSUER 1
-+#else
-+#undef HAVE_GNUTLS_CERTIFICATE_GET_ISSUER
-+#endif
-+
- #ifndef HAVE_CIPHERSUITES
- /* Versions prior to 2.2.0 didn't handle cipher suites, so we had to
- * kludge them ourselves.
-@@ -368,6 +374,22 @@ tlsg_ctx_init( struct ldapoptions *lo, struct ldaptls *lt, int is_server )
- * then we have to build the cert chain.
- */
- if ( max == 1 && !gnutls_x509_crt_check_issuer( certs[0], certs[0] )) {
-+#ifdef HAVE_GNUTLS_CERTIFICATE_GET_ISSUER
-+ gnutls_x509_crt_t issuer;
-+ unsigned int i;
-+
-+ for ( i = 1; i<VERIFY_DEPTH; i++ ) {
-+ /* If no CA is known, we're done */
-+ if ( gnutls_certificate_get_issuer( ctx->cred, certs[i-1],
-+ &issuer, 0 ) )
-+ break;
-+ certs[i] = issuer;
-+ max++;
-+ /* If this CA is self-signed, we're done */
-+ if ( gnutls_x509_crt_check_issuer( certs[i], certs[i] ))
-+ break;
-+ }
-+#else
- gnutls_x509_crt_t *cas;
- unsigned int i, j, ncas;
-
-@@ -387,6 +409,7 @@ tlsg_ctx_init( struct ldapoptions *lo, struct ldaptls *lt, int is_server )
- if ( j == ncas )
- break;
- }
-+#endif /* !defined HAVE_GNUTLS_CERTIFICATE_GET_ISSUER */
- }
- rc = gnutls_certificate_set_x509_key( ctx->cred, certs, max, key );
- if ( rc ) return -1;
---
-1.8.0.2
-
diff --git a/net-nds/openldap/files/openldap-2.4.40-mdb-unbundle.patch b/net-nds/openldap/files/openldap-2.4.40-mdb-unbundle.patch
deleted file mode 100644
index 9265a01701ab..000000000000
--- a/net-nds/openldap/files/openldap-2.4.40-mdb-unbundle.patch
+++ /dev/null
@@ -1,136 +0,0 @@
---- ./build/top.mk.orig 2014-10-24 14:34:59.260827298 +0200
-+++ ./build/top.mk 2014-10-24 14:35:25.281168893 +0200
-@@ -160,6 +160,7 @@
- LTHREAD_LIBS = @LTHREAD_LIBS@
-
- BDB_LIBS = @BDB_LIBS@
-+MDB_LIBS = @MDB_LIBS@
- SLAPD_NDB_LIBS = @SLAPD_NDB_LIBS@
-
- LDAP_LIBLBER_LA = $(LDAP_LIBDIR)/liblber/liblber.la
---- ./build/openldap.m4.orig 2014-10-24 10:52:02.837221734 +0200
-+++ ./build/openldap.m4 2014-10-24 11:31:02.748087966 +0200
-@@ -563,6 +563,38 @@
- ], [ol_cv_bdb_compat=yes], [ol_cv_bdb_compat=no])])
- ])
-
-+dnl --------------------------------------------------------------------
-+dnl Check for version compatility with back-mdb
-+AC_DEFUN([OL_MDB_COMPAT],
-+[AC_CACHE_CHECK([if LMDB version supported by MDB backends], [ol_cv_mdb_compat],[
-+ AC_EGREP_CPP(__mdb_version_compat,[
-+#include <lmdb.h>
-+
-+/* require 0.9.14 or later */
-+#if MDB_VERSION_FULL >= 0x00000009000E
-+ __mdb_version_compat
-+#endif
-+ ], [ol_cv_mdb_compat=yes], [ol_cv_mdb_compat=no])])
-+])
-+
-+dnl
-+dnl --------------------------------------------------------------------
-+dnl Find any MDB
-+AC_DEFUN([OL_MDB],
-+[ol_cv_mdb=no
-+AC_CHECK_HEADERS(lmdb.h)
-+if test $ac_cv_header_lmdb_h = yes; then
-+ OL_MDB_COMPAT
-+
-+ if test $ol_cv_mdb_compat != yes ; then
-+ AC_MSG_ERROR([LMDB version incompatible with MDB backends])
-+ fi
-+
-+ ol_cv_lib_mdb=-llmdb
-+ ol_cv_mdb=yes
-+fi
-+])
-+
- dnl
- dnl ====================================================================
- dnl Check POSIX Thread version
---- ./servers/slapd/back-mdb/Makefile.in.orig 2014-10-24 10:31:30.860931076 +0200
-+++ ./servers/slapd/back-mdb/Makefile.in 2014-10-24 14:33:33.803705424 +0200
-@@ -25,11 +25,10 @@
- extended.lo operational.lo \
- attr.lo index.lo key.lo filterindex.lo \
- dn2entry.lo dn2id.lo id2entry.lo idl.lo \
-- nextid.lo monitor.lo mdb.lo midl.lo
-+ nextid.lo monitor.lo
-
- LDAP_INCDIR= ../../../include
- LDAP_LIBDIR= ../../../libraries
--MDB_SUBDIR = $(srcdir)/$(LDAP_LIBDIR)/liblmdb
-
- BUILD_OPT = "--enable-mdb"
- BUILD_MOD = @BUILD_MDB@
-@@ -44,7 +43,7 @@
-
- LIBBASE = back_mdb
-
--XINCPATH = -I.. -I$(srcdir)/.. -I$(MDB_SUBDIR)
-+XINCPATH = -I.. -I$(srcdir)/..
- XDEFS = $(MODULES_CPPFLAGS)
-
- all-local-lib: ../.backend
-@@ -52,11 +51,5 @@
- ../.backend: lib$(LIBBASE).a
- @touch $@
-
--mdb.lo: $(MDB_SUBDIR)/mdb.c
-- $(LTCOMPILE_MOD) $(MDB_SUBDIR)/mdb.c
--
--midl.lo: $(MDB_SUBDIR)/midl.c
-- $(LTCOMPILE_MOD) $(MDB_SUBDIR)/midl.c
--
- veryclean-local-lib: FORCE
- $(RM) $(XXHEADERS) $(XXSRCS) .links
---- ./configure.in.orig 2014-10-24 10:46:53.289139847 +0200
-+++ ./configure.in 2014-10-24 10:51:34.372846374 +0200
-@@ -519,6 +519,7 @@
- dnl Initialize vars
- LDAP_LIBS=
- BDB_LIBS=
-+MDB_LIBS=
- SLAPD_NDB_LIBS=
- SLAPD_NDB_INCS=
- LTHREAD_LIBS=
-@@ -1905,6 +1906,30 @@
- fi
-
- dnl ----------------------------------------------------------------
-+ol_link_mdb=no
-+
-+if test $ol_enable_mdb != no; then
-+ OL_MDB
-+
-+ if test $ol_cv_mdb = no ; then
-+ AC_MSG_ERROR(MDB: LMDB not available)
-+ fi
-+
-+ AC_DEFINE(HAVE_MDB,1,
-+ [define this if LMDB is available])
-+
-+ dnl $ol_cv_lib_mdb should be yes or -llmdb
-+ dnl (it could be no, but that would be an error
-+ if test $ol_cv_lib_mdb != yes ; then
-+ MDB_LIBS="$MDB_LIBS $ol_cv_lib_mdb"
-+ fi
-+
-+ SLAPD_LIBS="$SLAPD_LIBS \$(MDB_LIBS)"
-+
-+ ol_link_mdb=yes
-+fi
-+
-+dnl ----------------------------------------------------------------
-
- if test $ol_enable_dynamic = yes && test $enable_shared = yes ; then
- BUILD_LIBS_DYNAMIC=shared
-@@ -3133,6 +3158,7 @@
- AC_SUBST(LDAP_LIBS)
- AC_SUBST(SLAPD_LIBS)
- AC_SUBST(BDB_LIBS)
-+AC_SUBST(MDB_LIBS)
- AC_SUBST(SLAPD_NDB_LIBS)
- AC_SUBST(SLAPD_NDB_INCS)
- AC_SUBST(LTHREAD_LIBS)
diff --git a/net-nds/openldap/files/openldap-2.4.40-slapd-conf b/net-nds/openldap/files/openldap-2.4.40-slapd-conf
deleted file mode 100644
index 8ecc732b9672..000000000000
--- a/net-nds/openldap/files/openldap-2.4.40-slapd-conf
+++ /dev/null
@@ -1,64 +0,0 @@
-#
-# See slapd.conf(5) for details on configuration options.
-# This file should NOT be world readable.
-#
-include /etc/openldap/schema/core.schema
-
-# Define global ACLs to disable default read access.
-
-# Do not enable referrals until AFTER you have a working directory
-# service AND an understanding of referrals.
-#referral ldap://root.openldap.org
-
-pidfile /run/openldap/slapd.pid
-argsfile /run/openldap/slapd.args
-
-# Load dynamic backend modules:
-###INSERTDYNAMICMODULESHERE###
-
-# Sample security restrictions
-# Require integrity protection (prevent hijacking)
-# Require 112-bit (3DES or better) encryption for updates
-# Require 63-bit encryption for simple bind
-# security ssf=1 update_ssf=112 simple_bind=64
-
-# Sample access control policy:
-# Root DSE: allow anyone to read it
-# Subschema (sub)entry DSE: allow anyone to read it
-# Other DSEs:
-# Allow self write access
-# Allow authenticated users read access
-# Allow anonymous users to authenticate
-# Directives needed to implement policy:
-# access to dn.base="" by * read
-# access to dn.base="cn=Subschema" by * read
-# access to *
-# by self write
-# by users read
-# by anonymous auth
-#
-# if no access controls are present, the default policy
-# allows anyone and everyone to read anything but restricts
-# updates to rootdn. (e.g., "access to * by * read")
-#
-# rootdn can always read and write EVERYTHING!
-
-#######################################################################
-# BDB database definitions
-#######################################################################
-
-database hdb
-suffix "dc=my-domain,dc=com"
-# <kbyte> <min>
-checkpoint 32 30
-rootdn "cn=Manager,dc=my-domain,dc=com"
-# Cleartext passwords, especially for the rootdn, should
-# be avoid. See slappasswd(8) and slapd.conf(5) for details.
-# Use of strong authentication encouraged.
-rootpw secret
-# The database directory MUST exist prior to running slapd AND
-# should only be accessible by the slapd and slap tools.
-# Mode 700 recommended.
-directory /var/lib/openldap-data
-# Indices to maintain
-index objectClass eq
diff --git a/net-nds/openldap/files/slapd-initd-2.4.40 b/net-nds/openldap/files/slapd-initd-2.4.40
deleted file mode 100644
index 473e9fd0e725..000000000000
--- a/net-nds/openldap/files/slapd-initd-2.4.40
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/sbin/openrc-run
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-extra_commands="checkconfig"
-
-[ -z "$INSTANCE" ] && INSTANCE="openldap${SVCNAME#slapd}"
-PIDDIR=/run/openldap
-PIDFILE=$PIDDIR/$SVCNAME.pid
-
-depend() {
- need net
- before dbus hald avahi-daemon
- provide ldap
-}
-
-start() {
- checkpath -q -d ${PIDDIR} -o ldap:ldap
- if ! checkconfig -Q ; then
- eerror "There is a problem with your slapd.conf!"
- return 1
- fi
- ebegin "Starting ldap-server"
- [ -n "$KRB5_KTNAME" ] && export KRB5_KTNAME
- eval start-stop-daemon --start --pidfile ${PIDFILE} --exec /usr/lib/openldap/slapd -- -u ldap -g ldap "${OPTS}"
- eend $?
-}
-
-stop() {
- ebegin "Stopping ldap-server"
- start-stop-daemon --stop --signal 2 --quiet --pidfile ${PIDFILE}
- eend $?
-}
-
-checkconfig() {
- # checks requested by bug #502948
- for d in `awk '/^directory/{print $2}'`; do
- if [ ! -d $d ]; then
- eerror "Directory $d in config does not exist!"
- return 1
- fi
- /usr/bin/find $d ! -name DB_CONFIG ! -user ldap -o ! -group ldap |grep -sq .
- if [ $? -ne 0 ]; then
- ewarn "You have files in $d not owned by the ldap user, you must ensure they are accessible to the slapd instance!"
- fi
- [ ! -e $d/DB_CONFIG ] && ewarn "$d/DB_CONFIG does not exist, slapd performance may be sub-optimal"
- done
- # now test the config fully
- /usr/sbin/slaptest -u "$@" ${OPTS_CONF}
-}
diff --git a/net-nds/openldap/files/slapd-initd-2.4.40-r1 b/net-nds/openldap/files/slapd-initd-2.4.40-r1
deleted file mode 100644
index 3547e0751816..000000000000
--- a/net-nds/openldap/files/slapd-initd-2.4.40-r1
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/sbin/openrc-run
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-extra_commands="checkconfig"
-
-[ -z "$INSTANCE" ] && INSTANCE="openldap${SVCNAME#slapd}"
-PIDDIR=/run/openldap
-PIDFILE=$PIDDIR/$SVCNAME.pid
-
-depend() {
- need net
- before dbus hald avahi-daemon
- provide ldap
-}
-
-start() {
- checkpath -q -d ${PIDDIR} -o ldap:ldap
- if ! checkconfig -Q ; then
- eerror "There is a problem with your slapd.conf!"
- return 1
- fi
- ebegin "Starting ldap-server"
- [ -n "$KRB5_KTNAME" ] && export KRB5_KTNAME
- eval start-stop-daemon --start --pidfile ${PIDFILE} --exec /usr/lib/openldap/slapd -- -u ldap -g ldap "${OPTS}"
- eend $?
-}
-
-stop() {
- ebegin "Stopping ldap-server"
- start-stop-daemon --stop --signal 2 --quiet --pidfile ${PIDFILE}
- eend $?
-}
-
-checkconfig() {
- # checks requested by bug #502948
- # Step 1: extract the last valid config file or config dir
- set -- $OPTS
- while [ -n "$*" ]; do
- opt=$1 ; shift
- if [ "$opt" = "-f" -o "$opt" = "-F" ] ; then
- CONF=$1
- shift
- fi
- done
- set --
- # Fallback
- CONF=${CONF-/etc/openldap/slapd.conf}
- [ -d $CONF ] && CONF=${CONF}/*
- DBDIRS=`eval awk '"/^(directory|olcDbDirectory:)/{print \$2}"' $CONF`
- for d in $DBDIRS; do
- if [ ! -d $d ]; then
- eerror "Directory $d in config does not exist!"
- return 1
- fi
- /usr/bin/find $d ! -name DB_CONFIG ! -user ldap -o ! -group ldap |grep -sq .
- if [ $? -ne 0 ]; then
- ewarn "You have files in $d not owned by the ldap user, you must ensure they are accessible to the slapd instance!"
- fi
- [ ! -e $d/DB_CONFIG ] && ewarn "$d/DB_CONFIG does not exist, slapd performance may be sub-optimal"
- done
- # now test the config fully
- /usr/sbin/slaptest -u "$@" ${OPTS_CONF}
-}
diff --git a/net-nds/openldap/files/slapd-initd-2.4.40-r2 b/net-nds/openldap/files/slapd-initd-2.4.40-r2
deleted file mode 100644
index 9ce071ac9780..000000000000
--- a/net-nds/openldap/files/slapd-initd-2.4.40-r2
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/sbin/openrc-run
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-extra_commands="checkconfig"
-
-[ -z "$INSTANCE" ] && INSTANCE="openldap${SVCNAME#slapd}"
-PIDDIR=/run/openldap
-PIDFILE=$PIDDIR/$SVCNAME.pid
-
-depend() {
- need net
- before dbus hald avahi-daemon
- provide ldap
-}
-
-start() {
- checkpath -q -d ${PIDDIR} -o ldap:ldap
- if ! checkconfig -Q ; then
- eerror "There is a problem with your slapd.conf!"
- return 1
- fi
- ebegin "Starting ldap-server"
- [ -n "$KRB5_KTNAME" ] && export KRB5_KTNAME
- eval start-stop-daemon --start --pidfile ${PIDFILE} --exec /usr/lib/openldap/slapd -- -u ldap -g ldap "${OPTS}"
- eend $?
-}
-
-stop() {
- ebegin "Stopping ldap-server"
- start-stop-daemon --stop --signal 2 --quiet --pidfile ${PIDFILE}
- eend $?
-}
-
-checkconfig() {
- # checks requested by bug #502948
- # Step 1: extract the last valid config file or config dir
- set -- $OPTS
- while [ -n "$*" ]; do
- opt=$1 ; shift
- if [ "$opt" = "-f" -o "$opt" = "-F" ] ; then
- CONF=$1
- shift
- fi
- done
- set --
- # Fallback
- CONF=${CONF-/etc/openldap/slapd.conf}
- [ -d $CONF ] && CONF=${CONF}/*
- DBDIRS=`eval awk '"/^(directory|olcDbDirectory:)/{print \\$2}"' $CONF`
- for d in $DBDIRS; do
- if [ ! -d $d ]; then
- eerror "Directory $d in config does not exist!"
- return 1
- fi
- /usr/bin/find $d ! -name DB_CONFIG ! -user ldap -o ! -group ldap |grep -sq .
- if [ $? -ne 0 ]; then
- ewarn "You have files in $d not owned by the ldap user, you must ensure they are accessible to the slapd instance!"
- fi
- [ ! -e $d/DB_CONFIG ] && ewarn "$d/DB_CONFIG does not exist, slapd performance may be sub-optimal"
- done
- # now test the config fully
- /usr/sbin/slaptest -u "$@" ${OPTS_CONF}
-}
diff --git a/net-nds/openldap/openldap-2.4.38-r2.ebuild b/net-nds/openldap/openldap-2.4.38-r2.ebuild
deleted file mode 100644
index 1706a4a57961..000000000000
--- a/net-nds/openldap/openldap-2.4.38-r2.ebuild
+++ /dev/null
@@ -1,761 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI="5"
-
-inherit db-use eutils flag-o-matic multilib multilib-minimal ssl-cert versionator toolchain-funcs autotools user systemd
-
-BIS_PN=rfc2307bis.schema
-BIS_PV=20140524
-BIS_P="${BIS_PN}-${BIS_PV}"
-
-DESCRIPTION="LDAP suite of application and development tools"
-HOMEPAGE="http://www.OpenLDAP.org/"
-
-# mirrors are mostly not working, using canonical URI
-SRC_URI="ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/${P}.tgz
- mirror://gentoo/${BIS_P}"
-
-LICENSE="OPENLDAP GPL-2"
-SLOT="0"
-KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~x86-solaris"
-
-IUSE_DAEMON="crypt icu samba slp tcpd experimental minimal"
-IUSE_BACKEND="+berkdb"
-IUSE_OVERLAY="overlays perl"
-IUSE_OPTIONAL="gnutls iodbc sasl ssl odbc debug ipv6 +syslog selinux"
-IUSE_CONTRIB="smbkrb5passwd kerberos"
-IUSE_CONTRIB="${IUSE_CONTRIB} -cxx"
-IUSE="${IUSE_DAEMON} ${IUSE_BACKEND} ${IUSE_OVERLAY} ${IUSE_OPTIONAL} ${IUSE_CONTRIB}"
-
-REQUIRED_USE="cxx? ( sasl )"
-
-# openssl is needed to generate lanman-passwords required by samba
-CDEPEND="icu? ( dev-libs/icu:= )
- ssl? ( !gnutls? ( >=dev-libs/openssl-1.0.1h-r2[${MULTILIB_USEDEP}] )
- gnutls? ( >=net-libs/gnutls-2.12.23-r6[${MULTILIB_USEDEP}] >=dev-libs/libgcrypt-1.5.3:0[${MULTILIB_USEDEP}] ) )
- sasl? ( dev-libs/cyrus-sasl:= )
- !minimal? (
- sys-devel/libtool
- tcpd? ( sys-apps/tcp-wrappers )
- odbc? ( !iodbc? ( dev-db/unixODBC )
- iodbc? ( dev-db/libiodbc ) )
- slp? ( net-libs/openslp )
- perl? ( dev-lang/perl:=[-build(-)] )
- samba? ( dev-libs/openssl )
- berkdb? ( sys-libs/db )
- smbkrb5passwd? (
- dev-libs/openssl
- app-crypt/heimdal )
- kerberos? ( virtual/krb5 )
- cxx? ( dev-libs/cyrus-sasl:= )
- )
- abi_x86_32? (
- !<=app-emulation/emul-linux-x86-baselibs-20140508-r3
- !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
- )"
-DEPEND="${CDEPEND}
- sys-apps/groff"
-RDEPEND="${CDEPEND}
- selinux? ( sec-policy/selinux-ldap )
-"
-
-# for tracking versions
-OPENLDAP_VERSIONTAG=".version-tag"
-OPENLDAP_DEFAULTDIR_VERSIONTAG="/var/lib/openldap-data"
-
-MULTILIB_WRAPPED_HEADERS=(
- # USE=cxx
- /usr/include/LDAPAsynConnection.h
- /usr/include/LDAPAttrType.h
- /usr/include/LDAPAttribute.h
- /usr/include/LDAPAttributeList.h
- /usr/include/LDAPConnection.h
- /usr/include/LDAPConstraints.h
- /usr/include/LDAPControl.h
- /usr/include/LDAPControlSet.h
- /usr/include/LDAPEntry.h
- /usr/include/LDAPEntryList.h
- /usr/include/LDAPException.h
- /usr/include/LDAPExtResult.h
- /usr/include/LDAPMessage.h
- /usr/include/LDAPMessageQueue.h
- /usr/include/LDAPModList.h
- /usr/include/LDAPModification.h
- /usr/include/LDAPObjClass.h
- /usr/include/LDAPRebind.h
- /usr/include/LDAPRebindAuth.h
- /usr/include/LDAPReferenceList.h
- /usr/include/LDAPResult.h
- /usr/include/LDAPSaslBindResult.h
- /usr/include/LDAPSchema.h
- /usr/include/LDAPSearchReference.h
- /usr/include/LDAPSearchResult.h
- /usr/include/LDAPSearchResults.h
- /usr/include/LDAPUrl.h
- /usr/include/LDAPUrlList.h
- /usr/include/LdifReader.h
- /usr/include/LdifWriter.h
- /usr/include/SaslInteraction.h
- /usr/include/SaslInteractionHandler.h
- /usr/include/StringList.h
- /usr/include/TlsOptions.h
-)
-
-openldap_filecount() {
- local dir="$1"
- find "${dir}" -type f ! -name '.*' ! -name 'DB_CONFIG*' | wc -l
-}
-
-openldap_find_versiontags() {
- # scan for all datadirs
- openldap_datadirs=""
- if [ -f "${EROOT}"/etc/openldap/slapd.conf ]; then
- openldap_datadirs="$(awk '{if($1 == "directory") print $2 }' ${EROOT}/etc/openldap/slapd.conf)"
- fi
- openldap_datadirs="${openldap_datadirs} ${OPENLDAP_DEFAULTDIR_VERSIONTAG}"
-
- einfo
- einfo "Scanning datadir(s) from slapd.conf and"
- einfo "the default installdir for Versiontags"
- einfo "(${OPENLDAP_DEFAULTDIR_VERSIONTAG} may appear twice)"
- einfo
-
- # scan datadirs if we have a version tag
- openldap_found_tag=0
- have_files=0
- for each in ${openldap_datadirs}; do
- CURRENT_TAGDIR=${ROOT}`echo ${each} | sed "s:\/::"`
- CURRENT_TAG=${CURRENT_TAGDIR}/${OPENLDAP_VERSIONTAG}
- if [ -d ${CURRENT_TAGDIR} ] && [ ${openldap_found_tag} == 0 ] ; then
- einfo "- Checking ${each}..."
- if [ -r ${CURRENT_TAG} ] ; then
- # yey, we have one :)
- einfo " Found Versiontag in ${each}"
- source ${CURRENT_TAG}
- if [ "${OLDPF}" == "" ] ; then
- eerror "Invalid Versiontag found in ${CURRENT_TAGDIR}"
- eerror "Please delete it"
- eerror
- die "Please kill the invalid versiontag in ${CURRENT_TAGDIR}"
- fi
-
- OLD_MAJOR=`get_version_component_range 2-3 ${OLDPF}`
-
- [ $(openldap_filecount ${CURRENT_TAGDIR}) -gt 0 ] && have_files=1
-
- # are we on the same branch?
- if [ "${OLD_MAJOR}" != "${PV:0:3}" ] ; then
- ewarn " Versiontag doesn't match current major release!"
- if [[ "${have_files}" == "1" ]] ; then
- eerror " Versiontag says other major and you (probably) have datafiles!"
- echo
- openldap_upgrade_howto
- else
- einfo " No real problem, seems there's no database."
- fi
- else
- einfo " Versiontag is fine here :)"
- fi
- else
- einfo " Non-tagged dir ${each}"
- [ $(openldap_filecount ${each}) -gt 0 ] && have_files=1
- if [[ "${have_files}" == "1" ]] ; then
- einfo " EEK! Non-empty non-tagged datadir, counting `ls -a ${each} | wc -l` files"
- echo
-
- eerror
- eerror "Your OpenLDAP Installation has a non tagged datadir that"
- eerror "possibly contains a database at ${CURRENT_TAGDIR}"
- eerror
- eerror "Please export data if any entered and empty or remove"
- eerror "the directory, installation has been stopped so you"
- eerror "can take required action"
- eerror
- eerror "For a HOWTO on exporting the data, see instructions in the ebuild"
- eerror
- openldap_upgrade_howto
- die "Please move the datadir ${CURRENT_TAGDIR} away"
- fi
- fi
- einfo
- fi
- done
- [ "${have_files}" == "1" ] && einfo "DB files present" || einfo "No DB files present"
-
- # Now we must check for the major version of sys-libs/db linked against.
- SLAPD_PATH=${EROOT}/usr/$(get_libdir)/openldap/slapd
- if [ "${have_files}" == "1" -a -f "${SLAPD_PATH}" ]; then
- OLDVER="$(/usr/bin/ldd ${SLAPD_PATH} \
- | awk '/libdb-/{gsub("^libdb-","",$1);gsub(".so$","",$1);print $1}')"
- NEWVER="$(use berkdb && db_findver sys-libs/db)"
- local fail=0
- if [ -z "${OLDVER}" -a -z "${NEWVER}" ]; then
- :
- # Nothing wrong here.
- elif [ -z "${OLDVER}" -a -n "${NEWVER}" ]; then
- eerror " Your existing version of OpenLDAP was not built against"
- eerror " any version of sys-libs/db, but the new one will build"
- eerror " against ${NEWVER} and your database may be inaccessible."
- echo
- fail=1
- elif [ -n "${OLDVER}" -a -z "${NEWVER}" ]; then
- eerror " Your existing version of OpenLDAP was built against"
- eerror " sys-libs/db:${OLDVER}, but the new one will not be"
- eerror " built against any version and your database may be"
- eerror " inaccessible."
- echo
- fail=1
- elif [ "${OLDVER}" != "${NEWVER}" ]; then
- eerror " Your existing version of OpenLDAP was built against"
- eerror " sys-libs/db:${OLDVER}, but the new one will build against"
- eerror " ${NEWVER} and your database would be inaccessible."
- echo
- fail=1
- fi
- [ "${fail}" == "1" ] && openldap_upgrade_howto
- fi
-
- echo
- einfo
- einfo "All datadirs are fine, proceeding with merge now..."
- einfo
-}
-
-openldap_upgrade_howto() {
- eerror
- eerror "A (possible old) installation of OpenLDAP was detected,"
- eerror "installation will not proceed for now."
- eerror
- eerror "As major version upgrades can corrupt your database,"
- eerror "you need to dump your database and re-create it afterwards."
- eerror
- eerror "Additionally, rebuilding against different major versions of the"
- eerror "sys-libs/db libraries will cause your database to be inaccessible."
- eerror ""
- d="$(date -u +%s)"
- l="/root/ldapdump.${d}"
- i="${l}.raw"
- eerror " 1. /etc/init.d/slurpd stop ; /etc/init.d/slapd stop"
- eerror " 2. slapcat -l ${i}"
- eerror " 3. egrep -v '^(entry|context)CSN:' <${i} >${l}"
- eerror " 4. mv /var/lib/openldap-data/ /var/lib/openldap-data-backup/"
- eerror " 5. emerge --update \=net-nds/${PF}"
- eerror " 6. etc-update, and ensure that you apply the changes"
- eerror " 7. slapadd -l ${l}"
- eerror " 8. chown ldap:ldap /var/lib/openldap-data/*"
- eerror " 9. /etc/init.d/slapd start"
- eerror "10. check that your data is intact."
- eerror "11. set up the new replication system."
- eerror
- if [ "${FORCE_UPGRADE}" != "1" ]; then
- die "You need to upgrade your database first"
- else
- eerror "You have the magical FORCE_UPGRADE=1 in place."
- eerror "Don't say you weren't warned about data loss."
- fi
-}
-
-pkg_setup() {
- if ! use sasl && use cxx ; then
- die "To build the ldapc++ library you must emerge openldap with sasl support"
- fi
- # Bug #322787
- if use minimal && ! has_version "net-nds/openldap" ; then
- einfo "No datadir scan needed, openldap not installed"
- elif use minimal && has_version "net-nds/openldap" && built_with_use net-nds/openldap minimal ; then
- einfo "Skipping scan for previous datadirs as requested by minimal useflag"
- else
- openldap_find_versiontags
- fi
-
- # The user/group are only used for running daemons which are
- # disabled in minimal builds, so elide the accounts too.
- if ! use minimal ; then
- enewgroup ldap 439
- enewuser ldap 439 -1 /usr/$(get_libdir)/openldap ldap
- fi
-}
-
-src_prepare() {
- # ensure correct SLAPI path by default
- sed -i -e 's,\(#define LDAPI_SOCK\).*,\1 "'"${EPREFIX}"'/var/run/openldap/slapd.sock",' \
- "${S}"/include/ldap_defaults.h
-
- epatch "${FILESDIR}"/${PN}-2.4.17-gcc44.patch
-
- epatch \
- "${FILESDIR}"/${PN}-2.2.14-perlthreadsfix.patch \
- "${FILESDIR}"/${PN}-2.4.15-ppolicy.patch
-
- # bug #116045 - still present in 2.4.28
- epatch "${FILESDIR}"/${PN}-2.4.35-contrib-smbk5pwd.patch
- # bug #408077 - samba4
- epatch "${FILESDIR}"/${PN}-2.4.35-contrib-samba4.patch
-
- # bug #189817
- epatch "${FILESDIR}"/${PN}-2.4.11-libldap_r.patch
-
- # bug #233633
- epatch "${FILESDIR}"/${PN}-2.4.17-fix-lmpasswd-gnutls-symbols.patch
-
- # bug #281495
- epatch "${FILESDIR}"/${PN}-2.4.28-gnutls-gcrypt.patch
-
- # bug #294350
- epatch "${FILESDIR}"/${PN}-2.4.6-evolution-ntlm.patch
-
- # unbreak /bin/sh -> dash
- epatch "${FILESDIR}"/${PN}-2.4.28-fix-dash.patch
-
- # bug #420959
- epatch "${FILESDIR}"/${PN}-2.4.31-gcc47.patch
-
- # bug #421463
- epatch "${FILESDIR}"/${PN}-2.4.33-gnutls.patch
-
- cd "${S}"/build || die
- einfo "Making sure upstream build strip does not do stripping too early"
- sed -i.orig \
- -e '/^STRIP/s,-s,,g' \
- top.mk || die "Failed to block stripping"
-
- # wrong assumption that /bin/sh is /bin/bash
- sed -i \
- -e 's|/bin/sh|/bin/bash|g' \
- "${S}"/tests/scripts/* || die "sed failed"
-
- cd "${S}" || die
- AT_NOEAUTOMAKE=yes eautoreconf
-}
-
-build_contrib_module() {
- # <dir> <sources> <outputname>
- cd "${S}/contrib/slapd-modules/$1" || die
- einfo "Compiling contrib-module: $3"
- # Make sure it's uppercase
- local define_name="$(echo "SLAPD_OVER_${1}" | LC_ALL=C tr '[:lower:]' '[:upper:]')"
- "${lt}" --mode=compile --tag=CC \
- "${CC}" \
- -D${define_name}=SLAPD_MOD_DYNAMIC \
- -I"${BUILD_DIR}"/include \
- -I../../../include -I../../../servers/slapd ${CFLAGS} \
- -o ${2%.c}.lo -c $2 || die "compiling $3 failed"
- einfo "Linking contrib-module: $3"
- "${lt}" --mode=link --tag=CC \
- "${CC}" -module \
- ${CFLAGS} \
- ${LDFLAGS} \
- -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
- -o $3.la ${2%.c}.lo || die "linking $3 failed"
-}
-
-src_configure() {
- #Fix for glibc-2.8 and ucred. Bug 228457.
- append-flags -D_GNU_SOURCE
-
- # Bug 408001
- use elibc_FreeBSD && append-cppflags -DMDB_DSYNC=O_SYNC -DMDB_FDATASYNC=fsync
-
- # connectionless ldap per bug #342439
- append-cppflags -DLDAP_CONNECTIONLESS
-
- multilib-minimal_src_configure
-}
-
-multilib_src_configure() {
- local myconf=()
-
- use debug && myconf+=( $(use_enable debug) )
-
- # ICU usage is not configurable
- export ac_cv_header_unicode_utypes_h="$(multilib_is_native_abi && use icu && echo yes || echo no)"
-
- if ! use minimal && multilib_is_native_abi; then
- local CPPFLAGS=${CPPFLAGS}
-
- # re-enable serverside overlay chains per bug #296567
- # see ldap docs chaper 12.3.1 for details
- myconf+=( --enable-ldap )
-
- # backends
- myconf+=( --enable-slapd )
- if use berkdb ; then
- einfo "Using Berkeley DB for local backend"
- myconf+=( --enable-bdb --enable-hdb )
- # We need to include the slotted db.h dir for FreeBSD
- append-cppflags -I$(db_includedir)
- else
- ewarn
- ewarn "Note: if you disable berkdb, you can only use remote-backends!"
- ewarn
- myconf+=( --disable-bdb --disable-hdb )
- fi
- for backend in dnssrv ldap meta monitor null passwd relay shell sock; do
- myconf+=( --enable-${backend}=mod )
- done
-
- myconf+=( $(use_enable perl perl mod) )
-
- myconf+=( $(use_enable odbc sql mod) )
- if use odbc ; then
- local odbc_lib="unixodbc"
- if use iodbc ; then
- odbc_lib="iodbc"
- append-cppflags -I"${EPREFIX}"/usr/include/iodbc
- fi
- myconf+=( --with-odbc=${odbc_lib} )
- fi
-
- # slapd options
- myconf+=(
- $(use_enable crypt)
- $(use_enable slp)
- $(use_enable samba lmpasswd)
- $(use_enable syslog)
- )
- if use experimental ; then
- myconf+=(
- --enable-dynacl
- --enable-aci=mod
- )
- fi
- for option in aci cleartext modules rewrite rlookups slapi; do
- myconf+=( --enable-${option} )
- done
-
- # slapd overlay options
- # Compile-in the syncprov, the others as module
- myconf+=( --enable-syncprov=yes )
- use overlays && myconf+=( --enable-overlays=mod )
-
- else
- myconf+=(
- --disable-slapd
- --disable-bdb
- --disable-hdb
- --disable-overlays
- --disable-syslog
- )
- fi
-
- # basic functionality stuff
- myconf+=(
- $(use_enable ipv6)
- $(multilib_native_use_with sasl cyrus-sasl)
- $(multilib_native_use_enable sasl spasswd)
- $(use_enable tcpd wrappers)
- )
-
- # Some cross-compiling tests don't pan out well.
- tc-is-cross-compiler && myconf+=(
- --with-yielding-select=yes
- )
-
- local ssl_lib="no"
- if use ssl || ( ! use minimal && use samba ) ; then
- ssl_lib="openssl"
- use gnutls && ssl_lib="gnutls"
- fi
-
- myconf+=( --with-tls=${ssl_lib} )
-
- for basicflag in dynamic local proctitle shared static; do
- myconf+=( --enable-${basicflag} )
- done
-
- tc-export AR CC CXX
- ECONF_SOURCE=${S} \
- STRIP=/bin/true \
- econf \
- --libexecdir="${EPREFIX}"/usr/$(get_libdir)/openldap \
- "${myconf[@]}"
- emake depend
-}
-
-src_configure_cxx() {
- # This needs the libraries built by the first build run.
- # So we have to run it AFTER the main build, not just after the main
- # configure.
- local myconf_ldapcpp=(
- --with-ldap-includes="${S}"/include
- )
-
- mkdir -p "${BUILD_DIR}"/contrib/ldapc++ || die
- cd "${BUILD_DIR}/contrib/ldapc++" || die
-
- local LDFLAGS=${LDFLAGS} CPPFLAGS=${CPPFLAGS}
- append-ldflags -L"${BUILD_DIR}"/libraries/liblber/.libs \
- -L"${BUILD_DIR}"/libraries/libldap/.libs
- append-cppflags -I"${BUILD_DIR}"/include
- ECONF_SOURCE=${S}/contrib/ldapc++ \
- econf "${myconf_ldapcpp[@]}" \
- CC="${CC}" \
- CXX="${CXX}"
-}
-
-multilib_src_compile() {
- tc-export AR CC CXX
- emake CC="${CC}" AR="${AR}" SHELL="${EPREFIX}"/bin/bash
- local lt="${BUILD_DIR}/libtool"
- export echo="echo"
-
- if ! use minimal && multilib_is_native_abi ; then
- if use cxx ; then
- einfo "Building contrib library: ldapc++"
- src_configure_cxx
- cd "${BUILD_DIR}/contrib/ldapc++" || die
- emake \
- CC="${CC}" CXX="${CXX}"
- fi
-
- if use smbkrb5passwd ; then
- einfo "Building contrib-module: smbk5pwd"
- cd "${S}/contrib/slapd-modules/smbk5pwd" || die
-
- emake \
- DEFS="-DDO_SAMBA -DDO_KRB5 -DDO_SHADOW" \
- KRB5_INC="$(krb5-config --cflags)" \
- LDAP_BUILD="${BUILD_DIR}" \
- CC="${CC}" libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap"
- fi
-
- if use overlays ; then
- einfo "Building contrib-module: samba4"
- cd "${S}/contrib/slapd-modules/samba4" || die
-
- emake \
- LDAP_BUILD="${BUILD_DIR}" \
- CC="${CC}" libexecdir="/usr/$(get_libdir)/openldap"
- fi
-
- if use kerberos ; then
- cd "${S}/contrib/slapd-modules/passwd" || die
- einfo "Compiling contrib-module: pw-kerberos"
- "${lt}" --mode=compile --tag=CC \
- "${CC}" \
- -I"${BUILD_DIR}"/include \
- -I../../../include \
- ${CFLAGS} \
- $(krb5-config --cflags) \
- -DHAVE_KRB5 \
- -o kerberos.lo \
- -c kerberos.c || die "compiling pw-kerberos failed"
- einfo "Linking contrib-module: pw-kerberos"
- "${lt}" --mode=link --tag=CC \
- "${CC}" -module \
- ${CFLAGS} \
- ${LDFLAGS} \
- -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
- -o pw-kerberos.la \
- kerberos.lo || die "linking pw-kerberos failed"
- fi
- # We could build pw-radius if GNURadius would install radlib.h
- cd "${S}/contrib/slapd-modules/passwd" || die
- einfo "Compiling contrib-module: pw-netscape"
- "${lt}" --mode=compile --tag=CC \
- "${CC}" \
- -I"${BUILD_DIR}"/include \
- -I../../../include \
- ${CFLAGS} \
- -o netscape.lo \
- -c netscape.c || die "compiling pw-netscape failed"
- einfo "Linking contrib-module: pw-netscape"
- "${lt}" --mode=link --tag=CC \
- "${CC}" -module \
- ${CFLAGS} \
- ${LDFLAGS} \
- -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
- -o pw-netscape.la \
- netscape.lo || die "linking pw-netscape failed"
-
- build_contrib_module "addpartial" "addpartial-overlay.c" "addpartial-overlay"
- build_contrib_module "allop" "allop.c" "overlay-allop"
- build_contrib_module "allowed" "allowed.c" "allowed"
- build_contrib_module "autogroup" "autogroup.c" "autogroup"
- build_contrib_module "denyop" "denyop.c" "denyop-overlay"
- build_contrib_module "dsaschema" "dsaschema.c" "dsaschema-plugin"
- # lastmod may not play well with other overlays
- build_contrib_module "lastmod" "lastmod.c" "lastmod"
- build_contrib_module "nops" "nops.c" "nops-overlay"
- build_contrib_module "trace" "trace.c" "trace"
- # build slapi-plugins
- cd "${S}/contrib/slapi-plugins/addrdnvalues" || die
- einfo "Building contrib-module: addrdnvalues plugin"
- "${CC}" -shared \
- -I"${BUILD_DIR}"/include \
- -I../../../include \
- ${CFLAGS} \
- -fPIC \
- ${LDFLAGS} \
- -o libaddrdnvalues-plugin.so \
- addrdnvalues.c || die "Building libaddrdnvalues-plugin.so failed"
-
- fi
-}
-
-multilib_src_test() {
- if multilib_is_native_abi; then
- cd tests || die
- make tests || die "make tests failed"
- fi
-}
-
-multilib_src_install() {
- local lt="${BUILD_DIR}/libtool"
- emake DESTDIR="${D}" SHELL="${EPREFIX}"/bin/bash install
-
- if ! use minimal && multilib_is_native_abi; then
- # openldap modules go here
- # TODO: write some code to populate slapd.conf with moduleload statements
- keepdir /usr/$(get_libdir)/openldap/openldap/
-
- # initial data storage dir
- keepdir /var/lib/openldap-data
- use prefix || fowners ldap:ldap /var/lib/openldap-data
- fperms 0700 /var/lib/openldap-data
-
- echo "OLDPF='${PF}'" > "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
- echo "# do NOT delete this. it is used" >> "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
- echo "# to track versions for upgrading." >> "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
-
- # use our config
- rm "${ED}"etc/openldap/slapd.conf
- insinto /etc/openldap
- newins "${FILESDIR}"/${PN}-2.3.34-slapd-conf slapd.conf
- configfile="${ED}"etc/openldap/slapd.conf
-
- # populate with built backends
- ebegin "populate config with built backends"
- for x in "${ED}"usr/$(get_libdir)/openldap/openldap/back_*.so; do
- elog "Adding $(basename ${x})"
- sed -e "/###INSERTDYNAMICMODULESHERE###$/a# moduleload\t$(basename ${x})" -i "${configfile}"
- done
- sed -e "s:###INSERTDYNAMICMODULESHERE###$:# modulepath\t${EPREFIX}/usr/$(get_libdir)/openldap/openldap:" -i "${configfile}"
- use prefix || fowners root:ldap /etc/openldap/slapd.conf
- fperms 0640 /etc/openldap/slapd.conf
- cp "${configfile}" "${configfile}".default
- eend
-
- # install our own init scripts and systemd unit files
- newinitd "${FILESDIR}"/slapd-initd-2.4.28-r1 slapd
- newconfd "${FILESDIR}"/slapd-confd-2.4.28-r1 slapd
- systemd_dounit "${FILESDIR}"/slapd.service
- systemd_install_serviced "${FILESDIR}"/slapd.service.conf
- systemd_newtmpfilesd "${FILESDIR}"/slapd.tmpfilesd slapd.conf
-
- if [[ $(get_libdir) != lib ]]; then
- sed -e "s,/usr/lib/,/usr/$(get_libdir)/," -i \
- "${ED}"/etc/init.d/slapd \
- "${ED}"/usr/lib/systemd/system/slapd.service || die
- fi
- # If built without SLP, we don't need to be before avahi
- use slp \
- || sed -i \
- -e '/before/{s/avahi-daemon//g}' \
- "${ED}"etc/init.d/slapd
-
- if use cxx ; then
- einfo "Install the ldapc++ library"
- cd "${BUILD_DIR}/contrib/ldapc++" || die
- emake DESTDIR="${D}" libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" install
- cd "${S}"/contrib/ldapc++ || die
- newdoc README ldapc++-README
- fi
-
- if use smbkrb5passwd ; then
- einfo "Install the smbk5pwd module"
- cd "${S}/contrib/slapd-modules/smbk5pwd" || die
- emake DESTDIR="${D}" \
- LDAP_BUILD="${BUILD_DIR}" \
- libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" install
- newdoc README smbk5pwd-README
- fi
-
- if use overlays ; then
- einfo "Install the samba4 module"
- cd "${S}/contrib/slapd-modules/samba4" || die
- emake DESTDIR="${D}" \
- LDAP_BUILD="${BUILD_DIR}" \
- libexecdir="/usr/$(get_libdir)/openldap" install
- newdoc README samba4-README
- fi
-
- einfo "Installing contrib modules"
- cd "${S}/contrib/slapd-modules" || die
- for l in */*.la; do
- "${lt}" --mode=install cp ${l} \
- "${ED}"usr/$(get_libdir)/openldap/openldap || \
- die "installing ${l} failed"
- done
-
- docinto contrib
- newdoc addpartial/README addpartial-README
- newdoc allop/README allop-README
- doman allop/slapo-allop.5
- newdoc autogroup/README autogroup-README
- newdoc denyop/denyop.c denyop-denyop.c
- newdoc dsaschema/README dsaschema-README
- doman lastmod/slapo-lastmod.5
- doman nops/slapo-nops.5
- newdoc passwd/README passwd-README
- cd "${S}/contrib/slapi-plugins" || die
- insinto /usr/$(get_libdir)/openldap/openldap
- doins */*.so
- docinto contrib
- newdoc addrdnvalues/README addrdnvalues-README
-
- insinto /etc/openldap/schema
- newins "${DISTDIR}"/${BIS_P} ${BIS_PN}
- fi
-}
-
-multilib_src_install_all() {
- dodoc ANNOUNCEMENT CHANGES COPYRIGHT README "${FILESDIR}"/DB_CONFIG.fast.example
- docinto rfc ; dodoc doc/rfc/*.txt
-}
-
-pkg_preinst() {
- # keep old libs if any
- preserve_old_lib /usr/$(get_libdir)/{liblber,libldap_r,liblber}-2.3$(get_libname 0)
-}
-
-pkg_postinst() {
- if ! use minimal ; then
- # You cannot build SSL certificates during src_install that will make
- # binary packages containing your SSL key, which is both a security risk
- # and a misconfiguration if multiple machines use the same key and cert.
- if use ssl; then
- install_cert /etc/openldap/ssl/ldap
- use prefix || chown ldap:ldap "${EROOT}"etc/openldap/ssl/ldap.*
- ewarn "Self-signed SSL certificates are treated harshly by OpenLDAP 2.[12]"
- ewarn "Self-signed SSL certificates are treated harshly by OpenLDAP 2.[12]"
- ewarn "add 'TLS_REQCERT never' if you want to use them."
- fi
-
- if use prefix; then
- # Warn about prefix issues with slapd
- eerror "slapd might NOT be usable on Prefix systems as it requires root privileges"
- eerror "to start up, and requires that certain files directories be owned by"
- eerror "ldap:ldap. As Prefix does not support changing ownership of files and"
- eerror "directories, you will have to manually fix this yourself."
- fi
-
- # These lines force the permissions of various content to be correct
- use prefix || chown ldap:ldap "${EROOT}"var/run/openldap
- chmod 0755 "${EROOT}"var/run/openldap
- use prefix || chown root:ldap "${EROOT}"etc/openldap/slapd.conf{,.default}
- chmod 0640 "${EROOT}"etc/openldap/slapd.conf{,.default}
- use prefix || chown ldap:ldap "${EROOT}"var/lib/openldap-data
- fi
-
- elog "Getting started using OpenLDAP? There is some documentation available:"
- elog "Gentoo Guide to OpenLDAP Authentication"
- elog "(https://www.gentoo.org/doc/en/ldap-howto.xml)"
- elog "---"
- elog "An example file for tuning BDB backends with openldap is"
- elog "DB_CONFIG.fast.example in /usr/share/doc/${PF}/"
-
- preserve_old_lib_notify /usr/$(get_libdir)/{liblber,libldap,libldap_r}-2.3$(get_libname 0)
-}
diff --git a/net-nds/openldap/openldap-2.4.39.ebuild b/net-nds/openldap/openldap-2.4.39.ebuild
deleted file mode 100644
index 838683003696..000000000000
--- a/net-nds/openldap/openldap-2.4.39.ebuild
+++ /dev/null
@@ -1,760 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI="5"
-
-inherit db-use eutils flag-o-matic multilib multilib-minimal ssl-cert versionator toolchain-funcs autotools user systemd
-
-BIS_PN=rfc2307bis.schema
-BIS_PV=20140524
-BIS_P="${BIS_PN}-${BIS_PV}"
-
-DESCRIPTION="LDAP suite of application and development tools"
-HOMEPAGE="http://www.OpenLDAP.org/"
-
-# mirrors are mostly not working, using canonical URI
-SRC_URI="ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/${P}.tgz
- mirror://gentoo/${BIS_P}"
-
-LICENSE="OPENLDAP GPL-2"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~x86-solaris"
-
-IUSE_DAEMON="crypt icu samba slp tcpd experimental minimal"
-IUSE_BACKEND="+berkdb"
-IUSE_OVERLAY="overlays perl"
-IUSE_OPTIONAL="gnutls iodbc sasl ssl odbc debug ipv6 +syslog selinux"
-IUSE_CONTRIB="smbkrb5passwd kerberos"
-IUSE_CONTRIB="${IUSE_CONTRIB} -cxx"
-IUSE="${IUSE_DAEMON} ${IUSE_BACKEND} ${IUSE_OVERLAY} ${IUSE_OPTIONAL} ${IUSE_CONTRIB}"
-
-REQUIRED_USE="cxx? ( sasl )"
-
-# openssl is needed to generate lanman-passwords required by samba
-CDEPEND="icu? ( dev-libs/icu:= )
- ssl? ( !gnutls? ( >=dev-libs/openssl-1.0.1h-r2[${MULTILIB_USEDEP}] )
- gnutls? ( >=net-libs/gnutls-2.12.23-r6[${MULTILIB_USEDEP}] >=dev-libs/libgcrypt-1.5.3:0[${MULTILIB_USEDEP}] ) )
- sasl? ( dev-libs/cyrus-sasl:= )
- !minimal? (
- sys-devel/libtool
- tcpd? ( sys-apps/tcp-wrappers )
- odbc? ( !iodbc? ( dev-db/unixODBC )
- iodbc? ( dev-db/libiodbc ) )
- slp? ( net-libs/openslp )
- perl? ( dev-lang/perl:=[-build(-)] )
- samba? ( dev-libs/openssl )
- berkdb? ( sys-libs/db )
- smbkrb5passwd? (
- dev-libs/openssl
- app-crypt/heimdal )
- kerberos? ( virtual/krb5 )
- cxx? ( dev-libs/cyrus-sasl:= )
- )
- abi_x86_32? (
- !<=app-emulation/emul-linux-x86-baselibs-20140508-r3
- !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
- )"
-DEPEND="${CDEPEND}
- sys-apps/groff"
-RDEPEND="${CDEPEND}
- selinux? ( sec-policy/selinux-ldap )
-"
-# for tracking versions
-OPENLDAP_VERSIONTAG=".version-tag"
-OPENLDAP_DEFAULTDIR_VERSIONTAG="/var/lib/openldap-data"
-
-MULTILIB_WRAPPED_HEADERS=(
- # USE=cxx
- /usr/include/LDAPAsynConnection.h
- /usr/include/LDAPAttrType.h
- /usr/include/LDAPAttribute.h
- /usr/include/LDAPAttributeList.h
- /usr/include/LDAPConnection.h
- /usr/include/LDAPConstraints.h
- /usr/include/LDAPControl.h
- /usr/include/LDAPControlSet.h
- /usr/include/LDAPEntry.h
- /usr/include/LDAPEntryList.h
- /usr/include/LDAPException.h
- /usr/include/LDAPExtResult.h
- /usr/include/LDAPMessage.h
- /usr/include/LDAPMessageQueue.h
- /usr/include/LDAPModList.h
- /usr/include/LDAPModification.h
- /usr/include/LDAPObjClass.h
- /usr/include/LDAPRebind.h
- /usr/include/LDAPRebindAuth.h
- /usr/include/LDAPReferenceList.h
- /usr/include/LDAPResult.h
- /usr/include/LDAPSaslBindResult.h
- /usr/include/LDAPSchema.h
- /usr/include/LDAPSearchReference.h
- /usr/include/LDAPSearchResult.h
- /usr/include/LDAPSearchResults.h
- /usr/include/LDAPUrl.h
- /usr/include/LDAPUrlList.h
- /usr/include/LdifReader.h
- /usr/include/LdifWriter.h
- /usr/include/SaslInteraction.h
- /usr/include/SaslInteractionHandler.h
- /usr/include/StringList.h
- /usr/include/TlsOptions.h
-)
-
-openldap_filecount() {
- local dir="$1"
- find "${dir}" -type f ! -name '.*' ! -name 'DB_CONFIG*' | wc -l
-}
-
-openldap_find_versiontags() {
- # scan for all datadirs
- openldap_datadirs=""
- if [ -f "${EROOT}"/etc/openldap/slapd.conf ]; then
- openldap_datadirs="$(awk '{if($1 == "directory") print $2 }' ${EROOT}/etc/openldap/slapd.conf)"
- fi
- openldap_datadirs="${openldap_datadirs} ${OPENLDAP_DEFAULTDIR_VERSIONTAG}"
-
- einfo
- einfo "Scanning datadir(s) from slapd.conf and"
- einfo "the default installdir for Versiontags"
- einfo "(${OPENLDAP_DEFAULTDIR_VERSIONTAG} may appear twice)"
- einfo
-
- # scan datadirs if we have a version tag
- openldap_found_tag=0
- have_files=0
- for each in ${openldap_datadirs}; do
- CURRENT_TAGDIR=${ROOT}`echo ${each} | sed "s:\/::"`
- CURRENT_TAG=${CURRENT_TAGDIR}/${OPENLDAP_VERSIONTAG}
- if [ -d ${CURRENT_TAGDIR} ] && [ ${openldap_found_tag} == 0 ] ; then
- einfo "- Checking ${each}..."
- if [ -r ${CURRENT_TAG} ] ; then
- # yey, we have one :)
- einfo " Found Versiontag in ${each}"
- source ${CURRENT_TAG}
- if [ "${OLDPF}" == "" ] ; then
- eerror "Invalid Versiontag found in ${CURRENT_TAGDIR}"
- eerror "Please delete it"
- eerror
- die "Please kill the invalid versiontag in ${CURRENT_TAGDIR}"
- fi
-
- OLD_MAJOR=`get_version_component_range 2-3 ${OLDPF}`
-
- [ $(openldap_filecount ${CURRENT_TAGDIR}) -gt 0 ] && have_files=1
-
- # are we on the same branch?
- if [ "${OLD_MAJOR}" != "${PV:0:3}" ] ; then
- ewarn " Versiontag doesn't match current major release!"
- if [[ "${have_files}" == "1" ]] ; then
- eerror " Versiontag says other major and you (probably) have datafiles!"
- echo
- openldap_upgrade_howto
- else
- einfo " No real problem, seems there's no database."
- fi
- else
- einfo " Versiontag is fine here :)"
- fi
- else
- einfo " Non-tagged dir ${each}"
- [ $(openldap_filecount ${each}) -gt 0 ] && have_files=1
- if [[ "${have_files}" == "1" ]] ; then
- einfo " EEK! Non-empty non-tagged datadir, counting `ls -a ${each} | wc -l` files"
- echo
-
- eerror
- eerror "Your OpenLDAP Installation has a non tagged datadir that"
- eerror "possibly contains a database at ${CURRENT_TAGDIR}"
- eerror
- eerror "Please export data if any entered and empty or remove"
- eerror "the directory, installation has been stopped so you"
- eerror "can take required action"
- eerror
- eerror "For a HOWTO on exporting the data, see instructions in the ebuild"
- eerror
- openldap_upgrade_howto
- die "Please move the datadir ${CURRENT_TAGDIR} away"
- fi
- fi
- einfo
- fi
- done
- [ "${have_files}" == "1" ] && einfo "DB files present" || einfo "No DB files present"
-
- # Now we must check for the major version of sys-libs/db linked against.
- SLAPD_PATH=${EROOT}/usr/$(get_libdir)/openldap/slapd
- if [ "${have_files}" == "1" -a -f "${SLAPD_PATH}" ]; then
- OLDVER="$(/usr/bin/ldd ${SLAPD_PATH} \
- | awk '/libdb-/{gsub("^libdb-","",$1);gsub(".so$","",$1);print $1}')"
- NEWVER="$(use berkdb && db_findver sys-libs/db)"
- local fail=0
- if [ -z "${OLDVER}" -a -z "${NEWVER}" ]; then
- :
- # Nothing wrong here.
- elif [ -z "${OLDVER}" -a -n "${NEWVER}" ]; then
- eerror " Your existing version of OpenLDAP was not built against"
- eerror " any version of sys-libs/db, but the new one will build"
- eerror " against ${NEWVER} and your database may be inaccessible."
- echo
- fail=1
- elif [ -n "${OLDVER}" -a -z "${NEWVER}" ]; then
- eerror " Your existing version of OpenLDAP was built against"
- eerror " sys-libs/db:${OLDVER}, but the new one will not be"
- eerror " built against any version and your database may be"
- eerror " inaccessible."
- echo
- fail=1
- elif [ "${OLDVER}" != "${NEWVER}" ]; then
- eerror " Your existing version of OpenLDAP was built against"
- eerror " sys-libs/db:${OLDVER}, but the new one will build against"
- eerror " ${NEWVER} and your database would be inaccessible."
- echo
- fail=1
- fi
- [ "${fail}" == "1" ] && openldap_upgrade_howto
- fi
-
- echo
- einfo
- einfo "All datadirs are fine, proceeding with merge now..."
- einfo
-}
-
-openldap_upgrade_howto() {
- eerror
- eerror "A (possible old) installation of OpenLDAP was detected,"
- eerror "installation will not proceed for now."
- eerror
- eerror "As major version upgrades can corrupt your database,"
- eerror "you need to dump your database and re-create it afterwards."
- eerror
- eerror "Additionally, rebuilding against different major versions of the"
- eerror "sys-libs/db libraries will cause your database to be inaccessible."
- eerror ""
- d="$(date -u +%s)"
- l="/root/ldapdump.${d}"
- i="${l}.raw"
- eerror " 1. /etc/init.d/slurpd stop ; /etc/init.d/slapd stop"
- eerror " 2. slapcat -l ${i}"
- eerror " 3. egrep -v '^(entry|context)CSN:' <${i} >${l}"
- eerror " 4. mv /var/lib/openldap-data/ /var/lib/openldap-data-backup/"
- eerror " 5. emerge --update \=net-nds/${PF}"
- eerror " 6. etc-update, and ensure that you apply the changes"
- eerror " 7. slapadd -l ${l}"
- eerror " 8. chown ldap:ldap /var/lib/openldap-data/*"
- eerror " 9. /etc/init.d/slapd start"
- eerror "10. check that your data is intact."
- eerror "11. set up the new replication system."
- eerror
- if [ "${FORCE_UPGRADE}" != "1" ]; then
- die "You need to upgrade your database first"
- else
- eerror "You have the magical FORCE_UPGRADE=1 in place."
- eerror "Don't say you weren't warned about data loss."
- fi
-}
-
-pkg_setup() {
- if ! use sasl && use cxx ; then
- die "To build the ldapc++ library you must emerge openldap with sasl support"
- fi
- # Bug #322787
- if use minimal && ! has_version "net-nds/openldap" ; then
- einfo "No datadir scan needed, openldap not installed"
- elif use minimal && has_version "net-nds/openldap" && built_with_use net-nds/openldap minimal ; then
- einfo "Skipping scan for previous datadirs as requested by minimal useflag"
- else
- openldap_find_versiontags
- fi
-
- # The user/group are only used for running daemons which are
- # disabled in minimal builds, so elide the accounts too.
- if ! use minimal ; then
- enewgroup ldap 439
- enewuser ldap 439 -1 /usr/$(get_libdir)/openldap ldap
- fi
-}
-
-src_prepare() {
- # ensure correct SLAPI path by default
- sed -i -e 's,\(#define LDAPI_SOCK\).*,\1 "'"${EPREFIX}"'/var/run/openldap/slapd.sock",' \
- "${S}"/include/ldap_defaults.h
-
- epatch "${FILESDIR}"/${PN}-2.4.17-gcc44.patch
-
- epatch \
- "${FILESDIR}"/${PN}-2.2.14-perlthreadsfix.patch \
- "${FILESDIR}"/${PN}-2.4.15-ppolicy.patch
-
- # bug #116045 - still present in 2.4.28
- epatch "${FILESDIR}"/${PN}-2.4.35-contrib-smbk5pwd.patch
- # bug #408077 - samba4
- epatch "${FILESDIR}"/${PN}-2.4.35-contrib-samba4.patch
-
- # bug #189817
- epatch "${FILESDIR}"/${PN}-2.4.11-libldap_r.patch
-
- # bug #233633
- epatch "${FILESDIR}"/${PN}-2.4.17-fix-lmpasswd-gnutls-symbols.patch
-
- # bug #281495
- epatch "${FILESDIR}"/${PN}-2.4.28-gnutls-gcrypt.patch
-
- # bug #294350
- epatch "${FILESDIR}"/${PN}-2.4.6-evolution-ntlm.patch
-
- # unbreak /bin/sh -> dash
- epatch "${FILESDIR}"/${PN}-2.4.28-fix-dash.patch
-
- # bug #420959
- epatch "${FILESDIR}"/${PN}-2.4.31-gcc47.patch
-
- # bug #421463
- epatch "${FILESDIR}"/${PN}-2.4.33-gnutls.patch
-
- cd "${S}"/build || die
- einfo "Making sure upstream build strip does not do stripping too early"
- sed -i.orig \
- -e '/^STRIP/s,-s,,g' \
- top.mk || die "Failed to block stripping"
-
- # wrong assumption that /bin/sh is /bin/bash
- sed -i \
- -e 's|/bin/sh|/bin/bash|g' \
- "${S}"/tests/scripts/* || die "sed failed"
-
- cd "${S}" || die
- AT_NOEAUTOMAKE=yes eautoreconf
-}
-
-build_contrib_module() {
- # <dir> <sources> <outputname>
- cd "${S}/contrib/slapd-modules/$1" || die
- einfo "Compiling contrib-module: $3"
- # Make sure it's uppercase
- local define_name="$(echo "SLAPD_OVER_${1}" | LC_ALL=C tr '[:lower:]' '[:upper:]')"
- "${lt}" --mode=compile --tag=CC \
- "${CC}" \
- -D${define_name}=SLAPD_MOD_DYNAMIC \
- -I"${BUILD_DIR}"/include \
- -I../../../include -I../../../servers/slapd ${CFLAGS} \
- -o ${2%.c}.lo -c $2 || die "compiling $3 failed"
- einfo "Linking contrib-module: $3"
- "${lt}" --mode=link --tag=CC \
- "${CC}" -module \
- ${CFLAGS} \
- ${LDFLAGS} \
- -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
- -o $3.la ${2%.c}.lo || die "linking $3 failed"
-}
-
-src_configure() {
- #Fix for glibc-2.8 and ucred. Bug 228457.
- append-flags -D_GNU_SOURCE
-
- # Bug 408001
- use elibc_FreeBSD && append-cppflags -DMDB_DSYNC=O_SYNC -DMDB_FDATASYNC=fsync
-
- # connectionless ldap per bug #342439
- append-cppflags -DLDAP_CONNECTIONLESS
-
- multilib-minimal_src_configure
-}
-
-multilib_src_configure() {
- local myconf=()
-
- use debug && myconf+=( $(use_enable debug) )
-
- # ICU usage is not configurable
- export ac_cv_header_unicode_utypes_h="$(multilib_is_native_abi && use icu && echo yes || echo no)"
-
- if ! use minimal && multilib_is_native_abi; then
- local CPPFLAGS=${CPPFLAGS}
-
- # re-enable serverside overlay chains per bug #296567
- # see ldap docs chaper 12.3.1 for details
- myconf+=( --enable-ldap )
-
- # backends
- myconf+=( --enable-slapd )
- if use berkdb ; then
- einfo "Using Berkeley DB for local backend"
- myconf+=( --enable-bdb --enable-hdb )
- # We need to include the slotted db.h dir for FreeBSD
- append-cppflags -I$(db_includedir)
- else
- ewarn
- ewarn "Note: if you disable berkdb, you can only use remote-backends!"
- ewarn
- myconf+=( --disable-bdb --disable-hdb )
- fi
- for backend in dnssrv ldap meta monitor null passwd relay shell sock; do
- myconf+=( --enable-${backend}=mod )
- done
-
- myconf+=( $(use_enable perl perl mod) )
-
- myconf+=( $(use_enable odbc sql mod) )
- if use odbc ; then
- local odbc_lib="unixodbc"
- if use iodbc ; then
- odbc_lib="iodbc"
- append-cppflags -I"${EPREFIX}"/usr/include/iodbc
- fi
- myconf+=( --with-odbc=${odbc_lib} )
- fi
-
- # slapd options
- myconf+=(
- $(use_enable crypt)
- $(use_enable slp)
- $(use_enable samba lmpasswd)
- $(use_enable syslog)
- )
- if use experimental ; then
- myconf+=(
- --enable-dynacl
- --enable-aci=mod
- )
- fi
- for option in aci cleartext modules rewrite rlookups slapi; do
- myconf+=( --enable-${option} )
- done
-
- # slapd overlay options
- # Compile-in the syncprov, the others as module
- myconf+=( --enable-syncprov=yes )
- use overlays && myconf+=( --enable-overlays=mod )
-
- else
- myconf+=(
- --disable-slapd
- --disable-bdb
- --disable-hdb
- --disable-overlays
- --disable-syslog
- )
- fi
-
- # basic functionality stuff
- myconf+=(
- $(use_enable ipv6)
- $(multilib_native_use_with sasl cyrus-sasl)
- $(multilib_native_use_enable sasl spasswd)
- $(use_enable tcpd wrappers)
- )
-
- # Some cross-compiling tests don't pan out well.
- tc-is-cross-compiler && myconf+=(
- --with-yielding-select=yes
- )
-
- local ssl_lib="no"
- if use ssl || ( ! use minimal && use samba ) ; then
- ssl_lib="openssl"
- use gnutls && ssl_lib="gnutls"
- fi
-
- myconf+=( --with-tls=${ssl_lib} )
-
- for basicflag in dynamic local proctitle shared static; do
- myconf+=( --enable-${basicflag} )
- done
-
- tc-export AR CC CXX
- ECONF_SOURCE=${S} \
- STRIP=/bin/true \
- econf \
- --libexecdir="${EPREFIX}"/usr/$(get_libdir)/openldap \
- "${myconf[@]}"
- emake depend
-}
-
-src_configure_cxx() {
- # This needs the libraries built by the first build run.
- # So we have to run it AFTER the main build, not just after the main
- # configure.
- local myconf_ldapcpp=(
- --with-ldap-includes="${S}"/include
- )
-
- mkdir -p "${BUILD_DIR}"/contrib/ldapc++ || die
- cd "${BUILD_DIR}/contrib/ldapc++" || die
-
- local LDFLAGS=${LDFLAGS} CPPFLAGS=${CPPFLAGS}
- append-ldflags -L"${BUILD_DIR}"/libraries/liblber/.libs \
- -L"${BUILD_DIR}"/libraries/libldap/.libs
- append-cppflags -I"${BUILD_DIR}"/include
- ECONF_SOURCE=${S}/contrib/ldapc++ \
- econf "${myconf_ldapcpp[@]}" \
- CC="${CC}" \
- CXX="${CXX}"
-}
-
-multilib_src_compile() {
- tc-export AR CC CXX
- emake CC="${CC}" AR="${AR}" SHELL="${EPREFIX}"/bin/bash
- local lt="${BUILD_DIR}/libtool"
- export echo="echo"
-
- if ! use minimal && multilib_is_native_abi ; then
- if use cxx ; then
- einfo "Building contrib library: ldapc++"
- src_configure_cxx
- cd "${BUILD_DIR}/contrib/ldapc++" || die
- emake \
- CC="${CC}" CXX="${CXX}"
- fi
-
- if use smbkrb5passwd ; then
- einfo "Building contrib-module: smbk5pwd"
- cd "${S}/contrib/slapd-modules/smbk5pwd" || die
-
- emake \
- DEFS="-DDO_SAMBA -DDO_KRB5 -DDO_SHADOW" \
- KRB5_INC="$(krb5-config --cflags)" \
- LDAP_BUILD="${BUILD_DIR}" \
- CC="${CC}" libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap"
- fi
-
- if use overlays ; then
- einfo "Building contrib-module: samba4"
- cd "${S}/contrib/slapd-modules/samba4" || die
-
- emake \
- LDAP_BUILD="${BUILD_DIR}" \
- CC="${CC}" libexecdir="/usr/$(get_libdir)/openldap"
- fi
-
- if use kerberos ; then
- cd "${S}/contrib/slapd-modules/passwd" || die
- einfo "Compiling contrib-module: pw-kerberos"
- "${lt}" --mode=compile --tag=CC \
- "${CC}" \
- -I"${BUILD_DIR}"/include \
- -I../../../include \
- ${CFLAGS} \
- $(krb5-config --cflags) \
- -DHAVE_KRB5 \
- -o kerberos.lo \
- -c kerberos.c || die "compiling pw-kerberos failed"
- einfo "Linking contrib-module: pw-kerberos"
- "${lt}" --mode=link --tag=CC \
- "${CC}" -module \
- ${CFLAGS} \
- ${LDFLAGS} \
- -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
- -o pw-kerberos.la \
- kerberos.lo || die "linking pw-kerberos failed"
- fi
- # We could build pw-radius if GNURadius would install radlib.h
- cd "${S}/contrib/slapd-modules/passwd" || die
- einfo "Compiling contrib-module: pw-netscape"
- "${lt}" --mode=compile --tag=CC \
- "${CC}" \
- -I"${BUILD_DIR}"/include \
- -I../../../include \
- ${CFLAGS} \
- -o netscape.lo \
- -c netscape.c || die "compiling pw-netscape failed"
- einfo "Linking contrib-module: pw-netscape"
- "${lt}" --mode=link --tag=CC \
- "${CC}" -module \
- ${CFLAGS} \
- ${LDFLAGS} \
- -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
- -o pw-netscape.la \
- netscape.lo || die "linking pw-netscape failed"
-
- build_contrib_module "addpartial" "addpartial-overlay.c" "addpartial-overlay"
- build_contrib_module "allop" "allop.c" "overlay-allop"
- build_contrib_module "allowed" "allowed.c" "allowed"
- build_contrib_module "autogroup" "autogroup.c" "autogroup"
- build_contrib_module "denyop" "denyop.c" "denyop-overlay"
- build_contrib_module "dsaschema" "dsaschema.c" "dsaschema-plugin"
- # lastmod may not play well with other overlays
- build_contrib_module "lastmod" "lastmod.c" "lastmod"
- build_contrib_module "nops" "nops.c" "nops-overlay"
- build_contrib_module "trace" "trace.c" "trace"
- # build slapi-plugins
- cd "${S}/contrib/slapi-plugins/addrdnvalues" || die
- einfo "Building contrib-module: addrdnvalues plugin"
- "${CC}" -shared \
- -I"${BUILD_DIR}"/include \
- -I../../../include \
- ${CFLAGS} \
- -fPIC \
- ${LDFLAGS} \
- -o libaddrdnvalues-plugin.so \
- addrdnvalues.c || die "Building libaddrdnvalues-plugin.so failed"
-
- fi
-}
-
-multilib_src_test() {
- if multilib_is_native_abi; then
- cd tests || die
- make tests || die "make tests failed"
- fi
-}
-
-multilib_src_install() {
- local lt="${BUILD_DIR}/libtool"
- emake DESTDIR="${D}" SHELL="${EPREFIX}"/bin/bash install
-
- if ! use minimal && multilib_is_native_abi; then
- # openldap modules go here
- # TODO: write some code to populate slapd.conf with moduleload statements
- keepdir /usr/$(get_libdir)/openldap/openldap/
-
- # initial data storage dir
- keepdir /var/lib/openldap-data
- use prefix || fowners ldap:ldap /var/lib/openldap-data
- fperms 0700 /var/lib/openldap-data
-
- echo "OLDPF='${PF}'" > "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
- echo "# do NOT delete this. it is used" >> "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
- echo "# to track versions for upgrading." >> "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
-
- # use our config
- rm "${ED}"etc/openldap/slapd.conf
- insinto /etc/openldap
- newins "${FILESDIR}"/${PN}-2.3.34-slapd-conf slapd.conf
- configfile="${ED}"etc/openldap/slapd.conf
-
- # populate with built backends
- ebegin "populate config with built backends"
- for x in "${ED}"usr/$(get_libdir)/openldap/openldap/back_*.so; do
- elog "Adding $(basename ${x})"
- sed -e "/###INSERTDYNAMICMODULESHERE###$/a# moduleload\t$(basename ${x})" -i "${configfile}"
- done
- sed -e "s:###INSERTDYNAMICMODULESHERE###$:# modulepath\t${EPREFIX}/usr/$(get_libdir)/openldap/openldap:" -i "${configfile}"
- use prefix || fowners root:ldap /etc/openldap/slapd.conf
- fperms 0640 /etc/openldap/slapd.conf
- cp "${configfile}" "${configfile}".default
- eend
-
- # install our own init scripts and systemd unit files
- newinitd "${FILESDIR}"/slapd-initd-2.4.28-r1 slapd
- newconfd "${FILESDIR}"/slapd-confd-2.4.28-r1 slapd
- systemd_dounit "${FILESDIR}"/slapd.service
- systemd_install_serviced "${FILESDIR}"/slapd.service.conf
- systemd_newtmpfilesd "${FILESDIR}"/slapd.tmpfilesd slapd.conf
-
- if [[ $(get_libdir) != lib ]]; then
- sed -e "s,/usr/lib/,/usr/$(get_libdir)/," -i \
- "${ED}"/etc/init.d/slapd \
- "${ED}"/usr/lib/systemd/system/slapd.service || die
- fi
- # If built without SLP, we don't need to be before avahi
- use slp \
- || sed -i \
- -e '/before/{s/avahi-daemon//g}' \
- "${ED}"etc/init.d/slapd
-
- if use cxx ; then
- einfo "Install the ldapc++ library"
- cd "${BUILD_DIR}/contrib/ldapc++" || die
- emake DESTDIR="${D}" libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" install
- cd "${S}"/contrib/ldapc++ || die
- newdoc README ldapc++-README
- fi
-
- if use smbkrb5passwd ; then
- einfo "Install the smbk5pwd module"
- cd "${S}/contrib/slapd-modules/smbk5pwd" || die
- emake DESTDIR="${D}" \
- LDAP_BUILD="${BUILD_DIR}" \
- libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" install
- newdoc README smbk5pwd-README
- fi
-
- if use overlays ; then
- einfo "Install the samba4 module"
- cd "${S}/contrib/slapd-modules/samba4" || die
- emake DESTDIR="${D}" \
- LDAP_BUILD="${BUILD_DIR}" \
- libexecdir="/usr/$(get_libdir)/openldap" install
- newdoc README samba4-README
- fi
-
- einfo "Installing contrib modules"
- cd "${S}/contrib/slapd-modules" || die
- for l in */*.la; do
- "${lt}" --mode=install cp ${l} \
- "${ED}"usr/$(get_libdir)/openldap/openldap || \
- die "installing ${l} failed"
- done
-
- docinto contrib
- newdoc addpartial/README addpartial-README
- newdoc allop/README allop-README
- doman allop/slapo-allop.5
- newdoc autogroup/README autogroup-README
- newdoc denyop/denyop.c denyop-denyop.c
- newdoc dsaschema/README dsaschema-README
- doman lastmod/slapo-lastmod.5
- doman nops/slapo-nops.5
- newdoc passwd/README passwd-README
- cd "${S}/contrib/slapi-plugins" || die
- insinto /usr/$(get_libdir)/openldap/openldap
- doins */*.so
- docinto contrib
- newdoc addrdnvalues/README addrdnvalues-README
-
- insinto /etc/openldap/schema
- newins "${DISTDIR}"/${BIS_P} ${BIS_PN}
- fi
-}
-
-multilib_src_install_all() {
- dodoc ANNOUNCEMENT CHANGES COPYRIGHT README "${FILESDIR}"/DB_CONFIG.fast.example
- docinto rfc ; dodoc doc/rfc/*.txt
-}
-
-pkg_preinst() {
- # keep old libs if any
- preserve_old_lib /usr/$(get_libdir)/{liblber,libldap_r,liblber}-2.3$(get_libname 0)
-}
-
-pkg_postinst() {
- if ! use minimal ; then
- # You cannot build SSL certificates during src_install that will make
- # binary packages containing your SSL key, which is both a security risk
- # and a misconfiguration if multiple machines use the same key and cert.
- if use ssl; then
- install_cert /etc/openldap/ssl/ldap
- use prefix || chown ldap:ldap "${EROOT}"etc/openldap/ssl/ldap.*
- ewarn "Self-signed SSL certificates are treated harshly by OpenLDAP 2.[12]"
- ewarn "Self-signed SSL certificates are treated harshly by OpenLDAP 2.[12]"
- ewarn "add 'TLS_REQCERT never' if you want to use them."
- fi
-
- if use prefix; then
- # Warn about prefix issues with slapd
- eerror "slapd might NOT be usable on Prefix systems as it requires root privileges"
- eerror "to start up, and requires that certain files directories be owned by"
- eerror "ldap:ldap. As Prefix does not support changing ownership of files and"
- eerror "directories, you will have to manually fix this yourself."
- fi
-
- # These lines force the permissions of various content to be correct
- use prefix || chown ldap:ldap "${EROOT}"var/run/openldap
- chmod 0755 "${EROOT}"var/run/openldap
- use prefix || chown root:ldap "${EROOT}"etc/openldap/slapd.conf{,.default}
- chmod 0640 "${EROOT}"etc/openldap/slapd.conf{,.default}
- use prefix || chown ldap:ldap "${EROOT}"var/lib/openldap-data
- fi
-
- elog "Getting started using OpenLDAP? There is some documentation available:"
- elog "Gentoo Guide to OpenLDAP Authentication"
- elog "(https://www.gentoo.org/doc/en/ldap-howto.xml)"
- elog "---"
- elog "An example file for tuning BDB backends with openldap is"
- elog "DB_CONFIG.fast.example in /usr/share/doc/${PF}/"
-
- preserve_old_lib_notify /usr/$(get_libdir)/{liblber,libldap,libldap_r}-2.3$(get_libname 0)
-}
diff --git a/net-nds/openldap/openldap-2.4.40-r2.ebuild b/net-nds/openldap/openldap-2.4.40-r2.ebuild
deleted file mode 100644
index ffe3d740f334..000000000000
--- a/net-nds/openldap/openldap-2.4.40-r2.ebuild
+++ /dev/null
@@ -1,821 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI="5"
-
-inherit db-use eutils flag-o-matic multilib multilib-minimal ssl-cert versionator toolchain-funcs autotools user systemd
-
-BIS_PN=rfc2307bis.schema
-BIS_PV=20140524
-BIS_P="${BIS_PN}-${BIS_PV}"
-
-DESCRIPTION="LDAP suite of application and development tools"
-HOMEPAGE="http://www.OpenLDAP.org/"
-
-# mirrors are mostly not working, using canonical URI
-SRC_URI="ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/${P}.tgz
- mirror://gentoo/${BIS_P}"
-
-LICENSE="OPENLDAP GPL-2"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~x86-solaris"
-
-IUSE_DAEMON="crypt icu samba slp tcpd experimental minimal"
-IUSE_BACKEND="+berkdb"
-IUSE_OVERLAY="overlays perl"
-IUSE_OPTIONAL="gnutls iodbc sasl ssl odbc debug ipv6 +syslog selinux static-libs"
-IUSE_CONTRIB="smbkrb5passwd kerberos"
-IUSE_CONTRIB="${IUSE_CONTRIB} -cxx"
-IUSE="${IUSE_DAEMON} ${IUSE_BACKEND} ${IUSE_OVERLAY} ${IUSE_OPTIONAL} ${IUSE_CONTRIB}"
-
-REQUIRED_USE="cxx? ( sasl )"
-
-# always list newer first
-# Do not add any AGPL-3 BDB here!
-# See bug 525110, comment 15.
-BDB_SLOTS='5.3 5.1 4.8 4.7 4.6 4.5 4.4'
-BDB_PKGS=''
-for _slot in $BDB_SLOTS; do BDB_PKGS="${BDB_PKGS} sys-libs/db:${_slot}" ; done
-
-# openssl is needed to generate lanman-passwords required by samba
-CDEPEND="icu? ( dev-libs/icu:= )
- ssl? ( !gnutls? ( >=dev-libs/openssl-1.0.1h-r2[${MULTILIB_USEDEP}] )
- gnutls? ( >=net-libs/gnutls-2.12.23-r6[${MULTILIB_USEDEP}] >=dev-libs/libgcrypt-1.5.3:0[${MULTILIB_USEDEP}] ) )
- sasl? ( dev-libs/cyrus-sasl:= )
- !minimal? (
- sys-devel/libtool
- sys-libs/e2fsprogs-libs
- >=dev-db/lmdb-0.9.14
- tcpd? ( sys-apps/tcp-wrappers )
- odbc? ( !iodbc? ( dev-db/unixODBC )
- iodbc? ( dev-db/libiodbc ) )
- slp? ( net-libs/openslp )
- perl? ( dev-lang/perl:=[-build(-)] )
- samba? ( dev-libs/openssl )
- berkdb? (
- <sys-libs/db-6.0:=
- || ( ${BDB_PKGS} )
- )
- smbkrb5passwd? (
- dev-libs/openssl
- kerberos? ( app-crypt/heimdal )
- )
- kerberos? ( virtual/krb5 )
- cxx? ( dev-libs/cyrus-sasl:= )
- )
- abi_x86_32? (
- !<=app-emulation/emul-linux-x86-baselibs-20140508-r3
- !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
- )"
-DEPEND="${CDEPEND}
- sys-apps/groff"
-RDEPEND="${CDEPEND}
- selinux? ( sec-policy/selinux-ldap )
-"
-# for tracking versions
-OPENLDAP_VERSIONTAG=".version-tag"
-OPENLDAP_DEFAULTDIR_VERSIONTAG="/var/lib/openldap-data"
-
-MULTILIB_WRAPPED_HEADERS=(
- # USE=cxx
- /usr/include/LDAPAsynConnection.h
- /usr/include/LDAPAttrType.h
- /usr/include/LDAPAttribute.h
- /usr/include/LDAPAttributeList.h
- /usr/include/LDAPConnection.h
- /usr/include/LDAPConstraints.h
- /usr/include/LDAPControl.h
- /usr/include/LDAPControlSet.h
- /usr/include/LDAPEntry.h
- /usr/include/LDAPEntryList.h
- /usr/include/LDAPException.h
- /usr/include/LDAPExtResult.h
- /usr/include/LDAPMessage.h
- /usr/include/LDAPMessageQueue.h
- /usr/include/LDAPModList.h
- /usr/include/LDAPModification.h
- /usr/include/LDAPObjClass.h
- /usr/include/LDAPRebind.h
- /usr/include/LDAPRebindAuth.h
- /usr/include/LDAPReferenceList.h
- /usr/include/LDAPResult.h
- /usr/include/LDAPSaslBindResult.h
- /usr/include/LDAPSchema.h
- /usr/include/LDAPSearchReference.h
- /usr/include/LDAPSearchResult.h
- /usr/include/LDAPSearchResults.h
- /usr/include/LDAPUrl.h
- /usr/include/LDAPUrlList.h
- /usr/include/LdifReader.h
- /usr/include/LdifWriter.h
- /usr/include/SaslInteraction.h
- /usr/include/SaslInteractionHandler.h
- /usr/include/StringList.h
- /usr/include/TlsOptions.h
-)
-
-openldap_filecount() {
- local dir="$1"
- find "${dir}" -type f ! -name '.*' ! -name 'DB_CONFIG*' | wc -l
-}
-
-openldap_find_versiontags() {
- # scan for all datadirs
- openldap_datadirs=""
- if [ -f "${EROOT}"/etc/openldap/slapd.conf ]; then
- openldap_datadirs="$(awk '{if($1 == "directory") print $2 }' ${EROOT}/etc/openldap/slapd.conf)"
- fi
- openldap_datadirs="${openldap_datadirs} ${OPENLDAP_DEFAULTDIR_VERSIONTAG}"
-
- einfo
- einfo "Scanning datadir(s) from slapd.conf and"
- einfo "the default installdir for Versiontags"
- einfo "(${OPENLDAP_DEFAULTDIR_VERSIONTAG} may appear twice)"
- einfo
-
- # scan datadirs if we have a version tag
- openldap_found_tag=0
- have_files=0
- for each in ${openldap_datadirs}; do
- CURRENT_TAGDIR=${ROOT}`echo ${each} | sed "s:\/::"`
- CURRENT_TAG=${CURRENT_TAGDIR}/${OPENLDAP_VERSIONTAG}
- if [ -d ${CURRENT_TAGDIR} ] && [ ${openldap_found_tag} == 0 ] ; then
- einfo "- Checking ${each}..."
- if [ -r ${CURRENT_TAG} ] ; then
- # yey, we have one :)
- einfo " Found Versiontag in ${each}"
- source ${CURRENT_TAG}
- if [ "${OLDPF}" == "" ] ; then
- eerror "Invalid Versiontag found in ${CURRENT_TAGDIR}"
- eerror "Please delete it"
- eerror
- die "Please kill the invalid versiontag in ${CURRENT_TAGDIR}"
- fi
-
- OLD_MAJOR=`get_version_component_range 2-3 ${OLDPF}`
-
- [ $(openldap_filecount ${CURRENT_TAGDIR}) -gt 0 ] && have_files=1
-
- # are we on the same branch?
- if [ "${OLD_MAJOR}" != "${PV:0:3}" ] ; then
- ewarn " Versiontag doesn't match current major release!"
- if [[ "${have_files}" == "1" ]] ; then
- eerror " Versiontag says other major and you (probably) have datafiles!"
- echo
- openldap_upgrade_howto
- else
- einfo " No real problem, seems there's no database."
- fi
- else
- einfo " Versiontag is fine here :)"
- fi
- else
- einfo " Non-tagged dir ${each}"
- [ $(openldap_filecount ${each}) -gt 0 ] && have_files=1
- if [[ "${have_files}" == "1" ]] ; then
- einfo " EEK! Non-empty non-tagged datadir, counting `ls -a ${each} | wc -l` files"
- echo
-
- eerror
- eerror "Your OpenLDAP Installation has a non tagged datadir that"
- eerror "possibly contains a database at ${CURRENT_TAGDIR}"
- eerror
- eerror "Please export data if any entered and empty or remove"
- eerror "the directory, installation has been stopped so you"
- eerror "can take required action"
- eerror
- eerror "For a HOWTO on exporting the data, see instructions in the ebuild"
- eerror
- openldap_upgrade_howto
- die "Please move the datadir ${CURRENT_TAGDIR} away"
- fi
- fi
- einfo
- fi
- done
- [ "${have_files}" == "1" ] && einfo "DB files present" || einfo "No DB files present"
-
- # Now we must check for the major version of sys-libs/db linked against.
- SLAPD_PATH=${EROOT}/usr/$(get_libdir)/openldap/slapd
- if [ "${have_files}" == "1" -a -f "${SLAPD_PATH}" ]; then
- OLDVER="$(/usr/bin/ldd ${SLAPD_PATH} \
- | awk '/libdb-/{gsub("^libdb-","",$1);gsub(".so$","",$1);print $1}')"
- if use berkdb; then
- # find which one would be used
- for bdb_slot in $BDB_SLOTS ; do
- NEWVER="$(db_findver "=sys-libs/db-${bdb_slot}*")"
- [[ -n "$NEWVER" ]] && break
- done
- fi
- local fail=0
- if [ -z "${OLDVER}" -a -z "${NEWVER}" ]; then
- :
- # Nothing wrong here.
- elif [ -z "${OLDVER}" -a -n "${NEWVER}" ]; then
- eerror " Your existing version of OpenLDAP was not built against"
- eerror " any version of sys-libs/db, but the new one will build"
- eerror " against ${NEWVER} and your database may be inaccessible."
- echo
- fail=1
- elif [ -n "${OLDVER}" -a -z "${NEWVER}" ]; then
- eerror " Your existing version of OpenLDAP was built against"
- eerror " sys-libs/db:${OLDVER}, but the new one will not be"
- eerror " built against any version and your database may be"
- eerror " inaccessible."
- echo
- fail=1
- elif [ "${OLDVER}" != "${NEWVER}" ]; then
- eerror " Your existing version of OpenLDAP was built against"
- eerror " sys-libs/db:${OLDVER}, but the new one will build against"
- eerror " ${NEWVER} and your database would be inaccessible."
- echo
- fail=1
- fi
- [ "${fail}" == "1" ] && openldap_upgrade_howto
- fi
-
- echo
- einfo
- einfo "All datadirs are fine, proceeding with merge now..."
- einfo
-}
-
-openldap_upgrade_howto() {
- eerror
- eerror "A (possible old) installation of OpenLDAP was detected,"
- eerror "installation will not proceed for now."
- eerror
- eerror "As major version upgrades can corrupt your database,"
- eerror "you need to dump your database and re-create it afterwards."
- eerror
- eerror "Additionally, rebuilding against different major versions of the"
- eerror "sys-libs/db libraries will cause your database to be inaccessible."
- eerror ""
- d="$(date -u +%s)"
- l="/root/ldapdump.${d}"
- i="${l}.raw"
- eerror " 1. /etc/init.d/slurpd stop ; /etc/init.d/slapd stop"
- eerror " 2. slapcat -l ${i}"
- eerror " 3. egrep -v '^(entry|context)CSN:' <${i} >${l}"
- eerror " 4. mv /var/lib/openldap-data/ /var/lib/openldap-data-backup/"
- eerror " 5. emerge --update \=net-nds/${PF}"
- eerror " 6. etc-update, and ensure that you apply the changes"
- eerror " 7. slapadd -l ${l}"
- eerror " 8. chown ldap:ldap /var/lib/openldap-data/*"
- eerror " 9. /etc/init.d/slapd start"
- eerror "10. check that your data is intact."
- eerror "11. set up the new replication system."
- eerror
- if [ "${FORCE_UPGRADE}" != "1" ]; then
- die "You need to upgrade your database first"
- else
- eerror "You have the magical FORCE_UPGRADE=1 in place."
- eerror "Don't say you weren't warned about data loss."
- fi
-}
-
-pkg_setup() {
- if ! use sasl && use cxx ; then
- die "To build the ldapc++ library you must emerge openldap with sasl support"
- fi
- # Bug #322787
- if use minimal && ! has_version "net-nds/openldap" ; then
- einfo "No datadir scan needed, openldap not installed"
- elif use minimal && has_version "net-nds/openldap" && built_with_use net-nds/openldap minimal ; then
- einfo "Skipping scan for previous datadirs as requested by minimal useflag"
- else
- openldap_find_versiontags
- fi
-
- # The user/group are only used for running daemons which are
- # disabled in minimal builds, so elide the accounts too.
- if ! use minimal ; then
- enewgroup ldap 439
- enewuser ldap 439 -1 /usr/$(get_libdir)/openldap ldap
- fi
-}
-
-src_prepare() {
- # ensure correct SLAPI path by default
- sed -i -e 's,\(#define LDAPI_SOCK\).*,\1 "'"${EPREFIX}"'/var/run/openldap/slapd.sock",' \
- "${S}"/include/ldap_defaults.h
-
- epatch "${FILESDIR}"/${PN}-2.4.17-gcc44.patch
-
- epatch \
- "${FILESDIR}"/${PN}-2.2.14-perlthreadsfix.patch \
- "${FILESDIR}"/${PN}-2.4.15-ppolicy.patch
-
- # bug #116045 - still present in 2.4.28
- epatch "${FILESDIR}"/${PN}-2.4.35-contrib-smbk5pwd.patch
- # bug #408077 - samba4
- epatch "${FILESDIR}"/${PN}-2.4.35-contrib-samba4.patch
-
- # bug #189817
- epatch "${FILESDIR}"/${PN}-2.4.11-libldap_r.patch
-
- # bug #233633
- epatch "${FILESDIR}"/${PN}-2.4.17-fix-lmpasswd-gnutls-symbols.patch
-
- # bug #281495
- epatch "${FILESDIR}"/${PN}-2.4.28-gnutls-gcrypt.patch
-
- # bug #294350
- epatch "${FILESDIR}"/${PN}-2.4.6-evolution-ntlm.patch
-
- # unbreak /bin/sh -> dash
- epatch "${FILESDIR}"/${PN}-2.4.28-fix-dash.patch
-
- # bug #420959
- epatch "${FILESDIR}"/${PN}-2.4.31-gcc47.patch
-
- # bug #421463
- #epatch "${FILESDIR}"/${PN}-2.4.33-gnutls.patch # merged upstream
-
- # unbundle lmdb
- epatch "${FILESDIR}"/${P}-mdb-unbundle.patch
- rm -rf "${S}"/libraries/liblmdb
-
- cd "${S}"/build || die
- einfo "Making sure upstream build strip does not do stripping too early"
- sed -i.orig \
- -e '/^STRIP/s,-s,,g' \
- top.mk || die "Failed to block stripping"
-
- # wrong assumption that /bin/sh is /bin/bash
- sed -i \
- -e 's|/bin/sh|/bin/bash|g' \
- "${S}"/tests/scripts/* || die "sed failed"
-
- cd "${S}" || die
-
- AT_NOEAUTOMAKE=yes eautoreconf
-}
-
-build_contrib_module() {
- # <dir> <sources> <outputname>
- cd "${S}/contrib/slapd-modules/$1" || die
- einfo "Compiling contrib-module: $3"
- # Make sure it's uppercase
- local define_name="$(echo "SLAPD_OVER_${1}" | LC_ALL=C tr '[:lower:]' '[:upper:]')"
- "${lt}" --mode=compile --tag=CC \
- "${CC}" \
- -D${define_name}=SLAPD_MOD_DYNAMIC \
- -I"${BUILD_DIR}"/include \
- -I../../../include -I../../../servers/slapd ${CFLAGS} \
- -o ${2%.c}.lo -c $2 || die "compiling $3 failed"
- einfo "Linking contrib-module: $3"
- "${lt}" --mode=link --tag=CC \
- "${CC}" -module \
- ${CFLAGS} \
- ${LDFLAGS} \
- -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
- -o $3.la ${2%.c}.lo || die "linking $3 failed"
-}
-
-src_configure() {
- #Fix for glibc-2.8 and ucred. Bug 228457.
- append-cppflags -D_GNU_SOURCE
-
- # Bug 408001
- use elibc_FreeBSD && append-cppflags -DMDB_DSYNC=O_SYNC -DMDB_FDATASYNC=fsync
-
- # connectionless ldap per bug #342439
- append-cppflags -DLDAP_CONNECTIONLESS
-
- multilib-minimal_src_configure
-}
-
-multilib_src_configure() {
- local myconf=()
-
- use debug && myconf+=( $(use_enable debug) )
-
- # ICU usage is not configurable
- export ac_cv_header_unicode_utypes_h="$(multilib_is_native_abi && use icu && echo yes || echo no)"
-
- if ! use minimal && multilib_is_native_abi; then
- local CPPFLAGS=${CPPFLAGS}
-
- # re-enable serverside overlay chains per bug #296567
- # see ldap docs chaper 12.3.1 for details
- myconf+=( --enable-ldap )
-
- # backends
- myconf+=( --enable-slapd )
- if use berkdb ; then
- einfo "Using Berkeley DB for local backend"
- myconf+=( --enable-bdb --enable-hdb )
- DBINCLUDE=$(db_includedir $BDB_SLOTS)
- einfo "Using $DBINCLUDE for sys-libs/db version"
- # We need to include the slotted db.h dir for FreeBSD
- append-cppflags -I${DBINCLUDE}
- else
- myconf+=( --disable-bdb --disable-hdb )
- fi
- for backend in dnssrv ldap mdb meta monitor null passwd relay shell sock; do
- myconf+=( --enable-${backend}=mod )
- done
-
- myconf+=( $(use_enable perl perl mod) )
-
- myconf+=( $(use_enable odbc sql mod) )
- if use odbc ; then
- local odbc_lib="unixodbc"
- if use iodbc ; then
- odbc_lib="iodbc"
- append-cppflags -I"${EPREFIX}"/usr/include/iodbc
- fi
- myconf+=( --with-odbc=${odbc_lib} )
- fi
-
- # slapd options
- myconf+=(
- $(use_enable crypt)
- $(use_enable slp)
- $(use_enable samba lmpasswd)
- $(use_enable syslog)
- )
- if use experimental ; then
- myconf+=(
- --enable-dynacl
- --enable-aci=mod
- )
- fi
- for option in aci cleartext modules rewrite rlookups slapi; do
- myconf+=( --enable-${option} )
- done
-
- # slapd overlay options
- # Compile-in the syncprov, the others as module
- myconf+=( --enable-syncprov=yes )
- use overlays && myconf+=( --enable-overlays=mod )
-
- else
- myconf+=(
- --disable-backends
- --disable-slapd
- --disable-bdb
- --disable-hdb
- --disable-mdb
- --disable-overlays
- --disable-syslog
- )
- fi
-
- # basic functionality stuff
- myconf+=(
- $(use_enable ipv6)
- $(multilib_native_use_with sasl cyrus-sasl)
- $(multilib_native_use_enable sasl spasswd)
- $(use_enable tcpd wrappers)
- )
-
- # Some cross-compiling tests don't pan out well.
- tc-is-cross-compiler && myconf+=(
- --with-yielding-select=yes
- )
-
- local ssl_lib="no"
- if use ssl || ( ! use minimal && use samba ) ; then
- ssl_lib="openssl"
- use gnutls && ssl_lib="gnutls"
- fi
-
- myconf+=( --with-tls=${ssl_lib} )
-
- for basicflag in dynamic local proctitle shared; do
- myconf+=( --enable-${basicflag} )
- done
-
- tc-export AR CC CXX
- ECONF_SOURCE=${S} \
- STRIP=/bin/true \
- econf \
- --libexecdir="${EPREFIX}"/usr/$(get_libdir)/openldap \
- $(use_enable static-libs static) \
- "${myconf[@]}"
- emake depend
-}
-
-src_configure_cxx() {
- # This needs the libraries built by the first build run.
- # So we have to run it AFTER the main build, not just after the main
- # configure.
- local myconf_ldapcpp=(
- --with-ldap-includes="${S}"/include
- )
-
- mkdir -p "${BUILD_DIR}"/contrib/ldapc++ || die
- cd "${BUILD_DIR}/contrib/ldapc++" || die
-
- local LDFLAGS=${LDFLAGS} CPPFLAGS=${CPPFLAGS}
- append-ldflags -L"${BUILD_DIR}"/libraries/liblber/.libs \
- -L"${BUILD_DIR}"/libraries/libldap/.libs
- append-cppflags -I"${BUILD_DIR}"/include
- ECONF_SOURCE=${S}/contrib/ldapc++ \
- econf "${myconf_ldapcpp[@]}" \
- CC="${CC}" \
- CXX="${CXX}"
-}
-
-multilib_src_compile() {
- tc-export AR CC CXX
- emake CC="${CC}" AR="${AR}" SHELL="${EPREFIX}"/bin/bash
- local lt="${BUILD_DIR}/libtool"
- export echo="echo"
-
- if ! use minimal && multilib_is_native_abi ; then
- if use cxx ; then
- einfo "Building contrib library: ldapc++"
- src_configure_cxx
- cd "${BUILD_DIR}/contrib/ldapc++" || die
- emake \
- CC="${CC}" CXX="${CXX}"
- fi
-
- if use smbkrb5passwd ; then
- einfo "Building contrib-module: smbk5pwd"
- cd "${S}/contrib/slapd-modules/smbk5pwd" || die
-
- MY_DEFS="-DDO_SHADOW"
- if use samba ; then
- MY_DEFS="${MY_DEFS} -DDO_SAMBA"
- MY_KRB5_INC=""
- fi
- if use kerberos ; then
- MY_DEFS="${MY_DEFS} -DDO_KRB5"
- MY_KRB5_INC="$(krb5-config --cflags)"
- fi
-
- emake \
- DEFS="${MY_DEFS}" \
- KRB5_INC="${MY_KRB5_INC}" \
- LDAP_BUILD="${BUILD_DIR}" \
- CC="${CC}" libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap"
- fi
-
- if use overlays ; then
- einfo "Building contrib-module: samba4"
- cd "${S}/contrib/slapd-modules/samba4" || die
-
- emake \
- LDAP_BUILD="${BUILD_DIR}" \
- CC="${CC}" libexecdir="/usr/$(get_libdir)/openldap"
- fi
-
- if use kerberos ; then
- build_contrib_module "kinit" "kinit.c" "kinit"
- cd "${S}/contrib/slapd-modules/passwd" || die
- einfo "Compiling contrib-module: pw-kerberos"
- "${lt}" --mode=compile --tag=CC \
- "${CC}" \
- -I"${BUILD_DIR}"/include \
- -I../../../include \
- ${CFLAGS} \
- $(krb5-config --cflags) \
- -DHAVE_KRB5 \
- -o kerberos.lo \
- -c kerberos.c || die "compiling pw-kerberos failed"
- einfo "Linking contrib-module: pw-kerberos"
- "${lt}" --mode=link --tag=CC \
- "${CC}" -module \
- ${CFLAGS} \
- ${LDFLAGS} \
- -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
- -o pw-kerberos.la \
- kerberos.lo || die "linking pw-kerberos failed"
- fi
- # We could build pw-radius if GNURadius would install radlib.h
- cd "${S}/contrib/slapd-modules/passwd" || die
- einfo "Compiling contrib-module: pw-netscape"
- "${lt}" --mode=compile --tag=CC \
- "${CC}" \
- -I"${BUILD_DIR}"/include \
- -I../../../include \
- ${CFLAGS} \
- -o netscape.lo \
- -c netscape.c || die "compiling pw-netscape failed"
- einfo "Linking contrib-module: pw-netscape"
- "${lt}" --mode=link --tag=CC \
- "${CC}" -module \
- ${CFLAGS} \
- ${LDFLAGS} \
- -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
- -o pw-netscape.la \
- netscape.lo || die "linking pw-netscape failed"
-
- #build_contrib_module "acl" "posixgroup.c" "posixGroup" # example code only
- #build_contrib_module "acl" "gssacl.c" "gss" # example code only, also needs kerberos
- build_contrib_module "addpartial" "addpartial-overlay.c" "addpartial-overlay"
- build_contrib_module "allop" "allop.c" "overlay-allop"
- build_contrib_module "allowed" "allowed.c" "allowed"
- build_contrib_module "autogroup" "autogroup.c" "autogroup"
- build_contrib_module "cloak" "cloak.c" "cloak"
- # build_contrib_module "comp_match" "comp_match.c" "comp_match" # really complex, adds new external deps, questionable demand
- build_contrib_module "denyop" "denyop.c" "denyop-overlay"
- build_contrib_module "dsaschema" "dsaschema.c" "dsaschema-plugin"
- build_contrib_module "dupent" "dupent.c" "dupent"
- build_contrib_module "lastbind" "lastbind.c" "lastbind"
- # lastmod may not play well with other overlays
- build_contrib_module "lastmod" "lastmod.c" "lastmod"
- build_contrib_module "noopsrch" "noopsrch.c" "noopsrch"
- build_contrib_module "nops" "nops.c" "nops-overlay"
- #build_contrib_module "nssov" "nssov.c" "nssov-overlay" RESO:LATER
- build_contrib_module "trace" "trace.c" "trace"
- # build slapi-plugins
- cd "${S}/contrib/slapi-plugins/addrdnvalues" || die
- einfo "Building contrib-module: addrdnvalues plugin"
- "${CC}" -shared \
- -I"${BUILD_DIR}"/include \
- -I../../../include \
- ${CFLAGS} \
- -fPIC \
- ${LDFLAGS} \
- -o libaddrdnvalues-plugin.so \
- addrdnvalues.c || die "Building libaddrdnvalues-plugin.so failed"
-
- fi
-}
-
-multilib_src_test() {
- if multilib_is_native_abi; then
- cd tests || die
- emake tests || die "make tests failed"
- fi
-}
-
-multilib_src_install() {
- local lt="${BUILD_DIR}/libtool"
- emake DESTDIR="${D}" SHELL="${EPREFIX}"/bin/bash install
- use static-libs || prune_libtool_files --all
-
- if ! use minimal && multilib_is_native_abi; then
- # openldap modules go here
- # TODO: write some code to populate slapd.conf with moduleload statements
- keepdir /usr/$(get_libdir)/openldap/openldap/
-
- # initial data storage dir
- keepdir /var/lib/openldap-data
- use prefix || fowners ldap:ldap /var/lib/openldap-data
- fperms 0700 /var/lib/openldap-data
-
- echo "OLDPF='${PF}'" > "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
- echo "# do NOT delete this. it is used" >> "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
- echo "# to track versions for upgrading." >> "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
-
- # use our config
- rm "${ED}"etc/openldap/slapd.conf
- insinto /etc/openldap
- newins "${FILESDIR}"/${PN}-2.4.40-slapd-conf slapd.conf
- configfile="${ED}"etc/openldap/slapd.conf
-
- # populate with built backends
- ebegin "populate config with built backends"
- for x in "${ED}"usr/$(get_libdir)/openldap/openldap/back_*.so; do
- einfo "Adding $(basename ${x})"
- sed -e "/###INSERTDYNAMICMODULESHERE###$/a# moduleload\t$(basename ${x})" -i "${configfile}"
- done
- sed -e "s:###INSERTDYNAMICMODULESHERE###$:# modulepath\t${EPREFIX}/usr/$(get_libdir)/openldap/openldap:" -i "${configfile}"
- use prefix || fowners root:ldap /etc/openldap/slapd.conf
- fperms 0640 /etc/openldap/slapd.conf
- cp "${configfile}" "${configfile}".default
- eend
-
- # install our own init scripts and systemd unit files
- einfo "Install init scripts"
- newinitd "${FILESDIR}"/slapd-initd-2.4.40-r1 slapd
- newconfd "${FILESDIR}"/slapd-confd-2.4.28-r1 slapd
- einfo "Install systemd service"
- systemd_dounit "${FILESDIR}"/slapd.service
- systemd_install_serviced "${FILESDIR}"/slapd.service.conf
- systemd_newtmpfilesd "${FILESDIR}"/slapd.tmpfilesd slapd.conf
-
- if [[ $(get_libdir) != lib ]]; then
- sed -e "s,/usr/lib/,/usr/$(get_libdir)/," -i \
- "${ED}"/etc/init.d/slapd \
- "${ED}"/usr/lib/systemd/system/slapd.service || die
- fi
- # If built without SLP, we don't need to be before avahi
- use slp \
- || sed -i \
- -e '/before/{s/avahi-daemon//g}' \
- "${ED}"etc/init.d/slapd
-
- if use cxx ; then
- einfo "Install the ldapc++ library"
- cd "${BUILD_DIR}/contrib/ldapc++" || die
- emake DESTDIR="${D}" libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" install
- cd "${S}"/contrib/ldapc++ || die
- newdoc README ldapc++-README
- fi
-
- if use smbkrb5passwd ; then
- einfo "Install the smbk5pwd module"
- cd "${S}/contrib/slapd-modules/smbk5pwd" || die
- emake DESTDIR="${D}" \
- LDAP_BUILD="${BUILD_DIR}" \
- libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" install
- newdoc README smbk5pwd-README
- fi
-
- if use overlays ; then
- einfo "Install the samba4 module"
- cd "${S}/contrib/slapd-modules/samba4" || die
- emake DESTDIR="${D}" \
- LDAP_BUILD="${BUILD_DIR}" \
- libexecdir="/usr/$(get_libdir)/openldap" install
- newdoc README samba4-README
- fi
-
- einfo "Installing contrib modules"
- cd "${S}/contrib/slapd-modules" || die
- for l in */*.la; do
- "${lt}" --mode=install cp ${l} \
- "${ED}"usr/$(get_libdir)/openldap/openldap || \
- die "installing ${l} failed"
- done
-
- dodoc "${FILESDIR}"/DB_CONFIG.fast.example
- docinto contrib
- doman */*.5
- #newdoc acl/README*
- newdoc addpartial/README addpartial-README
- newdoc allop/README allop-README
- newdoc allowed/README allowed-README
- newdoc autogroup/README autogroup-README
- newdoc dsaschema/README dsaschema-README
- newdoc passwd/README passwd-README
- cd "${S}/contrib/slapi-plugins" || die
- insinto /usr/$(get_libdir)/openldap/openldap
- doins */*.so
- docinto contrib
- newdoc addrdnvalues/README addrdnvalues-README
-
- insinto /etc/openldap/schema
- newins "${DISTDIR}"/${BIS_P} ${BIS_PN}
-
- docinto back-sock ; dodoc "${S}"/servers/slapd/back-sock/searchexample*
- docinto back-shell ; dodoc "${S}"/servers/slapd/back-shell/searchexample*
- docinto back-perl ; dodoc "${S}"/servers/slapd/back-perl/SampleLDAP.pm
-
- dosbin "${S}"/contrib/slapd-tools/statslog
- newdoc "${S}"/contrib/slapd-tools/README README.statslog
- fi
-}
-
-multilib_src_install_all() {
- dodoc ANNOUNCEMENT CHANGES COPYRIGHT README
- docinto rfc ; dodoc doc/rfc/*.txt
-}
-
-pkg_preinst() {
- # keep old libs if any
- preserve_old_lib /usr/$(get_libdir)/{liblber,libldap_r,liblber}-2.3$(get_libname 0)
- # bug 440470, only display the getting started help there was no openldap before,
- # or we are going to a non-minimal build
- ! has_version net-nds/openldap || has_version 'net-nds/openldap[minimal]'
- OPENLDAP_PRINT_MESSAGES=$((! $?))
-}
-
-pkg_postinst() {
- if ! use minimal ; then
- # You cannot build SSL certificates during src_install that will make
- # binary packages containing your SSL key, which is both a security risk
- # and a misconfiguration if multiple machines use the same key and cert.
- if use ssl; then
- install_cert /etc/openldap/ssl/ldap
- use prefix || chown ldap:ldap "${EROOT}"etc/openldap/ssl/ldap.*
- ewarn "Self-signed SSL certificates are treated harshly by OpenLDAP 2.[12]"
- ewarn "Self-signed SSL certificates are treated harshly by OpenLDAP 2.[12]"
- ewarn "add 'TLS_REQCERT allow' if you want to use them."
- fi
-
- if use prefix; then
- # Warn about prefix issues with slapd
- eerror "slapd might NOT be usable on Prefix systems as it requires root privileges"
- eerror "to start up, and requires that certain files directories be owned by"
- eerror "ldap:ldap. As Prefix does not support changing ownership of files and"
- eerror "directories, you will have to manually fix this yourself."
- fi
-
- # These lines force the permissions of various content to be correct
- use prefix || chown ldap:ldap "${EROOT}"var/run/openldap
- chmod 0755 "${EROOT}"var/run/openldap
- use prefix || chown root:ldap "${EROOT}"etc/openldap/slapd.conf{,.default}
- chmod 0640 "${EROOT}"etc/openldap/slapd.conf{,.default}
- use prefix || chown ldap:ldap "${EROOT}"var/lib/openldap-data
- fi
-
- if has_version 'net-nds/openldap[-minimal]' && ((${OPENLDAP_PRINT_MESSAGES})); then
- elog "Getting started using OpenLDAP? There is some documentation available:"
- elog "Gentoo Guide to OpenLDAP Authentication"
- elog "(https://www.gentoo.org/doc/en/ldap-howto.xml)"
- elog "---"
- elog "An example file for tuning BDB backends with openldap is"
- elog "DB_CONFIG.fast.example in /usr/share/doc/${PF}/"
- fi
-
- preserve_old_lib_notify /usr/$(get_libdir)/{liblber,libldap,libldap_r}-2.3$(get_libname 0)
-}
diff --git a/net-nds/openldap/openldap-2.4.40-r4.ebuild b/net-nds/openldap/openldap-2.4.40-r4.ebuild
deleted file mode 100644
index 26c2ac18c749..000000000000
--- a/net-nds/openldap/openldap-2.4.40-r4.ebuild
+++ /dev/null
@@ -1,821 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI="5"
-
-inherit db-use eutils flag-o-matic multilib multilib-minimal ssl-cert versionator toolchain-funcs autotools user systemd
-
-BIS_PN=rfc2307bis.schema
-BIS_PV=20140524
-BIS_P="${BIS_PN}-${BIS_PV}"
-
-DESCRIPTION="LDAP suite of application and development tools"
-HOMEPAGE="http://www.OpenLDAP.org/"
-
-# mirrors are mostly not working, using canonical URI
-SRC_URI="ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/${P}.tgz
- mirror://gentoo/${BIS_P}"
-
-LICENSE="OPENLDAP GPL-2"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~x86-solaris"
-
-IUSE_DAEMON="crypt icu samba slp tcpd experimental minimal"
-IUSE_BACKEND="+berkdb"
-IUSE_OVERLAY="overlays perl"
-IUSE_OPTIONAL="gnutls iodbc sasl ssl odbc debug ipv6 +syslog selinux static-libs"
-IUSE_CONTRIB="smbkrb5passwd kerberos"
-IUSE_CONTRIB="${IUSE_CONTRIB} -cxx"
-IUSE="${IUSE_DAEMON} ${IUSE_BACKEND} ${IUSE_OVERLAY} ${IUSE_OPTIONAL} ${IUSE_CONTRIB}"
-
-REQUIRED_USE="cxx? ( sasl )"
-
-# always list newer first
-# Do not add any AGPL-3 BDB here!
-# See bug 525110, comment 15.
-BDB_SLOTS='5.3 5.1 4.8 4.7 4.6 4.5 4.4'
-BDB_PKGS=''
-for _slot in $BDB_SLOTS; do BDB_PKGS="${BDB_PKGS} sys-libs/db:${_slot}" ; done
-
-# openssl is needed to generate lanman-passwords required by samba
-CDEPEND="icu? ( dev-libs/icu:= )
- ssl? ( !gnutls? ( >=dev-libs/openssl-1.0.1h-r2[${MULTILIB_USEDEP}] )
- gnutls? ( >=net-libs/gnutls-2.12.23-r6[${MULTILIB_USEDEP}] >=dev-libs/libgcrypt-1.5.3:0[${MULTILIB_USEDEP}] ) )
- sasl? ( dev-libs/cyrus-sasl:= )
- !minimal? (
- sys-devel/libtool
- sys-libs/e2fsprogs-libs
- >=dev-db/lmdb-0.9.14
- tcpd? ( sys-apps/tcp-wrappers )
- odbc? ( !iodbc? ( dev-db/unixODBC )
- iodbc? ( dev-db/libiodbc ) )
- slp? ( net-libs/openslp )
- perl? ( dev-lang/perl:=[-build(-)] )
- samba? ( dev-libs/openssl )
- berkdb? (
- <sys-libs/db-6.0:=
- || ( ${BDB_PKGS} )
- )
- smbkrb5passwd? (
- dev-libs/openssl
- kerberos? ( app-crypt/heimdal )
- )
- kerberos? ( virtual/krb5 )
- cxx? ( dev-libs/cyrus-sasl:= )
- )
- abi_x86_32? (
- !<=app-emulation/emul-linux-x86-baselibs-20140508-r3
- !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
- )"
-DEPEND="${CDEPEND}
- sys-apps/groff"
-RDEPEND="${CDEPEND}
- selinux? ( sec-policy/selinux-ldap )
-"
-# for tracking versions
-OPENLDAP_VERSIONTAG=".version-tag"
-OPENLDAP_DEFAULTDIR_VERSIONTAG="/var/lib/openldap-data"
-
-MULTILIB_WRAPPED_HEADERS=(
- # USE=cxx
- /usr/include/LDAPAsynConnection.h
- /usr/include/LDAPAttrType.h
- /usr/include/LDAPAttribute.h
- /usr/include/LDAPAttributeList.h
- /usr/include/LDAPConnection.h
- /usr/include/LDAPConstraints.h
- /usr/include/LDAPControl.h
- /usr/include/LDAPControlSet.h
- /usr/include/LDAPEntry.h
- /usr/include/LDAPEntryList.h
- /usr/include/LDAPException.h
- /usr/include/LDAPExtResult.h
- /usr/include/LDAPMessage.h
- /usr/include/LDAPMessageQueue.h
- /usr/include/LDAPModList.h
- /usr/include/LDAPModification.h
- /usr/include/LDAPObjClass.h
- /usr/include/LDAPRebind.h
- /usr/include/LDAPRebindAuth.h
- /usr/include/LDAPReferenceList.h
- /usr/include/LDAPResult.h
- /usr/include/LDAPSaslBindResult.h
- /usr/include/LDAPSchema.h
- /usr/include/LDAPSearchReference.h
- /usr/include/LDAPSearchResult.h
- /usr/include/LDAPSearchResults.h
- /usr/include/LDAPUrl.h
- /usr/include/LDAPUrlList.h
- /usr/include/LdifReader.h
- /usr/include/LdifWriter.h
- /usr/include/SaslInteraction.h
- /usr/include/SaslInteractionHandler.h
- /usr/include/StringList.h
- /usr/include/TlsOptions.h
-)
-
-openldap_filecount() {
- local dir="$1"
- find "${dir}" -type f ! -name '.*' ! -name 'DB_CONFIG*' | wc -l
-}
-
-openldap_find_versiontags() {
- # scan for all datadirs
- openldap_datadirs=""
- if [ -f "${EROOT}"/etc/openldap/slapd.conf ]; then
- openldap_datadirs="$(awk '{if($1 == "directory") print $2 }' ${EROOT}/etc/openldap/slapd.conf)"
- fi
- openldap_datadirs="${openldap_datadirs} ${OPENLDAP_DEFAULTDIR_VERSIONTAG}"
-
- einfo
- einfo "Scanning datadir(s) from slapd.conf and"
- einfo "the default installdir for Versiontags"
- einfo "(${OPENLDAP_DEFAULTDIR_VERSIONTAG} may appear twice)"
- einfo
-
- # scan datadirs if we have a version tag
- openldap_found_tag=0
- have_files=0
- for each in ${openldap_datadirs}; do
- CURRENT_TAGDIR=${ROOT}`echo ${each} | sed "s:\/::"`
- CURRENT_TAG=${CURRENT_TAGDIR}/${OPENLDAP_VERSIONTAG}
- if [ -d ${CURRENT_TAGDIR} ] && [ ${openldap_found_tag} == 0 ] ; then
- einfo "- Checking ${each}..."
- if [ -r ${CURRENT_TAG} ] ; then
- # yey, we have one :)
- einfo " Found Versiontag in ${each}"
- source ${CURRENT_TAG}
- if [ "${OLDPF}" == "" ] ; then
- eerror "Invalid Versiontag found in ${CURRENT_TAGDIR}"
- eerror "Please delete it"
- eerror
- die "Please kill the invalid versiontag in ${CURRENT_TAGDIR}"
- fi
-
- OLD_MAJOR=`get_version_component_range 2-3 ${OLDPF}`
-
- [ $(openldap_filecount ${CURRENT_TAGDIR}) -gt 0 ] && have_files=1
-
- # are we on the same branch?
- if [ "${OLD_MAJOR}" != "${PV:0:3}" ] ; then
- ewarn " Versiontag doesn't match current major release!"
- if [[ "${have_files}" == "1" ]] ; then
- eerror " Versiontag says other major and you (probably) have datafiles!"
- echo
- openldap_upgrade_howto
- else
- einfo " No real problem, seems there's no database."
- fi
- else
- einfo " Versiontag is fine here :)"
- fi
- else
- einfo " Non-tagged dir ${each}"
- [ $(openldap_filecount ${each}) -gt 0 ] && have_files=1
- if [[ "${have_files}" == "1" ]] ; then
- einfo " EEK! Non-empty non-tagged datadir, counting `ls -a ${each} | wc -l` files"
- echo
-
- eerror
- eerror "Your OpenLDAP Installation has a non tagged datadir that"
- eerror "possibly contains a database at ${CURRENT_TAGDIR}"
- eerror
- eerror "Please export data if any entered and empty or remove"
- eerror "the directory, installation has been stopped so you"
- eerror "can take required action"
- eerror
- eerror "For a HOWTO on exporting the data, see instructions in the ebuild"
- eerror
- openldap_upgrade_howto
- die "Please move the datadir ${CURRENT_TAGDIR} away"
- fi
- fi
- einfo
- fi
- done
- [ "${have_files}" == "1" ] && einfo "DB files present" || einfo "No DB files present"
-
- # Now we must check for the major version of sys-libs/db linked against.
- SLAPD_PATH=${EROOT}/usr/$(get_libdir)/openldap/slapd
- if [ "${have_files}" == "1" -a -f "${SLAPD_PATH}" ]; then
- OLDVER="$(/usr/bin/ldd ${SLAPD_PATH} \
- | awk '/libdb-/{gsub("^libdb-","",$1);gsub(".so$","",$1);print $1}')"
- if use berkdb; then
- # find which one would be used
- for bdb_slot in $BDB_SLOTS ; do
- NEWVER="$(db_findver "=sys-libs/db-${bdb_slot}*")"
- [[ -n "$NEWVER" ]] && break
- done
- fi
- local fail=0
- if [ -z "${OLDVER}" -a -z "${NEWVER}" ]; then
- :
- # Nothing wrong here.
- elif [ -z "${OLDVER}" -a -n "${NEWVER}" ]; then
- eerror " Your existing version of OpenLDAP was not built against"
- eerror " any version of sys-libs/db, but the new one will build"
- eerror " against ${NEWVER} and your database may be inaccessible."
- echo
- fail=1
- elif [ -n "${OLDVER}" -a -z "${NEWVER}" ]; then
- eerror " Your existing version of OpenLDAP was built against"
- eerror " sys-libs/db:${OLDVER}, but the new one will not be"
- eerror " built against any version and your database may be"
- eerror " inaccessible."
- echo
- fail=1
- elif [ "${OLDVER}" != "${NEWVER}" ]; then
- eerror " Your existing version of OpenLDAP was built against"
- eerror " sys-libs/db:${OLDVER}, but the new one will build against"
- eerror " ${NEWVER} and your database would be inaccessible."
- echo
- fail=1
- fi
- [ "${fail}" == "1" ] && openldap_upgrade_howto
- fi
-
- echo
- einfo
- einfo "All datadirs are fine, proceeding with merge now..."
- einfo
-}
-
-openldap_upgrade_howto() {
- eerror
- eerror "A (possible old) installation of OpenLDAP was detected,"
- eerror "installation will not proceed for now."
- eerror
- eerror "As major version upgrades can corrupt your database,"
- eerror "you need to dump your database and re-create it afterwards."
- eerror
- eerror "Additionally, rebuilding against different major versions of the"
- eerror "sys-libs/db libraries will cause your database to be inaccessible."
- eerror ""
- d="$(date -u +%s)"
- l="/root/ldapdump.${d}"
- i="${l}.raw"
- eerror " 1. /etc/init.d/slurpd stop ; /etc/init.d/slapd stop"
- eerror " 2. slapcat -l ${i}"
- eerror " 3. egrep -v '^(entry|context)CSN:' <${i} >${l}"
- eerror " 4. mv /var/lib/openldap-data/ /var/lib/openldap-data-backup/"
- eerror " 5. emerge --update \=net-nds/${PF}"
- eerror " 6. etc-update, and ensure that you apply the changes"
- eerror " 7. slapadd -l ${l}"
- eerror " 8. chown ldap:ldap /var/lib/openldap-data/*"
- eerror " 9. /etc/init.d/slapd start"
- eerror "10. check that your data is intact."
- eerror "11. set up the new replication system."
- eerror
- if [ "${FORCE_UPGRADE}" != "1" ]; then
- die "You need to upgrade your database first"
- else
- eerror "You have the magical FORCE_UPGRADE=1 in place."
- eerror "Don't say you weren't warned about data loss."
- fi
-}
-
-pkg_setup() {
- if ! use sasl && use cxx ; then
- die "To build the ldapc++ library you must emerge openldap with sasl support"
- fi
- # Bug #322787
- if use minimal && ! has_version "net-nds/openldap" ; then
- einfo "No datadir scan needed, openldap not installed"
- elif use minimal && has_version "net-nds/openldap" && built_with_use net-nds/openldap minimal ; then
- einfo "Skipping scan for previous datadirs as requested by minimal useflag"
- else
- openldap_find_versiontags
- fi
-
- # The user/group are only used for running daemons which are
- # disabled in minimal builds, so elide the accounts too.
- if ! use minimal ; then
- enewgroup ldap 439
- enewuser ldap 439 -1 /usr/$(get_libdir)/openldap ldap
- fi
-}
-
-src_prepare() {
- # ensure correct SLAPI path by default
- sed -i -e 's,\(#define LDAPI_SOCK\).*,\1 "'"${EPREFIX}"'/var/run/openldap/slapd.sock",' \
- "${S}"/include/ldap_defaults.h
-
- epatch "${FILESDIR}"/${PN}-2.4.17-gcc44.patch
-
- epatch \
- "${FILESDIR}"/${PN}-2.2.14-perlthreadsfix.patch \
- "${FILESDIR}"/${PN}-2.4.15-ppolicy.patch
-
- # bug #116045 - still present in 2.4.28
- epatch "${FILESDIR}"/${PN}-2.4.35-contrib-smbk5pwd.patch
- # bug #408077 - samba4
- epatch "${FILESDIR}"/${PN}-2.4.35-contrib-samba4.patch
-
- # bug #189817
- epatch "${FILESDIR}"/${PN}-2.4.11-libldap_r.patch
-
- # bug #233633
- epatch "${FILESDIR}"/${PN}-2.4.17-fix-lmpasswd-gnutls-symbols.patch
-
- # bug #281495
- epatch "${FILESDIR}"/${PN}-2.4.28-gnutls-gcrypt.patch
-
- # bug #294350
- epatch "${FILESDIR}"/${PN}-2.4.6-evolution-ntlm.patch
-
- # unbreak /bin/sh -> dash
- epatch "${FILESDIR}"/${PN}-2.4.28-fix-dash.patch
-
- # bug #420959
- epatch "${FILESDIR}"/${PN}-2.4.31-gcc47.patch
-
- # bug #421463
- #epatch "${FILESDIR}"/${PN}-2.4.33-gnutls.patch # merged upstream
-
- # unbundle lmdb
- epatch "${FILESDIR}"/${P}-mdb-unbundle.patch
- rm -rf "${S}"/libraries/liblmdb
-
- cd "${S}"/build || die
- einfo "Making sure upstream build strip does not do stripping too early"
- sed -i.orig \
- -e '/^STRIP/s,-s,,g' \
- top.mk || die "Failed to block stripping"
-
- # wrong assumption that /bin/sh is /bin/bash
- sed -i \
- -e 's|/bin/sh|/bin/bash|g' \
- "${S}"/tests/scripts/* || die "sed failed"
-
- cd "${S}" || die
-
- AT_NOEAUTOMAKE=yes eautoreconf
-}
-
-build_contrib_module() {
- # <dir> <sources> <outputname>
- cd "${S}/contrib/slapd-modules/$1" || die
- einfo "Compiling contrib-module: $3"
- # Make sure it's uppercase
- local define_name="$(echo "SLAPD_OVER_${1}" | LC_ALL=C tr '[:lower:]' '[:upper:]')"
- "${lt}" --mode=compile --tag=CC \
- "${CC}" \
- -D${define_name}=SLAPD_MOD_DYNAMIC \
- -I"${BUILD_DIR}"/include \
- -I../../../include -I../../../servers/slapd ${CFLAGS} \
- -o ${2%.c}.lo -c $2 || die "compiling $3 failed"
- einfo "Linking contrib-module: $3"
- "${lt}" --mode=link --tag=CC \
- "${CC}" -module \
- ${CFLAGS} \
- ${LDFLAGS} \
- -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
- -o $3.la ${2%.c}.lo || die "linking $3 failed"
-}
-
-src_configure() {
- #Fix for glibc-2.8 and ucred. Bug 228457.
- append-cppflags -D_GNU_SOURCE
-
- # Bug 408001
- use elibc_FreeBSD && append-cppflags -DMDB_DSYNC=O_SYNC -DMDB_FDATASYNC=fsync
-
- # connectionless ldap per bug #342439
- append-cppflags -DLDAP_CONNECTIONLESS
-
- multilib-minimal_src_configure
-}
-
-multilib_src_configure() {
- local myconf=()
-
- use debug && myconf+=( $(use_enable debug) )
-
- # ICU usage is not configurable
- export ac_cv_header_unicode_utypes_h="$(multilib_is_native_abi && use icu && echo yes || echo no)"
-
- if ! use minimal && multilib_is_native_abi; then
- local CPPFLAGS=${CPPFLAGS}
-
- # re-enable serverside overlay chains per bug #296567
- # see ldap docs chaper 12.3.1 for details
- myconf+=( --enable-ldap )
-
- # backends
- myconf+=( --enable-slapd )
- if use berkdb ; then
- einfo "Using Berkeley DB for local backend"
- myconf+=( --enable-bdb --enable-hdb )
- DBINCLUDE=$(db_includedir $BDB_SLOTS)
- einfo "Using $DBINCLUDE for sys-libs/db version"
- # We need to include the slotted db.h dir for FreeBSD
- append-cppflags -I${DBINCLUDE}
- else
- myconf+=( --disable-bdb --disable-hdb )
- fi
- for backend in dnssrv ldap mdb meta monitor null passwd relay shell sock; do
- myconf+=( --enable-${backend}=mod )
- done
-
- myconf+=( $(use_enable perl perl mod) )
-
- myconf+=( $(use_enable odbc sql mod) )
- if use odbc ; then
- local odbc_lib="unixodbc"
- if use iodbc ; then
- odbc_lib="iodbc"
- append-cppflags -I"${EPREFIX}"/usr/include/iodbc
- fi
- myconf+=( --with-odbc=${odbc_lib} )
- fi
-
- # slapd options
- myconf+=(
- $(use_enable crypt)
- $(use_enable slp)
- $(use_enable samba lmpasswd)
- $(use_enable syslog)
- )
- if use experimental ; then
- myconf+=(
- --enable-dynacl
- --enable-aci=mod
- )
- fi
- for option in aci cleartext modules rewrite rlookups slapi; do
- myconf+=( --enable-${option} )
- done
-
- # slapd overlay options
- # Compile-in the syncprov, the others as module
- myconf+=( --enable-syncprov=yes )
- use overlays && myconf+=( --enable-overlays=mod )
-
- else
- myconf+=(
- --disable-backends
- --disable-slapd
- --disable-bdb
- --disable-hdb
- --disable-mdb
- --disable-overlays
- --disable-syslog
- )
- fi
-
- # basic functionality stuff
- myconf+=(
- $(use_enable ipv6)
- $(multilib_native_use_with sasl cyrus-sasl)
- $(multilib_native_use_enable sasl spasswd)
- $(use_enable tcpd wrappers)
- )
-
- # Some cross-compiling tests don't pan out well.
- tc-is-cross-compiler && myconf+=(
- --with-yielding-select=yes
- )
-
- local ssl_lib="no"
- if use ssl || ( ! use minimal && use samba ) ; then
- ssl_lib="openssl"
- use gnutls && ssl_lib="gnutls"
- fi
-
- myconf+=( --with-tls=${ssl_lib} )
-
- for basicflag in dynamic local proctitle shared; do
- myconf+=( --enable-${basicflag} )
- done
-
- tc-export AR CC CXX
- ECONF_SOURCE=${S} \
- STRIP=/bin/true \
- econf \
- --libexecdir="${EPREFIX}"/usr/$(get_libdir)/openldap \
- $(use_enable static-libs static) \
- "${myconf[@]}"
- emake depend
-}
-
-src_configure_cxx() {
- # This needs the libraries built by the first build run.
- # So we have to run it AFTER the main build, not just after the main
- # configure.
- local myconf_ldapcpp=(
- --with-ldap-includes="${S}"/include
- )
-
- mkdir -p "${BUILD_DIR}"/contrib/ldapc++ || die
- cd "${BUILD_DIR}/contrib/ldapc++" || die
-
- local LDFLAGS=${LDFLAGS} CPPFLAGS=${CPPFLAGS}
- append-ldflags -L"${BUILD_DIR}"/libraries/liblber/.libs \
- -L"${BUILD_DIR}"/libraries/libldap/.libs
- append-cppflags -I"${BUILD_DIR}"/include
- ECONF_SOURCE=${S}/contrib/ldapc++ \
- econf "${myconf_ldapcpp[@]}" \
- CC="${CC}" \
- CXX="${CXX}"
-}
-
-multilib_src_compile() {
- tc-export AR CC CXX
- emake CC="${CC}" AR="${AR}" SHELL="${EPREFIX}"/bin/bash
- local lt="${BUILD_DIR}/libtool"
- export echo="echo"
-
- if ! use minimal && multilib_is_native_abi ; then
- if use cxx ; then
- einfo "Building contrib library: ldapc++"
- src_configure_cxx
- cd "${BUILD_DIR}/contrib/ldapc++" || die
- emake \
- CC="${CC}" CXX="${CXX}"
- fi
-
- if use smbkrb5passwd ; then
- einfo "Building contrib-module: smbk5pwd"
- cd "${S}/contrib/slapd-modules/smbk5pwd" || die
-
- MY_DEFS="-DDO_SHADOW"
- if use samba ; then
- MY_DEFS="${MY_DEFS} -DDO_SAMBA"
- MY_KRB5_INC=""
- fi
- if use kerberos ; then
- MY_DEFS="${MY_DEFS} -DDO_KRB5"
- MY_KRB5_INC="$(krb5-config --cflags)"
- fi
-
- emake \
- DEFS="${MY_DEFS}" \
- KRB5_INC="${MY_KRB5_INC}" \
- LDAP_BUILD="${BUILD_DIR}" \
- CC="${CC}" libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap"
- fi
-
- if use overlays ; then
- einfo "Building contrib-module: samba4"
- cd "${S}/contrib/slapd-modules/samba4" || die
-
- emake \
- LDAP_BUILD="${BUILD_DIR}" \
- CC="${CC}" libexecdir="/usr/$(get_libdir)/openldap"
- fi
-
- if use kerberos ; then
- build_contrib_module "kinit" "kinit.c" "kinit"
- cd "${S}/contrib/slapd-modules/passwd" || die
- einfo "Compiling contrib-module: pw-kerberos"
- "${lt}" --mode=compile --tag=CC \
- "${CC}" \
- -I"${BUILD_DIR}"/include \
- -I../../../include \
- ${CFLAGS} \
- $(krb5-config --cflags) \
- -DHAVE_KRB5 \
- -o kerberos.lo \
- -c kerberos.c || die "compiling pw-kerberos failed"
- einfo "Linking contrib-module: pw-kerberos"
- "${lt}" --mode=link --tag=CC \
- "${CC}" -module \
- ${CFLAGS} \
- ${LDFLAGS} \
- -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
- -o pw-kerberos.la \
- kerberos.lo || die "linking pw-kerberos failed"
- fi
- # We could build pw-radius if GNURadius would install radlib.h
- cd "${S}/contrib/slapd-modules/passwd" || die
- einfo "Compiling contrib-module: pw-netscape"
- "${lt}" --mode=compile --tag=CC \
- "${CC}" \
- -I"${BUILD_DIR}"/include \
- -I../../../include \
- ${CFLAGS} \
- -o netscape.lo \
- -c netscape.c || die "compiling pw-netscape failed"
- einfo "Linking contrib-module: pw-netscape"
- "${lt}" --mode=link --tag=CC \
- "${CC}" -module \
- ${CFLAGS} \
- ${LDFLAGS} \
- -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
- -o pw-netscape.la \
- netscape.lo || die "linking pw-netscape failed"
-
- #build_contrib_module "acl" "posixgroup.c" "posixGroup" # example code only
- #build_contrib_module "acl" "gssacl.c" "gss" # example code only, also needs kerberos
- build_contrib_module "addpartial" "addpartial-overlay.c" "addpartial-overlay"
- build_contrib_module "allop" "allop.c" "overlay-allop"
- build_contrib_module "allowed" "allowed.c" "allowed"
- build_contrib_module "autogroup" "autogroup.c" "autogroup"
- build_contrib_module "cloak" "cloak.c" "cloak"
- # build_contrib_module "comp_match" "comp_match.c" "comp_match" # really complex, adds new external deps, questionable demand
- build_contrib_module "denyop" "denyop.c" "denyop-overlay"
- build_contrib_module "dsaschema" "dsaschema.c" "dsaschema-plugin"
- build_contrib_module "dupent" "dupent.c" "dupent"
- build_contrib_module "lastbind" "lastbind.c" "lastbind"
- # lastmod may not play well with other overlays
- build_contrib_module "lastmod" "lastmod.c" "lastmod"
- build_contrib_module "noopsrch" "noopsrch.c" "noopsrch"
- build_contrib_module "nops" "nops.c" "nops-overlay"
- #build_contrib_module "nssov" "nssov.c" "nssov-overlay" RESO:LATER
- build_contrib_module "trace" "trace.c" "trace"
- # build slapi-plugins
- cd "${S}/contrib/slapi-plugins/addrdnvalues" || die
- einfo "Building contrib-module: addrdnvalues plugin"
- "${CC}" -shared \
- -I"${BUILD_DIR}"/include \
- -I../../../include \
- ${CFLAGS} \
- -fPIC \
- ${LDFLAGS} \
- -o libaddrdnvalues-plugin.so \
- addrdnvalues.c || die "Building libaddrdnvalues-plugin.so failed"
-
- fi
-}
-
-multilib_src_test() {
- if multilib_is_native_abi; then
- cd tests || die
- emake tests || die "make tests failed"
- fi
-}
-
-multilib_src_install() {
- local lt="${BUILD_DIR}/libtool"
- emake DESTDIR="${D}" SHELL="${EPREFIX}"/bin/bash install
- use static-libs || prune_libtool_files --all
-
- if ! use minimal && multilib_is_native_abi; then
- # openldap modules go here
- # TODO: write some code to populate slapd.conf with moduleload statements
- keepdir /usr/$(get_libdir)/openldap/openldap/
-
- # initial data storage dir
- keepdir /var/lib/openldap-data
- use prefix || fowners ldap:ldap /var/lib/openldap-data
- fperms 0700 /var/lib/openldap-data
-
- echo "OLDPF='${PF}'" > "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
- echo "# do NOT delete this. it is used" >> "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
- echo "# to track versions for upgrading." >> "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
-
- # use our config
- rm "${ED}"etc/openldap/slapd.conf
- insinto /etc/openldap
- newins "${FILESDIR}"/${PN}-2.4.40-slapd-conf slapd.conf
- configfile="${ED}"etc/openldap/slapd.conf
-
- # populate with built backends
- ebegin "populate config with built backends"
- for x in "${ED}"usr/$(get_libdir)/openldap/openldap/back_*.so; do
- einfo "Adding $(basename ${x})"
- sed -e "/###INSERTDYNAMICMODULESHERE###$/a# moduleload\t$(basename ${x})" -i "${configfile}"
- done
- sed -e "s:###INSERTDYNAMICMODULESHERE###$:# modulepath\t${EPREFIX}/usr/$(get_libdir)/openldap/openldap:" -i "${configfile}"
- use prefix || fowners root:ldap /etc/openldap/slapd.conf
- fperms 0640 /etc/openldap/slapd.conf
- cp "${configfile}" "${configfile}".default
- eend
-
- # install our own init scripts and systemd unit files
- einfo "Install init scripts"
- newinitd "${FILESDIR}"/slapd-initd-2.4.40-r2 slapd
- newconfd "${FILESDIR}"/slapd-confd-2.4.28-r1 slapd
- einfo "Install systemd service"
- systemd_dounit "${FILESDIR}"/slapd.service
- systemd_install_serviced "${FILESDIR}"/slapd.service.conf
- systemd_newtmpfilesd "${FILESDIR}"/slapd.tmpfilesd slapd.conf
-
- if [[ $(get_libdir) != lib ]]; then
- sed -e "s,/usr/lib/,/usr/$(get_libdir)/," -i \
- "${ED}"/etc/init.d/slapd \
- "${ED}"/usr/lib/systemd/system/slapd.service || die
- fi
- # If built without SLP, we don't need to be before avahi
- use slp \
- || sed -i \
- -e '/before/{s/avahi-daemon//g}' \
- "${ED}"etc/init.d/slapd
-
- if use cxx ; then
- einfo "Install the ldapc++ library"
- cd "${BUILD_DIR}/contrib/ldapc++" || die
- emake DESTDIR="${D}" libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" install
- cd "${S}"/contrib/ldapc++ || die
- newdoc README ldapc++-README
- fi
-
- if use smbkrb5passwd ; then
- einfo "Install the smbk5pwd module"
- cd "${S}/contrib/slapd-modules/smbk5pwd" || die
- emake DESTDIR="${D}" \
- LDAP_BUILD="${BUILD_DIR}" \
- libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" install
- newdoc README smbk5pwd-README
- fi
-
- if use overlays ; then
- einfo "Install the samba4 module"
- cd "${S}/contrib/slapd-modules/samba4" || die
- emake DESTDIR="${D}" \
- LDAP_BUILD="${BUILD_DIR}" \
- libexecdir="/usr/$(get_libdir)/openldap" install
- newdoc README samba4-README
- fi
-
- einfo "Installing contrib modules"
- cd "${S}/contrib/slapd-modules" || die
- for l in */*.la; do
- "${lt}" --mode=install cp ${l} \
- "${ED}"usr/$(get_libdir)/openldap/openldap || \
- die "installing ${l} failed"
- done
-
- dodoc "${FILESDIR}"/DB_CONFIG.fast.example
- docinto contrib
- doman */*.5
- #newdoc acl/README*
- newdoc addpartial/README addpartial-README
- newdoc allop/README allop-README
- newdoc allowed/README allowed-README
- newdoc autogroup/README autogroup-README
- newdoc dsaschema/README dsaschema-README
- newdoc passwd/README passwd-README
- cd "${S}/contrib/slapi-plugins" || die
- insinto /usr/$(get_libdir)/openldap/openldap
- doins */*.so
- docinto contrib
- newdoc addrdnvalues/README addrdnvalues-README
-
- insinto /etc/openldap/schema
- newins "${DISTDIR}"/${BIS_P} ${BIS_PN}
-
- docinto back-sock ; dodoc "${S}"/servers/slapd/back-sock/searchexample*
- docinto back-shell ; dodoc "${S}"/servers/slapd/back-shell/searchexample*
- docinto back-perl ; dodoc "${S}"/servers/slapd/back-perl/SampleLDAP.pm
-
- dosbin "${S}"/contrib/slapd-tools/statslog
- newdoc "${S}"/contrib/slapd-tools/README README.statslog
- fi
-}
-
-multilib_src_install_all() {
- dodoc ANNOUNCEMENT CHANGES COPYRIGHT README
- docinto rfc ; dodoc doc/rfc/*.txt
-}
-
-pkg_preinst() {
- # keep old libs if any
- preserve_old_lib /usr/$(get_libdir)/{liblber,libldap_r,liblber}-2.3$(get_libname 0)
- # bug 440470, only display the getting started help there was no openldap before,
- # or we are going to a non-minimal build
- ! has_version net-nds/openldap || has_version 'net-nds/openldap[minimal]'
- OPENLDAP_PRINT_MESSAGES=$((! $?))
-}
-
-pkg_postinst() {
- if ! use minimal ; then
- # You cannot build SSL certificates during src_install that will make
- # binary packages containing your SSL key, which is both a security risk
- # and a misconfiguration if multiple machines use the same key and cert.
- if use ssl; then
- install_cert /etc/openldap/ssl/ldap
- use prefix || chown ldap:ldap "${EROOT}"etc/openldap/ssl/ldap.*
- ewarn "Self-signed SSL certificates are treated harshly by OpenLDAP 2.[12]"
- ewarn "Self-signed SSL certificates are treated harshly by OpenLDAP 2.[12]"
- ewarn "add 'TLS_REQCERT allow' if you want to use them."
- fi
-
- if use prefix; then
- # Warn about prefix issues with slapd
- eerror "slapd might NOT be usable on Prefix systems as it requires root privileges"
- eerror "to start up, and requires that certain files directories be owned by"
- eerror "ldap:ldap. As Prefix does not support changing ownership of files and"
- eerror "directories, you will have to manually fix this yourself."
- fi
-
- # These lines force the permissions of various content to be correct
- use prefix || chown ldap:ldap "${EROOT}"var/run/openldap
- chmod 0755 "${EROOT}"var/run/openldap
- use prefix || chown root:ldap "${EROOT}"etc/openldap/slapd.conf{,.default}
- chmod 0640 "${EROOT}"etc/openldap/slapd.conf{,.default}
- use prefix || chown ldap:ldap "${EROOT}"var/lib/openldap-data
- fi
-
- if has_version 'net-nds/openldap[-minimal]' && ((${OPENLDAP_PRINT_MESSAGES})); then
- elog "Getting started using OpenLDAP? There is some documentation available:"
- elog "Gentoo Guide to OpenLDAP Authentication"
- elog "(https://www.gentoo.org/doc/en/ldap-howto.xml)"
- elog "---"
- elog "An example file for tuning BDB backends with openldap is"
- elog "DB_CONFIG.fast.example in /usr/share/doc/${PF}/"
- fi
-
- preserve_old_lib_notify /usr/$(get_libdir)/{liblber,libldap,libldap_r}-2.3$(get_libname 0)
-}
diff --git a/net-nds/openldap/openldap-2.4.40.ebuild b/net-nds/openldap/openldap-2.4.40.ebuild
deleted file mode 100644
index 5c7a172feec7..000000000000
--- a/net-nds/openldap/openldap-2.4.40.ebuild
+++ /dev/null
@@ -1,822 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI="5"
-
-inherit db-use eutils flag-o-matic multilib multilib-minimal ssl-cert versionator toolchain-funcs autotools user systemd
-
-BIS_PN=rfc2307bis.schema
-BIS_PV=20140524
-BIS_P="${BIS_PN}-${BIS_PV}"
-
-DESCRIPTION="LDAP suite of application and development tools"
-HOMEPAGE="http://www.OpenLDAP.org/"
-
-# mirrors are mostly not working, using canonical URI
-SRC_URI="ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/${P}.tgz
- mirror://gentoo/${BIS_P}"
-
-LICENSE="OPENLDAP GPL-2"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~x86-solaris"
-
-IUSE_DAEMON="crypt icu samba slp tcpd experimental minimal"
-IUSE_BACKEND="+berkdb"
-IUSE_OVERLAY="overlays perl"
-IUSE_OPTIONAL="gnutls iodbc sasl ssl odbc debug ipv6 +syslog selinux static-libs"
-IUSE_CONTRIB="smbkrb5passwd kerberos"
-IUSE_CONTRIB="${IUSE_CONTRIB} -cxx"
-IUSE="${IUSE_DAEMON} ${IUSE_BACKEND} ${IUSE_OVERLAY} ${IUSE_OPTIONAL} ${IUSE_CONTRIB}"
-
-REQUIRED_USE="cxx? ( sasl )"
-
-# openssl is needed to generate lanman-passwords required by samba
-CDEPEND="icu? ( dev-libs/icu:= )
- ssl? ( !gnutls? ( >=dev-libs/openssl-1.0.1h-r2[${MULTILIB_USEDEP}] )
- gnutls? ( >=net-libs/gnutls-2.12.23-r6[${MULTILIB_USEDEP}] >=dev-libs/libgcrypt-1.5.3:0[${MULTILIB_USEDEP}] ) )
- sasl? ( dev-libs/cyrus-sasl:= )
- !minimal? (
- sys-devel/libtool
- sys-libs/e2fsprogs-libs
- tcpd? ( sys-apps/tcp-wrappers )
- odbc? ( !iodbc? ( dev-db/unixODBC )
- iodbc? ( dev-db/libiodbc ) )
- slp? ( net-libs/openslp )
- perl? ( dev-lang/perl:=[-build(-)] )
- samba? ( dev-libs/openssl )
- berkdb? ( sys-libs/db )
- smbkrb5passwd? (
- dev-libs/openssl
- kerberos? ( app-crypt/heimdal )
- )
- kerberos? ( virtual/krb5 )
- cxx? ( dev-libs/cyrus-sasl:= )
- )
- abi_x86_32? (
- !<=app-emulation/emul-linux-x86-baselibs-20140508-r3
- !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
- )"
-DEPEND="${CDEPEND}
- sys-apps/groff"
-RDEPEND="${CDEPEND}
- selinux? ( sec-policy/selinux-ldap )
-"
-# for tracking versions
-OPENLDAP_VERSIONTAG=".version-tag"
-OPENLDAP_DEFAULTDIR_VERSIONTAG="/var/lib/openldap-data"
-
-MULTILIB_WRAPPED_HEADERS=(
- # USE=cxx
- /usr/include/LDAPAsynConnection.h
- /usr/include/LDAPAttrType.h
- /usr/include/LDAPAttribute.h
- /usr/include/LDAPAttributeList.h
- /usr/include/LDAPConnection.h
- /usr/include/LDAPConstraints.h
- /usr/include/LDAPControl.h
- /usr/include/LDAPControlSet.h
- /usr/include/LDAPEntry.h
- /usr/include/LDAPEntryList.h
- /usr/include/LDAPException.h
- /usr/include/LDAPExtResult.h
- /usr/include/LDAPMessage.h
- /usr/include/LDAPMessageQueue.h
- /usr/include/LDAPModList.h
- /usr/include/LDAPModification.h
- /usr/include/LDAPObjClass.h
- /usr/include/LDAPRebind.h
- /usr/include/LDAPRebindAuth.h
- /usr/include/LDAPReferenceList.h
- /usr/include/LDAPResult.h
- /usr/include/LDAPSaslBindResult.h
- /usr/include/LDAPSchema.h
- /usr/include/LDAPSearchReference.h
- /usr/include/LDAPSearchResult.h
- /usr/include/LDAPSearchResults.h
- /usr/include/LDAPUrl.h
- /usr/include/LDAPUrlList.h
- /usr/include/LdifReader.h
- /usr/include/LdifWriter.h
- /usr/include/SaslInteraction.h
- /usr/include/SaslInteractionHandler.h
- /usr/include/StringList.h
- /usr/include/TlsOptions.h
-
- # USE=-minimal
- /usr/include/lmdb.h
-)
-
-openldap_filecount() {
- local dir="$1"
- find "${dir}" -type f ! -name '.*' ! -name 'DB_CONFIG*' | wc -l
-}
-
-openldap_find_versiontags() {
- # scan for all datadirs
- openldap_datadirs=""
- if [ -f "${EROOT}"/etc/openldap/slapd.conf ]; then
- openldap_datadirs="$(awk '{if($1 == "directory") print $2 }' ${EROOT}/etc/openldap/slapd.conf)"
- fi
- openldap_datadirs="${openldap_datadirs} ${OPENLDAP_DEFAULTDIR_VERSIONTAG}"
-
- einfo
- einfo "Scanning datadir(s) from slapd.conf and"
- einfo "the default installdir for Versiontags"
- einfo "(${OPENLDAP_DEFAULTDIR_VERSIONTAG} may appear twice)"
- einfo
-
- # scan datadirs if we have a version tag
- openldap_found_tag=0
- have_files=0
- for each in ${openldap_datadirs}; do
- CURRENT_TAGDIR=${ROOT}`echo ${each} | sed "s:\/::"`
- CURRENT_TAG=${CURRENT_TAGDIR}/${OPENLDAP_VERSIONTAG}
- if [ -d ${CURRENT_TAGDIR} ] && [ ${openldap_found_tag} == 0 ] ; then
- einfo "- Checking ${each}..."
- if [ -r ${CURRENT_TAG} ] ; then
- # yey, we have one :)
- einfo " Found Versiontag in ${each}"
- source ${CURRENT_TAG}
- if [ "${OLDPF}" == "" ] ; then
- eerror "Invalid Versiontag found in ${CURRENT_TAGDIR}"
- eerror "Please delete it"
- eerror
- die "Please kill the invalid versiontag in ${CURRENT_TAGDIR}"
- fi
-
- OLD_MAJOR=`get_version_component_range 2-3 ${OLDPF}`
-
- [ $(openldap_filecount ${CURRENT_TAGDIR}) -gt 0 ] && have_files=1
-
- # are we on the same branch?
- if [ "${OLD_MAJOR}" != "${PV:0:3}" ] ; then
- ewarn " Versiontag doesn't match current major release!"
- if [[ "${have_files}" == "1" ]] ; then
- eerror " Versiontag says other major and you (probably) have datafiles!"
- echo
- openldap_upgrade_howto
- else
- einfo " No real problem, seems there's no database."
- fi
- else
- einfo " Versiontag is fine here :)"
- fi
- else
- einfo " Non-tagged dir ${each}"
- [ $(openldap_filecount ${each}) -gt 0 ] && have_files=1
- if [[ "${have_files}" == "1" ]] ; then
- einfo " EEK! Non-empty non-tagged datadir, counting `ls -a ${each} | wc -l` files"
- echo
-
- eerror
- eerror "Your OpenLDAP Installation has a non tagged datadir that"
- eerror "possibly contains a database at ${CURRENT_TAGDIR}"
- eerror
- eerror "Please export data if any entered and empty or remove"
- eerror "the directory, installation has been stopped so you"
- eerror "can take required action"
- eerror
- eerror "For a HOWTO on exporting the data, see instructions in the ebuild"
- eerror
- openldap_upgrade_howto
- die "Please move the datadir ${CURRENT_TAGDIR} away"
- fi
- fi
- einfo
- fi
- done
- [ "${have_files}" == "1" ] && einfo "DB files present" || einfo "No DB files present"
-
- # Now we must check for the major version of sys-libs/db linked against.
- SLAPD_PATH=${EROOT}/usr/$(get_libdir)/openldap/slapd
- if [ "${have_files}" == "1" -a -f "${SLAPD_PATH}" ]; then
- OLDVER="$(/usr/bin/ldd ${SLAPD_PATH} \
- | awk '/libdb-/{gsub("^libdb-","",$1);gsub(".so$","",$1);print $1}')"
- NEWVER="$(use berkdb && db_findver sys-libs/db)"
- local fail=0
- if [ -z "${OLDVER}" -a -z "${NEWVER}" ]; then
- :
- # Nothing wrong here.
- elif [ -z "${OLDVER}" -a -n "${NEWVER}" ]; then
- eerror " Your existing version of OpenLDAP was not built against"
- eerror " any version of sys-libs/db, but the new one will build"
- eerror " against ${NEWVER} and your database may be inaccessible."
- echo
- fail=1
- elif [ -n "${OLDVER}" -a -z "${NEWVER}" ]; then
- eerror " Your existing version of OpenLDAP was built against"
- eerror " sys-libs/db:${OLDVER}, but the new one will not be"
- eerror " built against any version and your database may be"
- eerror " inaccessible."
- echo
- fail=1
- elif [ "${OLDVER}" != "${NEWVER}" ]; then
- eerror " Your existing version of OpenLDAP was built against"
- eerror " sys-libs/db:${OLDVER}, but the new one will build against"
- eerror " ${NEWVER} and your database would be inaccessible."
- echo
- fail=1
- fi
- [ "${fail}" == "1" ] && openldap_upgrade_howto
- fi
-
- echo
- einfo
- einfo "All datadirs are fine, proceeding with merge now..."
- einfo
-}
-
-openldap_upgrade_howto() {
- eerror
- eerror "A (possible old) installation of OpenLDAP was detected,"
- eerror "installation will not proceed for now."
- eerror
- eerror "As major version upgrades can corrupt your database,"
- eerror "you need to dump your database and re-create it afterwards."
- eerror
- eerror "Additionally, rebuilding against different major versions of the"
- eerror "sys-libs/db libraries will cause your database to be inaccessible."
- eerror ""
- d="$(date -u +%s)"
- l="/root/ldapdump.${d}"
- i="${l}.raw"
- eerror " 1. /etc/init.d/slurpd stop ; /etc/init.d/slapd stop"
- eerror " 2. slapcat -l ${i}"
- eerror " 3. egrep -v '^(entry|context)CSN:' <${i} >${l}"
- eerror " 4. mv /var/lib/openldap-data/ /var/lib/openldap-data-backup/"
- eerror " 5. emerge --update \=net-nds/${PF}"
- eerror " 6. etc-update, and ensure that you apply the changes"
- eerror " 7. slapadd -l ${l}"
- eerror " 8. chown ldap:ldap /var/lib/openldap-data/*"
- eerror " 9. /etc/init.d/slapd start"
- eerror "10. check that your data is intact."
- eerror "11. set up the new replication system."
- eerror
- if [ "${FORCE_UPGRADE}" != "1" ]; then
- die "You need to upgrade your database first"
- else
- eerror "You have the magical FORCE_UPGRADE=1 in place."
- eerror "Don't say you weren't warned about data loss."
- fi
-}
-
-pkg_setup() {
- if ! use sasl && use cxx ; then
- die "To build the ldapc++ library you must emerge openldap with sasl support"
- fi
- # Bug #322787
- if use minimal && ! has_version "net-nds/openldap" ; then
- einfo "No datadir scan needed, openldap not installed"
- elif use minimal && has_version "net-nds/openldap" && built_with_use net-nds/openldap minimal ; then
- einfo "Skipping scan for previous datadirs as requested by minimal useflag"
- else
- openldap_find_versiontags
- fi
-
- # The user/group are only used for running daemons which are
- # disabled in minimal builds, so elide the accounts too.
- if ! use minimal ; then
- enewgroup ldap 439
- enewuser ldap 439 -1 /usr/$(get_libdir)/openldap ldap
- fi
-}
-
-src_prepare() {
- # ensure correct SLAPI path by default
- sed -i -e 's,\(#define LDAPI_SOCK\).*,\1 "'"${EPREFIX}"'/var/run/openldap/slapd.sock",' \
- "${S}"/include/ldap_defaults.h
-
- epatch "${FILESDIR}"/${PN}-2.4.17-gcc44.patch
-
- epatch \
- "${FILESDIR}"/${PN}-2.2.14-perlthreadsfix.patch \
- "${FILESDIR}"/${PN}-2.4.15-ppolicy.patch
-
- # bug #116045 - still present in 2.4.28
- epatch "${FILESDIR}"/${PN}-2.4.35-contrib-smbk5pwd.patch
- # bug #408077 - samba4
- epatch "${FILESDIR}"/${PN}-2.4.35-contrib-samba4.patch
-
- # bug #189817
- epatch "${FILESDIR}"/${PN}-2.4.11-libldap_r.patch
-
- # bug #233633
- epatch "${FILESDIR}"/${PN}-2.4.17-fix-lmpasswd-gnutls-symbols.patch
-
- # bug #281495
- epatch "${FILESDIR}"/${PN}-2.4.28-gnutls-gcrypt.patch
-
- # bug #294350
- epatch "${FILESDIR}"/${PN}-2.4.6-evolution-ntlm.patch
-
- # unbreak /bin/sh -> dash
- epatch "${FILESDIR}"/${PN}-2.4.28-fix-dash.patch
-
- # bug #420959
- epatch "${FILESDIR}"/${PN}-2.4.31-gcc47.patch
-
- # bug #421463
- #epatch "${FILESDIR}"/${PN}-2.4.33-gnutls.patch # merged upstream
-
- sed -i.orig \
- -e '/IDOCS.*DESTDIR/s,/man/man1,/share/man/man1,g' \
- -e '/ILIBS.*DESTDIR/s,/lib,/$(LIBDIR),g' \
- "${S}"/libraries/liblmdb/Makefile \
- || die "Failed to fix LMDB manpage install location"
-
- cd "${S}"/build || die
- einfo "Making sure upstream build strip does not do stripping too early"
- sed -i.orig \
- -e '/^STRIP/s,-s,,g' \
- top.mk || die "Failed to block stripping"
-
- # wrong assumption that /bin/sh is /bin/bash
- sed -i \
- -e 's|/bin/sh|/bin/bash|g' \
- "${S}"/tests/scripts/* || die "sed failed"
-
- cd "${S}" || die
- AT_NOEAUTOMAKE=yes eautoreconf
-}
-
-build_contrib_module() {
- # <dir> <sources> <outputname>
- cd "${S}/contrib/slapd-modules/$1" || die
- einfo "Compiling contrib-module: $3"
- # Make sure it's uppercase
- local define_name="$(echo "SLAPD_OVER_${1}" | LC_ALL=C tr '[:lower:]' '[:upper:]')"
- "${lt}" --mode=compile --tag=CC \
- "${CC}" \
- -D${define_name}=SLAPD_MOD_DYNAMIC \
- -I"${BUILD_DIR}"/include \
- -I../../../include -I../../../servers/slapd ${CFLAGS} \
- -o ${2%.c}.lo -c $2 || die "compiling $3 failed"
- einfo "Linking contrib-module: $3"
- "${lt}" --mode=link --tag=CC \
- "${CC}" -module \
- ${CFLAGS} \
- ${LDFLAGS} \
- -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
- -o $3.la ${2%.c}.lo || die "linking $3 failed"
-}
-
-src_configure() {
- #Fix for glibc-2.8 and ucred. Bug 228457.
- append-cppflags -D_GNU_SOURCE
-
- # Bug 408001
- use elibc_FreeBSD && append-cppflags -DMDB_DSYNC=O_SYNC -DMDB_FDATASYNC=fsync
-
- # connectionless ldap per bug #342439
- append-cppflags -DLDAP_CONNECTIONLESS
-
- multilib-minimal_src_configure
-}
-
-multilib_src_configure() {
- local myconf=()
-
- use debug && myconf+=( $(use_enable debug) )
-
- # ICU usage is not configurable
- export ac_cv_header_unicode_utypes_h="$(multilib_is_native_abi && use icu && echo yes || echo no)"
-
- if ! use minimal && multilib_is_native_abi; then
- local CPPFLAGS=${CPPFLAGS}
-
- # re-enable serverside overlay chains per bug #296567
- # see ldap docs chaper 12.3.1 for details
- myconf+=( --enable-ldap )
-
- # backends
- myconf+=( --enable-slapd )
- if use berkdb ; then
- einfo "Using Berkeley DB for local backend"
- myconf+=( --enable-bdb --enable-hdb )
- # We need to include the slotted db.h dir for FreeBSD
- append-cppflags -I$(db_includedir)
- else
- ewarn
- ewarn "Note: if you disable berkdb, you can only use remote-backends!"
- ewarn
- myconf+=( --disable-bdb --disable-hdb )
- fi
- for backend in dnssrv ldap mdb meta monitor null passwd relay shell sock; do
- myconf+=( --enable-${backend}=mod )
- done
-
- myconf+=( $(use_enable perl perl mod) )
-
- myconf+=( $(use_enable odbc sql mod) )
- if use odbc ; then
- local odbc_lib="unixodbc"
- if use iodbc ; then
- odbc_lib="iodbc"
- append-cppflags -I"${EPREFIX}"/usr/include/iodbc
- fi
- myconf+=( --with-odbc=${odbc_lib} )
- fi
-
- # slapd options
- myconf+=(
- $(use_enable crypt)
- $(use_enable slp)
- $(use_enable samba lmpasswd)
- $(use_enable syslog)
- )
- if use experimental ; then
- myconf+=(
- --enable-dynacl
- --enable-aci=mod
- )
- fi
- for option in aci cleartext modules rewrite rlookups slapi; do
- myconf+=( --enable-${option} )
- done
-
- # slapd overlay options
- # Compile-in the syncprov, the others as module
- myconf+=( --enable-syncprov=yes )
- use overlays && myconf+=( --enable-overlays=mod )
-
- else
- myconf+=(
- --disable-backends
- --disable-slapd
- --disable-bdb
- --disable-hdb
- --disable-mdb
- --disable-overlays
- --disable-syslog
- )
- fi
-
- # basic functionality stuff
- myconf+=(
- $(use_enable ipv6)
- $(multilib_native_use_with sasl cyrus-sasl)
- $(multilib_native_use_enable sasl spasswd)
- $(use_enable tcpd wrappers)
- )
-
- # Some cross-compiling tests don't pan out well.
- tc-is-cross-compiler && myconf+=(
- --with-yielding-select=yes
- )
-
- local ssl_lib="no"
- if use ssl || ( ! use minimal && use samba ) ; then
- ssl_lib="openssl"
- use gnutls && ssl_lib="gnutls"
- fi
-
- myconf+=( --with-tls=${ssl_lib} )
-
- for basicflag in dynamic local proctitle shared; do
- myconf+=( --enable-${basicflag} )
- done
-
- tc-export AR CC CXX
- ECONF_SOURCE=${S} \
- STRIP=/bin/true \
- econf \
- --libexecdir="${EPREFIX}"/usr/$(get_libdir)/openldap \
- $(use_enable static-libs static) \
- "${myconf[@]}"
- emake depend
-}
-
-src_configure_cxx() {
- # This needs the libraries built by the first build run.
- # So we have to run it AFTER the main build, not just after the main
- # configure.
- local myconf_ldapcpp=(
- --with-ldap-includes="${S}"/include
- )
-
- mkdir -p "${BUILD_DIR}"/contrib/ldapc++ || die
- cd "${BUILD_DIR}/contrib/ldapc++" || die
-
- local LDFLAGS=${LDFLAGS} CPPFLAGS=${CPPFLAGS}
- append-ldflags -L"${BUILD_DIR}"/libraries/liblber/.libs \
- -L"${BUILD_DIR}"/libraries/libldap/.libs
- append-cppflags -I"${BUILD_DIR}"/include
- ECONF_SOURCE=${S}/contrib/ldapc++ \
- econf "${myconf_ldapcpp[@]}" \
- CC="${CC}" \
- CXX="${CXX}"
-}
-
-multilib_src_compile() {
- tc-export AR CC CXX
- emake CC="${CC}" AR="${AR}" SHELL="${EPREFIX}"/bin/bash
- local lt="${BUILD_DIR}/libtool"
- export echo="echo"
-
- if ! use minimal && multilib_is_native_abi ; then
- if use cxx ; then
- einfo "Building contrib library: ldapc++"
- src_configure_cxx
- cd "${BUILD_DIR}/contrib/ldapc++" || die
- emake \
- CC="${CC}" CXX="${CXX}"
- fi
-
- # LMDB tools
- cp -ral "${S}"/libraries/liblmdb "${BUILD_DIR}"/libraries/liblmdb || die
- cd "${BUILD_DIR}"/libraries/liblmdb || die
- emake CC="${CC}" CXX="${CXX}" OPT="${CFLAGS}" prefix="${EPREFIX}/usr" DESTDIR="${D}" SHELL="${EPREFIX}"/bin/bash LIBDIR="$(get_libdir)"
-
- if use smbkrb5passwd ; then
- einfo "Building contrib-module: smbk5pwd"
- cd "${S}/contrib/slapd-modules/smbk5pwd" || die
-
- MY_DEFS="-DDO_SHADOW"
- if use samba ; then
- MY_DEFS="${MY_DEFS} -DDO_SAMBA"
- MY_KRB5_INC=""
- fi
- if use kerberos ; then
- MY_DEFS="${MY_DEFS} -DDO_KRB5"
- MY_KRB5_INC="$(krb5-config --cflags)"
- fi
-
- emake \
- DEFS="${MY_DEFS}" \
- KRB5_INC="${MY_KRB5_INC}" \
- LDAP_BUILD="${BUILD_DIR}" \
- CC="${CC}" libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap"
- fi
-
- if use overlays ; then
- einfo "Building contrib-module: samba4"
- cd "${S}/contrib/slapd-modules/samba4" || die
-
- emake \
- LDAP_BUILD="${BUILD_DIR}" \
- CC="${CC}" libexecdir="/usr/$(get_libdir)/openldap"
- fi
-
- if use kerberos ; then
- build_contrib_module "kinit" "kinit.c" "kinit"
- cd "${S}/contrib/slapd-modules/passwd" || die
- einfo "Compiling contrib-module: pw-kerberos"
- "${lt}" --mode=compile --tag=CC \
- "${CC}" \
- -I"${BUILD_DIR}"/include \
- -I../../../include \
- ${CFLAGS} \
- $(krb5-config --cflags) \
- -DHAVE_KRB5 \
- -o kerberos.lo \
- -c kerberos.c || die "compiling pw-kerberos failed"
- einfo "Linking contrib-module: pw-kerberos"
- "${lt}" --mode=link --tag=CC \
- "${CC}" -module \
- ${CFLAGS} \
- ${LDFLAGS} \
- -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
- -o pw-kerberos.la \
- kerberos.lo || die "linking pw-kerberos failed"
- fi
- # We could build pw-radius if GNURadius would install radlib.h
- cd "${S}/contrib/slapd-modules/passwd" || die
- einfo "Compiling contrib-module: pw-netscape"
- "${lt}" --mode=compile --tag=CC \
- "${CC}" \
- -I"${BUILD_DIR}"/include \
- -I../../../include \
- ${CFLAGS} \
- -o netscape.lo \
- -c netscape.c || die "compiling pw-netscape failed"
- einfo "Linking contrib-module: pw-netscape"
- "${lt}" --mode=link --tag=CC \
- "${CC}" -module \
- ${CFLAGS} \
- ${LDFLAGS} \
- -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
- -o pw-netscape.la \
- netscape.lo || die "linking pw-netscape failed"
-
- #build_contrib_module "acl" "posixgroup.c" "posixGroup" # example code only
- #build_contrib_module "acl" "gssacl.c" "gss" # example code only, also needs kerberos
- build_contrib_module "addpartial" "addpartial-overlay.c" "addpartial-overlay"
- build_contrib_module "allop" "allop.c" "overlay-allop"
- build_contrib_module "allowed" "allowed.c" "allowed"
- build_contrib_module "autogroup" "autogroup.c" "autogroup"
- build_contrib_module "cloak" "cloak.c" "cloak"
- # build_contrib_module "comp_match" "comp_match.c" "comp_match" # really complex, adds new external deps, questionable demand
- build_contrib_module "denyop" "denyop.c" "denyop-overlay"
- build_contrib_module "dsaschema" "dsaschema.c" "dsaschema-plugin"
- build_contrib_module "dupent" "dupent.c" "dupent"
- build_contrib_module "lastbind" "lastbind.c" "lastbind"
- # lastmod may not play well with other overlays
- build_contrib_module "lastmod" "lastmod.c" "lastmod"
- build_contrib_module "noopsrch" "noopsrch.c" "noopsrch"
- build_contrib_module "nops" "nops.c" "nops-overlay"
- #build_contrib_module "nssov" "nssov.c" "nssov-overlay" RESO:LATER
- build_contrib_module "trace" "trace.c" "trace"
- # build slapi-plugins
- cd "${S}/contrib/slapi-plugins/addrdnvalues" || die
- einfo "Building contrib-module: addrdnvalues plugin"
- "${CC}" -shared \
- -I"${BUILD_DIR}"/include \
- -I../../../include \
- ${CFLAGS} \
- -fPIC \
- ${LDFLAGS} \
- -o libaddrdnvalues-plugin.so \
- addrdnvalues.c || die "Building libaddrdnvalues-plugin.so failed"
-
- fi
-}
-
-multilib_src_test() {
- if multilib_is_native_abi; then
- cd tests || die
- make tests || die "make tests failed"
- fi
-}
-
-multilib_src_install() {
- local lt="${BUILD_DIR}/libtool"
- emake DESTDIR="${D}" SHELL="${EPREFIX}"/bin/bash install
- use static-libs || prune_libtool_files --all
-
- if ! use minimal && multilib_is_native_abi; then
- # LMDB tools
- cd "${BUILD_DIR}"/libraries/liblmdb || die
- dodir /usr/include /usr/lib /usr/bin /usr/share/man/man1 # otherwise this will make them files :-(
- emake CC="${CC}" CXX="${CXX}" OPT="${CFLAGS}" prefix="${EPREFIX}/usr" DESTDIR="${D}" SHELL="${EPREFIX}"/bin/bash LIBDIR="$(get_libdir)" install
-
- # openldap modules go here
- # TODO: write some code to populate slapd.conf with moduleload statements
- keepdir /usr/$(get_libdir)/openldap/openldap/
-
- # initial data storage dir
- keepdir /var/lib/openldap-data
- use prefix || fowners ldap:ldap /var/lib/openldap-data
- fperms 0700 /var/lib/openldap-data
-
- echo "OLDPF='${PF}'" > "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
- echo "# do NOT delete this. it is used" >> "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
- echo "# to track versions for upgrading." >> "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
-
- # use our config
- rm "${ED}"etc/openldap/slapd.conf
- insinto /etc/openldap
- newins "${FILESDIR}"/${PN}-2.4.40-slapd-conf slapd.conf
- configfile="${ED}"etc/openldap/slapd.conf
-
- # populate with built backends
- ebegin "populate config with built backends"
- for x in "${ED}"usr/$(get_libdir)/openldap/openldap/back_*.so; do
- einfo "Adding $(basename ${x})"
- sed -e "/###INSERTDYNAMICMODULESHERE###$/a# moduleload\t$(basename ${x})" -i "${configfile}"
- done
- sed -e "s:###INSERTDYNAMICMODULESHERE###$:# modulepath\t${EPREFIX}/usr/$(get_libdir)/openldap/openldap:" -i "${configfile}"
- use prefix || fowners root:ldap /etc/openldap/slapd.conf
- fperms 0640 /etc/openldap/slapd.conf
- cp "${configfile}" "${configfile}".default
- eend
-
- # install our own init scripts and systemd unit files
- einfo "Install init scripts"
- newinitd "${FILESDIR}"/slapd-initd-2.4.40 slapd
- newconfd "${FILESDIR}"/slapd-confd-2.4.28-r1 slapd
- einfo "Install systemd service"
- systemd_dounit "${FILESDIR}"/slapd.service
- systemd_install_serviced "${FILESDIR}"/slapd.service.conf
- systemd_newtmpfilesd "${FILESDIR}"/slapd.tmpfilesd slapd.conf
-
- if [[ $(get_libdir) != lib ]]; then
- sed -e "s,/usr/lib/,/usr/$(get_libdir)/," -i \
- "${ED}"/etc/init.d/slapd \
- "${ED}"/usr/lib/systemd/system/slapd.service || die
- fi
- # If built without SLP, we don't need to be before avahi
- use slp \
- || sed -i \
- -e '/before/{s/avahi-daemon//g}' \
- "${ED}"etc/init.d/slapd
-
- if use cxx ; then
- einfo "Install the ldapc++ library"
- cd "${BUILD_DIR}/contrib/ldapc++" || die
- emake DESTDIR="${D}" libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" install
- cd "${S}"/contrib/ldapc++ || die
- newdoc README ldapc++-README
- fi
-
- if use smbkrb5passwd ; then
- einfo "Install the smbk5pwd module"
- cd "${S}/contrib/slapd-modules/smbk5pwd" || die
- emake DESTDIR="${D}" \
- LDAP_BUILD="${BUILD_DIR}" \
- libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" install
- newdoc README smbk5pwd-README
- fi
-
- if use overlays ; then
- einfo "Install the samba4 module"
- cd "${S}/contrib/slapd-modules/samba4" || die
- emake DESTDIR="${D}" \
- LDAP_BUILD="${BUILD_DIR}" \
- libexecdir="/usr/$(get_libdir)/openldap" install
- newdoc README samba4-README
- fi
-
- einfo "Installing contrib modules"
- cd "${S}/contrib/slapd-modules" || die
- for l in */*.la; do
- "${lt}" --mode=install cp ${l} \
- "${ED}"usr/$(get_libdir)/openldap/openldap || \
- die "installing ${l} failed"
- done
-
- dodoc "${FILESDIR}"/DB_CONFIG.fast.example
- docinto contrib
- doman */*.5
- #newdoc acl/README*
- newdoc addpartial/README addpartial-README
- newdoc allop/README allop-README
- newdoc allowed/README allowed-README
- newdoc autogroup/README autogroup-README
- newdoc dsaschema/README dsaschema-README
- newdoc passwd/README passwd-README
- cd "${S}/contrib/slapi-plugins" || die
- insinto /usr/$(get_libdir)/openldap/openldap
- doins */*.so
- docinto contrib
- newdoc addrdnvalues/README addrdnvalues-README
-
- insinto /etc/openldap/schema
- newins "${DISTDIR}"/${BIS_P} ${BIS_PN}
-
- docinto back-sock ; dodoc "${S}"/servers/slapd/back-sock/searchexample*
- docinto back-shell ; dodoc "${S}"/servers/slapd/back-shell/searchexample*
- docinto back-perl ; dodoc "${S}"/servers/slapd/back-perl/SampleLDAP.pm
-
- docinto liblmdb ; dodoc "${S}"/libraries/liblmdb/{sample*txt,CHANGES,COPYRIGHT,LICENSE}
- doman "${S}"/libraries/liblmdb/*.1
-
- dosbin "${S}"/contrib/slapd-tools/statslog
- newdoc "${S}"/contrib/slapd-tools/README README.statslog
- fi
-}
-
-multilib_src_install_all() {
- dodoc ANNOUNCEMENT CHANGES COPYRIGHT README
- docinto rfc ; dodoc doc/rfc/*.txt
-}
-
-pkg_preinst() {
- # keep old libs if any
- preserve_old_lib /usr/$(get_libdir)/{liblber,libldap_r,liblber}-2.3$(get_libname 0)
- # bug 440470, only display the getting started help there was no openldap before,
- # or we are going to a non-minimal build
- ! has_version net-nds/openldap || has_version 'net-nds/openldap[minimal]'
- OPENLDAP_PRINT_MESSAGES=$((! $?))
-}
-
-pkg_postinst() {
- if ! use minimal ; then
- # You cannot build SSL certificates during src_install that will make
- # binary packages containing your SSL key, which is both a security risk
- # and a misconfiguration if multiple machines use the same key and cert.
- if use ssl; then
- install_cert /etc/openldap/ssl/ldap
- use prefix || chown ldap:ldap "${EROOT}"etc/openldap/ssl/ldap.*
- ewarn "Self-signed SSL certificates are treated harshly by OpenLDAP 2.[12]"
- ewarn "Self-signed SSL certificates are treated harshly by OpenLDAP 2.[12]"
- ewarn "add 'TLS_REQCERT allow' if you want to use them."
- fi
-
- if use prefix; then
- # Warn about prefix issues with slapd
- eerror "slapd might NOT be usable on Prefix systems as it requires root privileges"
- eerror "to start up, and requires that certain files directories be owned by"
- eerror "ldap:ldap. As Prefix does not support changing ownership of files and"
- eerror "directories, you will have to manually fix this yourself."
- fi
-
- # These lines force the permissions of various content to be correct
- use prefix || chown ldap:ldap "${EROOT}"var/run/openldap
- chmod 0755 "${EROOT}"var/run/openldap
- use prefix || chown root:ldap "${EROOT}"etc/openldap/slapd.conf{,.default}
- chmod 0640 "${EROOT}"etc/openldap/slapd.conf{,.default}
- use prefix || chown ldap:ldap "${EROOT}"var/lib/openldap-data
- fi
-
- if has_version 'net-nds/openldap[-minimal]' && ((${OPENLDAP_PRINT_MESSAGES})); then
- elog "Getting started using OpenLDAP? There is some documentation available:"
- elog "Gentoo Guide to OpenLDAP Authentication"
- elog "(https://www.gentoo.org/doc/en/ldap-howto.xml)"
- elog "---"
- elog "An example file for tuning BDB backends with openldap is"
- elog "DB_CONFIG.fast.example in /usr/share/doc/${PF}/"
- fi
-
- preserve_old_lib_notify /usr/$(get_libdir)/{liblber,libldap,libldap_r}-2.3$(get_libname 0)
-}
diff --git a/net-nds/openldap/openldap-2.4.42-r1.ebuild b/net-nds/openldap/openldap-2.4.42-r1.ebuild
deleted file mode 100644
index e7033de143ec..000000000000
--- a/net-nds/openldap/openldap-2.4.42-r1.ebuild
+++ /dev/null
@@ -1,828 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI="5"
-
-inherit db-use eutils flag-o-matic multilib multilib-minimal ssl-cert versionator toolchain-funcs autotools user systemd
-
-BIS_PN=rfc2307bis.schema
-BIS_PV=20140524
-BIS_P="${BIS_PN}-${BIS_PV}"
-
-DESCRIPTION="LDAP suite of application and development tools"
-HOMEPAGE="http://www.OpenLDAP.org/"
-
-# mirrors are mostly not working, using canonical URI
-SRC_URI="ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/${P}.tgz
- mirror://gentoo/${BIS_P}"
-
-LICENSE="OPENLDAP GPL-2"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~x86-solaris"
-
-IUSE_DAEMON="crypt icu samba slp tcpd experimental minimal"
-IUSE_BACKEND="+berkdb"
-IUSE_OVERLAY="overlays perl"
-IUSE_OPTIONAL="gnutls iodbc sasl ssl odbc debug ipv6 libressl +syslog selinux static-libs"
-IUSE_CONTRIB="smbkrb5passwd kerberos"
-IUSE_CONTRIB="${IUSE_CONTRIB} -cxx"
-IUSE="${IUSE_DAEMON} ${IUSE_BACKEND} ${IUSE_OVERLAY} ${IUSE_OPTIONAL} ${IUSE_CONTRIB}"
-
-REQUIRED_USE="cxx? ( sasl )
- ?? ( gnutls libressl )"
-
-# always list newer first
-# Do not add any AGPL-3 BDB here!
-# See bug 525110, comment 15.
-BDB_SLOTS='5.3 5.1 4.8 4.7 4.6 4.5 4.4'
-BDB_PKGS=''
-for _slot in $BDB_SLOTS; do BDB_PKGS="${BDB_PKGS} sys-libs/db:${_slot}" ; done
-
-# openssl is needed to generate lanman-passwords required by samba
-CDEPEND="icu? ( dev-libs/icu:= )
- ssl? (
- !gnutls? (
- !libressl? ( >=dev-libs/openssl-1.0.1h-r2:0[${MULTILIB_USEDEP}] )
- )
- gnutls? ( >=net-libs/gnutls-2.12.23-r6[${MULTILIB_USEDEP}]
- libressl? ( dev-libs/libressl[${MULTILIB_USEDEP}] )
- >=dev-libs/libgcrypt-1.5.3:0[${MULTILIB_USEDEP}] ) )
- sasl? ( dev-libs/cyrus-sasl:= )
- !minimal? (
- sys-devel/libtool
- sys-libs/e2fsprogs-libs
- >=dev-db/lmdb-0.9.17
- tcpd? ( sys-apps/tcp-wrappers )
- odbc? ( !iodbc? ( dev-db/unixODBC )
- iodbc? ( dev-db/libiodbc ) )
- slp? ( net-libs/openslp )
- perl? ( dev-lang/perl:=[-build(-)] )
- samba? (
- !libressl? ( dev-libs/openssl:0 )
- libressl? ( dev-libs/libressl )
- )
- berkdb? (
- <sys-libs/db-6.0:=
- || ( ${BDB_PKGS} )
- )
- smbkrb5passwd? (
- !libressl? ( dev-libs/openssl:0 )
- libressl? ( dev-libs/libressl )
- kerberos? ( app-crypt/heimdal )
- )
- kerberos? ( virtual/krb5 )
- cxx? ( dev-libs/cyrus-sasl:= )
- )
- abi_x86_32? (
- !<=app-emulation/emul-linux-x86-baselibs-20140508-r3
- !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
- )"
-DEPEND="${CDEPEND}
- sys-apps/groff"
-RDEPEND="${CDEPEND}
- selinux? ( sec-policy/selinux-ldap )
-"
-# for tracking versions
-OPENLDAP_VERSIONTAG=".version-tag"
-OPENLDAP_DEFAULTDIR_VERSIONTAG="/var/lib/openldap-data"
-
-MULTILIB_WRAPPED_HEADERS=(
- # USE=cxx
- /usr/include/LDAPAsynConnection.h
- /usr/include/LDAPAttrType.h
- /usr/include/LDAPAttribute.h
- /usr/include/LDAPAttributeList.h
- /usr/include/LDAPConnection.h
- /usr/include/LDAPConstraints.h
- /usr/include/LDAPControl.h
- /usr/include/LDAPControlSet.h
- /usr/include/LDAPEntry.h
- /usr/include/LDAPEntryList.h
- /usr/include/LDAPException.h
- /usr/include/LDAPExtResult.h
- /usr/include/LDAPMessage.h
- /usr/include/LDAPMessageQueue.h
- /usr/include/LDAPModList.h
- /usr/include/LDAPModification.h
- /usr/include/LDAPObjClass.h
- /usr/include/LDAPRebind.h
- /usr/include/LDAPRebindAuth.h
- /usr/include/LDAPReferenceList.h
- /usr/include/LDAPResult.h
- /usr/include/LDAPSaslBindResult.h
- /usr/include/LDAPSchema.h
- /usr/include/LDAPSearchReference.h
- /usr/include/LDAPSearchResult.h
- /usr/include/LDAPSearchResults.h
- /usr/include/LDAPUrl.h
- /usr/include/LDAPUrlList.h
- /usr/include/LdifReader.h
- /usr/include/LdifWriter.h
- /usr/include/SaslInteraction.h
- /usr/include/SaslInteractionHandler.h
- /usr/include/StringList.h
- /usr/include/TlsOptions.h
-)
-
-openldap_filecount() {
- local dir="$1"
- find "${dir}" -type f ! -name '.*' ! -name 'DB_CONFIG*' | wc -l
-}
-
-openldap_find_versiontags() {
- # scan for all datadirs
- openldap_datadirs=""
- if [ -f "${EROOT}"/etc/openldap/slapd.conf ]; then
- openldap_datadirs="$(awk '{if($1 == "directory") print $2 }' ${EROOT}/etc/openldap/slapd.conf)"
- fi
- openldap_datadirs="${openldap_datadirs} ${OPENLDAP_DEFAULTDIR_VERSIONTAG}"
-
- einfo
- einfo "Scanning datadir(s) from slapd.conf and"
- einfo "the default installdir for Versiontags"
- einfo "(${OPENLDAP_DEFAULTDIR_VERSIONTAG} may appear twice)"
- einfo
-
- # scan datadirs if we have a version tag
- openldap_found_tag=0
- have_files=0
- for each in ${openldap_datadirs}; do
- CURRENT_TAGDIR=${ROOT}`echo ${each} | sed "s:\/::"`
- CURRENT_TAG=${CURRENT_TAGDIR}/${OPENLDAP_VERSIONTAG}
- if [ -d ${CURRENT_TAGDIR} ] && [ ${openldap_found_tag} == 0 ] ; then
- einfo "- Checking ${each}..."
- if [ -r ${CURRENT_TAG} ] ; then
- # yey, we have one :)
- einfo " Found Versiontag in ${each}"
- source ${CURRENT_TAG}
- if [ "${OLDPF}" == "" ] ; then
- eerror "Invalid Versiontag found in ${CURRENT_TAGDIR}"
- eerror "Please delete it"
- eerror
- die "Please kill the invalid versiontag in ${CURRENT_TAGDIR}"
- fi
-
- OLD_MAJOR=`get_version_component_range 2-3 ${OLDPF}`
-
- [ $(openldap_filecount ${CURRENT_TAGDIR}) -gt 0 ] && have_files=1
-
- # are we on the same branch?
- if [ "${OLD_MAJOR}" != "${PV:0:3}" ] ; then
- ewarn " Versiontag doesn't match current major release!"
- if [[ "${have_files}" == "1" ]] ; then
- eerror " Versiontag says other major and you (probably) have datafiles!"
- echo
- openldap_upgrade_howto
- else
- einfo " No real problem, seems there's no database."
- fi
- else
- einfo " Versiontag is fine here :)"
- fi
- else
- einfo " Non-tagged dir ${each}"
- [ $(openldap_filecount ${each}) -gt 0 ] && have_files=1
- if [[ "${have_files}" == "1" ]] ; then
- einfo " EEK! Non-empty non-tagged datadir, counting `ls -a ${each} | wc -l` files"
- echo
-
- eerror
- eerror "Your OpenLDAP Installation has a non tagged datadir that"
- eerror "possibly contains a database at ${CURRENT_TAGDIR}"
- eerror
- eerror "Please export data if any entered and empty or remove"
- eerror "the directory, installation has been stopped so you"
- eerror "can take required action"
- eerror
- eerror "For a HOWTO on exporting the data, see instructions in the ebuild"
- eerror
- openldap_upgrade_howto
- die "Please move the datadir ${CURRENT_TAGDIR} away"
- fi
- fi
- einfo
- fi
- done
- [ "${have_files}" == "1" ] && einfo "DB files present" || einfo "No DB files present"
-
- # Now we must check for the major version of sys-libs/db linked against.
- SLAPD_PATH=${EROOT}/usr/$(get_libdir)/openldap/slapd
- if [ "${have_files}" == "1" -a -f "${SLAPD_PATH}" ]; then
- OLDVER="$(/usr/bin/ldd ${SLAPD_PATH} \
- | awk '/libdb-/{gsub("^libdb-","",$1);gsub(".so$","",$1);print $1}')"
- if use berkdb; then
- # find which one would be used
- for bdb_slot in $BDB_SLOTS ; do
- NEWVER="$(db_findver "=sys-libs/db-${bdb_slot}*")"
- [[ -n "$NEWVER" ]] && break
- done
- fi
- local fail=0
- if [ -z "${OLDVER}" -a -z "${NEWVER}" ]; then
- :
- # Nothing wrong here.
- elif [ -z "${OLDVER}" -a -n "${NEWVER}" ]; then
- eerror " Your existing version of OpenLDAP was not built against"
- eerror " any version of sys-libs/db, but the new one will build"
- eerror " against ${NEWVER} and your database may be inaccessible."
- echo
- fail=1
- elif [ -n "${OLDVER}" -a -z "${NEWVER}" ]; then
- eerror " Your existing version of OpenLDAP was built against"
- eerror " sys-libs/db:${OLDVER}, but the new one will not be"
- eerror " built against any version and your database may be"
- eerror " inaccessible."
- echo
- fail=1
- elif [ "${OLDVER}" != "${NEWVER}" ]; then
- eerror " Your existing version of OpenLDAP was built against"
- eerror " sys-libs/db:${OLDVER}, but the new one will build against"
- eerror " ${NEWVER} and your database would be inaccessible."
- echo
- fail=1
- fi
- [ "${fail}" == "1" ] && openldap_upgrade_howto
- fi
-
- echo
- einfo
- einfo "All datadirs are fine, proceeding with merge now..."
- einfo
-}
-
-openldap_upgrade_howto() {
- eerror
- eerror "A (possible old) installation of OpenLDAP was detected,"
- eerror "installation will not proceed for now."
- eerror
- eerror "As major version upgrades can corrupt your database,"
- eerror "you need to dump your database and re-create it afterwards."
- eerror
- eerror "Additionally, rebuilding against different major versions of the"
- eerror "sys-libs/db libraries will cause your database to be inaccessible."
- eerror ""
- d="$(date -u +%s)"
- l="/root/ldapdump.${d}"
- i="${l}.raw"
- eerror " 1. /etc/init.d/slurpd stop ; /etc/init.d/slapd stop"
- eerror " 2. slapcat -l ${i}"
- eerror " 3. egrep -v '^(entry|context)CSN:' <${i} >${l}"
- eerror " 4. mv /var/lib/openldap-data/ /var/lib/openldap-data-backup/"
- eerror " 5. emerge --update \=net-nds/${PF}"
- eerror " 6. etc-update, and ensure that you apply the changes"
- eerror " 7. slapadd -l ${l}"
- eerror " 8. chown ldap:ldap /var/lib/openldap-data/*"
- eerror " 9. /etc/init.d/slapd start"
- eerror "10. check that your data is intact."
- eerror "11. set up the new replication system."
- eerror
- if [ "${FORCE_UPGRADE}" != "1" ]; then
- die "You need to upgrade your database first"
- else
- eerror "You have the magical FORCE_UPGRADE=1 in place."
- eerror "Don't say you weren't warned about data loss."
- fi
-}
-
-pkg_setup() {
- if ! use sasl && use cxx ; then
- die "To build the ldapc++ library you must emerge openldap with sasl support"
- fi
- # Bug #322787
- if use minimal && ! has_version "net-nds/openldap" ; then
- einfo "No datadir scan needed, openldap not installed"
- elif use minimal && has_version "net-nds/openldap" && built_with_use net-nds/openldap minimal ; then
- einfo "Skipping scan for previous datadirs as requested by minimal useflag"
- else
- openldap_find_versiontags
- fi
-
- # The user/group are only used for running daemons which are
- # disabled in minimal builds, so elide the accounts too.
- if ! use minimal ; then
- enewgroup ldap 439
- enewuser ldap 439 -1 /usr/$(get_libdir)/openldap ldap
- fi
-}
-
-src_prepare() {
- # ensure correct SLAPI path by default
- sed -i -e 's,\(#define LDAPI_SOCK\).*,\1 "'"${EPREFIX}"'/var/run/openldap/slapd.sock",' \
- "${S}"/include/ldap_defaults.h
-
- epatch "${FILESDIR}"/${PN}-2.4.17-gcc44.patch
-
- epatch \
- "${FILESDIR}"/${PN}-2.2.14-perlthreadsfix.patch \
- "${FILESDIR}"/${PN}-2.4.15-ppolicy.patch
-
- # bug #116045 - still present in 2.4.28
- epatch "${FILESDIR}"/${PN}-2.4.35-contrib-smbk5pwd.patch
- # bug #408077 - samba4
- epatch "${FILESDIR}"/${PN}-2.4.35-contrib-samba4.patch
-
- # bug #189817
- epatch "${FILESDIR}"/${PN}-2.4.11-libldap_r.patch
-
- # bug #233633
- epatch "${FILESDIR}"/${PN}-2.4.17-fix-lmpasswd-gnutls-symbols.patch
-
- # bug #281495
- epatch "${FILESDIR}"/${PN}-2.4.28-gnutls-gcrypt.patch
-
- # bug #294350
- epatch "${FILESDIR}"/${PN}-2.4.6-evolution-ntlm.patch
-
- # unbreak /bin/sh -> dash
- epatch "${FILESDIR}"/${PN}-2.4.28-fix-dash.patch
-
- # bug #420959
- epatch "${FILESDIR}"/${PN}-2.4.31-gcc47.patch
-
- # bug #421463
- #epatch "${FILESDIR}"/${PN}-2.4.33-gnutls.patch # merged upstream
-
- # unbundle lmdb
- epatch "${FILESDIR}"/${P}-mdb-unbundle.patch
- rm -rf "${S}"/libraries/liblmdb
-
- cd "${S}"/build || die
- einfo "Making sure upstream build strip does not do stripping too early"
- sed -i.orig \
- -e '/^STRIP/s,-s,,g' \
- top.mk || die "Failed to block stripping"
-
- # wrong assumption that /bin/sh is /bin/bash
- sed -i \
- -e 's|/bin/sh|/bin/bash|g' \
- "${S}"/tests/scripts/* || die "sed failed"
-
- cd "${S}" || die
-
- AT_NOEAUTOMAKE=yes eautoreconf
-}
-
-build_contrib_module() {
- # <dir> <sources> <outputname>
- cd "${S}/contrib/slapd-modules/$1" || die
- einfo "Compiling contrib-module: $3"
- # Make sure it's uppercase
- local define_name="$(echo "SLAPD_OVER_${1}" | LC_ALL=C tr '[:lower:]' '[:upper:]')"
- "${lt}" --mode=compile --tag=CC \
- "${CC}" \
- -D${define_name}=SLAPD_MOD_DYNAMIC \
- -I"${BUILD_DIR}"/include \
- -I../../../include -I../../../servers/slapd ${CFLAGS} \
- -o ${2%.c}.lo -c $2 || die "compiling $3 failed"
- einfo "Linking contrib-module: $3"
- "${lt}" --mode=link --tag=CC \
- "${CC}" -module \
- ${CFLAGS} \
- ${LDFLAGS} \
- -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
- -o $3.la ${2%.c}.lo || die "linking $3 failed"
-}
-
-src_configure() {
- # Bug 408001
- use elibc_FreeBSD && append-cppflags -DMDB_DSYNC=O_SYNC -DMDB_FDATASYNC=fsync
-
- # connectionless ldap per bug #342439
- append-cppflags -DLDAP_CONNECTIONLESS
-
- multilib-minimal_src_configure
-}
-
-multilib_src_configure() {
- local myconf=()
-
- use debug && myconf+=( $(use_enable debug) )
-
- # ICU usage is not configurable
- export ac_cv_header_unicode_utypes_h="$(multilib_is_native_abi && use icu && echo yes || echo no)"
-
- if ! use minimal && multilib_is_native_abi; then
- local CPPFLAGS=${CPPFLAGS}
-
- # re-enable serverside overlay chains per bug #296567
- # see ldap docs chaper 12.3.1 for details
- myconf+=( --enable-ldap )
-
- # backends
- myconf+=( --enable-slapd )
- if use berkdb ; then
- einfo "Using Berkeley DB for local backend"
- myconf+=( --enable-bdb --enable-hdb )
- DBINCLUDE=$(db_includedir $BDB_SLOTS)
- einfo "Using $DBINCLUDE for sys-libs/db version"
- # We need to include the slotted db.h dir for FreeBSD
- append-cppflags -I${DBINCLUDE}
- else
- myconf+=( --disable-bdb --disable-hdb )
- fi
- for backend in dnssrv ldap mdb meta monitor null passwd relay shell sock; do
- myconf+=( --enable-${backend}=mod )
- done
-
- myconf+=( $(use_enable perl perl mod) )
-
- myconf+=( $(use_enable odbc sql mod) )
- if use odbc ; then
- local odbc_lib="unixodbc"
- if use iodbc ; then
- odbc_lib="iodbc"
- append-cppflags -I"${EPREFIX}"/usr/include/iodbc
- fi
- myconf+=( --with-odbc=${odbc_lib} )
- fi
-
- # slapd options
- myconf+=(
- $(use_enable crypt)
- $(use_enable slp)
- $(use_enable samba lmpasswd)
- $(use_enable syslog)
- )
- if use experimental ; then
- myconf+=(
- --enable-dynacl
- --enable-aci=mod
- )
- fi
- for option in aci cleartext modules rewrite rlookups slapi; do
- myconf+=( --enable-${option} )
- done
-
- # slapd overlay options
- # Compile-in the syncprov, the others as module
- myconf+=( --enable-syncprov=yes )
- use overlays && myconf+=( --enable-overlays=mod )
-
- else
- myconf+=(
- --disable-backends
- --disable-slapd
- --disable-bdb
- --disable-hdb
- --disable-mdb
- --disable-overlays
- --disable-syslog
- )
- fi
-
- # basic functionality stuff
- myconf+=(
- $(use_enable ipv6)
- $(multilib_native_use_with sasl cyrus-sasl)
- $(multilib_native_use_enable sasl spasswd)
- $(use_enable tcpd wrappers)
- )
-
- # Some cross-compiling tests don't pan out well.
- tc-is-cross-compiler && myconf+=(
- --with-yielding-select=yes
- )
-
- local ssl_lib="no"
- if use ssl || ( ! use minimal && use samba ) ; then
- ssl_lib="openssl"
- use gnutls && ssl_lib="gnutls"
- fi
-
- myconf+=( --with-tls=${ssl_lib} )
-
- for basicflag in dynamic local proctitle shared; do
- myconf+=( --enable-${basicflag} )
- done
-
- tc-export AR CC CXX
- ECONF_SOURCE=${S} \
- STRIP=/bin/true \
- econf \
- --libexecdir="${EPREFIX}"/usr/$(get_libdir)/openldap \
- $(use_enable static-libs static) \
- "${myconf[@]}"
- emake depend
-}
-
-src_configure_cxx() {
- # This needs the libraries built by the first build run.
- # So we have to run it AFTER the main build, not just after the main
- # configure.
- local myconf_ldapcpp=(
- --with-ldap-includes="${S}"/include
- )
-
- mkdir -p "${BUILD_DIR}"/contrib/ldapc++ || die
- cd "${BUILD_DIR}/contrib/ldapc++" || die
-
- local LDFLAGS=${LDFLAGS} CPPFLAGS=${CPPFLAGS}
- append-ldflags -L"${BUILD_DIR}"/libraries/liblber/.libs \
- -L"${BUILD_DIR}"/libraries/libldap/.libs
- append-cppflags -I"${BUILD_DIR}"/include
- ECONF_SOURCE=${S}/contrib/ldapc++ \
- econf "${myconf_ldapcpp[@]}" \
- CC="${CC}" \
- CXX="${CXX}"
-}
-
-multilib_src_compile() {
- tc-export AR CC CXX
- emake CC="${CC}" AR="${AR}" SHELL="${EPREFIX}"/bin/bash
- local lt="${BUILD_DIR}/libtool"
- export echo="echo"
-
- if ! use minimal && multilib_is_native_abi ; then
- if use cxx ; then
- einfo "Building contrib library: ldapc++"
- src_configure_cxx
- cd "${BUILD_DIR}/contrib/ldapc++" || die
- emake \
- CC="${CC}" CXX="${CXX}"
- fi
-
- if use smbkrb5passwd ; then
- einfo "Building contrib-module: smbk5pwd"
- cd "${S}/contrib/slapd-modules/smbk5pwd" || die
-
- MY_DEFS="-DDO_SHADOW"
- if use samba ; then
- MY_DEFS="${MY_DEFS} -DDO_SAMBA"
- MY_KRB5_INC=""
- fi
- if use kerberos ; then
- MY_DEFS="${MY_DEFS} -DDO_KRB5"
- MY_KRB5_INC="$(krb5-config --cflags)"
- fi
-
- emake \
- DEFS="${MY_DEFS}" \
- KRB5_INC="${MY_KRB5_INC}" \
- LDAP_BUILD="${BUILD_DIR}" \
- CC="${CC}" libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap"
- fi
-
- if use overlays ; then
- einfo "Building contrib-module: samba4"
- cd "${S}/contrib/slapd-modules/samba4" || die
-
- emake \
- LDAP_BUILD="${BUILD_DIR}" \
- CC="${CC}" libexecdir="/usr/$(get_libdir)/openldap"
- fi
-
- if use kerberos ; then
- build_contrib_module "kinit" "kinit.c" "kinit"
- cd "${S}/contrib/slapd-modules/passwd" || die
- einfo "Compiling contrib-module: pw-kerberos"
- "${lt}" --mode=compile --tag=CC \
- "${CC}" \
- -I"${BUILD_DIR}"/include \
- -I../../../include \
- ${CFLAGS} \
- $(krb5-config --cflags) \
- -DHAVE_KRB5 \
- -o kerberos.lo \
- -c kerberos.c || die "compiling pw-kerberos failed"
- einfo "Linking contrib-module: pw-kerberos"
- "${lt}" --mode=link --tag=CC \
- "${CC}" -module \
- ${CFLAGS} \
- ${LDFLAGS} \
- -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
- -o pw-kerberos.la \
- kerberos.lo || die "linking pw-kerberos failed"
- fi
- # We could build pw-radius if GNURadius would install radlib.h
- cd "${S}/contrib/slapd-modules/passwd" || die
- einfo "Compiling contrib-module: pw-netscape"
- "${lt}" --mode=compile --tag=CC \
- "${CC}" \
- -I"${BUILD_DIR}"/include \
- -I../../../include \
- ${CFLAGS} \
- -o netscape.lo \
- -c netscape.c || die "compiling pw-netscape failed"
- einfo "Linking contrib-module: pw-netscape"
- "${lt}" --mode=link --tag=CC \
- "${CC}" -module \
- ${CFLAGS} \
- ${LDFLAGS} \
- -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
- -o pw-netscape.la \
- netscape.lo || die "linking pw-netscape failed"
-
- #build_contrib_module "acl" "posixgroup.c" "posixGroup" # example code only
- #build_contrib_module "acl" "gssacl.c" "gss" # example code only, also needs kerberos
- build_contrib_module "addpartial" "addpartial-overlay.c" "addpartial-overlay"
- build_contrib_module "allop" "allop.c" "overlay-allop"
- build_contrib_module "allowed" "allowed.c" "allowed"
- build_contrib_module "autogroup" "autogroup.c" "autogroup"
- build_contrib_module "cloak" "cloak.c" "cloak"
- # build_contrib_module "comp_match" "comp_match.c" "comp_match" # really complex, adds new external deps, questionable demand
- build_contrib_module "denyop" "denyop.c" "denyop-overlay"
- build_contrib_module "dsaschema" "dsaschema.c" "dsaschema-plugin"
- build_contrib_module "dupent" "dupent.c" "dupent"
- build_contrib_module "lastbind" "lastbind.c" "lastbind"
- # lastmod may not play well with other overlays
- build_contrib_module "lastmod" "lastmod.c" "lastmod"
- build_contrib_module "noopsrch" "noopsrch.c" "noopsrch"
- build_contrib_module "nops" "nops.c" "nops-overlay"
- #build_contrib_module "nssov" "nssov.c" "nssov-overlay" RESO:LATER
- build_contrib_module "trace" "trace.c" "trace"
- # build slapi-plugins
- cd "${S}/contrib/slapi-plugins/addrdnvalues" || die
- einfo "Building contrib-module: addrdnvalues plugin"
- "${CC}" -shared \
- -I"${BUILD_DIR}"/include \
- -I../../../include \
- ${CFLAGS} \
- -fPIC \
- ${LDFLAGS} \
- -o libaddrdnvalues-plugin.so \
- addrdnvalues.c || die "Building libaddrdnvalues-plugin.so failed"
-
- fi
-}
-
-multilib_src_test() {
- if multilib_is_native_abi; then
- cd tests || die
- emake tests || die "make tests failed"
- fi
-}
-
-multilib_src_install() {
- local lt="${BUILD_DIR}/libtool"
- emake DESTDIR="${D}" SHELL="${EPREFIX}"/bin/bash install
- use static-libs || prune_libtool_files --all
-
- if ! use minimal && multilib_is_native_abi; then
- # openldap modules go here
- # TODO: write some code to populate slapd.conf with moduleload statements
- keepdir /usr/$(get_libdir)/openldap/openldap/
-
- # initial data storage dir
- keepdir /var/lib/openldap-data
- use prefix || fowners ldap:ldap /var/lib/openldap-data
- fperms 0700 /var/lib/openldap-data
-
- echo "OLDPF='${PF}'" > "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
- echo "# do NOT delete this. it is used" >> "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
- echo "# to track versions for upgrading." >> "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
-
- # use our config
- rm "${ED}"etc/openldap/slapd.conf
- insinto /etc/openldap
- newins "${FILESDIR}"/${PN}-2.4.40-slapd-conf slapd.conf
- configfile="${ED}"etc/openldap/slapd.conf
-
- # populate with built backends
- ebegin "populate config with built backends"
- for x in "${ED}"usr/$(get_libdir)/openldap/openldap/back_*.so; do
- einfo "Adding $(basename ${x})"
- sed -e "/###INSERTDYNAMICMODULESHERE###$/a# moduleload\t$(basename ${x})" -i "${configfile}"
- done
- sed -e "s:###INSERTDYNAMICMODULESHERE###$:# modulepath\t${EPREFIX}/usr/$(get_libdir)/openldap/openldap:" -i "${configfile}"
- use prefix || fowners root:ldap /etc/openldap/slapd.conf
- fperms 0640 /etc/openldap/slapd.conf
- cp "${configfile}" "${configfile}".default
- eend
-
- # install our own init scripts and systemd unit files
- einfo "Install init scripts"
- newinitd "${FILESDIR}"/slapd-initd-2.4.40-r2 slapd
- newconfd "${FILESDIR}"/slapd-confd-2.4.28-r1 slapd
- einfo "Install systemd service"
- systemd_dounit "${FILESDIR}"/slapd.service
- systemd_install_serviced "${FILESDIR}"/slapd.service.conf
- systemd_newtmpfilesd "${FILESDIR}"/slapd.tmpfilesd slapd.conf
-
- if [[ $(get_libdir) != lib ]]; then
- sed -e "s,/usr/lib/,/usr/$(get_libdir)/," -i \
- "${ED}"/etc/init.d/slapd \
- "${ED}"/usr/lib/systemd/system/slapd.service || die
- fi
- # If built without SLP, we don't need to be before avahi
- use slp \
- || sed -i \
- -e '/before/{s/avahi-daemon//g}' \
- "${ED}"etc/init.d/slapd
-
- if use cxx ; then
- einfo "Install the ldapc++ library"
- cd "${BUILD_DIR}/contrib/ldapc++" || die
- emake DESTDIR="${D}" libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" install
- cd "${S}"/contrib/ldapc++ || die
- newdoc README ldapc++-README
- fi
-
- if use smbkrb5passwd ; then
- einfo "Install the smbk5pwd module"
- cd "${S}/contrib/slapd-modules/smbk5pwd" || die
- emake DESTDIR="${D}" \
- LDAP_BUILD="${BUILD_DIR}" \
- libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" install
- newdoc README smbk5pwd-README
- fi
-
- if use overlays ; then
- einfo "Install the samba4 module"
- cd "${S}/contrib/slapd-modules/samba4" || die
- emake DESTDIR="${D}" \
- LDAP_BUILD="${BUILD_DIR}" \
- libexecdir="/usr/$(get_libdir)/openldap" install
- newdoc README samba4-README
- fi
-
- einfo "Installing contrib modules"
- cd "${S}/contrib/slapd-modules" || die
- for l in */*.la; do
- "${lt}" --mode=install cp ${l} \
- "${ED}"usr/$(get_libdir)/openldap/openldap || \
- die "installing ${l} failed"
- done
-
- dodoc "${FILESDIR}"/DB_CONFIG.fast.example
- docinto contrib
- doman */*.5
- #newdoc acl/README*
- newdoc addpartial/README addpartial-README
- newdoc allop/README allop-README
- newdoc allowed/README allowed-README
- newdoc autogroup/README autogroup-README
- newdoc dsaschema/README dsaschema-README
- newdoc passwd/README passwd-README
- cd "${S}/contrib/slapi-plugins" || die
- insinto /usr/$(get_libdir)/openldap/openldap
- doins */*.so
- docinto contrib
- newdoc addrdnvalues/README addrdnvalues-README
-
- insinto /etc/openldap/schema
- newins "${DISTDIR}"/${BIS_P} ${BIS_PN}
-
- docinto back-sock ; dodoc "${S}"/servers/slapd/back-sock/searchexample*
- docinto back-shell ; dodoc "${S}"/servers/slapd/back-shell/searchexample*
- docinto back-perl ; dodoc "${S}"/servers/slapd/back-perl/SampleLDAP.pm
-
- dosbin "${S}"/contrib/slapd-tools/statslog
- newdoc "${S}"/contrib/slapd-tools/README README.statslog
- fi
-}
-
-multilib_src_install_all() {
- dodoc ANNOUNCEMENT CHANGES COPYRIGHT README
- docinto rfc ; dodoc doc/rfc/*.txt
-}
-
-pkg_preinst() {
- # keep old libs if any
- preserve_old_lib /usr/$(get_libdir)/{liblber,libldap_r,liblber}-2.3$(get_libname 0)
- # bug 440470, only display the getting started help there was no openldap before,
- # or we are going to a non-minimal build
- ! has_version net-nds/openldap || has_version 'net-nds/openldap[minimal]'
- OPENLDAP_PRINT_MESSAGES=$((! $?))
-}
-
-pkg_postinst() {
- if ! use minimal ; then
- # You cannot build SSL certificates during src_install that will make
- # binary packages containing your SSL key, which is both a security risk
- # and a misconfiguration if multiple machines use the same key and cert.
- if use ssl; then
- install_cert /etc/openldap/ssl/ldap
- use prefix || chown ldap:ldap "${EROOT}"etc/openldap/ssl/ldap.*
- ewarn "Self-signed SSL certificates are treated harshly by OpenLDAP 2.[12]"
- ewarn "Self-signed SSL certificates are treated harshly by OpenLDAP 2.[12]"
- ewarn "add 'TLS_REQCERT allow' if you want to use them."
- fi
-
- if use prefix; then
- # Warn about prefix issues with slapd
- eerror "slapd might NOT be usable on Prefix systems as it requires root privileges"
- eerror "to start up, and requires that certain files directories be owned by"
- eerror "ldap:ldap. As Prefix does not support changing ownership of files and"
- eerror "directories, you will have to manually fix this yourself."
- fi
-
- # These lines force the permissions of various content to be correct
- use prefix || chown ldap:ldap "${EROOT}"var/run/openldap
- chmod 0755 "${EROOT}"var/run/openldap
- use prefix || chown root:ldap "${EROOT}"etc/openldap/slapd.conf{,.default}
- chmod 0640 "${EROOT}"etc/openldap/slapd.conf{,.default}
- use prefix || chown ldap:ldap "${EROOT}"var/lib/openldap-data
- fi
-
- if has_version 'net-nds/openldap[-minimal]' && ((${OPENLDAP_PRINT_MESSAGES})); then
- elog "Getting started using OpenLDAP? There is some documentation available:"
- elog "Gentoo Guide to OpenLDAP Authentication"
- elog "(https://www.gentoo.org/doc/en/ldap-howto.xml)"
- elog "---"
- elog "An example file for tuning BDB backends with openldap is"
- elog "DB_CONFIG.fast.example in /usr/share/doc/${PF}/"
- fi
-
- preserve_old_lib_notify /usr/$(get_libdir)/{liblber,libldap,libldap_r}-2.3$(get_libname 0)
-}
diff --git a/net-nds/openldap/openldap-2.4.42.ebuild b/net-nds/openldap/openldap-2.4.42.ebuild
deleted file mode 100644
index 4aa1760d48b0..000000000000
--- a/net-nds/openldap/openldap-2.4.42.ebuild
+++ /dev/null
@@ -1,818 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI="5"
-
-inherit db-use eutils flag-o-matic multilib multilib-minimal ssl-cert versionator toolchain-funcs autotools user systemd
-
-BIS_PN=rfc2307bis.schema
-BIS_PV=20140524
-BIS_P="${BIS_PN}-${BIS_PV}"
-
-DESCRIPTION="LDAP suite of application and development tools"
-HOMEPAGE="http://www.OpenLDAP.org/"
-
-# mirrors are mostly not working, using canonical URI
-SRC_URI="ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/${P}.tgz
- mirror://gentoo/${BIS_P}"
-
-LICENSE="OPENLDAP GPL-2"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~x86-solaris"
-
-IUSE_DAEMON="crypt icu samba slp tcpd experimental minimal"
-IUSE_BACKEND="+berkdb"
-IUSE_OVERLAY="overlays perl"
-IUSE_OPTIONAL="gnutls iodbc sasl ssl odbc debug ipv6 +syslog selinux static-libs"
-IUSE_CONTRIB="smbkrb5passwd kerberos"
-IUSE_CONTRIB="${IUSE_CONTRIB} -cxx"
-IUSE="${IUSE_DAEMON} ${IUSE_BACKEND} ${IUSE_OVERLAY} ${IUSE_OPTIONAL} ${IUSE_CONTRIB}"
-
-REQUIRED_USE="cxx? ( sasl )"
-
-# always list newer first
-# Do not add any AGPL-3 BDB here!
-# See bug 525110, comment 15.
-BDB_SLOTS='5.3 5.1 4.8 4.7 4.6 4.5 4.4'
-BDB_PKGS=''
-for _slot in $BDB_SLOTS; do BDB_PKGS="${BDB_PKGS} sys-libs/db:${_slot}" ; done
-
-# openssl is needed to generate lanman-passwords required by samba
-CDEPEND="icu? ( dev-libs/icu:= )
- ssl? ( !gnutls? ( >=dev-libs/openssl-1.0.1h-r2[${MULTILIB_USEDEP}] )
- gnutls? ( >=net-libs/gnutls-2.12.23-r6[${MULTILIB_USEDEP}] >=dev-libs/libgcrypt-1.5.3:0[${MULTILIB_USEDEP}] ) )
- sasl? ( dev-libs/cyrus-sasl:= )
- !minimal? (
- sys-devel/libtool
- sys-libs/e2fsprogs-libs
- >=dev-db/lmdb-0.9.17
- tcpd? ( sys-apps/tcp-wrappers )
- odbc? ( !iodbc? ( dev-db/unixODBC )
- iodbc? ( dev-db/libiodbc ) )
- slp? ( net-libs/openslp )
- perl? ( dev-lang/perl:=[-build(-)] )
- samba? ( dev-libs/openssl )
- berkdb? (
- <sys-libs/db-6.0:=
- || ( ${BDB_PKGS} )
- )
- smbkrb5passwd? (
- dev-libs/openssl
- kerberos? ( app-crypt/heimdal )
- )
- kerberos? ( virtual/krb5 )
- cxx? ( dev-libs/cyrus-sasl:= )
- )
- abi_x86_32? (
- !<=app-emulation/emul-linux-x86-baselibs-20140508-r3
- !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
- )"
-DEPEND="${CDEPEND}
- sys-apps/groff"
-RDEPEND="${CDEPEND}
- selinux? ( sec-policy/selinux-ldap )
-"
-# for tracking versions
-OPENLDAP_VERSIONTAG=".version-tag"
-OPENLDAP_DEFAULTDIR_VERSIONTAG="/var/lib/openldap-data"
-
-MULTILIB_WRAPPED_HEADERS=(
- # USE=cxx
- /usr/include/LDAPAsynConnection.h
- /usr/include/LDAPAttrType.h
- /usr/include/LDAPAttribute.h
- /usr/include/LDAPAttributeList.h
- /usr/include/LDAPConnection.h
- /usr/include/LDAPConstraints.h
- /usr/include/LDAPControl.h
- /usr/include/LDAPControlSet.h
- /usr/include/LDAPEntry.h
- /usr/include/LDAPEntryList.h
- /usr/include/LDAPException.h
- /usr/include/LDAPExtResult.h
- /usr/include/LDAPMessage.h
- /usr/include/LDAPMessageQueue.h
- /usr/include/LDAPModList.h
- /usr/include/LDAPModification.h
- /usr/include/LDAPObjClass.h
- /usr/include/LDAPRebind.h
- /usr/include/LDAPRebindAuth.h
- /usr/include/LDAPReferenceList.h
- /usr/include/LDAPResult.h
- /usr/include/LDAPSaslBindResult.h
- /usr/include/LDAPSchema.h
- /usr/include/LDAPSearchReference.h
- /usr/include/LDAPSearchResult.h
- /usr/include/LDAPSearchResults.h
- /usr/include/LDAPUrl.h
- /usr/include/LDAPUrlList.h
- /usr/include/LdifReader.h
- /usr/include/LdifWriter.h
- /usr/include/SaslInteraction.h
- /usr/include/SaslInteractionHandler.h
- /usr/include/StringList.h
- /usr/include/TlsOptions.h
-)
-
-openldap_filecount() {
- local dir="$1"
- find "${dir}" -type f ! -name '.*' ! -name 'DB_CONFIG*' | wc -l
-}
-
-openldap_find_versiontags() {
- # scan for all datadirs
- openldap_datadirs=""
- if [ -f "${EROOT}"/etc/openldap/slapd.conf ]; then
- openldap_datadirs="$(awk '{if($1 == "directory") print $2 }' ${EROOT}/etc/openldap/slapd.conf)"
- fi
- openldap_datadirs="${openldap_datadirs} ${OPENLDAP_DEFAULTDIR_VERSIONTAG}"
-
- einfo
- einfo "Scanning datadir(s) from slapd.conf and"
- einfo "the default installdir for Versiontags"
- einfo "(${OPENLDAP_DEFAULTDIR_VERSIONTAG} may appear twice)"
- einfo
-
- # scan datadirs if we have a version tag
- openldap_found_tag=0
- have_files=0
- for each in ${openldap_datadirs}; do
- CURRENT_TAGDIR=${ROOT}`echo ${each} | sed "s:\/::"`
- CURRENT_TAG=${CURRENT_TAGDIR}/${OPENLDAP_VERSIONTAG}
- if [ -d ${CURRENT_TAGDIR} ] && [ ${openldap_found_tag} == 0 ] ; then
- einfo "- Checking ${each}..."
- if [ -r ${CURRENT_TAG} ] ; then
- # yey, we have one :)
- einfo " Found Versiontag in ${each}"
- source ${CURRENT_TAG}
- if [ "${OLDPF}" == "" ] ; then
- eerror "Invalid Versiontag found in ${CURRENT_TAGDIR}"
- eerror "Please delete it"
- eerror
- die "Please kill the invalid versiontag in ${CURRENT_TAGDIR}"
- fi
-
- OLD_MAJOR=`get_version_component_range 2-3 ${OLDPF}`
-
- [ $(openldap_filecount ${CURRENT_TAGDIR}) -gt 0 ] && have_files=1
-
- # are we on the same branch?
- if [ "${OLD_MAJOR}" != "${PV:0:3}" ] ; then
- ewarn " Versiontag doesn't match current major release!"
- if [[ "${have_files}" == "1" ]] ; then
- eerror " Versiontag says other major and you (probably) have datafiles!"
- echo
- openldap_upgrade_howto
- else
- einfo " No real problem, seems there's no database."
- fi
- else
- einfo " Versiontag is fine here :)"
- fi
- else
- einfo " Non-tagged dir ${each}"
- [ $(openldap_filecount ${each}) -gt 0 ] && have_files=1
- if [[ "${have_files}" == "1" ]] ; then
- einfo " EEK! Non-empty non-tagged datadir, counting `ls -a ${each} | wc -l` files"
- echo
-
- eerror
- eerror "Your OpenLDAP Installation has a non tagged datadir that"
- eerror "possibly contains a database at ${CURRENT_TAGDIR}"
- eerror
- eerror "Please export data if any entered and empty or remove"
- eerror "the directory, installation has been stopped so you"
- eerror "can take required action"
- eerror
- eerror "For a HOWTO on exporting the data, see instructions in the ebuild"
- eerror
- openldap_upgrade_howto
- die "Please move the datadir ${CURRENT_TAGDIR} away"
- fi
- fi
- einfo
- fi
- done
- [ "${have_files}" == "1" ] && einfo "DB files present" || einfo "No DB files present"
-
- # Now we must check for the major version of sys-libs/db linked against.
- SLAPD_PATH=${EROOT}/usr/$(get_libdir)/openldap/slapd
- if [ "${have_files}" == "1" -a -f "${SLAPD_PATH}" ]; then
- OLDVER="$(/usr/bin/ldd ${SLAPD_PATH} \
- | awk '/libdb-/{gsub("^libdb-","",$1);gsub(".so$","",$1);print $1}')"
- if use berkdb; then
- # find which one would be used
- for bdb_slot in $BDB_SLOTS ; do
- NEWVER="$(db_findver "=sys-libs/db-${bdb_slot}*")"
- [[ -n "$NEWVER" ]] && break
- done
- fi
- local fail=0
- if [ -z "${OLDVER}" -a -z "${NEWVER}" ]; then
- :
- # Nothing wrong here.
- elif [ -z "${OLDVER}" -a -n "${NEWVER}" ]; then
- eerror " Your existing version of OpenLDAP was not built against"
- eerror " any version of sys-libs/db, but the new one will build"
- eerror " against ${NEWVER} and your database may be inaccessible."
- echo
- fail=1
- elif [ -n "${OLDVER}" -a -z "${NEWVER}" ]; then
- eerror " Your existing version of OpenLDAP was built against"
- eerror " sys-libs/db:${OLDVER}, but the new one will not be"
- eerror " built against any version and your database may be"
- eerror " inaccessible."
- echo
- fail=1
- elif [ "${OLDVER}" != "${NEWVER}" ]; then
- eerror " Your existing version of OpenLDAP was built against"
- eerror " sys-libs/db:${OLDVER}, but the new one will build against"
- eerror " ${NEWVER} and your database would be inaccessible."
- echo
- fail=1
- fi
- [ "${fail}" == "1" ] && openldap_upgrade_howto
- fi
-
- echo
- einfo
- einfo "All datadirs are fine, proceeding with merge now..."
- einfo
-}
-
-openldap_upgrade_howto() {
- eerror
- eerror "A (possible old) installation of OpenLDAP was detected,"
- eerror "installation will not proceed for now."
- eerror
- eerror "As major version upgrades can corrupt your database,"
- eerror "you need to dump your database and re-create it afterwards."
- eerror
- eerror "Additionally, rebuilding against different major versions of the"
- eerror "sys-libs/db libraries will cause your database to be inaccessible."
- eerror ""
- d="$(date -u +%s)"
- l="/root/ldapdump.${d}"
- i="${l}.raw"
- eerror " 1. /etc/init.d/slurpd stop ; /etc/init.d/slapd stop"
- eerror " 2. slapcat -l ${i}"
- eerror " 3. egrep -v '^(entry|context)CSN:' <${i} >${l}"
- eerror " 4. mv /var/lib/openldap-data/ /var/lib/openldap-data-backup/"
- eerror " 5. emerge --update \=net-nds/${PF}"
- eerror " 6. etc-update, and ensure that you apply the changes"
- eerror " 7. slapadd -l ${l}"
- eerror " 8. chown ldap:ldap /var/lib/openldap-data/*"
- eerror " 9. /etc/init.d/slapd start"
- eerror "10. check that your data is intact."
- eerror "11. set up the new replication system."
- eerror
- if [ "${FORCE_UPGRADE}" != "1" ]; then
- die "You need to upgrade your database first"
- else
- eerror "You have the magical FORCE_UPGRADE=1 in place."
- eerror "Don't say you weren't warned about data loss."
- fi
-}
-
-pkg_setup() {
- if ! use sasl && use cxx ; then
- die "To build the ldapc++ library you must emerge openldap with sasl support"
- fi
- # Bug #322787
- if use minimal && ! has_version "net-nds/openldap" ; then
- einfo "No datadir scan needed, openldap not installed"
- elif use minimal && has_version "net-nds/openldap" && built_with_use net-nds/openldap minimal ; then
- einfo "Skipping scan for previous datadirs as requested by minimal useflag"
- else
- openldap_find_versiontags
- fi
-
- # The user/group are only used for running daemons which are
- # disabled in minimal builds, so elide the accounts too.
- if ! use minimal ; then
- enewgroup ldap 439
- enewuser ldap 439 -1 /usr/$(get_libdir)/openldap ldap
- fi
-}
-
-src_prepare() {
- # ensure correct SLAPI path by default
- sed -i -e 's,\(#define LDAPI_SOCK\).*,\1 "'"${EPREFIX}"'/var/run/openldap/slapd.sock",' \
- "${S}"/include/ldap_defaults.h
-
- epatch "${FILESDIR}"/${PN}-2.4.17-gcc44.patch
-
- epatch \
- "${FILESDIR}"/${PN}-2.2.14-perlthreadsfix.patch \
- "${FILESDIR}"/${PN}-2.4.15-ppolicy.patch
-
- # bug #116045 - still present in 2.4.28
- epatch "${FILESDIR}"/${PN}-2.4.35-contrib-smbk5pwd.patch
- # bug #408077 - samba4
- epatch "${FILESDIR}"/${PN}-2.4.35-contrib-samba4.patch
-
- # bug #189817
- epatch "${FILESDIR}"/${PN}-2.4.11-libldap_r.patch
-
- # bug #233633
- epatch "${FILESDIR}"/${PN}-2.4.17-fix-lmpasswd-gnutls-symbols.patch
-
- # bug #281495
- epatch "${FILESDIR}"/${PN}-2.4.28-gnutls-gcrypt.patch
-
- # bug #294350
- epatch "${FILESDIR}"/${PN}-2.4.6-evolution-ntlm.patch
-
- # unbreak /bin/sh -> dash
- epatch "${FILESDIR}"/${PN}-2.4.28-fix-dash.patch
-
- # bug #420959
- epatch "${FILESDIR}"/${PN}-2.4.31-gcc47.patch
-
- # bug #421463
- #epatch "${FILESDIR}"/${PN}-2.4.33-gnutls.patch # merged upstream
-
- # unbundle lmdb
- epatch "${FILESDIR}"/${P}-mdb-unbundle.patch
- rm -rf "${S}"/libraries/liblmdb
-
- cd "${S}"/build || die
- einfo "Making sure upstream build strip does not do stripping too early"
- sed -i.orig \
- -e '/^STRIP/s,-s,,g' \
- top.mk || die "Failed to block stripping"
-
- # wrong assumption that /bin/sh is /bin/bash
- sed -i \
- -e 's|/bin/sh|/bin/bash|g' \
- "${S}"/tests/scripts/* || die "sed failed"
-
- cd "${S}" || die
-
- AT_NOEAUTOMAKE=yes eautoreconf
-}
-
-build_contrib_module() {
- # <dir> <sources> <outputname>
- cd "${S}/contrib/slapd-modules/$1" || die
- einfo "Compiling contrib-module: $3"
- # Make sure it's uppercase
- local define_name="$(echo "SLAPD_OVER_${1}" | LC_ALL=C tr '[:lower:]' '[:upper:]')"
- "${lt}" --mode=compile --tag=CC \
- "${CC}" \
- -D${define_name}=SLAPD_MOD_DYNAMIC \
- -I"${BUILD_DIR}"/include \
- -I../../../include -I../../../servers/slapd ${CFLAGS} \
- -o ${2%.c}.lo -c $2 || die "compiling $3 failed"
- einfo "Linking contrib-module: $3"
- "${lt}" --mode=link --tag=CC \
- "${CC}" -module \
- ${CFLAGS} \
- ${LDFLAGS} \
- -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
- -o $3.la ${2%.c}.lo || die "linking $3 failed"
-}
-
-src_configure() {
- # Bug 408001
- use elibc_FreeBSD && append-cppflags -DMDB_DSYNC=O_SYNC -DMDB_FDATASYNC=fsync
-
- # connectionless ldap per bug #342439
- append-cppflags -DLDAP_CONNECTIONLESS
-
- multilib-minimal_src_configure
-}
-
-multilib_src_configure() {
- local myconf=()
-
- use debug && myconf+=( $(use_enable debug) )
-
- # ICU usage is not configurable
- export ac_cv_header_unicode_utypes_h="$(multilib_is_native_abi && use icu && echo yes || echo no)"
-
- if ! use minimal && multilib_is_native_abi; then
- local CPPFLAGS=${CPPFLAGS}
-
- # re-enable serverside overlay chains per bug #296567
- # see ldap docs chaper 12.3.1 for details
- myconf+=( --enable-ldap )
-
- # backends
- myconf+=( --enable-slapd )
- if use berkdb ; then
- einfo "Using Berkeley DB for local backend"
- myconf+=( --enable-bdb --enable-hdb )
- DBINCLUDE=$(db_includedir $BDB_SLOTS)
- einfo "Using $DBINCLUDE for sys-libs/db version"
- # We need to include the slotted db.h dir for FreeBSD
- append-cppflags -I${DBINCLUDE}
- else
- myconf+=( --disable-bdb --disable-hdb )
- fi
- for backend in dnssrv ldap mdb meta monitor null passwd relay shell sock; do
- myconf+=( --enable-${backend}=mod )
- done
-
- myconf+=( $(use_enable perl perl mod) )
-
- myconf+=( $(use_enable odbc sql mod) )
- if use odbc ; then
- local odbc_lib="unixodbc"
- if use iodbc ; then
- odbc_lib="iodbc"
- append-cppflags -I"${EPREFIX}"/usr/include/iodbc
- fi
- myconf+=( --with-odbc=${odbc_lib} )
- fi
-
- # slapd options
- myconf+=(
- $(use_enable crypt)
- $(use_enable slp)
- $(use_enable samba lmpasswd)
- $(use_enable syslog)
- )
- if use experimental ; then
- myconf+=(
- --enable-dynacl
- --enable-aci=mod
- )
- fi
- for option in aci cleartext modules rewrite rlookups slapi; do
- myconf+=( --enable-${option} )
- done
-
- # slapd overlay options
- # Compile-in the syncprov, the others as module
- myconf+=( --enable-syncprov=yes )
- use overlays && myconf+=( --enable-overlays=mod )
-
- else
- myconf+=(
- --disable-backends
- --disable-slapd
- --disable-bdb
- --disable-hdb
- --disable-mdb
- --disable-overlays
- --disable-syslog
- )
- fi
-
- # basic functionality stuff
- myconf+=(
- $(use_enable ipv6)
- $(multilib_native_use_with sasl cyrus-sasl)
- $(multilib_native_use_enable sasl spasswd)
- $(use_enable tcpd wrappers)
- )
-
- # Some cross-compiling tests don't pan out well.
- tc-is-cross-compiler && myconf+=(
- --with-yielding-select=yes
- )
-
- local ssl_lib="no"
- if use ssl || ( ! use minimal && use samba ) ; then
- ssl_lib="openssl"
- use gnutls && ssl_lib="gnutls"
- fi
-
- myconf+=( --with-tls=${ssl_lib} )
-
- for basicflag in dynamic local proctitle shared; do
- myconf+=( --enable-${basicflag} )
- done
-
- tc-export AR CC CXX
- ECONF_SOURCE=${S} \
- STRIP=/bin/true \
- econf \
- --libexecdir="${EPREFIX}"/usr/$(get_libdir)/openldap \
- $(use_enable static-libs static) \
- "${myconf[@]}"
- emake depend
-}
-
-src_configure_cxx() {
- # This needs the libraries built by the first build run.
- # So we have to run it AFTER the main build, not just after the main
- # configure.
- local myconf_ldapcpp=(
- --with-ldap-includes="${S}"/include
- )
-
- mkdir -p "${BUILD_DIR}"/contrib/ldapc++ || die
- cd "${BUILD_DIR}/contrib/ldapc++" || die
-
- local LDFLAGS=${LDFLAGS} CPPFLAGS=${CPPFLAGS}
- append-ldflags -L"${BUILD_DIR}"/libraries/liblber/.libs \
- -L"${BUILD_DIR}"/libraries/libldap/.libs
- append-cppflags -I"${BUILD_DIR}"/include
- ECONF_SOURCE=${S}/contrib/ldapc++ \
- econf "${myconf_ldapcpp[@]}" \
- CC="${CC}" \
- CXX="${CXX}"
-}
-
-multilib_src_compile() {
- tc-export AR CC CXX
- emake CC="${CC}" AR="${AR}" SHELL="${EPREFIX}"/bin/bash
- local lt="${BUILD_DIR}/libtool"
- export echo="echo"
-
- if ! use minimal && multilib_is_native_abi ; then
- if use cxx ; then
- einfo "Building contrib library: ldapc++"
- src_configure_cxx
- cd "${BUILD_DIR}/contrib/ldapc++" || die
- emake \
- CC="${CC}" CXX="${CXX}"
- fi
-
- if use smbkrb5passwd ; then
- einfo "Building contrib-module: smbk5pwd"
- cd "${S}/contrib/slapd-modules/smbk5pwd" || die
-
- MY_DEFS="-DDO_SHADOW"
- if use samba ; then
- MY_DEFS="${MY_DEFS} -DDO_SAMBA"
- MY_KRB5_INC=""
- fi
- if use kerberos ; then
- MY_DEFS="${MY_DEFS} -DDO_KRB5"
- MY_KRB5_INC="$(krb5-config --cflags)"
- fi
-
- emake \
- DEFS="${MY_DEFS}" \
- KRB5_INC="${MY_KRB5_INC}" \
- LDAP_BUILD="${BUILD_DIR}" \
- CC="${CC}" libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap"
- fi
-
- if use overlays ; then
- einfo "Building contrib-module: samba4"
- cd "${S}/contrib/slapd-modules/samba4" || die
-
- emake \
- LDAP_BUILD="${BUILD_DIR}" \
- CC="${CC}" libexecdir="/usr/$(get_libdir)/openldap"
- fi
-
- if use kerberos ; then
- build_contrib_module "kinit" "kinit.c" "kinit"
- cd "${S}/contrib/slapd-modules/passwd" || die
- einfo "Compiling contrib-module: pw-kerberos"
- "${lt}" --mode=compile --tag=CC \
- "${CC}" \
- -I"${BUILD_DIR}"/include \
- -I../../../include \
- ${CFLAGS} \
- $(krb5-config --cflags) \
- -DHAVE_KRB5 \
- -o kerberos.lo \
- -c kerberos.c || die "compiling pw-kerberos failed"
- einfo "Linking contrib-module: pw-kerberos"
- "${lt}" --mode=link --tag=CC \
- "${CC}" -module \
- ${CFLAGS} \
- ${LDFLAGS} \
- -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
- -o pw-kerberos.la \
- kerberos.lo || die "linking pw-kerberos failed"
- fi
- # We could build pw-radius if GNURadius would install radlib.h
- cd "${S}/contrib/slapd-modules/passwd" || die
- einfo "Compiling contrib-module: pw-netscape"
- "${lt}" --mode=compile --tag=CC \
- "${CC}" \
- -I"${BUILD_DIR}"/include \
- -I../../../include \
- ${CFLAGS} \
- -o netscape.lo \
- -c netscape.c || die "compiling pw-netscape failed"
- einfo "Linking contrib-module: pw-netscape"
- "${lt}" --mode=link --tag=CC \
- "${CC}" -module \
- ${CFLAGS} \
- ${LDFLAGS} \
- -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
- -o pw-netscape.la \
- netscape.lo || die "linking pw-netscape failed"
-
- #build_contrib_module "acl" "posixgroup.c" "posixGroup" # example code only
- #build_contrib_module "acl" "gssacl.c" "gss" # example code only, also needs kerberos
- build_contrib_module "addpartial" "addpartial-overlay.c" "addpartial-overlay"
- build_contrib_module "allop" "allop.c" "overlay-allop"
- build_contrib_module "allowed" "allowed.c" "allowed"
- build_contrib_module "autogroup" "autogroup.c" "autogroup"
- build_contrib_module "cloak" "cloak.c" "cloak"
- # build_contrib_module "comp_match" "comp_match.c" "comp_match" # really complex, adds new external deps, questionable demand
- build_contrib_module "denyop" "denyop.c" "denyop-overlay"
- build_contrib_module "dsaschema" "dsaschema.c" "dsaschema-plugin"
- build_contrib_module "dupent" "dupent.c" "dupent"
- build_contrib_module "lastbind" "lastbind.c" "lastbind"
- # lastmod may not play well with other overlays
- build_contrib_module "lastmod" "lastmod.c" "lastmod"
- build_contrib_module "noopsrch" "noopsrch.c" "noopsrch"
- build_contrib_module "nops" "nops.c" "nops-overlay"
- #build_contrib_module "nssov" "nssov.c" "nssov-overlay" RESO:LATER
- build_contrib_module "trace" "trace.c" "trace"
- # build slapi-plugins
- cd "${S}/contrib/slapi-plugins/addrdnvalues" || die
- einfo "Building contrib-module: addrdnvalues plugin"
- "${CC}" -shared \
- -I"${BUILD_DIR}"/include \
- -I../../../include \
- ${CFLAGS} \
- -fPIC \
- ${LDFLAGS} \
- -o libaddrdnvalues-plugin.so \
- addrdnvalues.c || die "Building libaddrdnvalues-plugin.so failed"
-
- fi
-}
-
-multilib_src_test() {
- if multilib_is_native_abi; then
- cd tests || die
- emake tests || die "make tests failed"
- fi
-}
-
-multilib_src_install() {
- local lt="${BUILD_DIR}/libtool"
- emake DESTDIR="${D}" SHELL="${EPREFIX}"/bin/bash install
- use static-libs || prune_libtool_files --all
-
- if ! use minimal && multilib_is_native_abi; then
- # openldap modules go here
- # TODO: write some code to populate slapd.conf with moduleload statements
- keepdir /usr/$(get_libdir)/openldap/openldap/
-
- # initial data storage dir
- keepdir /var/lib/openldap-data
- use prefix || fowners ldap:ldap /var/lib/openldap-data
- fperms 0700 /var/lib/openldap-data
-
- echo "OLDPF='${PF}'" > "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
- echo "# do NOT delete this. it is used" >> "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
- echo "# to track versions for upgrading." >> "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
-
- # use our config
- rm "${ED}"etc/openldap/slapd.conf
- insinto /etc/openldap
- newins "${FILESDIR}"/${PN}-2.4.40-slapd-conf slapd.conf
- configfile="${ED}"etc/openldap/slapd.conf
-
- # populate with built backends
- ebegin "populate config with built backends"
- for x in "${ED}"usr/$(get_libdir)/openldap/openldap/back_*.so; do
- einfo "Adding $(basename ${x})"
- sed -e "/###INSERTDYNAMICMODULESHERE###$/a# moduleload\t$(basename ${x})" -i "${configfile}"
- done
- sed -e "s:###INSERTDYNAMICMODULESHERE###$:# modulepath\t${EPREFIX}/usr/$(get_libdir)/openldap/openldap:" -i "${configfile}"
- use prefix || fowners root:ldap /etc/openldap/slapd.conf
- fperms 0640 /etc/openldap/slapd.conf
- cp "${configfile}" "${configfile}".default
- eend
-
- # install our own init scripts and systemd unit files
- einfo "Install init scripts"
- newinitd "${FILESDIR}"/slapd-initd-2.4.40-r2 slapd
- newconfd "${FILESDIR}"/slapd-confd-2.4.28-r1 slapd
- einfo "Install systemd service"
- systemd_dounit "${FILESDIR}"/slapd.service
- systemd_install_serviced "${FILESDIR}"/slapd.service.conf
- systemd_newtmpfilesd "${FILESDIR}"/slapd.tmpfilesd slapd.conf
-
- if [[ $(get_libdir) != lib ]]; then
- sed -e "s,/usr/lib/,/usr/$(get_libdir)/," -i \
- "${ED}"/etc/init.d/slapd \
- "${ED}"/usr/lib/systemd/system/slapd.service || die
- fi
- # If built without SLP, we don't need to be before avahi
- use slp \
- || sed -i \
- -e '/before/{s/avahi-daemon//g}' \
- "${ED}"etc/init.d/slapd
-
- if use cxx ; then
- einfo "Install the ldapc++ library"
- cd "${BUILD_DIR}/contrib/ldapc++" || die
- emake DESTDIR="${D}" libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" install
- cd "${S}"/contrib/ldapc++ || die
- newdoc README ldapc++-README
- fi
-
- if use smbkrb5passwd ; then
- einfo "Install the smbk5pwd module"
- cd "${S}/contrib/slapd-modules/smbk5pwd" || die
- emake DESTDIR="${D}" \
- LDAP_BUILD="${BUILD_DIR}" \
- libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" install
- newdoc README smbk5pwd-README
- fi
-
- if use overlays ; then
- einfo "Install the samba4 module"
- cd "${S}/contrib/slapd-modules/samba4" || die
- emake DESTDIR="${D}" \
- LDAP_BUILD="${BUILD_DIR}" \
- libexecdir="/usr/$(get_libdir)/openldap" install
- newdoc README samba4-README
- fi
-
- einfo "Installing contrib modules"
- cd "${S}/contrib/slapd-modules" || die
- for l in */*.la; do
- "${lt}" --mode=install cp ${l} \
- "${ED}"usr/$(get_libdir)/openldap/openldap || \
- die "installing ${l} failed"
- done
-
- dodoc "${FILESDIR}"/DB_CONFIG.fast.example
- docinto contrib
- doman */*.5
- #newdoc acl/README*
- newdoc addpartial/README addpartial-README
- newdoc allop/README allop-README
- newdoc allowed/README allowed-README
- newdoc autogroup/README autogroup-README
- newdoc dsaschema/README dsaschema-README
- newdoc passwd/README passwd-README
- cd "${S}/contrib/slapi-plugins" || die
- insinto /usr/$(get_libdir)/openldap/openldap
- doins */*.so
- docinto contrib
- newdoc addrdnvalues/README addrdnvalues-README
-
- insinto /etc/openldap/schema
- newins "${DISTDIR}"/${BIS_P} ${BIS_PN}
-
- docinto back-sock ; dodoc "${S}"/servers/slapd/back-sock/searchexample*
- docinto back-shell ; dodoc "${S}"/servers/slapd/back-shell/searchexample*
- docinto back-perl ; dodoc "${S}"/servers/slapd/back-perl/SampleLDAP.pm
-
- dosbin "${S}"/contrib/slapd-tools/statslog
- newdoc "${S}"/contrib/slapd-tools/README README.statslog
- fi
-}
-
-multilib_src_install_all() {
- dodoc ANNOUNCEMENT CHANGES COPYRIGHT README
- docinto rfc ; dodoc doc/rfc/*.txt
-}
-
-pkg_preinst() {
- # keep old libs if any
- preserve_old_lib /usr/$(get_libdir)/{liblber,libldap_r,liblber}-2.3$(get_libname 0)
- # bug 440470, only display the getting started help there was no openldap before,
- # or we are going to a non-minimal build
- ! has_version net-nds/openldap || has_version 'net-nds/openldap[minimal]'
- OPENLDAP_PRINT_MESSAGES=$((! $?))
-}
-
-pkg_postinst() {
- if ! use minimal ; then
- # You cannot build SSL certificates during src_install that will make
- # binary packages containing your SSL key, which is both a security risk
- # and a misconfiguration if multiple machines use the same key and cert.
- if use ssl; then
- install_cert /etc/openldap/ssl/ldap
- use prefix || chown ldap:ldap "${EROOT}"etc/openldap/ssl/ldap.*
- ewarn "Self-signed SSL certificates are treated harshly by OpenLDAP 2.[12]"
- ewarn "Self-signed SSL certificates are treated harshly by OpenLDAP 2.[12]"
- ewarn "add 'TLS_REQCERT allow' if you want to use them."
- fi
-
- if use prefix; then
- # Warn about prefix issues with slapd
- eerror "slapd might NOT be usable on Prefix systems as it requires root privileges"
- eerror "to start up, and requires that certain files directories be owned by"
- eerror "ldap:ldap. As Prefix does not support changing ownership of files and"
- eerror "directories, you will have to manually fix this yourself."
- fi
-
- # These lines force the permissions of various content to be correct
- use prefix || chown ldap:ldap "${EROOT}"var/run/openldap
- chmod 0755 "${EROOT}"var/run/openldap
- use prefix || chown root:ldap "${EROOT}"etc/openldap/slapd.conf{,.default}
- chmod 0640 "${EROOT}"etc/openldap/slapd.conf{,.default}
- use prefix || chown ldap:ldap "${EROOT}"var/lib/openldap-data
- fi
-
- if has_version 'net-nds/openldap[-minimal]' && ((${OPENLDAP_PRINT_MESSAGES})); then
- elog "Getting started using OpenLDAP? There is some documentation available:"
- elog "Gentoo Guide to OpenLDAP Authentication"
- elog "(https://www.gentoo.org/doc/en/ldap-howto.xml)"
- elog "---"
- elog "An example file for tuning BDB backends with openldap is"
- elog "DB_CONFIG.fast.example in /usr/share/doc/${PF}/"
- fi
-
- preserve_old_lib_notify /usr/$(get_libdir)/{liblber,libldap,libldap_r}-2.3$(get_libname 0)
-}
diff --git a/net-nds/openldap/openldap-2.4.43-r1.ebuild b/net-nds/openldap/openldap-2.4.43-r1.ebuild
deleted file mode 100644
index ee27b3c2c66e..000000000000
--- a/net-nds/openldap/openldap-2.4.43-r1.ebuild
+++ /dev/null
@@ -1,830 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI="5"
-
-inherit db-use eutils flag-o-matic multilib multilib-minimal ssl-cert versionator toolchain-funcs autotools user systemd
-
-BIS_PN=rfc2307bis.schema
-BIS_PV=20140524
-BIS_P="${BIS_PN}-${BIS_PV}"
-
-DESCRIPTION="LDAP suite of application and development tools"
-HOMEPAGE="http://www.OpenLDAP.org/"
-
-# mirrors are mostly not working, using canonical URI
-SRC_URI="ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/${P}.tgz
- mirror://gentoo/${BIS_P}"
-
-LICENSE="OPENLDAP GPL-2"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~x86-solaris"
-
-IUSE_DAEMON="crypt icu samba slp tcpd experimental minimal"
-IUSE_BACKEND="+berkdb"
-IUSE_OVERLAY="overlays perl"
-IUSE_OPTIONAL="gnutls iodbc sasl ssl odbc debug ipv6 libressl +syslog selinux static-libs"
-IUSE_CONTRIB="smbkrb5passwd kerberos kinit"
-IUSE_CONTRIB="${IUSE_CONTRIB} -cxx"
-IUSE="${IUSE_DAEMON} ${IUSE_BACKEND} ${IUSE_OVERLAY} ${IUSE_OPTIONAL} ${IUSE_CONTRIB}"
-
-REQUIRED_USE="cxx? ( sasl )
- ?? ( gnutls libressl )"
-
-# always list newer first
-# Do not add any AGPL-3 BDB here!
-# See bug 525110, comment 15.
-BDB_SLOTS='5.3 5.1 4.8 4.7 4.6 4.5 4.4'
-BDB_PKGS=''
-for _slot in $BDB_SLOTS; do BDB_PKGS="${BDB_PKGS} sys-libs/db:${_slot}" ; done
-
-# openssl is needed to generate lanman-passwords required by samba
-CDEPEND="icu? ( dev-libs/icu:= )
- ssl? (
- !gnutls? (
- !libressl? ( >=dev-libs/openssl-1.0.1h-r2:0[${MULTILIB_USEDEP}] )
- )
- gnutls? ( >=net-libs/gnutls-2.12.23-r6[${MULTILIB_USEDEP}]
- libressl? ( dev-libs/libressl[${MULTILIB_USEDEP}] )
- >=dev-libs/libgcrypt-1.5.3:0[${MULTILIB_USEDEP}] ) )
- sasl? ( dev-libs/cyrus-sasl:= )
- !minimal? (
- sys-devel/libtool
- sys-libs/e2fsprogs-libs
- >=dev-db/lmdb-0.9.17
- tcpd? ( sys-apps/tcp-wrappers )
- odbc? ( !iodbc? ( dev-db/unixODBC )
- iodbc? ( dev-db/libiodbc ) )
- slp? ( net-libs/openslp )
- perl? ( dev-lang/perl:=[-build(-)] )
- samba? (
- !libressl? ( dev-libs/openssl:0 )
- libressl? ( dev-libs/libressl )
- )
- berkdb? (
- <sys-libs/db-6.0:=
- || ( ${BDB_PKGS} )
- )
- smbkrb5passwd? (
- !libressl? ( dev-libs/openssl:0 )
- libressl? ( dev-libs/libressl )
- kerberos? ( app-crypt/heimdal )
- )
- kerberos? (
- virtual/krb5
- kinit? ( !app-crypt/heimdal )
- )
- cxx? ( dev-libs/cyrus-sasl:= )
- )
- abi_x86_32? (
- !<=app-emulation/emul-linux-x86-baselibs-20140508-r3
- !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
- )"
-DEPEND="${CDEPEND}
- sys-apps/groff"
-RDEPEND="${CDEPEND}
- selinux? ( sec-policy/selinux-ldap )
-"
-# for tracking versions
-OPENLDAP_VERSIONTAG=".version-tag"
-OPENLDAP_DEFAULTDIR_VERSIONTAG="/var/lib/openldap-data"
-
-MULTILIB_WRAPPED_HEADERS=(
- # USE=cxx
- /usr/include/LDAPAsynConnection.h
- /usr/include/LDAPAttrType.h
- /usr/include/LDAPAttribute.h
- /usr/include/LDAPAttributeList.h
- /usr/include/LDAPConnection.h
- /usr/include/LDAPConstraints.h
- /usr/include/LDAPControl.h
- /usr/include/LDAPControlSet.h
- /usr/include/LDAPEntry.h
- /usr/include/LDAPEntryList.h
- /usr/include/LDAPException.h
- /usr/include/LDAPExtResult.h
- /usr/include/LDAPMessage.h
- /usr/include/LDAPMessageQueue.h
- /usr/include/LDAPModList.h
- /usr/include/LDAPModification.h
- /usr/include/LDAPObjClass.h
- /usr/include/LDAPRebind.h
- /usr/include/LDAPRebindAuth.h
- /usr/include/LDAPReferenceList.h
- /usr/include/LDAPResult.h
- /usr/include/LDAPSaslBindResult.h
- /usr/include/LDAPSchema.h
- /usr/include/LDAPSearchReference.h
- /usr/include/LDAPSearchResult.h
- /usr/include/LDAPSearchResults.h
- /usr/include/LDAPUrl.h
- /usr/include/LDAPUrlList.h
- /usr/include/LdifReader.h
- /usr/include/LdifWriter.h
- /usr/include/SaslInteraction.h
- /usr/include/SaslInteractionHandler.h
- /usr/include/StringList.h
- /usr/include/TlsOptions.h
-)
-
-openldap_filecount() {
- local dir="$1"
- find "${dir}" -type f ! -name '.*' ! -name 'DB_CONFIG*' | wc -l
-}
-
-openldap_find_versiontags() {
- # scan for all datadirs
- openldap_datadirs=""
- if [ -f "${EROOT}"/etc/openldap/slapd.conf ]; then
- openldap_datadirs="$(awk '{if($1 == "directory") print $2 }' ${EROOT}/etc/openldap/slapd.conf)"
- fi
- openldap_datadirs="${openldap_datadirs} ${OPENLDAP_DEFAULTDIR_VERSIONTAG}"
-
- einfo
- einfo "Scanning datadir(s) from slapd.conf and"
- einfo "the default installdir for Versiontags"
- einfo "(${OPENLDAP_DEFAULTDIR_VERSIONTAG} may appear twice)"
- einfo
-
- # scan datadirs if we have a version tag
- openldap_found_tag=0
- have_files=0
- for each in ${openldap_datadirs}; do
- CURRENT_TAGDIR=${ROOT}`echo ${each} | sed "s:\/::"`
- CURRENT_TAG=${CURRENT_TAGDIR}/${OPENLDAP_VERSIONTAG}
- if [ -d ${CURRENT_TAGDIR} ] && [ ${openldap_found_tag} == 0 ] ; then
- einfo "- Checking ${each}..."
- if [ -r ${CURRENT_TAG} ] ; then
- # yey, we have one :)
- einfo " Found Versiontag in ${each}"
- source ${CURRENT_TAG}
- if [ "${OLDPF}" == "" ] ; then
- eerror "Invalid Versiontag found in ${CURRENT_TAGDIR}"
- eerror "Please delete it"
- eerror
- die "Please kill the invalid versiontag in ${CURRENT_TAGDIR}"
- fi
-
- OLD_MAJOR=`get_version_component_range 2-3 ${OLDPF}`
-
- [ $(openldap_filecount ${CURRENT_TAGDIR}) -gt 0 ] && have_files=1
-
- # are we on the same branch?
- if [ "${OLD_MAJOR}" != "${PV:0:3}" ] ; then
- ewarn " Versiontag doesn't match current major release!"
- if [[ "${have_files}" == "1" ]] ; then
- eerror " Versiontag says other major and you (probably) have datafiles!"
- echo
- openldap_upgrade_howto
- else
- einfo " No real problem, seems there's no database."
- fi
- else
- einfo " Versiontag is fine here :)"
- fi
- else
- einfo " Non-tagged dir ${each}"
- [ $(openldap_filecount ${each}) -gt 0 ] && have_files=1
- if [[ "${have_files}" == "1" ]] ; then
- einfo " EEK! Non-empty non-tagged datadir, counting `ls -a ${each} | wc -l` files"
- echo
-
- eerror
- eerror "Your OpenLDAP Installation has a non tagged datadir that"
- eerror "possibly contains a database at ${CURRENT_TAGDIR}"
- eerror
- eerror "Please export data if any entered and empty or remove"
- eerror "the directory, installation has been stopped so you"
- eerror "can take required action"
- eerror
- eerror "For a HOWTO on exporting the data, see instructions in the ebuild"
- eerror
- openldap_upgrade_howto
- die "Please move the datadir ${CURRENT_TAGDIR} away"
- fi
- fi
- einfo
- fi
- done
- [ "${have_files}" == "1" ] && einfo "DB files present" || einfo "No DB files present"
-
- # Now we must check for the major version of sys-libs/db linked against.
- SLAPD_PATH=${EROOT}/usr/$(get_libdir)/openldap/slapd
- if [ "${have_files}" == "1" -a -f "${SLAPD_PATH}" ]; then
- OLDVER="$(/usr/bin/ldd ${SLAPD_PATH} \
- | awk '/libdb-/{gsub("^libdb-","",$1);gsub(".so$","",$1);print $1}')"
- if use berkdb; then
- # find which one would be used
- for bdb_slot in $BDB_SLOTS ; do
- NEWVER="$(db_findver "=sys-libs/db-${bdb_slot}*")"
- [[ -n "$NEWVER" ]] && break
- done
- fi
- local fail=0
- if [ -z "${OLDVER}" -a -z "${NEWVER}" ]; then
- :
- # Nothing wrong here.
- elif [ -z "${OLDVER}" -a -n "${NEWVER}" ]; then
- eerror " Your existing version of OpenLDAP was not built against"
- eerror " any version of sys-libs/db, but the new one will build"
- eerror " against ${NEWVER} and your database may be inaccessible."
- echo
- fail=1
- elif [ -n "${OLDVER}" -a -z "${NEWVER}" ]; then
- eerror " Your existing version of OpenLDAP was built against"
- eerror " sys-libs/db:${OLDVER}, but the new one will not be"
- eerror " built against any version and your database may be"
- eerror " inaccessible."
- echo
- fail=1
- elif [ "${OLDVER}" != "${NEWVER}" ]; then
- eerror " Your existing version of OpenLDAP was built against"
- eerror " sys-libs/db:${OLDVER}, but the new one will build against"
- eerror " ${NEWVER} and your database would be inaccessible."
- echo
- fail=1
- fi
- [ "${fail}" == "1" ] && openldap_upgrade_howto
- fi
-
- echo
- einfo
- einfo "All datadirs are fine, proceeding with merge now..."
- einfo
-}
-
-openldap_upgrade_howto() {
- eerror
- eerror "A (possible old) installation of OpenLDAP was detected,"
- eerror "installation will not proceed for now."
- eerror
- eerror "As major version upgrades can corrupt your database,"
- eerror "you need to dump your database and re-create it afterwards."
- eerror
- eerror "Additionally, rebuilding against different major versions of the"
- eerror "sys-libs/db libraries will cause your database to be inaccessible."
- eerror ""
- d="$(date -u +%s)"
- l="/root/ldapdump.${d}"
- i="${l}.raw"
- eerror " 1. /etc/init.d/slurpd stop ; /etc/init.d/slapd stop"
- eerror " 2. slapcat -l ${i}"
- eerror " 3. egrep -v '^(entry|context)CSN:' <${i} >${l}"
- eerror " 4. mv /var/lib/openldap-data/ /var/lib/openldap-data-backup/"
- eerror " 5. emerge --update \=net-nds/${PF}"
- eerror " 6. etc-update, and ensure that you apply the changes"
- eerror " 7. slapadd -l ${l}"
- eerror " 8. chown ldap:ldap /var/lib/openldap-data/*"
- eerror " 9. /etc/init.d/slapd start"
- eerror "10. check that your data is intact."
- eerror "11. set up the new replication system."
- eerror
- if [ "${FORCE_UPGRADE}" != "1" ]; then
- die "You need to upgrade your database first"
- else
- eerror "You have the magical FORCE_UPGRADE=1 in place."
- eerror "Don't say you weren't warned about data loss."
- fi
-}
-
-pkg_setup() {
- if ! use sasl && use cxx ; then
- die "To build the ldapc++ library you must emerge openldap with sasl support"
- fi
- # Bug #322787
- if use minimal && ! has_version "net-nds/openldap" ; then
- einfo "No datadir scan needed, openldap not installed"
- elif use minimal && has_version "net-nds/openldap" && built_with_use net-nds/openldap minimal ; then
- einfo "Skipping scan for previous datadirs as requested by minimal useflag"
- else
- openldap_find_versiontags
- fi
-
- # The user/group are only used for running daemons which are
- # disabled in minimal builds, so elide the accounts too.
- if ! use minimal ; then
- enewgroup ldap 439
- enewuser ldap 439 -1 /usr/$(get_libdir)/openldap ldap
- fi
-}
-
-src_prepare() {
- # ensure correct SLAPI path by default
- sed -i -e 's,\(#define LDAPI_SOCK\).*,\1 "'"${EPREFIX}"'/var/run/openldap/slapd.sock",' \
- "${S}"/include/ldap_defaults.h
-
- epatch "${FILESDIR}"/${PN}-2.4.17-gcc44.patch
-
- epatch \
- "${FILESDIR}"/${PN}-2.2.14-perlthreadsfix.patch \
- "${FILESDIR}"/${PN}-2.4.15-ppolicy.patch
-
- # bug #116045 - still present in 2.4.28
- epatch "${FILESDIR}"/${PN}-2.4.35-contrib-smbk5pwd.patch
- # bug #408077 - samba4
- epatch "${FILESDIR}"/${PN}-2.4.35-contrib-samba4.patch
-
- # bug #189817
- epatch "${FILESDIR}"/${PN}-2.4.11-libldap_r.patch
-
- # bug #233633
- epatch "${FILESDIR}"/${PN}-2.4.17-fix-lmpasswd-gnutls-symbols.patch
-
- # bug #281495
- epatch "${FILESDIR}"/${PN}-2.4.28-gnutls-gcrypt.patch
-
- # bug #294350
- epatch "${FILESDIR}"/${PN}-2.4.6-evolution-ntlm.patch
-
- # unbreak /bin/sh -> dash
- epatch "${FILESDIR}"/${PN}-2.4.28-fix-dash.patch
-
- # bug #420959
- epatch "${FILESDIR}"/${PN}-2.4.31-gcc47.patch
-
- # unbundle lmdb
- epatch "${FILESDIR}"/${PN}-2.4.42-mdb-unbundle.patch
- rm -rf "${S}"/libraries/liblmdb
-
- cd "${S}"/build || die
- einfo "Making sure upstream build strip does not do stripping too early"
- sed -i.orig \
- -e '/^STRIP/s,-s,,g' \
- top.mk || die "Failed to block stripping"
-
- # wrong assumption that /bin/sh is /bin/bash
- sed -i \
- -e 's|/bin/sh|/bin/bash|g' \
- "${S}"/tests/scripts/* || die "sed failed"
-
- cd "${S}" || die
-
- AT_NOEAUTOMAKE=yes eautoreconf
-}
-
-build_contrib_module() {
- # <dir> <sources> <outputname>
- cd "${S}/contrib/slapd-modules/$1" || die
- einfo "Compiling contrib-module: $3"
- # Make sure it's uppercase
- local define_name="$(echo "SLAPD_OVER_${1}" | LC_ALL=C tr '[:lower:]' '[:upper:]')"
- "${lt}" --mode=compile --tag=CC \
- "${CC}" \
- -D${define_name}=SLAPD_MOD_DYNAMIC \
- -I"${BUILD_DIR}"/include \
- -I../../../include -I../../../servers/slapd ${CFLAGS} \
- -o ${2%.c}.lo -c $2 || die "compiling $3 failed"
- einfo "Linking contrib-module: $3"
- "${lt}" --mode=link --tag=CC \
- "${CC}" -module \
- ${CFLAGS} \
- ${LDFLAGS} \
- -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
- -o $3.la ${2%.c}.lo || die "linking $3 failed"
-}
-
-src_configure() {
- # Bug 408001
- use elibc_FreeBSD && append-cppflags -DMDB_DSYNC=O_SYNC -DMDB_FDATASYNC=fsync
-
- # connectionless ldap per bug #342439
- append-cppflags -DLDAP_CONNECTIONLESS
-
- multilib-minimal_src_configure
-}
-
-multilib_src_configure() {
- local myconf=()
-
- use debug && myconf+=( $(use_enable debug) )
-
- # ICU usage is not configurable
- export ac_cv_header_unicode_utypes_h="$(multilib_is_native_abi && use icu && echo yes || echo no)"
-
- if ! use minimal && multilib_is_native_abi; then
- local CPPFLAGS=${CPPFLAGS}
-
- # re-enable serverside overlay chains per bug #296567
- # see ldap docs chaper 12.3.1 for details
- myconf+=( --enable-ldap )
-
- # backends
- myconf+=( --enable-slapd )
- if use berkdb ; then
- einfo "Using Berkeley DB for local backend"
- myconf+=( --enable-bdb --enable-hdb )
- DBINCLUDE=$(db_includedir $BDB_SLOTS)
- einfo "Using $DBINCLUDE for sys-libs/db version"
- # We need to include the slotted db.h dir for FreeBSD
- append-cppflags -I${DBINCLUDE}
- else
- myconf+=( --disable-bdb --disable-hdb )
- fi
- for backend in dnssrv ldap mdb meta monitor null passwd relay shell sock; do
- myconf+=( --enable-${backend}=mod )
- done
-
- myconf+=( $(use_enable perl perl mod) )
-
- myconf+=( $(use_enable odbc sql mod) )
- if use odbc ; then
- local odbc_lib="unixodbc"
- if use iodbc ; then
- odbc_lib="iodbc"
- append-cppflags -I"${EPREFIX}"/usr/include/iodbc
- fi
- myconf+=( --with-odbc=${odbc_lib} )
- fi
-
- # slapd options
- myconf+=(
- $(use_enable crypt)
- $(use_enable slp)
- $(use_enable samba lmpasswd)
- $(use_enable syslog)
- )
- if use experimental ; then
- myconf+=(
- --enable-dynacl
- --enable-aci=mod
- )
- fi
- for option in aci cleartext modules rewrite rlookups slapi; do
- myconf+=( --enable-${option} )
- done
-
- # slapd overlay options
- # Compile-in the syncprov, the others as module
- myconf+=( --enable-syncprov=yes )
- use overlays && myconf+=( --enable-overlays=mod )
-
- else
- myconf+=(
- --disable-backends
- --disable-slapd
- --disable-bdb
- --disable-hdb
- --disable-mdb
- --disable-overlays
- --disable-syslog
- )
- fi
-
- # basic functionality stuff
- myconf+=(
- $(use_enable ipv6)
- $(multilib_native_use_with sasl cyrus-sasl)
- $(multilib_native_use_enable sasl spasswd)
- $(use_enable tcpd wrappers)
- )
-
- # Some cross-compiling tests don't pan out well.
- tc-is-cross-compiler && myconf+=(
- --with-yielding-select=yes
- )
-
- local ssl_lib="no"
- if use ssl || ( ! use minimal && use samba ) ; then
- ssl_lib="openssl"
- use gnutls && ssl_lib="gnutls"
- fi
-
- myconf+=( --with-tls=${ssl_lib} )
-
- for basicflag in dynamic local proctitle shared; do
- myconf+=( --enable-${basicflag} )
- done
-
- tc-export AR CC CXX
- ECONF_SOURCE=${S} \
- STRIP=/bin/true \
- econf \
- --libexecdir="${EPREFIX}"/usr/$(get_libdir)/openldap \
- $(use_enable static-libs static) \
- "${myconf[@]}"
- emake depend
-}
-
-src_configure_cxx() {
- # This needs the libraries built by the first build run.
- # So we have to run it AFTER the main build, not just after the main
- # configure.
- local myconf_ldapcpp=(
- --with-ldap-includes="${S}"/include
- )
-
- mkdir -p "${BUILD_DIR}"/contrib/ldapc++ || die
- cd "${BUILD_DIR}/contrib/ldapc++" || die
-
- local LDFLAGS=${LDFLAGS} CPPFLAGS=${CPPFLAGS}
- append-ldflags -L"${BUILD_DIR}"/libraries/liblber/.libs \
- -L"${BUILD_DIR}"/libraries/libldap/.libs
- append-cppflags -I"${BUILD_DIR}"/include
- ECONF_SOURCE=${S}/contrib/ldapc++ \
- econf "${myconf_ldapcpp[@]}" \
- CC="${CC}" \
- CXX="${CXX}"
-}
-
-multilib_src_compile() {
- tc-export AR CC CXX
- emake CC="${CC}" AR="${AR}" SHELL="${EPREFIX}"/bin/bash
- local lt="${BUILD_DIR}/libtool"
- export echo="echo"
-
- if ! use minimal && multilib_is_native_abi ; then
- if use cxx ; then
- einfo "Building contrib library: ldapc++"
- src_configure_cxx
- cd "${BUILD_DIR}/contrib/ldapc++" || die
- emake \
- CC="${CC}" CXX="${CXX}"
- fi
-
- if use smbkrb5passwd ; then
- einfo "Building contrib-module: smbk5pwd"
- cd "${S}/contrib/slapd-modules/smbk5pwd" || die
-
- MY_DEFS="-DDO_SHADOW"
- if use samba ; then
- MY_DEFS="${MY_DEFS} -DDO_SAMBA"
- MY_KRB5_INC=""
- fi
- if use kerberos ; then
- MY_DEFS="${MY_DEFS} -DDO_KRB5"
- MY_KRB5_INC="$(krb5-config --cflags)"
- fi
-
- emake \
- DEFS="${MY_DEFS}" \
- KRB5_INC="${MY_KRB5_INC}" \
- LDAP_BUILD="${BUILD_DIR}" \
- CC="${CC}" libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap"
- fi
-
- if use overlays ; then
- einfo "Building contrib-module: samba4"
- cd "${S}/contrib/slapd-modules/samba4" || die
-
- emake \
- LDAP_BUILD="${BUILD_DIR}" \
- CC="${CC}" libexecdir="/usr/$(get_libdir)/openldap"
- fi
-
- if use kerberos ; then
- if use kinit ; then
- build_contrib_module "kinit" "kinit.c" "kinit"
- fi
- cd "${S}/contrib/slapd-modules/passwd" || die
- einfo "Compiling contrib-module: pw-kerberos"
- "${lt}" --mode=compile --tag=CC \
- "${CC}" \
- -I"${BUILD_DIR}"/include \
- -I../../../include \
- ${CFLAGS} \
- $(krb5-config --cflags) \
- -DHAVE_KRB5 \
- -o kerberos.lo \
- -c kerberos.c || die "compiling pw-kerberos failed"
- einfo "Linking contrib-module: pw-kerberos"
- "${lt}" --mode=link --tag=CC \
- "${CC}" -module \
- ${CFLAGS} \
- ${LDFLAGS} \
- -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
- -o pw-kerberos.la \
- kerberos.lo || die "linking pw-kerberos failed"
- fi
- # We could build pw-radius if GNURadius would install radlib.h
- cd "${S}/contrib/slapd-modules/passwd" || die
- einfo "Compiling contrib-module: pw-netscape"
- "${lt}" --mode=compile --tag=CC \
- "${CC}" \
- -I"${BUILD_DIR}"/include \
- -I../../../include \
- ${CFLAGS} \
- -o netscape.lo \
- -c netscape.c || die "compiling pw-netscape failed"
- einfo "Linking contrib-module: pw-netscape"
- "${lt}" --mode=link --tag=CC \
- "${CC}" -module \
- ${CFLAGS} \
- ${LDFLAGS} \
- -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
- -o pw-netscape.la \
- netscape.lo || die "linking pw-netscape failed"
-
- #build_contrib_module "acl" "posixgroup.c" "posixGroup" # example code only
- #build_contrib_module "acl" "gssacl.c" "gss" # example code only, also needs kerberos
- build_contrib_module "addpartial" "addpartial-overlay.c" "addpartial-overlay"
- build_contrib_module "allop" "allop.c" "overlay-allop"
- build_contrib_module "allowed" "allowed.c" "allowed"
- build_contrib_module "autogroup" "autogroup.c" "autogroup"
- build_contrib_module "cloak" "cloak.c" "cloak"
- # build_contrib_module "comp_match" "comp_match.c" "comp_match" # really complex, adds new external deps, questionable demand
- build_contrib_module "denyop" "denyop.c" "denyop-overlay"
- build_contrib_module "dsaschema" "dsaschema.c" "dsaschema-plugin"
- build_contrib_module "dupent" "dupent.c" "dupent"
- build_contrib_module "lastbind" "lastbind.c" "lastbind"
- # lastmod may not play well with other overlays
- build_contrib_module "lastmod" "lastmod.c" "lastmod"
- build_contrib_module "noopsrch" "noopsrch.c" "noopsrch"
- build_contrib_module "nops" "nops.c" "nops-overlay"
- #build_contrib_module "nssov" "nssov.c" "nssov-overlay" RESO:LATER
- build_contrib_module "trace" "trace.c" "trace"
- # build slapi-plugins
- cd "${S}/contrib/slapi-plugins/addrdnvalues" || die
- einfo "Building contrib-module: addrdnvalues plugin"
- "${CC}" -shared \
- -I"${BUILD_DIR}"/include \
- -I../../../include \
- ${CFLAGS} \
- -fPIC \
- ${LDFLAGS} \
- -o libaddrdnvalues-plugin.so \
- addrdnvalues.c || die "Building libaddrdnvalues-plugin.so failed"
-
- fi
-}
-
-multilib_src_test() {
- if multilib_is_native_abi; then
- cd tests || die
- emake tests || die "make tests failed"
- fi
-}
-
-multilib_src_install() {
- local lt="${BUILD_DIR}/libtool"
- emake DESTDIR="${D}" SHELL="${EPREFIX}"/bin/bash install
- use static-libs || prune_libtool_files --all
-
- if ! use minimal && multilib_is_native_abi; then
- # openldap modules go here
- # TODO: write some code to populate slapd.conf with moduleload statements
- keepdir /usr/$(get_libdir)/openldap/openldap/
-
- # initial data storage dir
- keepdir /var/lib/openldap-data
- use prefix || fowners ldap:ldap /var/lib/openldap-data
- fperms 0700 /var/lib/openldap-data
-
- echo "OLDPF='${PF}'" > "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
- echo "# do NOT delete this. it is used" >> "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
- echo "# to track versions for upgrading." >> "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
-
- # use our config
- rm "${ED}"etc/openldap/slapd.conf
- insinto /etc/openldap
- newins "${FILESDIR}"/${PN}-2.4.40-slapd-conf slapd.conf
- configfile="${ED}"etc/openldap/slapd.conf
-
- # populate with built backends
- ebegin "populate config with built backends"
- for x in "${ED}"usr/$(get_libdir)/openldap/openldap/back_*.so; do
- einfo "Adding $(basename ${x})"
- sed -e "/###INSERTDYNAMICMODULESHERE###$/a# moduleload\t$(basename ${x})" -i "${configfile}"
- done
- sed -e "s:###INSERTDYNAMICMODULESHERE###$:# modulepath\t${EPREFIX}/usr/$(get_libdir)/openldap/openldap:" -i "${configfile}"
- use prefix || fowners root:ldap /etc/openldap/slapd.conf
- fperms 0640 /etc/openldap/slapd.conf
- cp "${configfile}" "${configfile}".default
- eend
-
- # install our own init scripts and systemd unit files
- einfo "Install init scripts"
- newinitd "${FILESDIR}"/slapd-initd-2.4.40-r2 slapd
- newconfd "${FILESDIR}"/slapd-confd-2.4.28-r1 slapd
- einfo "Install systemd service"
- systemd_dounit "${FILESDIR}"/slapd.service
- systemd_install_serviced "${FILESDIR}"/slapd.service.conf
- systemd_newtmpfilesd "${FILESDIR}"/slapd.tmpfilesd slapd.conf
-
- if [[ $(get_libdir) != lib ]]; then
- sed -e "s,/usr/lib/,/usr/$(get_libdir)/," -i \
- "${ED}"/etc/init.d/slapd \
- "${ED}"/usr/lib/systemd/system/slapd.service || die
- fi
- # If built without SLP, we don't need to be before avahi
- use slp \
- || sed -i \
- -e '/before/{s/avahi-daemon//g}' \
- "${ED}"etc/init.d/slapd
-
- if use cxx ; then
- einfo "Install the ldapc++ library"
- cd "${BUILD_DIR}/contrib/ldapc++" || die
- emake DESTDIR="${D}" libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" install
- cd "${S}"/contrib/ldapc++ || die
- newdoc README ldapc++-README
- fi
-
- if use smbkrb5passwd ; then
- einfo "Install the smbk5pwd module"
- cd "${S}/contrib/slapd-modules/smbk5pwd" || die
- emake DESTDIR="${D}" \
- LDAP_BUILD="${BUILD_DIR}" \
- libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" install
- newdoc README smbk5pwd-README
- fi
-
- if use overlays ; then
- einfo "Install the samba4 module"
- cd "${S}/contrib/slapd-modules/samba4" || die
- emake DESTDIR="${D}" \
- LDAP_BUILD="${BUILD_DIR}" \
- libexecdir="/usr/$(get_libdir)/openldap" install
- newdoc README samba4-README
- fi
-
- einfo "Installing contrib modules"
- cd "${S}/contrib/slapd-modules" || die
- for l in */*.la; do
- "${lt}" --mode=install cp ${l} \
- "${ED}"usr/$(get_libdir)/openldap/openldap || \
- die "installing ${l} failed"
- done
-
- dodoc "${FILESDIR}"/DB_CONFIG.fast.example
- docinto contrib
- doman */*.5
- #newdoc acl/README*
- newdoc addpartial/README addpartial-README
- newdoc allop/README allop-README
- newdoc allowed/README allowed-README
- newdoc autogroup/README autogroup-README
- newdoc dsaschema/README dsaschema-README
- newdoc passwd/README passwd-README
- cd "${S}/contrib/slapi-plugins" || die
- insinto /usr/$(get_libdir)/openldap/openldap
- doins */*.so
- docinto contrib
- newdoc addrdnvalues/README addrdnvalues-README
-
- insinto /etc/openldap/schema
- newins "${DISTDIR}"/${BIS_P} ${BIS_PN}
-
- docinto back-sock ; dodoc "${S}"/servers/slapd/back-sock/searchexample*
- docinto back-shell ; dodoc "${S}"/servers/slapd/back-shell/searchexample*
- docinto back-perl ; dodoc "${S}"/servers/slapd/back-perl/SampleLDAP.pm
-
- dosbin "${S}"/contrib/slapd-tools/statslog
- newdoc "${S}"/contrib/slapd-tools/README README.statslog
- fi
-}
-
-multilib_src_install_all() {
- dodoc ANNOUNCEMENT CHANGES COPYRIGHT README
- docinto rfc ; dodoc doc/rfc/*.txt
-}
-
-pkg_preinst() {
- # keep old libs if any
- preserve_old_lib /usr/$(get_libdir)/{liblber,libldap_r,liblber}-2.3$(get_libname 0)
- # bug 440470, only display the getting started help there was no openldap before,
- # or we are going to a non-minimal build
- ! has_version net-nds/openldap || has_version 'net-nds/openldap[minimal]'
- OPENLDAP_PRINT_MESSAGES=$((! $?))
-}
-
-pkg_postinst() {
- if ! use minimal ; then
- # You cannot build SSL certificates during src_install that will make
- # binary packages containing your SSL key, which is both a security risk
- # and a misconfiguration if multiple machines use the same key and cert.
- if use ssl; then
- install_cert /etc/openldap/ssl/ldap
- use prefix || chown ldap:ldap "${EROOT}"etc/openldap/ssl/ldap.*
- ewarn "Self-signed SSL certificates are treated harshly by OpenLDAP 2.[12]"
- ewarn "Self-signed SSL certificates are treated harshly by OpenLDAP 2.[12]"
- ewarn "add 'TLS_REQCERT allow' if you want to use them."
- fi
-
- if use prefix; then
- # Warn about prefix issues with slapd
- eerror "slapd might NOT be usable on Prefix systems as it requires root privileges"
- eerror "to start up, and requires that certain files directories be owned by"
- eerror "ldap:ldap. As Prefix does not support changing ownership of files and"
- eerror "directories, you will have to manually fix this yourself."
- fi
-
- # These lines force the permissions of various content to be correct
- use prefix || chown ldap:ldap "${EROOT}"var/run/openldap
- chmod 0755 "${EROOT}"var/run/openldap
- use prefix || chown root:ldap "${EROOT}"etc/openldap/slapd.conf{,.default}
- chmod 0640 "${EROOT}"etc/openldap/slapd.conf{,.default}
- use prefix || chown ldap:ldap "${EROOT}"var/lib/openldap-data
- fi
-
- if has_version 'net-nds/openldap[-minimal]' && ((${OPENLDAP_PRINT_MESSAGES})); then
- elog "Getting started using OpenLDAP? There is some documentation available:"
- elog "Gentoo Guide to OpenLDAP Authentication"
- elog "(https://www.gentoo.org/doc/en/ldap-howto.xml)"
- elog "---"
- elog "An example file for tuning BDB backends with openldap is"
- elog "DB_CONFIG.fast.example in /usr/share/doc/${PF}/"
- fi
-
- preserve_old_lib_notify /usr/$(get_libdir)/{liblber,libldap,libldap_r}-2.3$(get_libname 0)
-}
diff --git a/net-nds/openldap/openldap-2.4.43.ebuild b/net-nds/openldap/openldap-2.4.43.ebuild
deleted file mode 100644
index dd6af161af41..000000000000
--- a/net-nds/openldap/openldap-2.4.43.ebuild
+++ /dev/null
@@ -1,825 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI="5"
-
-inherit db-use eutils flag-o-matic multilib multilib-minimal ssl-cert versionator toolchain-funcs autotools user systemd
-
-BIS_PN=rfc2307bis.schema
-BIS_PV=20140524
-BIS_P="${BIS_PN}-${BIS_PV}"
-
-DESCRIPTION="LDAP suite of application and development tools"
-HOMEPAGE="http://www.OpenLDAP.org/"
-
-# mirrors are mostly not working, using canonical URI
-SRC_URI="ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/${P}.tgz
- mirror://gentoo/${BIS_P}"
-
-LICENSE="OPENLDAP GPL-2"
-SLOT="0"
-KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~x86-solaris"
-
-IUSE_DAEMON="crypt icu samba slp tcpd experimental minimal"
-IUSE_BACKEND="+berkdb"
-IUSE_OVERLAY="overlays perl"
-IUSE_OPTIONAL="gnutls iodbc sasl ssl odbc debug ipv6 libressl +syslog selinux static-libs"
-IUSE_CONTRIB="smbkrb5passwd kerberos"
-IUSE_CONTRIB="${IUSE_CONTRIB} -cxx"
-IUSE="${IUSE_DAEMON} ${IUSE_BACKEND} ${IUSE_OVERLAY} ${IUSE_OPTIONAL} ${IUSE_CONTRIB}"
-
-REQUIRED_USE="cxx? ( sasl )
- ?? ( gnutls libressl )"
-
-# always list newer first
-# Do not add any AGPL-3 BDB here!
-# See bug 525110, comment 15.
-BDB_SLOTS='5.3 5.1 4.8 4.7 4.6 4.5 4.4'
-BDB_PKGS=''
-for _slot in $BDB_SLOTS; do BDB_PKGS="${BDB_PKGS} sys-libs/db:${_slot}" ; done
-
-# openssl is needed to generate lanman-passwords required by samba
-CDEPEND="icu? ( dev-libs/icu:= )
- ssl? (
- !gnutls? (
- !libressl? ( >=dev-libs/openssl-1.0.1h-r2:0[${MULTILIB_USEDEP}] )
- )
- gnutls? ( >=net-libs/gnutls-2.12.23-r6[${MULTILIB_USEDEP}]
- libressl? ( dev-libs/libressl[${MULTILIB_USEDEP}] )
- >=dev-libs/libgcrypt-1.5.3:0[${MULTILIB_USEDEP}] ) )
- sasl? ( dev-libs/cyrus-sasl:= )
- !minimal? (
- sys-devel/libtool
- sys-libs/e2fsprogs-libs
- >=dev-db/lmdb-0.9.17
- tcpd? ( sys-apps/tcp-wrappers )
- odbc? ( !iodbc? ( dev-db/unixODBC )
- iodbc? ( dev-db/libiodbc ) )
- slp? ( net-libs/openslp )
- perl? ( dev-lang/perl:=[-build(-)] )
- samba? (
- !libressl? ( dev-libs/openssl:0 )
- libressl? ( dev-libs/libressl )
- )
- berkdb? (
- <sys-libs/db-6.0:=
- || ( ${BDB_PKGS} )
- )
- smbkrb5passwd? (
- !libressl? ( dev-libs/openssl:0 )
- libressl? ( dev-libs/libressl )
- kerberos? ( app-crypt/heimdal )
- )
- kerberos? ( virtual/krb5 )
- cxx? ( dev-libs/cyrus-sasl:= )
- )
- abi_x86_32? (
- !<=app-emulation/emul-linux-x86-baselibs-20140508-r3
- !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
- )"
-DEPEND="${CDEPEND}
- sys-apps/groff"
-RDEPEND="${CDEPEND}
- selinux? ( sec-policy/selinux-ldap )
-"
-# for tracking versions
-OPENLDAP_VERSIONTAG=".version-tag"
-OPENLDAP_DEFAULTDIR_VERSIONTAG="/var/lib/openldap-data"
-
-MULTILIB_WRAPPED_HEADERS=(
- # USE=cxx
- /usr/include/LDAPAsynConnection.h
- /usr/include/LDAPAttrType.h
- /usr/include/LDAPAttribute.h
- /usr/include/LDAPAttributeList.h
- /usr/include/LDAPConnection.h
- /usr/include/LDAPConstraints.h
- /usr/include/LDAPControl.h
- /usr/include/LDAPControlSet.h
- /usr/include/LDAPEntry.h
- /usr/include/LDAPEntryList.h
- /usr/include/LDAPException.h
- /usr/include/LDAPExtResult.h
- /usr/include/LDAPMessage.h
- /usr/include/LDAPMessageQueue.h
- /usr/include/LDAPModList.h
- /usr/include/LDAPModification.h
- /usr/include/LDAPObjClass.h
- /usr/include/LDAPRebind.h
- /usr/include/LDAPRebindAuth.h
- /usr/include/LDAPReferenceList.h
- /usr/include/LDAPResult.h
- /usr/include/LDAPSaslBindResult.h
- /usr/include/LDAPSchema.h
- /usr/include/LDAPSearchReference.h
- /usr/include/LDAPSearchResult.h
- /usr/include/LDAPSearchResults.h
- /usr/include/LDAPUrl.h
- /usr/include/LDAPUrlList.h
- /usr/include/LdifReader.h
- /usr/include/LdifWriter.h
- /usr/include/SaslInteraction.h
- /usr/include/SaslInteractionHandler.h
- /usr/include/StringList.h
- /usr/include/TlsOptions.h
-)
-
-openldap_filecount() {
- local dir="$1"
- find "${dir}" -type f ! -name '.*' ! -name 'DB_CONFIG*' | wc -l
-}
-
-openldap_find_versiontags() {
- # scan for all datadirs
- openldap_datadirs=""
- if [ -f "${EROOT}"/etc/openldap/slapd.conf ]; then
- openldap_datadirs="$(awk '{if($1 == "directory") print $2 }' ${EROOT}/etc/openldap/slapd.conf)"
- fi
- openldap_datadirs="${openldap_datadirs} ${OPENLDAP_DEFAULTDIR_VERSIONTAG}"
-
- einfo
- einfo "Scanning datadir(s) from slapd.conf and"
- einfo "the default installdir for Versiontags"
- einfo "(${OPENLDAP_DEFAULTDIR_VERSIONTAG} may appear twice)"
- einfo
-
- # scan datadirs if we have a version tag
- openldap_found_tag=0
- have_files=0
- for each in ${openldap_datadirs}; do
- CURRENT_TAGDIR=${ROOT}`echo ${each} | sed "s:\/::"`
- CURRENT_TAG=${CURRENT_TAGDIR}/${OPENLDAP_VERSIONTAG}
- if [ -d ${CURRENT_TAGDIR} ] && [ ${openldap_found_tag} == 0 ] ; then
- einfo "- Checking ${each}..."
- if [ -r ${CURRENT_TAG} ] ; then
- # yey, we have one :)
- einfo " Found Versiontag in ${each}"
- source ${CURRENT_TAG}
- if [ "${OLDPF}" == "" ] ; then
- eerror "Invalid Versiontag found in ${CURRENT_TAGDIR}"
- eerror "Please delete it"
- eerror
- die "Please kill the invalid versiontag in ${CURRENT_TAGDIR}"
- fi
-
- OLD_MAJOR=`get_version_component_range 2-3 ${OLDPF}`
-
- [ $(openldap_filecount ${CURRENT_TAGDIR}) -gt 0 ] && have_files=1
-
- # are we on the same branch?
- if [ "${OLD_MAJOR}" != "${PV:0:3}" ] ; then
- ewarn " Versiontag doesn't match current major release!"
- if [[ "${have_files}" == "1" ]] ; then
- eerror " Versiontag says other major and you (probably) have datafiles!"
- echo
- openldap_upgrade_howto
- else
- einfo " No real problem, seems there's no database."
- fi
- else
- einfo " Versiontag is fine here :)"
- fi
- else
- einfo " Non-tagged dir ${each}"
- [ $(openldap_filecount ${each}) -gt 0 ] && have_files=1
- if [[ "${have_files}" == "1" ]] ; then
- einfo " EEK! Non-empty non-tagged datadir, counting `ls -a ${each} | wc -l` files"
- echo
-
- eerror
- eerror "Your OpenLDAP Installation has a non tagged datadir that"
- eerror "possibly contains a database at ${CURRENT_TAGDIR}"
- eerror
- eerror "Please export data if any entered and empty or remove"
- eerror "the directory, installation has been stopped so you"
- eerror "can take required action"
- eerror
- eerror "For a HOWTO on exporting the data, see instructions in the ebuild"
- eerror
- openldap_upgrade_howto
- die "Please move the datadir ${CURRENT_TAGDIR} away"
- fi
- fi
- einfo
- fi
- done
- [ "${have_files}" == "1" ] && einfo "DB files present" || einfo "No DB files present"
-
- # Now we must check for the major version of sys-libs/db linked against.
- SLAPD_PATH=${EROOT}/usr/$(get_libdir)/openldap/slapd
- if [ "${have_files}" == "1" -a -f "${SLAPD_PATH}" ]; then
- OLDVER="$(/usr/bin/ldd ${SLAPD_PATH} \
- | awk '/libdb-/{gsub("^libdb-","",$1);gsub(".so$","",$1);print $1}')"
- if use berkdb; then
- # find which one would be used
- for bdb_slot in $BDB_SLOTS ; do
- NEWVER="$(db_findver "=sys-libs/db-${bdb_slot}*")"
- [[ -n "$NEWVER" ]] && break
- done
- fi
- local fail=0
- if [ -z "${OLDVER}" -a -z "${NEWVER}" ]; then
- :
- # Nothing wrong here.
- elif [ -z "${OLDVER}" -a -n "${NEWVER}" ]; then
- eerror " Your existing version of OpenLDAP was not built against"
- eerror " any version of sys-libs/db, but the new one will build"
- eerror " against ${NEWVER} and your database may be inaccessible."
- echo
- fail=1
- elif [ -n "${OLDVER}" -a -z "${NEWVER}" ]; then
- eerror " Your existing version of OpenLDAP was built against"
- eerror " sys-libs/db:${OLDVER}, but the new one will not be"
- eerror " built against any version and your database may be"
- eerror " inaccessible."
- echo
- fail=1
- elif [ "${OLDVER}" != "${NEWVER}" ]; then
- eerror " Your existing version of OpenLDAP was built against"
- eerror " sys-libs/db:${OLDVER}, but the new one will build against"
- eerror " ${NEWVER} and your database would be inaccessible."
- echo
- fail=1
- fi
- [ "${fail}" == "1" ] && openldap_upgrade_howto
- fi
-
- echo
- einfo
- einfo "All datadirs are fine, proceeding with merge now..."
- einfo
-}
-
-openldap_upgrade_howto() {
- eerror
- eerror "A (possible old) installation of OpenLDAP was detected,"
- eerror "installation will not proceed for now."
- eerror
- eerror "As major version upgrades can corrupt your database,"
- eerror "you need to dump your database and re-create it afterwards."
- eerror
- eerror "Additionally, rebuilding against different major versions of the"
- eerror "sys-libs/db libraries will cause your database to be inaccessible."
- eerror ""
- d="$(date -u +%s)"
- l="/root/ldapdump.${d}"
- i="${l}.raw"
- eerror " 1. /etc/init.d/slurpd stop ; /etc/init.d/slapd stop"
- eerror " 2. slapcat -l ${i}"
- eerror " 3. egrep -v '^(entry|context)CSN:' <${i} >${l}"
- eerror " 4. mv /var/lib/openldap-data/ /var/lib/openldap-data-backup/"
- eerror " 5. emerge --update \=net-nds/${PF}"
- eerror " 6. etc-update, and ensure that you apply the changes"
- eerror " 7. slapadd -l ${l}"
- eerror " 8. chown ldap:ldap /var/lib/openldap-data/*"
- eerror " 9. /etc/init.d/slapd start"
- eerror "10. check that your data is intact."
- eerror "11. set up the new replication system."
- eerror
- if [ "${FORCE_UPGRADE}" != "1" ]; then
- die "You need to upgrade your database first"
- else
- eerror "You have the magical FORCE_UPGRADE=1 in place."
- eerror "Don't say you weren't warned about data loss."
- fi
-}
-
-pkg_setup() {
- if ! use sasl && use cxx ; then
- die "To build the ldapc++ library you must emerge openldap with sasl support"
- fi
- # Bug #322787
- if use minimal && ! has_version "net-nds/openldap" ; then
- einfo "No datadir scan needed, openldap not installed"
- elif use minimal && has_version "net-nds/openldap" && built_with_use net-nds/openldap minimal ; then
- einfo "Skipping scan for previous datadirs as requested by minimal useflag"
- else
- openldap_find_versiontags
- fi
-
- # The user/group are only used for running daemons which are
- # disabled in minimal builds, so elide the accounts too.
- if ! use minimal ; then
- enewgroup ldap 439
- enewuser ldap 439 -1 /usr/$(get_libdir)/openldap ldap
- fi
-}
-
-src_prepare() {
- # ensure correct SLAPI path by default
- sed -i -e 's,\(#define LDAPI_SOCK\).*,\1 "'"${EPREFIX}"'/var/run/openldap/slapd.sock",' \
- "${S}"/include/ldap_defaults.h
-
- epatch "${FILESDIR}"/${PN}-2.4.17-gcc44.patch
-
- epatch \
- "${FILESDIR}"/${PN}-2.2.14-perlthreadsfix.patch \
- "${FILESDIR}"/${PN}-2.4.15-ppolicy.patch
-
- # bug #116045 - still present in 2.4.28
- epatch "${FILESDIR}"/${PN}-2.4.35-contrib-smbk5pwd.patch
- # bug #408077 - samba4
- epatch "${FILESDIR}"/${PN}-2.4.35-contrib-samba4.patch
-
- # bug #189817
- epatch "${FILESDIR}"/${PN}-2.4.11-libldap_r.patch
-
- # bug #233633
- epatch "${FILESDIR}"/${PN}-2.4.17-fix-lmpasswd-gnutls-symbols.patch
-
- # bug #281495
- epatch "${FILESDIR}"/${PN}-2.4.28-gnutls-gcrypt.patch
-
- # bug #294350
- epatch "${FILESDIR}"/${PN}-2.4.6-evolution-ntlm.patch
-
- # unbreak /bin/sh -> dash
- epatch "${FILESDIR}"/${PN}-2.4.28-fix-dash.patch
-
- # bug #420959
- epatch "${FILESDIR}"/${PN}-2.4.31-gcc47.patch
-
- # unbundle lmdb
- epatch "${FILESDIR}"/${PN}-2.4.42-mdb-unbundle.patch
- rm -rf "${S}"/libraries/liblmdb
-
- cd "${S}"/build || die
- einfo "Making sure upstream build strip does not do stripping too early"
- sed -i.orig \
- -e '/^STRIP/s,-s,,g' \
- top.mk || die "Failed to block stripping"
-
- # wrong assumption that /bin/sh is /bin/bash
- sed -i \
- -e 's|/bin/sh|/bin/bash|g' \
- "${S}"/tests/scripts/* || die "sed failed"
-
- cd "${S}" || die
-
- AT_NOEAUTOMAKE=yes eautoreconf
-}
-
-build_contrib_module() {
- # <dir> <sources> <outputname>
- cd "${S}/contrib/slapd-modules/$1" || die
- einfo "Compiling contrib-module: $3"
- # Make sure it's uppercase
- local define_name="$(echo "SLAPD_OVER_${1}" | LC_ALL=C tr '[:lower:]' '[:upper:]')"
- "${lt}" --mode=compile --tag=CC \
- "${CC}" \
- -D${define_name}=SLAPD_MOD_DYNAMIC \
- -I"${BUILD_DIR}"/include \
- -I../../../include -I../../../servers/slapd ${CFLAGS} \
- -o ${2%.c}.lo -c $2 || die "compiling $3 failed"
- einfo "Linking contrib-module: $3"
- "${lt}" --mode=link --tag=CC \
- "${CC}" -module \
- ${CFLAGS} \
- ${LDFLAGS} \
- -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
- -o $3.la ${2%.c}.lo || die "linking $3 failed"
-}
-
-src_configure() {
- # Bug 408001
- use elibc_FreeBSD && append-cppflags -DMDB_DSYNC=O_SYNC -DMDB_FDATASYNC=fsync
-
- # connectionless ldap per bug #342439
- append-cppflags -DLDAP_CONNECTIONLESS
-
- multilib-minimal_src_configure
-}
-
-multilib_src_configure() {
- local myconf=()
-
- use debug && myconf+=( $(use_enable debug) )
-
- # ICU usage is not configurable
- export ac_cv_header_unicode_utypes_h="$(multilib_is_native_abi && use icu && echo yes || echo no)"
-
- if ! use minimal && multilib_is_native_abi; then
- local CPPFLAGS=${CPPFLAGS}
-
- # re-enable serverside overlay chains per bug #296567
- # see ldap docs chaper 12.3.1 for details
- myconf+=( --enable-ldap )
-
- # backends
- myconf+=( --enable-slapd )
- if use berkdb ; then
- einfo "Using Berkeley DB for local backend"
- myconf+=( --enable-bdb --enable-hdb )
- DBINCLUDE=$(db_includedir $BDB_SLOTS)
- einfo "Using $DBINCLUDE for sys-libs/db version"
- # We need to include the slotted db.h dir for FreeBSD
- append-cppflags -I${DBINCLUDE}
- else
- myconf+=( --disable-bdb --disable-hdb )
- fi
- for backend in dnssrv ldap mdb meta monitor null passwd relay shell sock; do
- myconf+=( --enable-${backend}=mod )
- done
-
- myconf+=( $(use_enable perl perl mod) )
-
- myconf+=( $(use_enable odbc sql mod) )
- if use odbc ; then
- local odbc_lib="unixodbc"
- if use iodbc ; then
- odbc_lib="iodbc"
- append-cppflags -I"${EPREFIX}"/usr/include/iodbc
- fi
- myconf+=( --with-odbc=${odbc_lib} )
- fi
-
- # slapd options
- myconf+=(
- $(use_enable crypt)
- $(use_enable slp)
- $(use_enable samba lmpasswd)
- $(use_enable syslog)
- )
- if use experimental ; then
- myconf+=(
- --enable-dynacl
- --enable-aci=mod
- )
- fi
- for option in aci cleartext modules rewrite rlookups slapi; do
- myconf+=( --enable-${option} )
- done
-
- # slapd overlay options
- # Compile-in the syncprov, the others as module
- myconf+=( --enable-syncprov=yes )
- use overlays && myconf+=( --enable-overlays=mod )
-
- else
- myconf+=(
- --disable-backends
- --disable-slapd
- --disable-bdb
- --disable-hdb
- --disable-mdb
- --disable-overlays
- --disable-syslog
- )
- fi
-
- # basic functionality stuff
- myconf+=(
- $(use_enable ipv6)
- $(multilib_native_use_with sasl cyrus-sasl)
- $(multilib_native_use_enable sasl spasswd)
- $(use_enable tcpd wrappers)
- )
-
- # Some cross-compiling tests don't pan out well.
- tc-is-cross-compiler && myconf+=(
- --with-yielding-select=yes
- )
-
- local ssl_lib="no"
- if use ssl || ( ! use minimal && use samba ) ; then
- ssl_lib="openssl"
- use gnutls && ssl_lib="gnutls"
- fi
-
- myconf+=( --with-tls=${ssl_lib} )
-
- for basicflag in dynamic local proctitle shared; do
- myconf+=( --enable-${basicflag} )
- done
-
- tc-export AR CC CXX
- ECONF_SOURCE=${S} \
- STRIP=/bin/true \
- econf \
- --libexecdir="${EPREFIX}"/usr/$(get_libdir)/openldap \
- $(use_enable static-libs static) \
- "${myconf[@]}"
- emake depend
-}
-
-src_configure_cxx() {
- # This needs the libraries built by the first build run.
- # So we have to run it AFTER the main build, not just after the main
- # configure.
- local myconf_ldapcpp=(
- --with-ldap-includes="${S}"/include
- )
-
- mkdir -p "${BUILD_DIR}"/contrib/ldapc++ || die
- cd "${BUILD_DIR}/contrib/ldapc++" || die
-
- local LDFLAGS=${LDFLAGS} CPPFLAGS=${CPPFLAGS}
- append-ldflags -L"${BUILD_DIR}"/libraries/liblber/.libs \
- -L"${BUILD_DIR}"/libraries/libldap/.libs
- append-cppflags -I"${BUILD_DIR}"/include
- ECONF_SOURCE=${S}/contrib/ldapc++ \
- econf "${myconf_ldapcpp[@]}" \
- CC="${CC}" \
- CXX="${CXX}"
-}
-
-multilib_src_compile() {
- tc-export AR CC CXX
- emake CC="${CC}" AR="${AR}" SHELL="${EPREFIX}"/bin/bash
- local lt="${BUILD_DIR}/libtool"
- export echo="echo"
-
- if ! use minimal && multilib_is_native_abi ; then
- if use cxx ; then
- einfo "Building contrib library: ldapc++"
- src_configure_cxx
- cd "${BUILD_DIR}/contrib/ldapc++" || die
- emake \
- CC="${CC}" CXX="${CXX}"
- fi
-
- if use smbkrb5passwd ; then
- einfo "Building contrib-module: smbk5pwd"
- cd "${S}/contrib/slapd-modules/smbk5pwd" || die
-
- MY_DEFS="-DDO_SHADOW"
- if use samba ; then
- MY_DEFS="${MY_DEFS} -DDO_SAMBA"
- MY_KRB5_INC=""
- fi
- if use kerberos ; then
- MY_DEFS="${MY_DEFS} -DDO_KRB5"
- MY_KRB5_INC="$(krb5-config --cflags)"
- fi
-
- emake \
- DEFS="${MY_DEFS}" \
- KRB5_INC="${MY_KRB5_INC}" \
- LDAP_BUILD="${BUILD_DIR}" \
- CC="${CC}" libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap"
- fi
-
- if use overlays ; then
- einfo "Building contrib-module: samba4"
- cd "${S}/contrib/slapd-modules/samba4" || die
-
- emake \
- LDAP_BUILD="${BUILD_DIR}" \
- CC="${CC}" libexecdir="/usr/$(get_libdir)/openldap"
- fi
-
- if use kerberos ; then
- build_contrib_module "kinit" "kinit.c" "kinit"
- cd "${S}/contrib/slapd-modules/passwd" || die
- einfo "Compiling contrib-module: pw-kerberos"
- "${lt}" --mode=compile --tag=CC \
- "${CC}" \
- -I"${BUILD_DIR}"/include \
- -I../../../include \
- ${CFLAGS} \
- $(krb5-config --cflags) \
- -DHAVE_KRB5 \
- -o kerberos.lo \
- -c kerberos.c || die "compiling pw-kerberos failed"
- einfo "Linking contrib-module: pw-kerberos"
- "${lt}" --mode=link --tag=CC \
- "${CC}" -module \
- ${CFLAGS} \
- ${LDFLAGS} \
- -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
- -o pw-kerberos.la \
- kerberos.lo || die "linking pw-kerberos failed"
- fi
- # We could build pw-radius if GNURadius would install radlib.h
- cd "${S}/contrib/slapd-modules/passwd" || die
- einfo "Compiling contrib-module: pw-netscape"
- "${lt}" --mode=compile --tag=CC \
- "${CC}" \
- -I"${BUILD_DIR}"/include \
- -I../../../include \
- ${CFLAGS} \
- -o netscape.lo \
- -c netscape.c || die "compiling pw-netscape failed"
- einfo "Linking contrib-module: pw-netscape"
- "${lt}" --mode=link --tag=CC \
- "${CC}" -module \
- ${CFLAGS} \
- ${LDFLAGS} \
- -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
- -o pw-netscape.la \
- netscape.lo || die "linking pw-netscape failed"
-
- #build_contrib_module "acl" "posixgroup.c" "posixGroup" # example code only
- #build_contrib_module "acl" "gssacl.c" "gss" # example code only, also needs kerberos
- build_contrib_module "addpartial" "addpartial-overlay.c" "addpartial-overlay"
- build_contrib_module "allop" "allop.c" "overlay-allop"
- build_contrib_module "allowed" "allowed.c" "allowed"
- build_contrib_module "autogroup" "autogroup.c" "autogroup"
- build_contrib_module "cloak" "cloak.c" "cloak"
- # build_contrib_module "comp_match" "comp_match.c" "comp_match" # really complex, adds new external deps, questionable demand
- build_contrib_module "denyop" "denyop.c" "denyop-overlay"
- build_contrib_module "dsaschema" "dsaschema.c" "dsaschema-plugin"
- build_contrib_module "dupent" "dupent.c" "dupent"
- build_contrib_module "lastbind" "lastbind.c" "lastbind"
- # lastmod may not play well with other overlays
- build_contrib_module "lastmod" "lastmod.c" "lastmod"
- build_contrib_module "noopsrch" "noopsrch.c" "noopsrch"
- build_contrib_module "nops" "nops.c" "nops-overlay"
- #build_contrib_module "nssov" "nssov.c" "nssov-overlay" RESO:LATER
- build_contrib_module "trace" "trace.c" "trace"
- # build slapi-plugins
- cd "${S}/contrib/slapi-plugins/addrdnvalues" || die
- einfo "Building contrib-module: addrdnvalues plugin"
- "${CC}" -shared \
- -I"${BUILD_DIR}"/include \
- -I../../../include \
- ${CFLAGS} \
- -fPIC \
- ${LDFLAGS} \
- -o libaddrdnvalues-plugin.so \
- addrdnvalues.c || die "Building libaddrdnvalues-plugin.so failed"
-
- fi
-}
-
-multilib_src_test() {
- if multilib_is_native_abi; then
- cd tests || die
- emake tests || die "make tests failed"
- fi
-}
-
-multilib_src_install() {
- local lt="${BUILD_DIR}/libtool"
- emake DESTDIR="${D}" SHELL="${EPREFIX}"/bin/bash install
- use static-libs || prune_libtool_files --all
-
- if ! use minimal && multilib_is_native_abi; then
- # openldap modules go here
- # TODO: write some code to populate slapd.conf with moduleload statements
- keepdir /usr/$(get_libdir)/openldap/openldap/
-
- # initial data storage dir
- keepdir /var/lib/openldap-data
- use prefix || fowners ldap:ldap /var/lib/openldap-data
- fperms 0700 /var/lib/openldap-data
-
- echo "OLDPF='${PF}'" > "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
- echo "# do NOT delete this. it is used" >> "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
- echo "# to track versions for upgrading." >> "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
-
- # use our config
- rm "${ED}"etc/openldap/slapd.conf
- insinto /etc/openldap
- newins "${FILESDIR}"/${PN}-2.4.40-slapd-conf slapd.conf
- configfile="${ED}"etc/openldap/slapd.conf
-
- # populate with built backends
- ebegin "populate config with built backends"
- for x in "${ED}"usr/$(get_libdir)/openldap/openldap/back_*.so; do
- einfo "Adding $(basename ${x})"
- sed -e "/###INSERTDYNAMICMODULESHERE###$/a# moduleload\t$(basename ${x})" -i "${configfile}"
- done
- sed -e "s:###INSERTDYNAMICMODULESHERE###$:# modulepath\t${EPREFIX}/usr/$(get_libdir)/openldap/openldap:" -i "${configfile}"
- use prefix || fowners root:ldap /etc/openldap/slapd.conf
- fperms 0640 /etc/openldap/slapd.conf
- cp "${configfile}" "${configfile}".default
- eend
-
- # install our own init scripts and systemd unit files
- einfo "Install init scripts"
- newinitd "${FILESDIR}"/slapd-initd-2.4.40-r2 slapd
- newconfd "${FILESDIR}"/slapd-confd-2.4.28-r1 slapd
- einfo "Install systemd service"
- systemd_dounit "${FILESDIR}"/slapd.service
- systemd_install_serviced "${FILESDIR}"/slapd.service.conf
- systemd_newtmpfilesd "${FILESDIR}"/slapd.tmpfilesd slapd.conf
-
- if [[ $(get_libdir) != lib ]]; then
- sed -e "s,/usr/lib/,/usr/$(get_libdir)/," -i \
- "${ED}"/etc/init.d/slapd \
- "${ED}"/usr/lib/systemd/system/slapd.service || die
- fi
- # If built without SLP, we don't need to be before avahi
- use slp \
- || sed -i \
- -e '/before/{s/avahi-daemon//g}' \
- "${ED}"etc/init.d/slapd
-
- if use cxx ; then
- einfo "Install the ldapc++ library"
- cd "${BUILD_DIR}/contrib/ldapc++" || die
- emake DESTDIR="${D}" libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" install
- cd "${S}"/contrib/ldapc++ || die
- newdoc README ldapc++-README
- fi
-
- if use smbkrb5passwd ; then
- einfo "Install the smbk5pwd module"
- cd "${S}/contrib/slapd-modules/smbk5pwd" || die
- emake DESTDIR="${D}" \
- LDAP_BUILD="${BUILD_DIR}" \
- libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" install
- newdoc README smbk5pwd-README
- fi
-
- if use overlays ; then
- einfo "Install the samba4 module"
- cd "${S}/contrib/slapd-modules/samba4" || die
- emake DESTDIR="${D}" \
- LDAP_BUILD="${BUILD_DIR}" \
- libexecdir="/usr/$(get_libdir)/openldap" install
- newdoc README samba4-README
- fi
-
- einfo "Installing contrib modules"
- cd "${S}/contrib/slapd-modules" || die
- for l in */*.la; do
- "${lt}" --mode=install cp ${l} \
- "${ED}"usr/$(get_libdir)/openldap/openldap || \
- die "installing ${l} failed"
- done
-
- dodoc "${FILESDIR}"/DB_CONFIG.fast.example
- docinto contrib
- doman */*.5
- #newdoc acl/README*
- newdoc addpartial/README addpartial-README
- newdoc allop/README allop-README
- newdoc allowed/README allowed-README
- newdoc autogroup/README autogroup-README
- newdoc dsaschema/README dsaschema-README
- newdoc passwd/README passwd-README
- cd "${S}/contrib/slapi-plugins" || die
- insinto /usr/$(get_libdir)/openldap/openldap
- doins */*.so
- docinto contrib
- newdoc addrdnvalues/README addrdnvalues-README
-
- insinto /etc/openldap/schema
- newins "${DISTDIR}"/${BIS_P} ${BIS_PN}
-
- docinto back-sock ; dodoc "${S}"/servers/slapd/back-sock/searchexample*
- docinto back-shell ; dodoc "${S}"/servers/slapd/back-shell/searchexample*
- docinto back-perl ; dodoc "${S}"/servers/slapd/back-perl/SampleLDAP.pm
-
- dosbin "${S}"/contrib/slapd-tools/statslog
- newdoc "${S}"/contrib/slapd-tools/README README.statslog
- fi
-}
-
-multilib_src_install_all() {
- dodoc ANNOUNCEMENT CHANGES COPYRIGHT README
- docinto rfc ; dodoc doc/rfc/*.txt
-}
-
-pkg_preinst() {
- # keep old libs if any
- preserve_old_lib /usr/$(get_libdir)/{liblber,libldap_r,liblber}-2.3$(get_libname 0)
- # bug 440470, only display the getting started help there was no openldap before,
- # or we are going to a non-minimal build
- ! has_version net-nds/openldap || has_version 'net-nds/openldap[minimal]'
- OPENLDAP_PRINT_MESSAGES=$((! $?))
-}
-
-pkg_postinst() {
- if ! use minimal ; then
- # You cannot build SSL certificates during src_install that will make
- # binary packages containing your SSL key, which is both a security risk
- # and a misconfiguration if multiple machines use the same key and cert.
- if use ssl; then
- install_cert /etc/openldap/ssl/ldap
- use prefix || chown ldap:ldap "${EROOT}"etc/openldap/ssl/ldap.*
- ewarn "Self-signed SSL certificates are treated harshly by OpenLDAP 2.[12]"
- ewarn "Self-signed SSL certificates are treated harshly by OpenLDAP 2.[12]"
- ewarn "add 'TLS_REQCERT allow' if you want to use them."
- fi
-
- if use prefix; then
- # Warn about prefix issues with slapd
- eerror "slapd might NOT be usable on Prefix systems as it requires root privileges"
- eerror "to start up, and requires that certain files directories be owned by"
- eerror "ldap:ldap. As Prefix does not support changing ownership of files and"
- eerror "directories, you will have to manually fix this yourself."
- fi
-
- # These lines force the permissions of various content to be correct
- use prefix || chown ldap:ldap "${EROOT}"var/run/openldap
- chmod 0755 "${EROOT}"var/run/openldap
- use prefix || chown root:ldap "${EROOT}"etc/openldap/slapd.conf{,.default}
- chmod 0640 "${EROOT}"etc/openldap/slapd.conf{,.default}
- use prefix || chown ldap:ldap "${EROOT}"var/lib/openldap-data
- fi
-
- if has_version 'net-nds/openldap[-minimal]' && ((${OPENLDAP_PRINT_MESSAGES})); then
- elog "Getting started using OpenLDAP? There is some documentation available:"
- elog "Gentoo Guide to OpenLDAP Authentication"
- elog "(https://www.gentoo.org/doc/en/ldap-howto.xml)"
- elog "---"
- elog "An example file for tuning BDB backends with openldap is"
- elog "DB_CONFIG.fast.example in /usr/share/doc/${PF}/"
- fi
-
- preserve_old_lib_notify /usr/$(get_libdir)/{liblber,libldap,libldap_r}-2.3$(get_libname 0)
-}