File nss_ldap.spec of Package nss_ldap

#
# spec file for package nss_ldap
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           nss_ldap
BuildRequires:  db-devel krb5-devel openldap2-devel
License:        LGPLv2.1+
Group:          Productivity/Networking/LDAP/Clients
PreReq:         sed coreutils /usr/bin/grep /bin/mktemp
AutoReqProv:    on
# bug437293
%ifarch ppc64
Obsoletes:      nss_ldap-64bit
%endif
#
Version:        265
Release:        7
Summary:        NSS LDAP Module
Url:            http://www.padl.com/OSS/nss_ldap.html
Source:         nss_ldap-%{version}.tar.bz2
Source1:        README.SuSE
Source2:        baselibs.conf
Patch:          nss_ldap.dif
Patch1:         group-utf8.dif
Patch2:         nss_ldap-ldapconn-leak-bug418.dif
Patch3:         nss_ldap-getent-retry.dif
Patch4:         nss_ldap-getent-skip-invalid-uidgidnumber.dif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Nss_ldap is a glibc NSS module that allows X.500 and LDAP directory
servers to be used as a primary source of aliases, ethers, groups,
hosts, networks, protocol, users, RPCs, services, and shadow passwords
(instead of or in addition to using flat files or NIS).



Authors:
--------
    Luke Howard <lukeh@padl.com>

%prep
%setup -q
%patch -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
cp -v %{S:1} .

%build
%{?suse_update_config:%{suse_update_config -f}}
autoreconf
CFLAGS="$RPM_OPT_FLAGS" \
CPPFLAGS="-I/usr/include/sasl -DINET6" \
./configure --prefix=/usr \
            --mandir=%{_mandir} \
	    --enable-rfc2307bis \
	    --enable-schema-mapping \
	    --enable-xad \
	    --enable-paged-results \
            --enable-configurable-krb5-ccname-gssapi \
	    --libdir=%{_libdir} \
	    --sysconfdir=/etc \
	    --x-libraries=/usr/X11R6/%{_lib}
make

%install
mkdir -p $RPM_BUILD_ROOT/%{_lib}
mkdir -p $RPM_BUILD_ROOT%{_libdir}
install -m 755 nss_ldap.so $RPM_BUILD_ROOT/%{_lib}/libnss_ldap.so.2
make DESTDIR=$RPM_BUILD_ROOT install-man

%clean
rm -fr $RPM_BUILD_ROOT

%post
/sbin/ldconfig
if [ ${1:-0} -gt 1 ] ; then
    if ! /usr/bin/grep -q ^bind_policy /etc/ldap.conf; then
        if grep -q -e ^#[[:space:]]\*bind_policy /etc/ldap.conf; then
            LDAP_ORIG=`mktemp /tmp/ldap.conf.XXXXXXXXXX`
            cp /etc/ldap.conf $LDAP_ORIG
            sed -e 's;^#[[:space:]]*bind_policy.*$;bind_policy soft;' \
                $LDAP_ORIG > /etc/ldap.conf
            rm $LDAP_ORIG
        else
            echo -e "\n"\
"#Don't try forever if the LDAP server is not reacheable\n"\
"bind_policy soft" >> /etc/ldap.conf
        fi
    fi
fi

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc ANNOUNCE AUTHORS COPYING ChangeLog NEWS README README.SuSE nsswitch.ldap ldap.conf doc/README.paged
/%{_lib}/libnss_ldap.so.2
%doc %{_mandir}/man5/nss_ldap.5*

%changelog
openSUSE Build Service is sponsored by