%define migtools_version 46
%define db_version 4.4.20
%define ldbm_backend berkeley
%define version_22 2.2.29
%define version_23 2.3.27
%define evolution_connector_prefix %{_libdir}/evolution-openldap
%define evolution_connector_includedir %{evolution_connector_prefix}/include
%define evolution_connector_libdir %{evolution_connector_prefix}/%{_lib}
# For Fedora Core 5, we want 2.2 compatibility.
%define compat_version %{version_22}
%define nptl_arches %{ix86} ia64 ppc ppc64 s390 s390x sparcv9 x86_64
Summary: The configuration files, libraries, and documentation for OpenLDAP.
Name: openldap
Version: %{version_23}
Release: 8%{?dist}.3
License: OpenLDAP
Group: System Environment/Daemons
Source0: ftp://ftp.OpenLDAP.org/pub/OpenLDAP/openldap-release/openldap-%{version_23}.tgz
Source1: ftp://ftp.OpenLDAP.org/pub/OpenLDAP/openldap-release/openldap-%{version_22}.tgz
Source2: http://downloads.sleepycat.com/db-%{db_version}.tar.gz
Source3: ftp://ftp.OpenLDAP.org/pub/tools/autoconf-2.13.1.tar.gz
Source4: ftp://ftp.OpenLDAP.org/pub/tools/automake-1.4a.tar.gz
Source5: ftp://ftp.padl.com/pub/MigrationTools-%{migtools_version}.tar.gz
Source6: ldap.init
Source7: migration-tools.txt
Source8: autofs.schema
Source9: README.upgrading
Source10: http://www.OpenLDAP.org/doc/admin/guide.html
Source11: nptl-abi-note.S
Source12: README.evolution
# Patches that are still valid for 2.3
Patch0: openldap-2.3.11-config.patch
Patch1: openldap-1.2.11-cldap.patch
Patch2: openldap-2.0.11-ldaprc.patch
Patch3: openldap-2.2.13-setugid.patch
Patch4: openldap-2.2.13-pie.patch
Patch5: openldap-2.3.11-toollinks.patch
Patch6: openldap-2.3.11-nosql.patch
#Patch7: openldap-2.3.19-nostrip.patch
Patch8: openldap-2.3.19-gethostbyXXXX_r.patch
Patch9: openldap-2.3.27-getdn.patch
Patch10: openldap-2.3.27-config-sasl-options.patch
Patch11: openldap-2.3.27-timeout-option.patch
Patch12: openldap-2.3.27-writable-socket.patch
Patch13: openldap-2.3.27-acl-memleak.patch
Patch14: openldap-2.3.27-classes.patch
Patch15: openldap-2.3.27-modify-noop.patch
# Patches for 2.2.29 for the compat-openldap package.
Patch100: openldap-2.2.13-tls-fix-connection-test.patch
Patch101: openldap-2.2.23-resolv.patch
Patch102: openldap-2.2.29-ads.patch
#Patch103: openldap-2.2.29-nostrip.patch
# Patches for the evolution library
Patch200: openldap-ntlm.diff
# Patches for the MigrationTools package
Patch300: MigrationTools-38-instdir.patch
Patch301: MigrationTools-36-mktemp.patch
Patch302: MigrationTools-27-simple.patch
Patch303: MigrationTools-26-suffix.patch
Patch304: MigrationTools-46-schema.patch
Patch305: MigrationTools-45-noaliases.patch
Patch400: db-4.4.20-1.patch
Patch401: db-4.4.20-2.patch
URL: http://www.openldap.org/
BuildRoot: %{_tmppath}/%{name}-%{version_23}-root
BuildPreReq: cyrus-sasl-devel >= 2.1, gdbm-devel, libtool >= 1.5.6-2, krb5-devel
BuildPreReq: openssl-devel, pam-devel, perl, pkgconfig, tcp_wrappers,
BuildPreReq: unixODBC-devel, bind-libbind-devel, libtool-ltdl-devel
Requires: glibc >= 2.2.3-48, mktemp
%description
OpenLDAP is an open source suite of LDAP (Lightweight Directory Access
Protocol) applications and development tools. LDAP is a set of
protocols for accessing directory services (usually phone book style
information, but other information is possible) over the Internet,
similar to the way DNS (Domain Name System) information is propagated
over the Internet. The openldap package contains configuration files,
libraries, and documentation for OpenLDAP.
%package devel
Summary: OpenLDAP development libraries and header files.
Group: Development/Libraries
Requires: openldap = %{version_23}-%{release}, cyrus-sasl-devel >= 2.1
Provides: openldap-evolution-devel = %{version_23}-%{release}
%description devel
The openldap-devel package includes the development libraries and
header files needed for compiling applications that use LDAP
(Lightweight Directory Access Protocol) internals. LDAP is a set of
protocols for enabling directory services over the Internet. Install
this package only if you plan to develop or will need to compile
customized LDAP clients.
%package servers
Summary: OpenLDAP servers and related files.
Prereq: fileutils, make, openldap = %{version_23}-%{release}, openssl, /usr/sbin/useradd, /sbin/chkconfig, /sbin/runuser
Group: System Environment/Daemons
%description servers
OpenLDAP is an open-source suite of LDAP (Lightweight Directory Access
Protocol) applications and development tools. LDAP is a set of
protocols for accessing directory services (usually phone book style
information, but other information is possible) over the Internet,
similar to the way DNS (Domain Name System) information is propagated
over the Internet. This package contains the slapd and slurpd servers,
migration scripts, and related files.
%package servers-sql
Summary: OpenLDAP server SQL support module.
Prereq: openldap-servers = %{version_23}-%{release}
Group: System Environment/Daemons
%description servers-sql
OpenLDAP is an open-source suite of LDAP (Lightweight Directory Access
Protocol) applications and development tools. LDAP is a set of
protocols for accessing directory services (usually phone book style
information, but other information is possible) over the Internet,
similar to the way DNS (Domain Name System) information is propagated
over the Internet. This package contains a loadable module which the
slapd server can use to read data from an RDBMS.
%package clients
Summary: Client programs for OpenLDAP.
Prereq: openldap = %{version_23}-%{release}
Group: Applications/Internet
%description clients
OpenLDAP is an open-source suite of LDAP (Lightweight Directory Access
Protocol) applications and development tools. LDAP is a set of
protocols for accessing directory services (usually phone book style
information, but other information is possible) over the Internet,
similar to the way DNS (Domain Name System) information is propagated
over the Internet. The openldap-clients package contains the client
programs needed for accessing and modifying OpenLDAP directories.
# Declare this subpackage LAST. This version tag redefines %%{version}, so
# any future use would reference the wrong version.
%package -n compat-openldap
Summary: OpenLDAP compatibility shared libraries.
Group: System Environment/Libraries
# Require the current OpenLDAP libraries package in an attempt to ensure that
# we have a /etc/openldap/ldap.conf file on the system.
Requires: openldap = %{version_23}-%{release}
# Why this weirdo version number? We want to ensure that version comparisons
# for this package always sort in the same order as the main openldap package.
Version: %{version_23}_%{compat_version}
%description -n compat-openldap
OpenLDAP is an open source suite of LDAP (Lightweight Directory Access
Protocol) applications and development tools. The compat-openldap package
includes older versions of the OpenLDAP shared libraries which may be
required by some applications.
%prep
%setup -q -c -a 1 -a 2 -a 3 -a 4 -a 5
pushd db-%{db_version}
%patch400 -b .patch1
%patch401 -b .patch2
popd
pushd openldap-%{version_23}
cp %{_datadir}/libtool/config.{sub,guess} build/
popd
pushd openldap-%{version_23}
%patch0 -p1 -b .config
%patch1 -p1 -b .cldap
%patch2 -p1 -b .ldaprc
%patch3 -p1 -b .setugid
%patch4 -p1 -b .pie
%patch5 -p1 -b .toollinks
%patch6 -p1 -b .nosql
#%patch7 -p1 -b .nostrip
%patch8 -p1 -b .gethostbyname_r
%patch9 -p1 -b .getdn
%patch10 -p1 -b .sasl
%patch11 -p1 -b .timeout
%patch12 -p1 -b .socket
%patch13 -p1 -b .acl-memleak
%patch14 -p0 -b .classes
%patch15 -p1 -b .modify-noop
cp %{_datadir}/libtool/config.{sub,guess} build/
popd
# Set up a build tree for a static version of libldap with the hooks for the
# non-standard NTLM bind type which is needed to connect to Win2k GC servers
# (Win2k3 supports SASL with DIGEST-MD5, so this shouldn't be needed for those
# servers, though as of version 1.4 the connector doesn't try SASL first).
if ! cp -al openldap-%{version_23} evo-openldap-%{version_23} ; then
rm -fr evo-openldap-%{version_23}
cp -a openldap-%{version_23} evo-openldap-%{version_23}
fi
pushd evo-openldap-%{version_23}
%patch200 -p0 -b .evolution-ntlm
popd
pushd MigrationTools-%{migtools_version}
%patch300 -p1 -b .instdir
%patch301 -p1 -b .mktemp
%patch302 -p1 -b .simple
%patch303 -p1 -b .suffix
%patch304 -p1 -b .schema
%patch305 -p1 -b .noaliases
popd
autodir=`pwd`/auto-instroot
pushd autoconf-2.13.1
./configure --prefix=$autodir
make all install
popd
pushd automake-1.4a
./configure --prefix=$autodir
make all install
popd
pushd openldap-%{version_22}
%patch100 -p1 -b .resolv
%patch101 -p1 -b .CAN-2005-2069
%patch102 -p1 -b .ads
#%patch103 -p1 -b .nostrip
for subdir in build-servers build-compat ; do
mkdir $subdir
ln -s ../configure $subdir
done
$autodir/bin/autoconf
popd
pushd openldap-%{version_23}
for subdir in build-servers build-clients ; do
mkdir $subdir
ln -s ../configure $subdir
done
autoconf
popd
%build
autodir=`pwd`/auto-instroot
dbdir=`pwd`/db-instroot
libtool='%{_bindir}/libtool'
tagname=CC; export tagname
PATH=${autodir}/bin:${PATH}
%ifarch ia64
RPM_OPT_FLAGS="$RPM_OPT_FLAGS -O0"
%endif
# Set CFLAGS to incorporate RPM_OPT_FLAGS.
CFLAGS="$RPM_OPT_FLAGS -D_REENTRANT -fPIC"; export CFLAGS
# Build Berkeley DB and install it into a temporary area, isolating OpenLDAP
# from any future changes to the system-wide Berkeley DB library. Version 4.2
# or later is required by the BDB backend in OpenLDAP 2.1 and later.
buildbdb() {
subdir=$1
shift
install -d db-%{db_version}/build-rpm${subdir:+-${subdir}}
pushd db-%{db_version}/build-rpm${subdir:+-${subdir}}
echo "${1:+db_cv_mutex=$1}" > config.cache
shift
../dist/configure -C \
--with-pic \
--disable-static \
--enable-shared \
--with-uniquename=_openldap_slapd_rhl_42 \
--prefix=${dbdir} \
--includedir=${dbdir}/include \
--libdir=${dbdir}/%{_lib}${subdir:+/${subdir}}
# XXX db-4.2.x handles O_DIRECT (by disabling on linux) correctly.
# XXX hack out O_DIRECT support in db4 for now.
perl -pi -e 's/#define HAVE_O_DIRECT 1/#undef HAVE_O_DIRECT/' db_config.h
# fix libtool: no rpath
perl -pi -e 's|hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=\"-L\\\$libdir\"|g;' libtool
if test -n "$nptl_lo" ; then
./libtool --mode=compile %{__cc} -o $nptl_lo -c $nptl_s
fi
make %{_smp_mflags} libdb_base=libslapd_db libso_base=libslapd_db LIBSO_LIBS="$nptl_lo"
make install libdb_base=libslapd_db libso_base=libslapd_db LIBSO_LIBS="$nptl_lo"
ln -sf libslapd_db.so ${dbdir}/%{_lib}/${subdir}/libdb.so
popd
}
# Build an NPTL libdb if we're on a Linux arch with NPTL. NPTL gives us the
# ability to share mutexes between threads in different processes, and to have
# threads in both honor those locks. We have to do this because if you build
# libdb with support for intra-process locks, it dies if you don't have it and
# the application has specified to libdb that it's multi-threaded (as slapd
# does).
%ifarch %{nptl_arches}
unset nptl_s nptl_lo
case %{_os} in
linux|Linux)
nptl_s=$RPM_SOURCE_DIR/nptl-abi-note.S
nptl_lo=nptl-abi-note.lo
;;
esac
buildbdb tls POSIX/pthreads/library
unset nptl_s nptl_lo
%endif
# Build a non-NPTL libdb and tools, able to only use intra-process thread
# locks. Useless for bdb's purposes (bdb requires shared env support), but
# acceptable for ldbm.
buildbdb "" POSIX/pthreads/library/private
# Find OpenSSL's header and library dependencies.
if pkg-config openssl ; then
OPENSSL_CPPFLAGS=`pkg-config --cflags-only-I openssl`
CPPFLAGS="$OPENSSL_CPPFLAGS" ; export CPPFLAGS
OPENSSL_LDFLAGS=`pkg-config --libs-only-L openssl`
LDFLAGS="$OPENSSL_LDFLAGS" ; export LDFLAGS
fi
CPPFLAGS="-I${dbdir}/include $OPENSSL_CPPFLAGS" ; export CPPFLAGS
CFLAGS="$CPPFLAGS $RPM_OPT_FLAGS -D_REENTRANT -fPIC"; export CFLAGS
LDFLAGS="-L${dbdir}/%{_lib} $OPENSSL_LDFLAGS" ; export LDFLAGS
LD_LIBRARY_PATH=${dbdir}/%{_lib}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}; export LD_LIBRARY_PATH
# Build the client libraries for the compat package.
pushd openldap-%{compat_version}/build-compat
%configure \
--disable-slapd --disable-slurpd \
--with-threads=posix --enable-static --enable-shared --enable-dynamic \
--enable-local --with-tls --with-cyrus-sasl --without-kerberos
make %{_smp_mflags}
popd
# Build 2.2.
build() {
%configure \
--with-threads=posix \
\
--enable-local --enable-rlookups \
\
--with-tls \
--with-cyrus-sasl \
\
--enable-wrappers \
\
--enable-passwd \
\
--enable-cleartext \
--enable-crypt \
--enable-spasswd \
--enable-lmpasswd \
--enable-modules \
--disable-sql \
--enable-overlays=yes \
\
--libexecdir=%{_libdir} \
$@
make %{_smp_mflags} LIBTOOL="$libtool"
}
# Build the servers with Kerberos support (for password checking, mainly).
LIBS=-lpthread; export LIBS
LD_LIBRARY_PATH=${dbdir}/%{_lib}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}; export LD_LIBRARY_PATH
pushd openldap-%{version_23}/build-servers
build \
--enable-plugins \
--enable-slapd \
--enable-slurpd \
--enable-multimaster \
--enable-bdb \
--enable-hdb \
--enable-ldap \
--enable-ldbm \
--with-ldbm-api=%{ldbm_backend} \
--enable-meta \
--enable-monitor \
--enable-null \
--enable-shell \
--enable-sql=mod \
--disable-perl \
--disable-shared \
--disable-dynamic \
--enable-static \
--enable-overlays=yes \
--with-kerberos=k5only
unset LIBS
popd
# Build clients without Kerberos password-checking support, which is only
# useful in the server anyway, to avoid stray dependencies.
pushd openldap-%{version_23}/build-clients
build \
--disable-slapd \
--disable-slurpd \
--enable-shared \
--enable-dynamic \
--enable-static \
--without-kerberos \
--with-pic
popd
# Build evolution-specific clients just as we would normal clients, except with
# a different installation directory in mind and no shared libraries.
pushd evo-openldap-%{version_23}
build \
--disable-slapd \
--disable-slurpd \
--disable-shared \
--disable-dynamic \
--enable-static \
--without-kerberos \
--with-pic \
--includedir=%{evolution_connector_includedir} \
--libdir=%{evolution_connector_libdir}
popd
%install
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
libtool='%{_bindir}/libtool'
tagname=CC; export tagname
# Install the 2.0 or 2.1 shared libraries for compatibility. The two sets of
# libraries share sonames, so we have to choose one or the other.
mkdir -p $RPM_BUILD_ROOT/%{_libdir}/
pushd openldap-%{compat_version}/build-compat/libraries
make install DESTDIR=$RPM_BUILD_ROOT
rm $RPM_BUILD_ROOT/%{_libdir}/*.a
rm $RPM_BUILD_ROOT/%{_libdir}/*.la
rm $RPM_BUILD_ROOT/%{_libdir}/*.so
popd
# Install servers.
%ifarch %{nptl_arches}
case %{_target_platform} in
i386*|i486*) archp=i486; arches="i586 i686";;
i586*) archp=i586; arches=i686;;
i686*) archp=i686; arches=;;
athlon*) archp=i686; arches=;;
*) archp=; arches=;;
esac
pushd db-instroot/%{_lib}/tls/
install -d $RPM_BUILD_ROOT/%{_libdir}/tls/${archp}/
install -m755 libslapd_db-*.*.so $RPM_BUILD_ROOT/%{_libdir}/tls/${archp}/
for arch in $arches ; do
install -d $RPM_BUILD_ROOT/%{_libdir}/tls/${arch}/
ln $RPM_BUILD_ROOT/%{_libdir}/tls/${archp}/* $RPM_BUILD_ROOT/%{_libdir}/tls/${arch}/
done
popd
%endif
pushd db-instroot/%{_lib}/
install -d $RPM_BUILD_ROOT/%{_libdir}/
install -m755 libslapd_db-*.*.so $RPM_BUILD_ROOT/%{_libdir}/
popd
pushd openldap-%{version_23}/build-servers
make install DESTDIR=$RPM_BUILD_ROOT libdir=%{_libdir} LIBTOOL="$libtool"
popd
# Install the bdb maintenance tools.
pushd db-instroot/bin
for binary in db_* ; do
install -m755 ${binary} $RPM_BUILD_ROOT/%{_sbindir}/slapd_${binary}
done
popd
# Install clients and shared libraries. Install the evo-specific versions
# first so that any conflicting files are overwritten by generic versions.
pushd evo-openldap-%{version_23}
make install DESTDIR=$RPM_BUILD_ROOT \
includedir=%{evolution_connector_includedir} \
libdir=%{evolution_connector_libdir} \
LIBTOOL="$libtool"
install -m644 \
$RPM_SOURCE_DIR/README.evolution \
$RPM_BUILD_ROOT/%{evolution_connector_prefix}/
popd
pushd openldap-%{version_23}/build-clients
make install DESTDIR=$RPM_BUILD_ROOT libdir=%{_libdir} LIBTOOL="$libtool"
popd
# Create this directory so that authconfig setting TLS_CACERT to
# /etc/openldap/cacerts doesn't cause TLS startup of any kind to fail
# when the directory doesn't exist.
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/openldap/cacerts
# make sure the certs directory exists
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/pki/tls/certs
# Touch the dummy slapd.pem to make rpmbuild happy
touch $RPM_BUILD_ROOT%{_sysconfdir}/pki/tls/certs/slapd.pem
# Install the padl.com migration tools.
mkdir -p $RPM_BUILD_ROOT%{_datadir}/openldap/migration
install -m 755 MigrationTools-%{migtools_version}/migrate_* \
$RPM_BUILD_ROOT%{_datadir}/openldap/migration/
install -m 644 MigrationTools-%{migtools_version}/README \
$RPM_SOURCE_DIR/migration-tools.txt \
$RPM_BUILD_ROOT%{_datadir}/openldap/migration/
cp MigrationTools-%{migtools_version}/README README.migration
cp $RPM_SOURCE_DIR/migration-tools.txt TOOLS.migration
# Create the data directory.
mkdir -p $RPM_BUILD_ROOT/var/lib/ldap
# Create the new run directory
mkdir -p $RPM_BUILD_ROOT/var/run/openldap
# Hack the build root out of the default config files.
perl -pi -e "s|$RPM_BUILD_ROOT||g" $RPM_BUILD_ROOT/%{_sysconfdir}/openldap/*.conf
# Get the buildroot out of the man pages.
perl -pi -e "s|$RPM_BUILD_ROOT||g" $RPM_BUILD_ROOT%{_mandir}/*/*.*
# We don't need the default files -- RPM handles changes.
rm -f $RPM_BUILD_ROOT/%{_sysconfdir}/openldap/*.default
rm -f $RPM_BUILD_ROOT/%{_sysconfdir}/openldap/schema/*.default
# Install an init script for the servers.
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d
install -m 755 $RPM_SOURCE_DIR/ldap.init $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/ldap
# Add some more schema for the sake of migration scripts.
install -d -m755 $RPM_BUILD_ROOT%{_sysconfdir}/openldap/schema/redhat
install -m644 \
$RPM_SOURCE_DIR/autofs.schema \
$RPM_BUILD_ROOT%{_sysconfdir}/openldap/schema/redhat/
# Move slapd and slurpd out of _libdir
mv $RPM_BUILD_ROOT/%{_libdir}/sl{apd,urpd} $RPM_BUILD_ROOT/%{_sbindir}/
rm -f $RPM_BUILD_ROOT/%{_sbindir}/slap{acl,add,auth,cat,dn,index,passwd,test}
rm -f $RPM_BUILD_ROOT/%{_libdir}/slap{acl,add,auth,cat,dn,index,passwd,test}
for X in acl add auth cat dn index passwd test; do ln -s slapd $RPM_BUILD_ROOT/%{_sbindir}/slap$X ; done
# Tweak permissions on the libraries to make sure they're correct.
chmod 755 $RPM_BUILD_ROOT/%{_libdir}/lib*.so*
chmod 644 $RPM_BUILD_ROOT/%{_libdir}/lib*.*a
# Remove files which we don't want packaged.
rm -f $RPM_BUILD_ROOT/%{_datadir}/openldap/migration/*.{instdir,simple,schema,mktemp,suffix,noaliases}
rm -f $RPM_BUILD_ROOT/%{_libdir}/*.la
rm -f $RPM_BUILD_ROOT/%{evolution_connector_libdir}/*.la
rm -f $RPM_BUILD_ROOT/%{evolution_connector_libdir}/*.so*
rm -f $RPM_BUILD_ROOT/%{_libdir}/openldap/*.a
rm -f $RPM_BUILD_ROOT/%{_libdir}/openldap/*.so
rm -f $RPM_BUILD_ROOT/var/openldap-data/DB_CONFIG.example
rmdir $RPM_BUILD_ROOT/var/openldap-slurp $RPM_BUILD_ROOT/var/openldap-data
%clean
rm -rf $RPM_BUILD_ROOT
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%pre servers
# Take care to only do ownership-changing if we're adding the user.
if /usr/sbin/useradd -c "LDAP User" -u 55 \
-s /bin/false -r -d /var/lib/ldap ldap 2> /dev/null ; then
if [ -d /var/lib/ldap ] ; then
for dbfile in /var/lib/ldap/* ; do
if [ -f $dbfile ] ; then
chown ldap:ldap $dbfile
fi
done
fi
fi
# See if slapd has been configured and (ever) started
files=$(echo /var/lib/ldap/{[a]lock,*.bdb,*.dbd,log.*,__db.*})
if [ "$files" != '/var/lib/ldap/[a]lock /var/lib/ldap/*.bdb /var/lib/ldap/*.dbd /var/lib/ldap/log.* /var/lib/ldap/__db.*' ] ; then
# Save an ldif of the database where the "%post servers" scriptlet can
# restore it. Also save the database files to a "rpmorig" directory
# Just In Case (TM)
if /sbin/runuser -m -s /usr/sbin/slapcat -- ldap -l /var/lib/ldap/upgrade.ldif > /dev/null 2>&1 ; then
if [ -s /var/lib/ldap/upgrade.ldif ] ; then
/bin/rm -fr /var/lib/ldap/rpmorig > /dev/null 2>&1 || :
mkdir /var/lib/ldap/rpmorig
mv /var/lib/ldap/{alock,*.bdb,*.dbd,__db.*,log.*} /var/lib/ldap/rpmorig > /dev/null 2>&1 || :
cp -f /var/lib/ldap/DB_CONFIG /var/lib/ldap/rpmorig > /dev/null 2>&1 || :
else
/bin/rm -f /var/lib/ldap/upgrade.ldif
fi
fi
fi
%post servers
/sbin/ldconfig
/sbin/chkconfig --add ldap
# If there's a /var/lib/ldap/upgrade.ldif file, slapadd it and delete it.
# It was created by the %pre and contains data of the previous version.
if [ -f /var/lib/ldap/upgrade.ldif ] ; then
/sbin/runuser -m -s /usr/sbin/slapadd -- "ldap" -l /var/lib/ldap/upgrade.ldif
rm /var/lib/ldap/upgrade.ldif
fi
exec > /dev/null 2> /dev/null
if [ ! -f %{_sysconfdir}/pki/tls/certs/slapd.pem ] ; then
pushd %{_sysconfdir}/pki/tls/certs
umask 077
cat << EOF | make slapd.pem
--
SomeState
SomeCity
SomeOrganization
SomeOrganizationalUnit
localhost.localdomain
root@localhost.localdomain
EOF
chown root:ldap slapd.pem
chmod 640 slapd.pem
popd
fi
exit 0
%preun servers
if [ "$1" = "0" ] ; then
/sbin/service ldap stop > /dev/null 2>&1 || :
/sbin/chkconfig --del ldap
fi
%postun servers
/sbin/ldconfig
if [ $1 -ge 1 ] ; then
/sbin/service ldap condrestart > /dev/null 2>&1 || :
fi
%posttrans servers
# prev. versions of openldap-servers package exported the database
# to /var/lib/ldap/upgrade.ldif and moved the database to
# /var/lib/rpmorig in %preun, assuming that %post will be called
# later and restore the DB from there. Unfortunatelly this
# assumption is wrong, %preun is called after %post ->
# in the end the database is moved to /var/lib/rpmorig
# and nobody restores it.
# Let's restore it here:
# If there's a /var/lib/ldap/upgrade.ldif file, slapadd it and delete it.
# It was created by the uninstall of the previous version.
if [ -f /var/lib/ldap/upgrade.ldif ] ; then
STARTAGAIN=0
/sbin/service ldap status >/dev/null 2>/dev/null
if [ "$?" = "0" ] ; then
service ldap stop
STARTAGAIN=1
fi
# set the database owner - #preun of prev. version could create
# the database with root:root owner (!)
if [ -d /var/lib/ldap ] ; then
for dbfile in /var/lib/ldap/* ; do
if [ -f $dbfile ] ; then
chown ldap:ldap $dbfile
fi
done
fi
/sbin/runuser -m -s /usr/sbin/slapadd -- "ldap" -l /var/lib/ldap/upgrade.ldif >/dev/null 2>/dev/null
rm /var/lib/ldap/upgrade.ldif
if [ "$STARTAGAIN" = 1 ] ; then
service ldap start
fi
fi
exec > /dev/null 2> /dev/null
%files
%defattr(-,root,root)
%doc openldap-%{version_23}/ANNOUNCEMENT
%doc openldap-%{version_23}/CHANGES
%doc openldap-%{version_23}/COPYRIGHT
%doc openldap-%{version_23}/LICENSE
%doc openldap-%{version_23}/README
%attr(0755,root,root) %dir %{_sysconfdir}/openldap
%attr(0755,root,root) %dir %{_sysconfdir}/openldap/cacerts
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/openldap/ldap*.conf
%attr(0755,root,root) %{_libdir}/liblber-2.3*.so.*
%attr(0755,root,root) %{_libdir}/libldap-2.3*.so.*
%attr(0755,root,root) %{_libdir}/libldap_r-2.3*.so.*
%attr(0644,root,root) %{_mandir}/man5/ldif.5*
%attr(0644,root,root) %{_mandir}/man5/ldap.conf.5*
%attr(0755,root,root) %dir %{_datadir}/openldap
%files -n compat-openldap
%defattr(-,root,root)
%doc openldap-%{compat_version}/ANNOUNCEMENT
%doc openldap-%{compat_version}/COPYRIGHT
%doc openldap-%{compat_version}/LICENSE
%attr(0755,root,root) %{_libdir}/liblber-2.2.so.*
%attr(0755,root,root) %{_libdir}/libldap-2.2.so.*
%attr(0755,root,root) %{_libdir}/libldap_r-2.2.so.*
%files servers
%defattr(-,root,root)
%doc README.migration
%doc TOOLS.migration
%doc $RPM_SOURCE_DIR/README.upgrading $RPM_SOURCE_DIR/guide.html
%ghost %config %{_sysconfdir}/pki/tls/certs/slapd.pem
%attr(0755,root,root) %config %{_sysconfdir}/rc.d/init.d/ldap
%attr(0640,root,ldap) %config(noreplace) %{_sysconfdir}/openldap/slapd.conf
%attr(0640,root,ldap) %{_sysconfdir}/openldap/DB_CONFIG.example
%attr(0755,root,root) %dir %{_sysconfdir}/openldap/schema
%attr(0644,root,root) %dir %{_sysconfdir}/openldap/schema/README*
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/openldap/schema/*.schema*
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/openldap/schema/*.ldif
%attr(0755,root,root) %dir %{_sysconfdir}/openldap/schema/redhat
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/openldap/schema/redhat/*.schema*
%attr(0755,root,root) %{_sbindir}/sl*
%attr(0644,root,root) %{_mandir}/man8/*
%attr(0644,root,root) %{_mandir}/man5/slapd*.5*
%attr(0644,root,root) %{_mandir}/man5/slapo-*.5*
%attr(0755,root,root) %dir %{_datadir}/openldap/migration
%attr(0644,root,root) %{_datadir}/openldap/migration/README
%attr(0644,root,root) %config(noreplace) %{_datadir}/openldap/migration/*.ph
%attr(0755,root,root) %{_datadir}/openldap/migration/*.pl
%attr(0755,root,root) %{_datadir}/openldap/migration/*.sh
%attr(0644,root,root) %{_datadir}/openldap/migration/*.txt
%attr(0755,root,root) %dir %{_datadir}/openldap/ucdata
%attr(0644,root,root) %dir %{_datadir}/openldap/ucdata/*
%attr(0700,ldap,ldap) %dir /var/lib/ldap
%attr(0755,ldap,ldap) %dir /var/run/openldap
%attr(0755,root,root) %{_libdir}/libslapd_db-*.*.so
%ifarch %{nptl_arches}
%ifnarch %{ix86}
%attr(0755,root,root) %{_libdir}/tls/libslapd_db-*.*.so
%else
%dir %attr(0755,root,root) %{_libdir}/tls/*
%attr(0755,root,root) %{_libdir}/tls/*/libslapd_db-*.*.so
%endif
%endif
%files servers-sql
%defattr(-,root,root)
%doc openldap-%{version_23}/servers/slapd/back-sql/docs/*
%doc openldap-%{version_23}/servers/slapd/back-sql/rdbms_depend
%attr(0755,root,root) %{_libdir}/openldap
%attr(0755,root,root) %{_libdir}/openldap/back_sql.la
%attr(0755,root,root) %{_libdir}/openldap/back_sql*.so.*
%files clients
%defattr(-,root,root)
%attr(0755,root,root) %{_bindir}/*
%attr(0644,root,root) %{_mandir}/man1/*
%files devel
%defattr(-,root,root)
%doc openldap-%{version_23}/doc/drafts openldap-%{version_23}/doc/rfc
%attr(0755,root,root) %{_libdir}/libl*.so
%attr(0644,root,root) %{_libdir}/libl*.a
%attr(0644,root,root) %{_includedir}/*
%attr(0644,root,root) %{_mandir}/man3/*
%attr(0755,root,root) %dir %{evolution_connector_prefix}
%attr(0644,root,root) %{evolution_connector_prefix}/README*
%attr(0755,root,root) %dir %{evolution_connector_includedir}
%attr(0644,root,root) %{evolution_connector_includedir}/*.h
%attr(0755,root,root) %dir %{evolution_connector_libdir}
%attr(0644,root,root) %{evolution_connector_libdir}/*.a