From 53d4a008107a1d4674b701275f586092a3af6993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= Date: Thu, 2 Nov 2023 20:23:45 +0100 Subject: [PATCH] Drop libdb for RHEL>9 Related: rhbz#1781181 --- sendmail-8.17.2-aliases_dir.patch | 8 ++--- sendmail-etc-mail-mailertable | 4 ++- sendmail.etc-mail-make | 49 ++++++++++++++++----------- sendmail.spec | 55 +++++++++++++++++++++---------- 4 files changed, 74 insertions(+), 42 deletions(-) diff --git a/sendmail-8.17.2-aliases_dir.patch b/sendmail-8.17.2-aliases_dir.patch index 965e133..cbcc5cd 100644 --- a/sendmail-8.17.2-aliases_dir.patch +++ b/sendmail-8.17.2-aliases_dir.patch @@ -91,10 +91,9 @@ index 59dc0de..9ba8752 100644 .SH SEE ALSO aliases(5), sendmail(8) diff --git a/sendmail/sendmail.0 b/sendmail/sendmail.0 -index 4227d16..2cb177d 100644 --- a/sendmail/sendmail.0 +++ b/sendmail/sendmail.0 -@@ -433,10 +433,10 @@ SENDMAIL(8) System Manager's Manual SENDMAIL(8) +@@ -433,10 +433,11 @@ SENDMAIL(8) System Manager's Manual SENDMAIL(8) names are all specified in /etc/mail/sendmail.cf. Thus, these values are only approximations. @@ -104,14 +103,14 @@ index 4227d16..2cb177d 100644 - /etc/mail/aliases.db + /etc/aliases.db ++ /etc/aliases.cdb data base of alias names /etc/mail/sendmail.cf diff --git a/sendmail/sendmail.8 b/sendmail/sendmail.8 -index 26685d0..60e7b64 100644 --- a/sendmail/sendmail.8 +++ b/sendmail/sendmail.8 -@@ -716,10 +716,10 @@ Thus, +@@ -716,10 +716,11 @@ Thus, these values are only approximations. .PP .TP @@ -121,6 +120,7 @@ index 26685d0..60e7b64 100644 .TP - /etc/mail/aliases.db + /etc/aliases.db ++ /etc/aliases.cdb data base of alias names .TP /etc/mail/sendmail.cf diff --git a/sendmail-etc-mail-mailertable b/sendmail-etc-mail-mailertable index 0deb307..9119a6c 100644 --- a/sendmail-etc-mail-mailertable +++ b/sendmail-etc-mail-mailertable @@ -1,7 +1,9 @@ # The "mailer table" can be used to override routing for particular domains -# (which are not in class {w}, i.e. local host names). +# (which are not in class {w}, i.e. local host names). Uncomment either +# "hash" or "cdb". The "hash" requires libdb. If there is no libdb, use "cdb". # # hash /etc/mail/mailertable +# cdb /etc/mail/mailertable # # Keys in this database are fully qualified domain names or partial domains # preceded by a dot -- for example, "vangogh.CS.Berkeley.EDU" or diff --git a/sendmail.etc-mail-make b/sendmail.etc-mail-make index f345b43..5232d7e 100644 --- a/sendmail.etc-mail-make +++ b/sendmail.etc-mail-make @@ -1,5 +1,5 @@ #!/bin/sh -# Generate db and cf files if necessary. This used to be handled by +# Generate db/cdb and cf files if necessary. This used to be handled by # /etc/mail/Makefile. teste() { @@ -10,16 +10,16 @@ teste() { } makedb() { - teste "${1%.db}" + teste "${1%.${DB_SUFFIX}}" if [ -z "$SM_FORCE_DBREBUILD" ]; then - test "${1%.db}" -nt "$1" || return 0 + test "${1%.${DB_SUFFIX}}" -nt "$1" || return 0 fi if [ "$1" = userdb.db ]; then makemap btree "$1" < "${1%.db}" else - makemap hash "$1" < "${1%.db}" + makemap "$DB_MAP" "$1" < "${1%.${DB_SUFFIX}}" fi } @@ -34,11 +34,11 @@ makealiasesdb() { if [ "$a" = /etc/aliases ]; then # /etc/aliases.db may be used by other MTA, make sure nothing # has touched it since our last newaliases call - test "$a" -nt "${a}.db" || - test aliasesdb-stamp -nt "${a}.db" || - test aliasesdb-stamp -ot "${a}.db" || continue + test "$a" -nt "${a}.${DB_SUFFIX}" || + test aliasesdb-stamp -nt "${a}.${DB_SUFFIX}" || + test aliasesdb-stamp -ot "${a}.${DB_SUFFIX}" || continue else - test "$a" -nt "${a}.db" || continue + test "$a" -nt "${a}.${DB_SUFFIX}" || continue fi uptodate=0 @@ -54,7 +54,7 @@ makealiasesdb() { if [ "$(readlink -e /usr/bin/newaliases)" = /usr/sbin/sendmail.sendmail ] then /usr/bin/newaliases > /dev/null - touch -r /etc/aliases.db aliasesdb-stamp 2> /dev/null + touch -r /etc/aliases.$DB_SUFFIX aliasesdb-stamp 2> /dev/null else rm -f aliasesdb-stamp fi @@ -83,16 +83,16 @@ makeall() { # These could be used by sendmail, but are not part of the default install. # To use them you will have to generate your own sendmail.cf with # FEATURE('whatever') - test -f bitdomain && makedb bitdomain.db - test -f uudomain && makedb uudomain.db - test -f genericstable && makedb genericstable.db - test -f userdb && makedb userdb.db - test -f authinfo && makedb authinfo.db + test -f bitdomain && makedb bitdomain.$DB_SUFFIX + test -f uudomain && makedb uudomain.$DB_SUFFIX + test -f genericstable && makedb genericstable.$DB_SUFFIX + test -f userdb && makedb userdb.$DB_SUFFIX + test -f authinfo && makedb authinfo.$DB_SUFFIX - makedb virtusertable.db - makedb access.db - makedb domaintable.db - makedb mailertable.db + makedb virtusertable.$DB_SUFFIX + makedb access.$DB_SUFFIX + makedb domaintable.$DB_SUFFIX + makedb mailertable.$DB_SUFFIX makecf sendmail.cf makecf submit.cf @@ -100,11 +100,20 @@ makeall() { cd /etc/mail || exit 1 +if /usr/bin/makemap -l | grep -q hash +then + DB_MAP="hash" + DB_SUFFIX="db" +else + DB_MAP="cdb" + DB_SUFFIX="cdb" +fi + [ $# -eq 0 ] && makeall for target; do case "$target" in - *.db) + *.db|*.cdb) makedb "$target" ;; *.cf) @@ -117,7 +126,7 @@ for target; do makealiasesdb ;; clean) - rm -f *.db *~ aliasesdb-stamp + rm -f *.db *.cdb *~ aliasesdb-stamp ;; start|stop|restart) service sendmail "$target" diff --git a/sendmail.spec b/sendmail.spec index f03bfbe..becdf7b 100644 --- a/sendmail.spec +++ b/sendmail.spec @@ -1,3 +1,15 @@ +%if 0%{?rhel} < 10 +%bcond_without db +%else +%bcond_with db +%endif + +%if %{with db} +%global db_suffix db +%else +%global db_suffix cdb +%endif + # package options %global with_tls yes %global with_sasl2 yes @@ -29,7 +41,7 @@ Summary: A widely used Mail Transport Agent (MTA) Name: sendmail Version: 8.17.2 -Release: 3%{?dist} +Release: 4%{?dist} License: Sendmail URL: http://www.sendmail.org/ @@ -96,7 +108,7 @@ Patch25: sendmail-8.17.2-qos.patch Patch26: sendmail-8.17.1-libmilter-socket-activation.patch BuildRequires: make -BuildRequires: libdb-devel +%{?with_db:BuildRequires: libdb-devel} %if "%{with_nis}" == "yes" BuildRequires: libnsl2-devel %endif @@ -119,11 +131,13 @@ BuildRequires: setup >= 2.5.31-1 BuildRequires: openssl-devel %endif %if "%{with_sasl2}" == "yes" -BuildRequires: cyrus-sasl-devel openssl-devel +BuildRequires: cyrus-sasl-devel +BuildRequires: openssl-devel Requires: %{_sbindir}/saslauthd %endif %if "%{with_ldap}" == "yes" -BuildRequires: openldap-devel openssl-devel +BuildRequires: openldap-devel +BuildRequires: openssl-devel %endif # Old NetworkManager expects the dispatcher scripts in a different place Conflicts: NetworkManager < 1.20 @@ -216,11 +230,11 @@ sed -i 's|/usr/local/bin/perl|%{_bindir}/perl|' contrib/*.pl %set_build_flags # generate redhat config file cat > redhat.config.m4 << EOF -define(\`confMAPDEF', \`-DNEWDB -DCDB %{?nis_cflags} -DMAP_REGEX -DSOCKETMAP -DNAMED_BIND=1') +define(\`confMAPDEF', \`%{?with_db:-DNEWDB }-DCDB %{?nis_cflags} -DMAP_REGEX -DSOCKETMAP -DNAMED_BIND=1') define(\`confOPTIMIZE', \`\`\`\`${CFLAGS}'''') -define(\`confENVDEF', \`-I%{_includedir}/libdb -I%{_prefix}/kerberos/include -Wall -DXDEBUG=0 -DNETINET6 -DHES_GETMAILHOST -DUSE_VENDOR_CF_PATH=1 -D_FFR_LINUX_MHNL -D_FFR_QOS -D_FILE_OFFSET_BITS=64 -DHAS_GETHOSTBYNAME2 -DHASFLOCK') +define(\`confENVDEF', \`%{?with_db:-I%{_includedir}/libdb }-I%{_prefix}/kerberos/include -Wall -DXDEBUG=0 -DNETINET6 -DHES_GETMAILHOST -DUSE_VENDOR_CF_PATH=1 -D_FFR_LINUX_MHNL -D_FFR_QOS -D_FILE_OFFSET_BITS=64 -DHAS_GETHOSTBYNAME2 -DHASFLOCK') define(\`confLIBDIRS', \`-L%{_prefix}/kerberos/%{_lib}') -define(\`confLIBS', \`%{?nis_ldadd} -lcrypt -ldb -lcdb -lresolv') +define(\`confLIBS', \`%{?nis_ldadd} -lcrypt %{?with_db:-ldb }-lcdb -lresolv') %{?_hardened_build:define(\`confLDOPTS', \`${LDFLAGS}')} define(\`confMANOWN', \`root') define(\`confMANGRP', \`root') @@ -230,7 +244,7 @@ define(\`confMAN5SRC', \`5') define(\`confMAN8SRC', \`8') define(\`confSTDIR', \`%{stdir}') define(\`STATUS_FILE', \`%{stdir}/statistics') -define(\`confLIBSEARCH', \`db resolv 44bsd') +define(\`confLIBSEARCH', \`%{?with_db:db }cdb resolv 44bsd') define(\`confCC', \`${CC}') EOF #' @@ -383,6 +397,9 @@ rm -f %{buildroot}%{sendmailcf}/cf/README # install sendmail.mc with proper paths install -m 644 %{SOURCE6} %{buildroot}%{maildir}/sendmail.mc +%if %{without db} + sed -i 's/\bhash\b/cdb/g;s/\.db\b/.%{db_suffix}/g' %{buildroot}%{maildir}/sendmail.mc +%endif sed -i -e 's|@@PATH@@|%{sendmailcf}|' %{buildroot}%{maildir}/sendmail.mc touch -r %{SOURCE6} %{buildroot}%{maildir}/sendmail.mc @@ -409,8 +426,8 @@ install -p -m 644 %{SOURCE17} %{buildroot}%{maildir}/virtusertable # create db ghosts for map in virtusertable access domaintable mailertable ; do - touch %{buildroot}%{maildir}/${map}.db - chmod 0644 %{buildroot}%{maildir}/${map}.db + touch %{buildroot}%{maildir}/${map}.%{db_suffix} + chmod 0644 %{buildroot}%{maildir}/${map}.%{db_suffix} done touch %{buildroot}%{maildir}/aliasesdb-stamp @@ -530,9 +547,9 @@ exit 0 # Rebuild maps. { - chown root %{_sysconfdir}/aliases.db %{maildir}/access.db \ - %{maildir}/mailertable.db %{maildir}/domaintable.db \ - %{maildir}/virtusertable.db + chown root %{_sysconfdir}/aliases.%{db_suffix} %{maildir}/access.%{db_suffix} \ + %{maildir}/mailertable.%{db_suffix} %{maildir}/domaintable.%{db_suffix} \ + %{maildir}/virtusertable.%{db_suffix} SM_FORCE_DBREBUILD=1 %{maildir}/make SM_FORCE_DBREBUILD=1 %{maildir}/make aliases } > /dev/null 2>&1 @@ -654,10 +671,10 @@ exit 0 %config(noreplace) %{maildir}/virtusertable %ghost %{maildir}/aliasesdb-stamp -%ghost %attr(0640, root,root) %verify(not md5 size mtime) %{maildir}/virtusertable.db -%ghost %attr(0640, root,root) %verify(not md5 size mtime) %{maildir}/access.db -%ghost %attr(0640, root,root) %verify(not md5 size mtime) %{maildir}/domaintable.db -%ghost %attr(0640, root,root) %verify(not md5 size mtime) %{maildir}/mailertable.db +%ghost %attr(0640, root,root) %verify(not md5 size mtime) %{maildir}/virtusertable.%{db_suffix} +%ghost %attr(0640, root,root) %verify(not md5 size mtime) %{maildir}/access.%{db_suffix} +%ghost %attr(0640, root,root) %verify(not md5 size mtime) %{maildir}/domaintable.%{db_suffix} +%ghost %attr(0640, root,root) %verify(not md5 size mtime) %{maildir}/mailertable.%{db_suffix} %ghost %attr(0660, smmsp, smmsp) %verify(not md5 size mtime) %{spooldir}/clientmqueue/sm-client.st @@ -708,6 +725,10 @@ exit 0 %changelog +* Thu Nov 2 2023 Jaroslav Škarvada - 8.17.2-4 +- Drop libdb for RHEL>9 + Related: rhbz#1781181 + * Sat Jul 22 2023 Fedora Release Engineering - 8.17.2-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild