Sophie

Sophie

distrib > Mandriva > 2006.0 > x86_64 > by-pkgid > b99c6aa8df012bfb256788ac7fb08d61 > files > 6

courier-authlib-0.55-5mdk.src.rpm

%define build_vpopmail 0

# commandline overrides:
# rpm -ba|--rebuild --with 'xxx'
%{?_with_authvchkpw: %{expand: %%define build_vpopmail 1}}

%if %{build_vpopmail}
%define build_vpopmail 1
%endif

%define name courier-authlib
%define version 0.55
%define release 5mdk

%define	major	0
%define libname	%mklibname %{name} %{major}

Summary:	Courier authentication library
Name:		%{name}
Version:	%{version}
Release:	%{release}
Group:		System/Servers
License:	GPL
URL:		http://www.courier-mta.org
Source0:	http://prdownloads.sourceforge.net/courier/%{name}-%{version}.tar.bz2
Source1:	http://prdownloads.sourceforge.net/courier/%{name}-%{version}.tar.bz2.sig
Source2:	courier-authlib.init.bz2
Patch0:		courier-authlib-0.54-avoid-version.diff.bz2
Patch1:		courier-authlib-0.55-vpopmail.diff.bz2
Patch2:		courier-imap-3.0.8-overflow.patch.bz2
BuildRequires:	gdbm-devel
BuildRequires:	expect
BuildRequires:	MySQL-devel
BuildRequires:	openldap-devel
BuildRequires:	pam-devel
BuildRequires:	postgresql-devel
Requires:	expect
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root

%description
The Courier authentication library provides authentication
services for other Courier applications.

You can build %{name} with some conditional build swithes:

(ie. use with rpm --rebuild):

--with vpopmail Compile with the authvchkpw auth module (disabled)
                This will disable all the other authentication 
		modules such as userdb, ldap, mysql and pgsql.

%package -n	courier-authdaemond
Summary:	Courier authentication daemon
Group:		System/Servers
Requires:	expect
PreReq:		rpm-helper

%description -n	courier-authdaemond
The Courier authentication library provides authentication
services for other Courier applications.

This package contains the Courier authentication daemon and common
authentication modules:

 o authcustom
 o authpam
 o authpwd
 o uthshadow
 o courierauthsaslclient
 o courierauthsasl

%package -n	%{libname}
Summary:	Courier authentication library
Group:		System/Servers

%description -n	%{libname}
The Courier authentication library provides authentication
services for other Courier applications.

This package contains the common libraries needed by the 
authentication daemon.

%if %{build_vpopmail}
%package	authvchkpw
Summary:	Vpopmail support for the Courier authentication library
Group:		System/Servers
PreReq:		courier-authdaemond = %{version}

%description	authvchkpw
This package installs vpopmail support for the Courier authentication
library. Install this package in order to be able to authenticate
using vpopmail.
%endif

%package	userdb
Summary:	Userdb support for the Courier authentication library
Group:		System/Servers
#Conflicts:	%{name}-ldap %{name}-mysql %{name}-pgsql
PreReq:		courier-authdaemond = %{version}

%description	userdb
This package installs the userdb support for the Courier
authentication library.  Userdb is a simple way to manage virtual
mail accounts using a GDBM-based database file.

Install this package in order to be able to authenticate with
userdb.

%package	ldap
Summary:	LDAP support for the Courier authentication library
Group:		System/Servers
#Conflicts:	%{name}-userdb %{name}-mysql %{name}-pgsql
PreReq:		courier-authdaemond = %{version}

%description	ldap
This package installs LDAP support for the Courier authentication
library. Install this package in order to be able to authenticate
using LDAP.

%package	mysql
Summary:	MySQL support for the Courier authentication library
Group:		System/Servers
#Conflicts:	%{name}-userdb %{name}-ldap %{name}-pgsql
PreReq:		courier-authdaemond = %{version}

%description	mysql
This package installs MySQL support for the Courier authentication
library. Install this package in order to be able to authenticate
using MySQL.

%package	pgsql
Summary:	MySQL support for the Courier authentication library
Group:		System/Servers
#Conflicts:	%{name}-userdb %{name}-ldap %{name}-mysql
PreReq:		courier-authdaemond = %{version}

%description	pgsql
This package installs PostgreSQL support for the Courier
authentication library. Install this package in order to be able
to authenticate using PostgreSQL.

%package -n	%{libname}-devel
Summary:	Development libraries for the Courier authentication library
Group:		Development/C
Provides:	%{name}-devel libcourier-authlib-devel
Obsoletes:	%{name}-devel libcourier-authlib-devel
Requires:	%{libname} = %{version}

%description -n	%{libname}-devel
This package contains the development libraries and files needed
to compile Courier packages that use this authentication library.
Install this package in order to build the rest of the Courier
packages. After they are built and installed this package can be
removed. Files in this package are not needed at runtime.

%prep

%setup -q -n %{name}-%{version}
%patch0 -p1 -b .avoid-version
%patch1 -p1 -b .vpopmail
%patch2 -p2 -b .overflow

bzcat %{SOURCE2} > courier-authdaemond.init

# lib64 fixes
perl -pi -e "s|/usr/lib|%{_libdir}|g" courier-authdaemond.init

%build

%if %mdkversion
%define __libtoolize /bin/true
%endif

%if %{build_vpopmail}
export CFLAGS="%{optflags} -DHAVE_OPEN_SMTP_RELAY -DHAVE_VLOGAUTH"
export CXXFLAGS="%{optflags} -DHAVE_OPEN_SMTP_RELAY -DHAVE_VLOGAUTH"
export LDFLAGS="-L/home/vpopmail/%{_lib}"
export CPPFLAGS="-I/home/vpopmail/include"
%endif

# removed because it was causing build to fail - andreas - sep/05
#--cache-file=$PWD/config.cache

%configure2_5x \
    --with-syslog=MAIL \
    --disable-ltdl-install \
    --with-db=db \
    --with-random=/dev/urandom \
    --with-mailuser=daemon \
    --with-mailgroup=daemon \
    --with-authdaemonrc=%{_sysconfdir}/courier-authlib/authdaemonrc \
    --with-authdaemonvar=%{_localstatedir}/authdaemon \
%if %{build_vpopmail}
    --with-authvchkpw \
    --without-authpam \
    --without-authldap \
    --without-authpwd \
    --without-authmysql \
    --without-authpgsql \
    --without-authshadow \
    --without-authuserdb \
    --without-authcustom \
    --without-authcram \
    --with-authvchkpw
%else
    --with-makedatprog=%{_sbindir}/makedatprog \
    --with-userdb=%{_sysconfdir}/userdb \
    --with-pkgconfdir=%{_sysconfdir}/courier-authlib \
    --with-authuserdb \
    --with-authpam \
    --with-authldap \
    --with-authldaprc=%{_sysconfdir}/courier-authlib/authldaprc \
    --with-authpwd \
    --with-authshadow \
    --without-authvchkpw \
    --with-authpgsqlrc=%{_sysconfdir}/courier-authlib/authpgsqlrc \
    --with-authpgsql \
    --with-pgsql-libs=%{_libdir} \
    --with-pgsql-includes=%{_includedir}/pgsql \
    --with-authmysqlrc=%{_sysconfdir}/courier-authlib/authmysqlrc \
    --with-authmysql \
    --with-mysql-libs=%{_libdir} \
    --with-mysql-includes=%{_includedir}/mysql \
    --with-authcustom
%endif

%make

%make authinfo

# a very modest test suite...
make check

%install
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}

install -d %{buildroot}%{_initrddir}
install -d %{buildroot}%{_var}/run/authdaemon

%makeinstall_std
%makeinstall_std install-configure

install -m0755 sysconftool %{buildroot}%{_libdir}/courier-authlib/
install -m0755 authmigrate %{buildroot}%{_libdir}/courier-authlib/

# authmksock can only use paths up to 108 chars
foo=$(pwd)
cd %{buildroot}%{_localstatedir}/authdaemon/
$foo/authmksock socket || exit 1
cd -
chmod 777 %{buildroot}%{_localstatedir}/authdaemon/socket || exit 1
install -m0755 courier-authdaemond.init %{buildroot}%{_initrddir}/courier-authdaemond
mv %{buildroot}%{_libdir}/courier-authlib/authdaemond %{buildroot}%{_sbindir}/authdaemond

%if ! %{build_vpopmail}
mv %{buildroot}%{_libdir}/courier-authlib/makedatprog %{buildroot}%{_sbindir}/makedatprog
%endif

# some utils...
install -m0755 authinfo %{buildroot}%{_sbindir}/
install -m0755 authdaemontest %{buildroot}%{_sbindir}/
install -m0755 liblock/lockmail %{buildroot}%{_sbindir}/
install -m0644 liblock/lockmail.1 %{buildroot}%{_mandir}/man1/

%if ! %{build_vpopmail}
# disable not yet installed auth modules.
perl -pi -e "s|^authmodulelist=.*|authmodulelist=\"authpam authpwd authshadow\"|g" \
    %{buildroot}%{_sysconfdir}/courier-authlib/authdaemonrc*

perl -pi -e "s|^authmodulelistorig=.*|authmodulelistorig=\"authpam authpwd authshadow\"|g" \
    %{buildroot}%{_sysconfdir}/courier-authlib/authdaemonrc*
%else
perl -pi -e "s|^authmodulelist=.*|authmodulelist=\"authvchkpw\"|g" \
    %{buildroot}%{_sysconfdir}/courier-authlib/authdaemonrc*

perl -pi -e "s|^authmodulelistorig=.*|authmodulelistorig=\"authvchkpw\"|g" \
    %{buildroot}%{_sysconfdir}/courier-authlib/authdaemonrc*
%endif

%if %{build_vpopmail}
rm -f %{buildroot}%{_mandir}/man8/makeuserdb.8
rm -f %{buildroot}%{_mandir}/man8/userdb.8
rm -f %{buildroot}%{_mandir}/man8/userdbpw.8
%endif

cat > README.MDK << EOF
C O U R I E R - A U T H L I B   A N D   M A N D R A K E L I N U X 
-----------------------------------------------------------------

Currently there is no automatic way to activate the different authentication modules
like authuserdb, authpgsql, authldap, authmysql and authcustom. The general rule of
thumb is to add the string for example "authldap" in the beginning of the authmodulelist
and authmodulelistorig statements in the %{_sysconfdir}/courier-authlib/authdaemonrc file,
like so:

authmodulelist="authldap authpam authpwd authshadow"

Or maybe just:

authmodulelist="authldap"

EOF

# cleanup
rm -f %{buildroot}%{_libdir}/courier-authlib/libauth*.la
rm -f %{buildroot}%{_libdir}/courier-authlib/libcourierauthsasl*.la

%post -n %{libname} -p /sbin/ldconfig

%preun -n %{libname} -p /sbin/ldconfig

%post -n courier-authdaemond
%{_libexecdir}/courier-authlib/authmigrate >/dev/null
if ! [ -f %{_sysconfdir}/courier-authlib/authdaemonrc ]; then
    %{_libexecdir}/courier-authlib/sysconftool %{_sysconfdir}/courier-authlib/authdaemonrc.dist >/dev/null
fi
%create_ghostfile %{_localstatedir}/authdaemon/socket root root 0777
%_post_service courier-authdaemond

%preun  -n courier-authdaemond
%_preun_service courier-authdaemond

%if ! %{build_vpopmail}
%post userdb
if [ -f %{_var}/lock/subsys/courier-authdaemon ]; then
    %{_initrddir}/courier-authdaemon restart 1>&2;
fi

%postun userdb
if [ "$1" = "0" ]; then
    if [ -f %{_var}/lock/subsys/courier-authdaemon ]; then
        %{_initrddir}/courier-authdaemon restart 1>&2
    fi
fi

%if %{build_vpopmail}
%pre authvchkpw
%{_libdir}/courier-authlib/authmigrate >/dev/null
if ! [ -f %{_sysconfdir}/courier-authlib/authvchkpw ]; then
    %{_libdir}/courier-authlib/sysconftool %{_sysconfdir}/courier-authlib/authvchkpw.dist >/dev/null
fi

%post authvchkpw
if [ -f %{_var}/lock/subsys/courier-authdaemon ]; then
    %{_initrddir}/courier-authdaemon restart 1>&2;
fi
    
%postun authvchkpw
if [ "$1" = "0" ]; then
    if [ -f %{_var}/lock/subsys/courier-authdaemon ]; then
        %{_initrddir}/courier-authdaemon restart 1>&2
    fi
fi
%endif

%pre ldap
%{_libdir}/courier-authlib/authmigrate >/dev/null
if ! [ -f %{_sysconfdir}/courier-authlib/authldaprc ]; then
    %{_libdir}/courier-authlib/sysconftool %{_sysconfdir}/courier-authlib/authldaprc.dist >/dev/null
fi

%post ldap
if [ -f %{_var}/lock/subsys/courier-authdaemon ]; then
    %{_initrddir}/courier-authdaemon restart 1>&2;
fi
    
%postun ldap
if [ "$1" = "0" ]; then
    if [ -f %{_var}/lock/subsys/courier-authdaemon ]; then
        %{_initrddir}/courier-authdaemon restart 1>&2
    fi
fi

%pre mysql
%{_libdir}/courier-authlib/authmigrate >/dev/null
if ! [ -f %{_sysconfdir}/courier-authlib/authmysqlrc ]; then
    %{_libdir}/courier-authlib/sysconftool %{_sysconfdir}/courier-authlib/authmysqlrc.dist >/dev/null
fi

%post mysql
if [ -f %{_var}/lock/subsys/courier-authdaemon ]; then
    %{_initrddir}/courier-authdaemon restart 1>&2;
fi
    
%postun mysql
if [ "$1" = "0" ]; then
    if [ -f %{_var}/lock/subsys/courier-authdaemon ]; then
        %{_initrddir}/courier-authdaemon restart 1>&2
    fi
fi

%pre pgsql
%{_libdir}/courier-authlib/authmigrate >/dev/null
if ! [ -f %{_sysconfdir}/courier-authlib/authpgsqlrc ]; then
    %{_libdir}/courier-authlib/sysconftool %{_sysconfdir}/courier-authlib/authpgsqlrc.dist >/dev/null
fi

%post pgsql
if [ -f %{_var}/lock/subsys/courier-authdaemon ]; then
    %{_initrddir}/courier-authdaemon restart 1>&2;
fi
    
%postun pgsql
if [ "$1" = "0" ]; then
    if [ -f %{_var}/lock/subsys/courier-authdaemon ]; then
        %{_initrddir}/courier-authdaemon restart 1>&2
    fi
fi
%endif

%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}

%files -n courier-authdaemond
%defattr(-,root,root,-)
%doc README.MDK README README.authdebug.html README.html README_authlib.html
%doc NEWS COPYING* AUTHORS ChangeLog liblock/lockmail.html liblog/courierlogger.html
%dir %{_sysconfdir}/courier-authlib
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/courier-authlib/authdaemonrc.dist
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/courier-authlib/authdaemonrc
%attr(0755,root,root) %{_initrddir}/courier-authdaemond
%dir %attr(0750,daemon,daemon) %{_localstatedir}/authdaemon
%dir %attr(0750,daemon,daemon) %{_var}/run/authdaemon
%ghost %attr(0777,root,root) %{_localstatedir}/authdaemon/socket
%dir %{_libdir}/courier-authlib
%attr(0755,root,root) %{_sbindir}/authdaemond
%attr(0755,root,root) %{_sbindir}/authdaemontest
%attr(0755,root,root) %{_sbindir}/authenumerate
%attr(0755,root,root) %{_sbindir}/authinfo
%attr(0755,root,root) %{_sbindir}/authtest
%attr(0755,root,root) %{_sbindir}/courierlogger
%attr(0755,root,root) %{_sbindir}/lockmail
%attr(0755,root,root) %{_libdir}/courier-authlib/authmigrate
%attr(0755,root,root) %{_libdir}/courier-authlib/authsystem.passwd
%attr(0755,root,root) %{_libdir}/courier-authlib/sysconftool
%if ! %{build_vpopmail}
%attr(0755,root,root) %{_sbindir}/makedatprog
%attr(0755,root,root) %{_libdir}/courier-authlib/libauthcustom.so
%attr(0755,root,root) %{_libdir}/courier-authlib/libauthpam.so
%attr(0755,root,root) %{_libdir}/courier-authlib/libauthpwd.so
%attr(0755,root,root) %{_libdir}/courier-authlib/libauthshadow.so
%endif
%attr(0755,root,root) %{_libdir}/courier-authlib/libcourierauthsaslclient.so
%attr(0755,root,root) %{_libdir}/courier-authlib/libcourierauthsasl.so
%attr(0644,root,root) %{_mandir}/man1/*

%files -n %{libname}
%defattr(-,root,root,-)
%attr(0755,root,root) %{_libdir}/courier-authlib/libcourierauthcommon.so.*
%attr(0755,root,root) %{_libdir}/courier-authlib/libcourierauth.so.*

%if %{build_vpopmail}
%files authvchkpw
%defattr(-,root,root,-)
#%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/courier-authlib/authvchkpw.dist
#%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/courier-authlib/authvchkpw
%attr(0755,root,root) %{_libdir}/courier-authlib/libauthvchkpw.so.*
%endif

%if ! %{build_vpopmail}
%files userdb
%defattr(-,root,root,-)
%doc userdb/makeuserdb.html userdb/userdb.html userdb/userdbpw.html
%attr(0755,root,root) %{_sbindir}/makeuserdb
%attr(0755,root,root) %{_sbindir}/pw2userdb
%attr(0755,root,root) %{_sbindir}/userdb
%attr(0755,root,root) %{_sbindir}/userdb-test-cram-md5
%attr(0755,root,root) %{_sbindir}/userdbpw
%attr(0755,root,root) %{_sbindir}/vchkpw2userdb
%attr(0755,root,root) %{_libdir}/courier-authlib/libauthuserdb.so
%attr(0644,root,root) %{_mandir}/man8/*userdb*

%files ldap
%defattr(-,root,root,-)
%doc README.ldap authldap.schema
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/courier-authlib/authldaprc.dist
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/courier-authlib/authldaprc
%attr(0755,root,root) %{_libdir}/courier-authlib/libauthldap.so

%files mysql
%defattr(-,root,root,-)
%doc README.authmysql.html README.authmysql.myownquery
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/courier-authlib/authmysqlrc.dist
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/courier-authlib/authmysqlrc
%attr(0755,root,root) %{_libdir}/courier-authlib/libauthmysql.so

%files pgsql
%defattr(-,root,root,-)
%doc README.authpostgres.html
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/courier-authlib/authpgsqlrc.dist
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/courier-authlib/authpgsqlrc
%attr(0755,root,root) %{_libdir}/courier-authlib/libauthpgsql.so
%endif

%files -n %{libname}-devel
%defattr(-,root,root,-)
%doc authlib.html auth_*.html
%attr(0755,root,root) %{_bindir}/courierauthconfig
%attr(0644,root,root) %{_libdir}/courier-authlib/*.la
%attr(0644,root,root) %{_libdir}/courier-authlib/*.a
%attr(0755,root,root) %{_libdir}/courier-authlib/*.so
%attr(0644,root,root) %{_includedir}/*
%attr(0644,root,root) %{_mandir}/man3/*

%changelog
* Thu Sep 08 2005 Andreas Hasenack <andreas@mandriva.com> 0.55-5mdk
- rebuilt with openldap-2.3.x
- workaround authmksock path length bug and added a patch to avoid
  the overflow (same patch as in the courier-imap)
- removed cache option from ./configure as it was failing

* Wed Apr 20 2005 Oden Eriksson <oeriksson@mandriva.com> 0.55-4mdk
- rebuilt against new postgresql libs

* Sun Mar 06 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 0.55-3mdk
- fix some minor issues
- make it compile on 10.0 too (libtool mess)
- make it somewhat possible to link against vpopmail
- do some libifiction
- rename the initscript to courier-authdaemond

* Sat Mar 05 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 0.55-2mdk
- fix deps

* Fri Mar 04 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 0.55-1mdk
- 0.55

* Tue Mar 01 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 0.54-1mdk
- initial Mandrakelinux package
- added a more standard initscript (S2)
- used tiny parts of the provided spec file