File imap.spec of Package imap

#
# spec file for package imap (Version 2006c1_suse)
#
# Copyright (c) 2008 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:           imap
BuildRequires:  openssl-devel pam-devel
Url:            http://www.washington.edu/imap/
License:        The Apache Software License
Group:          Productivity/Networking/Email/Servers
Version:        2006c1_suse
Release:        127.1
Summary:        IMAP4, POP2, and POP3 Mail Server
Source0:        imap-2006c1.tar.bz2
Source1:        README.SuSE
# pam config
Source2:        imap.pamd
Source3:        pop.pamd
# xinetd config
Source4:        imap.xinetd
# c-client config
Source5:        c-client.cf
Source6:        %name.firewall
Patch0:         imap-2001a-include.diff
Patch1:         imap-2004a-doc.diff
Patch2:         imap-2002e-ssl.diff
Patch3:         imap-2004-cflags.diff
Patch4:         imap-2001a-overflow.diff
Patch5:         imap-2002c-c++.diff
Patch6:         imap-2006c1.diff
Patch7:         imap-2006c1-rfc822_output_char_dos.patch
Patch8:         imap-2006c1-smtp_quit.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       pam inet-daemon
PreReq:         bash /bin/echo /bin/mv

%description
This package contains IMAP4, POP2, and POP3 mail servers.

After installation, activate the servers in the file /etc/inetd.conf.



Authors:
--------
    Mark Crispin <mrc@cac.washington.edu>

%package lib
License:        BSD 3-Clause
Summary:        IMAP4rev1/c-client Development Environment
Group:          Development/Libraries/C and C++
Provides:       imap-devel:/usr/lib/libc-client.so

%description lib
This package contains the libraries for IMAP client programs.



Authors:
--------
    Mark Crispin <mrc@cac.washington.edu>

%package devel
License:        BSD 3-Clause
Summary:        IMAP4rev1/c-client Development Environment
Group:          Development/Libraries/C and C++
Requires:       imap-lib = %version

%description devel
This package contains the libraries and header files for IMAP client
programs.



Authors:
--------
    Mark Crispin <mrc@cac.washington.edu>

%prep
%setup -n imap-2006c1
%patch0
%patch1
%patch2
%patch3
%patch4
%patch5
%patch6
%patch7
%patch8

%build
export CFLAGS="$RPM_OPT_FLAGS -DDISABLE_POP_PROXY=1 -fPIC -fno-strict-aliasing -fstack-protector"
make lnp MYCFLAGS="$CFLAGS" SSLTYPE=nopwd IP=6
make lnp c-client
gcc -shared -Wl,-soname,libc-client.so.%{version} -o libc-client.so.%{version} c-client/*.o

%install
mkdir -p $RPM_BUILD_ROOT/usr/{sbin,share/man/man8,share/doc/packages/imap}
mkdir -p $RPM_BUILD_ROOT/etc/pam.d
install -m 755 imapd/imapd ipopd/ipop2d ipopd/ipop3d mtest/mtest $RPM_BUILD_ROOT/usr/sbin/
install -m 644 $RPM_SOURCE_DIR/imap.pamd ${RPM_BUILD_ROOT}/etc/pam.d/imap
install -m 644 $RPM_SOURCE_DIR/pop.pamd ${RPM_BUILD_ROOT}/etc/pam.d/pop
install -m 644 -D $RPM_SOURCE_DIR/imap.xinetd $RPM_BUILD_ROOT/etc/xinetd.d/imap
install -m 644 $RPM_SOURCE_DIR/c-client.cf ${RPM_BUILD_ROOT}/etc/c-client.cf
install -m 644 src/imapd/imapd.8 $RPM_BUILD_ROOT/usr/share/man/man8/imapd.8
install -m 644 src/ipopd/ipopd.8 $RPM_BUILD_ROOT/usr/share/man/man8/ipopd.8
install -m 644 $RPM_SOURCE_DIR/README.SuSE $RPM_BUILD_ROOT/usr/share/doc/packages/imap/
install -m 644 CONTENTS README docs/RELNOTES $RPM_BUILD_ROOT/usr/share/doc/packages/imap/
install -m 644 docs/{FAQ,bugs,imaprc,md5,naming,drivers}.txt $RPM_BUILD_ROOT/usr/share/doc/packages/imap/
mkdir -p $RPM_BUILD_ROOT/%{_includedir}/imap
cp src/osdep/tops-20/*.h $RPM_BUILD_ROOT/%{_includedir}/imap
cp src/osdep/unix/*.h $RPM_BUILD_ROOT/%{_includedir}/imap
cp src/c-client/*.h $RPM_BUILD_ROOT/%{_includedir}/imap
cp c-client/linkage.{h,c} $RPM_BUILD_ROOT/%{_includedir}/imap
cp c-client/osdep.h $RPM_BUILD_ROOT/%{_includedir}/imap
mkdir -p $RPM_BUILD_ROOT/%{_libdir}
install -m 644 c-client/c-client.a $RPM_BUILD_ROOT/%{_libdir}/libc-client.a
ln -sf libc-client.a $RPM_BUILD_ROOT/%{_libdir}/c-client.a
install -m 755 libc-client.so.%{version} $RPM_BUILD_ROOT/%{_libdir}/
ln -sf libc-client.so.%{version} $RPM_BUILD_ROOT/%{_libdir}/libc-client.so
ln -sf ../usr/sbin/imapd $RPM_BUILD_ROOT/etc/rimapd
ln -sf ../usr/sbin/ipop3d $RPM_BUILD_ROOT/etc/rpop3d
ln -sf ../usr/sbin/ipop2d $RPM_BUILD_ROOT/etc/rpop2d
install -d $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/
install -m 644 %{S:6} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/%{name}

%clean
rm -rf $RPM_BUILD_ROOT

%post lib
%run_ldconfig

%postun lib
%run_ldconfig

%files
%defattr (-,root,root)
/usr/sbin/*
/usr/share/man/man8/*
%config /etc/pam.d/*
%config(noreplace) /etc/xinetd.d/imap
/etc/rimapd
/etc/rpop3d
/etc/rpop2d
%doc /usr/share/doc/packages/imap

%files lib
%defattr (-,root,root)
%config(noreplace) /etc/c-client.cf
%{_libdir}/*.so
%{_libdir}/*.so.*
%config %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/%{name}

%files devel
%defattr (-,root,root)
%{_libdir}/*.a
%{_includedir}/imap

%post
if [ -f /usr/share/ssl/certs/imapd.pem ] ; then
    if [ ! -f /etc/ssl/certs/imapd.pem ] ; then
	echo "moving imapd certificate to /etc/ssl/certs"
	mv /usr/share/ssl/certs/imapd.pem /etc/ssl/certs/
    fi
fi
if [ -f /usr/share/ssl/certs/ipop3d.pem ] ; then
    if [ ! -f /etc/ssl/certs/ipop3d.pem ] ; then
	echo "moving ipop3d certificate to /etc/ssl/certs"
	mv /usr/share/ssl/certs/ipop3d.pem /etc/ssl/certs/
    fi
fi

%changelog
* Tue Dec 16 2008 hvogel@suse.de
- Fix CVE-2008-5514. Buffer overflow in rfc822_output_char.
  bnc#458579
- Fix smtp NULL pointer dereference DOS.
  bnc#459037
* Mon Jan 07 2008 mskibbe@suse.de
- Bug 351197 - several packages use wrong dir for SuSEfirewall2
  services files
* Fri Mar 16 2007 mskibbe@suse.de
- fix ports in firewall file
* Fri Mar 02 2007 mskibbe@suse.de
- imap : Support for FATE #300687: Ports for SuSEfirewall added
  via packages (#250579)
* Thu Nov 16 2006 mskibbe@suse.de
- update to version 2006c1 which
  o fix bugs
  o fix bug( Bug 217287 - imap-2004g_suse-28: use of dangerous
  "gets" function )
  o fix bug( Bug 144598 - imap-2004g_suse-4: dodgy code )
* Thu Feb 02 2006 ro@suse.de
- give libc-client.so a SONAME
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Sat Jan 14 2006 schwab@suse.de
- Don't strip binaries.
* Wed Jan 11 2006 seife@suse.de
- add -fstack-protector
* Mon Oct 10 2005 rommel@suse.de
- version update to imap-2004g (includes fix for Bug #120608)
* Mon Aug 22 2005 rommel@suse.de
- the FreeFork license used by UW says we have to make it clear in the version
  number that we modified the sources; hinted by our license manager
* Fri Jan 21 2005 arvin@suse.de
- updated to version 2004c
* Tue Dec 14 2004 arvin@suse.de
- updated to version 2004b RC1
* Mon Nov 15 2004 kukuk@suse.de
- Use common-* PAM config files in imap.pamd and pop.pamd
* Mon Sep 13 2004 arvin@suse.de
- fixes for mailbox access over rsh and ssh (bug #43905)
* Fri Jul 16 2004 arvin@suse.de
- updated to version 2004a (bugfix release)
* Tue May 11 2004 arvin@suse.de
- updated to version 2004
- enable IPv6 support
* Fri Feb 27 2004 arvin@suse.de
- add %%run_ldconfig
* Fri Jan 16 2004 kukuk@suse.de
- Add pam-devel to neededforbuild
* Fri Oct 31 2003 arvin@suse.de
- build rpms as non-root user
* Wed Sep 24 2003 arvin@suse.de
- updated to version 2002e (minor release with primarily bugfixes)
* Thu Jun 12 2003 arvin@suse.de
- fixed directory file list
* Fri Jun 06 2003 arvin@suse.de
- updated to version 2002d (minor release with primarily bugfixes)
* Thu Apr 17 2003 arvin@suse.de
- updated to version 2002c (minor release with primarily bugfixes)
* Tue Apr 15 2003 arvin@suse.de
- explain how to create a certificate (bug #26281)
* Fri Apr 11 2003 arvin@suse.de
- added tls/ssl services to xinetd config file
* Thu Apr 10 2003 arvin@suse.de
- updated to version 2002b (maintenace release)
* Thu Apr 10 2003 arvin@suse.de
- fixed path for certificates (now /etc/ssl/certs) (bug #25762)
* Thu Mar 06 2003 arvin@suse.de
- don't use tcpwrapper config file for xinetd (bug #24773)
* Mon Mar 03 2003 arvin@suse.de
- added config file for xinetd
* Fri Feb 07 2003 kukuk@suse.de
- Use pam_unix2.so instead of pam_unix.so
- Don't use absolute path to pam modules
* Wed Nov 20 2002 arvin@suse.de
- updated to imap version 2002
- now compiled with the default SSLTYPE=nopwd in accordance with
  current IESG security requirements
* Thu Nov 07 2002 arvin@suse.de
- include linkage.c in imap-devel
* Tue Sep 03 2002 arvin@suse.de
- fixed header files to be C++ compliant
* Wed Jul 24 2002 arvin@suse.de
- moved shared library into extra sub package
* Fri Jul 12 2002 arvin@suse.de
- imap-devel package requires imap package
* Mon May 06 2002 arvin@suse.de
- fixed overflow while parsing rfc822 messages
* Mon Apr 22 2002 arvin@suse.de
- make c-client.a a link to libc-client.a
* Thu Apr 18 2002 kukuk@suse.de
- Use -fPIC instead of -fpic
* Mon Feb 04 2002 arvin@suse.de
- updated to version 2001a (maintenance release)
- turned SSL support on again
* Fri Aug 24 2001 ro@suse.de
- removed /lib/security path from pam.d config file
* Mon Jun 18 2001 arvin@suse.de
- added osdep.h to imap-devel (bug #8698)
* Tue May 08 2001 arvin@suse.de
- bzip2 sources
* Wed Apr 18 2001 arvin@suse.de
- do not explicit provide imap, it's done automatically
* Tue Feb 06 2001 arvin@suse.de
- updated to version 2000c
- fixed to compile without kernel header files
* Tue Dec 19 2000 arvin@suse.de
- ensure to link against shared version of libcrypto
* Mon Dec 18 2000 arvin@suse.de
- added SSL support
* Fri Nov 03 2000 kukuk@suse.de
- Fix compiling on SPARC
* Fri Nov 03 2000 arvin@suse.de
- changed group tag
* Thu Oct 26 2000 arvin@suse.de
- new version with imap 2000
- contains both programs and libraries
* Fri Mar 17 2000 rolf@suse.de
- removed binaries [bug#2378]
- compile -fpic for shared lib
- use RPM macros for locations of files
- set Group: tag
* Thu Dec 23 1999 rolf@suse.de
- make shared lib work and strip it
* Thu Dec 09 1999 rolf@suse.de
- new version 4.7
- build for PAM systems (LDAP not supported)
- apply lock-patch
- also build shared lib
* Fri Oct 01 1999 rolf@suse.de
- initial version 4.5.BETA