From 7ac8442a73d36ff06a42933e2eab0ea1e5854bc9 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Fri, 5 Jan 2024 17:44:29 +0100 Subject: [PATCH] package created using the webbuild interface [release 8.17.1-1mamba;Sat Jan 28 2023] --- README.md | 2 + libmilter-site.config.m4 | 15 +++++ sendmail-8.17.1-fd-passing-libmilter.patch | 76 ++++++++++++++++++++++ sendmail.spec | 60 +++++++++++++++++ 4 files changed, 153 insertions(+) create mode 100644 libmilter-site.config.m4 create mode 100644 sendmail-8.17.1-fd-passing-libmilter.patch create mode 100644 sendmail.spec diff --git a/README.md b/README.md index fd85d40..f2f1ab0 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # sendmail +Implementation of the sendmail Mail Filter API + diff --git a/libmilter-site.config.m4 b/libmilter-site.config.m4 new file mode 100644 index 0000000..86c5313 --- /dev/null +++ b/libmilter-site.config.m4 @@ -0,0 +1,15 @@ +dnl Enable libmilter with a pool of workers +APPENDDEF(`conf_libmilter_ENVDEF',`-D_FFR_WORKERS_POOL=1') +APPENDDEF(`conf_libmilter_ENVDEF',`-DMIN_WORKERS=4') +dnl Use poll instead of select +APPENDDEF(`conf_libmilter_ENVDEF',`-DSM_CONF_POLL=1') +dnl Enable IPv6 +APPENDDEF(`conf_libmilter_ENVDEF',`-DNETINET6=1') +dnl Add -fPIC +APPENDDEF(`conf_libmilter_ENVDEF',`-fPIC') +dnl Permissions +APPENDDEF(`confINCGRP',`root') +APPENDDEF(`confLIBGRP',`root') +APPENDDEF(`confMBINGRP',`root') +APPENDDEF(`confSBINGRP',`root') +APPENDDEF(`confBINGRP',`root') diff --git a/sendmail-8.17.1-fd-passing-libmilter.patch b/sendmail-8.17.1-fd-passing-libmilter.patch new file mode 100644 index 0000000..01d35f5 --- /dev/null +++ b/sendmail-8.17.1-fd-passing-libmilter.patch @@ -0,0 +1,76 @@ +Description: systemd-like socket activation support for libmilter +Author: Mikhail Gusarov {unix|local}:/path/to/file -- A named pipe. +
  • inet:port@{hostname|ip-address} -- An IPV4 socket. +
  • inet6:port@{hostname|ip-address} -- An IPV6 socket. ++
  • fd:number -- Pre-opened file descriptor. + + + +--- a/libmilter/listener.c ++++ b/libmilter/listener.c +@@ -197,6 +197,11 @@ + L_socksize = sizeof addr.sin6; + } + #endif /* NETINET6 */ ++ else if (strcasecmp(p, "fd") == 0) ++ { ++ addr.sa.sa_family = AF_UNSPEC; ++ L_socksize = sizeof (_SOCK_ADDR); ++ } + else + { + smi_log(SMI_LOG_ERR, "%s: unknown socket type %s", +@@ -443,7 +448,21 @@ + } + #endif /* NETINET || NETINET6 */ + +- sock = socket(addr.sa.sa_family, SOCK_STREAM, 0); ++ if (addr.sa.sa_family == AF_UNSPEC) ++ { ++ char *end; ++ sock = strtol(colon, &end, 10); ++ if (*end != '\0' || sock < 0) ++ { ++ smi_log(SMI_LOG_ERR, "%s: expected positive integer as fd, got %s", name, colon); ++ return INVALID_SOCKET; ++ } ++ } ++ else ++ { ++ sock = socket(addr.sa.sa_family, SOCK_STREAM, 0); ++ } ++ + if (!ValidSocket(sock)) + { + smi_log(SMI_LOG_ERR, +@@ -466,6 +485,7 @@ + #if NETUNIX + addr.sa.sa_family != AF_UNIX && + #endif ++ addr.sa.sa_family != AF_UNSPEC && + setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *) &sockopt, + sizeof(sockopt)) == -1) + { +@@ -511,7 +531,8 @@ + } + #endif /* NETUNIX */ + +- if (bind(sock, &addr.sa, L_socksize) < 0) ++ if (addr.sa.sa_family != AF_UNSPEC && ++ bind(sock, &addr.sa, L_socksize) < 0) + { + smi_log(SMI_LOG_ERR, + "%s: Unable to bind to port %s: %s", +@@ -818,7 +839,7 @@ + #ifdef BSD4_4_SOCKADDR + cliaddr.sa.sa_len == 0 || + #endif +- cliaddr.sa.sa_family != L_family)) ++ (L_family != AF_UNSPEC && cliaddr.sa.sa_family != L_family))) + { + (void) closesocket(connfd); + connfd = INVALID_SOCKET; diff --git a/sendmail.spec b/sendmail.spec new file mode 100644 index 0000000..bd9ec03 --- /dev/null +++ b/sendmail.spec @@ -0,0 +1,60 @@ +Name: sendmail +Version: 8.17.1 +Release: 1mamba +Summary: Implementation of the sendmail Mail Filter API +Group: System/Servers +Vendor: openmamba +Distribution: openmamba +Packager: Silvan Calarco +URL: https://www.proofpoint.com/us/sendmail-open-source +Source: https://ftp.sendmail.org/sendmail.%{version}.tar.gz +Source1: libmilter-site.config.m4 +Patch0: sendmail-8.17.1-fd-passing-libmilter.patch +License: Custom +## AUTOBUILDREQ-BEGIN +## AUTOBUILDREQ-END + +%description +Implementation of the sendmail Mail Filter API + +%package -n libmilter-devel +Group: Development/Libraries +Summary: Development files for %{name} + +%description -n libmilter-devel +This package contains libraries and header files for developing applications that use %{name}. + +#% debug_package + +%prep +%setup -q +%patch0 -p1 -b .fd-passing-libmilter +cp %{SOURCE1} devtools/Site/site.config.m4 + +%build +%make -C libmilter + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +install -d -m0755 %{buildroot}%{_libdir} +%makeinstall -C libmilter \ + INCOWN=`id -u` INCGRP=`id -g` INCMODE=0644 \ + LIBOWN=`id -u` LIBGRP=`id -g` LIBMODE=0644 \ + LIBDIR=%{_libdir} + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%files -n libmilter-devel +%defattr(-,root,root) +%dir %{_includedir}/libmilter +%{_includedir}/libmilter/mfapi.h +%{_includedir}/libmilter/mfdef.h +%{_libdir}/libmilter.a +%doc README +%doc LICENSE + +%changelog +* Sat Jan 28 2023 Silvan Calarco 8.17.1-1mamba +- package created using the webbuild interface