--- postfix-1.1.11-5.spec	Wed Sep 11 15:47:59 2002
+++ postfix-1.1.11.20021029-5.AERAsec.6.spec	Sun Nov  3 15:22:05 2002
@@ -1,28 +1,40 @@
+# Red Hat Linux specific release extraction
+%define DISTRO %([ -f /etc/redhat-release ] && sed -e "s/\\(.\\+\\)\\( Linux release \\)\\(.\\+\\)\\( .\\+\\)/\\1 \\3/" /etc/redhat-release)
+%define DISTRO_REL %([ -f /etc/redhat-release ] && sed -e "s/\\(.\\+ release \\)\\(.\\+\\)\\( .\\+\\)/\\2/" /etc/redhat-release)
+%define REQ_RPM_REL %(rpm -q --queryformat "%{VERSION}" rpm)
+%define GLIBC_REL %(rpm -q --queryformat "%{VERSION}" glibc)
+%define USE_DB3 %(if echo %{DISTRO_REL} | grep -q ^7; then echo 1; fi)
+
+# Special version 
+%define myversion AERAsec.6
+
 %define copy_cmd copy() { ln -f "$1" "$2" 2>/dev/null || cp -df "$1" "$2"; }
 %define ROOT /var/spool/postfix
 
-%define LDAP 0
+%define LDAP 1
 %define MYSQL 0
 %define PCRE 1
 %define SASL 1
 %define TLS 1
-%define SMTPD_MULTILINE_GREETING 1
+%define IPV6 1
+%define SMTPD_MULTILINE_GREETING 0
 %define POSTDROP_GID 90
 
 # If set to 1 if official version, 0 if snapshot
-%define official 1 
+%define official 0 
 %define ver 1.1.11
-%define releasedate 20020624
+%define releasedate 20021029
 %define alternatives 1
 %if %{official}
 Version: %{ver}
 %define ftp_directory official
 %else
-Version: %{ver}-%{releasedate}
+Version: %{ver}.%{releasedate}
 %define ftp_directory experimental
 %endif
 
 %define tlsno pfixtls-0.8.11a-1.1.11-0.9.6d
+%define tlsipv6no 1.7/tls+ipv6-1.7pre3-pf-%{ver}-%{releasedate} 
 
 # Postfix requires one exlusive uid/gid and a 2nd exclusive gid for its own
 # use.  Let me know if the second gid collides with another package.
@@ -46,9 +58,13 @@
 PreReq: %{_sbindir}/groupadd, %{_sbindir}/useradd
 Epoch: 2
 Provides: MTA smtpd smtpdaemon /usr/bin/newaliases
-Release: 5
+Release: 5.%{DISTRO_REL}.%{myversion}
 Summary: Postfix Mail Transport Agent
+%if %{official}
 Source0: ftp://ftp.porcupine.org/mirrors/postfix-release/%{ftp_directory}/%{name}-%{version}.tar.bz2
+%else
+Source0: ftp://ftp.porcupine.org/mirrors/postfix-release/%{ftp_directory}/%{name}-%{ver}-%{releasedate}.tar.gz
+%endif
 Source3: postfix-etc-init.d-postfix
 Source5: postfix-aliases
 Source6: postfix-chroot-setup.awk
@@ -59,6 +75,7 @@
 Patch2: postfix-smtp_sasl_proto.c.patch
 Patch3: postfix-alternatives.patch
 Patch4: postfix-1.1.4-sasl2-patch
+Patch10: ftp://ftp.stack.nl/pub/postfix/tls+ipv6/%{tlsipv6no}.patch
 
 # Optional patches - set the appropriate environment variables to include
 #                    them when building the package/spec file
@@ -69,7 +86,13 @@
 BuildRoot: %{_tmppath}/%{name}-buildroot
 
 # Determine the different packages required for building postfix
-BuildRequires: gawk, perl, sed, ed, db4-devel
+BuildRequires: gawk, perl, sed, ed
+%if %{USE_DB3}
+BuildRequires: db3-devel
+%else
+BuildRequires: db4-devel
+%endif
+
 
 %if %{LDAP}
 BuildRequires: openldap >= 1.2.9, openldap-devel >= 1.2.9
@@ -90,6 +113,10 @@
 BuildRequires: cyrus-sasl, cyrus-sasl-devel
 %endif
 
+%if %{IPV6}
+%define TLS 1
+%endif
+
 %if %{TLS}
 Requires: openssl
 BuildRequires: openssl-devel
@@ -99,15 +126,27 @@
 
 %description
 Postfix is a Mail Transport Agent (MTA), supporting LDAP, SMTP AUTH (SASL),
-TLS and running in a chroot environment.
+TLS, IPv6 and running in a chroot environment.
 
 %prep
 umask 022
 
+%if %{official}
 %setup -q -a 9
+%else
+%setup -q -a 9 -n %{name}-%{ver}-%{releasedate}
+%endif
+
 # Apply the TLS patch, must be at first, because the changes of master.cf
 %if %{TLS}
+if [ "%{IPV6}" = "0" ]; then
 patch -p1 <%{tlsno}/pfixtls.diff
+fi
+%endif
+
+# Apply the IPv6+TLS patch
+%if %{IPV6}
+patch -p1 <%{P:10}
 %endif
 
 # Apply obligatory patches
@@ -118,7 +157,7 @@
 %endif
 
 # Apply the SASL2 patch to make postfix work correctly with SASL2.
-%patch4 -p1 -b .sasl2
+#%patch4 -p1 -b .sasl2
 
 # Apply optional patches
 
@@ -144,6 +183,7 @@
 umask 022
 
 CCARGS=
+#CCARGS="-DDEBUG6"
 AUXLIBS=
 
 %ifarch s390 s390x ppc
@@ -330,8 +370,12 @@
 %{copy_cmd}
 copy /etc/services %{ROOT}/etc
 
-# Put db4 in the chroot jail, but only if the soname is correct
+# Put db in the chroot jail, but only if the soname is correct
+%if %{USE_DB3}
+%triggerin -- db3
+%else
 %triggerin -- db4
+%endif
 %{copy_cmd}
 DBVER=`ldd %{_libexecdir}/postfix/pickup |grep libdb |sed "s,[[:blank:]],,g;s,=>.*,,"`
 if [ -e "/lib/$DBVER" ]; then
@@ -508,6 +552,19 @@
 %{_mandir}/*/*
 
 %changelog
+* Sun Nov  3 2002 Dr. Peter Bieringer <pbieringer@aerasec.de>
+- Update to postfix snapshot 1.1.11-20021029
+- Update IPv6+TLS patch
+- Add db autodetection to support RHL 7.x (db3) and 8.x (db4)
+
+* Wed Oct 27 2002 Dr. Peter Bieringer <pbieringer@aerasec.de>
+- Update to postfix snapshot 1.1.11-20020928
+- Add IPv6+TLS patch
+- Disable extra SASL2 and MULTILINEGREETING patch because of conflicts
+
+* Wed Sep 11 2002 Dr. Peter Bieringer <pbieringer@aerasec.de>
+- Enable LDAP, downgrade to db3
+
 * Wed Jul 24 2002 Karsten Hopp <karsten@redhat.de>
 - make aliases.db config(noreplace) (#69612)
 
