package created using the webbuild interface [release 8.17.1-1mamba;Sat Jan 28 2023]

This commit is contained in:
Silvan Calarco 2024-01-05 17:44:29 +01:00
parent e0b9c67722
commit 7ac8442a73
4 changed files with 153 additions and 0 deletions

View File

@ -1,2 +1,4 @@
# sendmail
Implementation of the sendmail Mail Filter API

15
libmilter-site.config.m4 Normal file
View File

@ -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')

View File

@ -0,0 +1,76 @@
Description: systemd-like socket activation support for libmilter
Author: Mikhail Gusarov <dottedmag@debian.org
--- a/libmilter/docs/smfi_setconn.html
+++ b/libmilter/docs/smfi_setconn.html
@@ -44,6 +44,7 @@ Set the socket through which this filter
<LI><CODE>{unix|local}:/path/to/file</CODE> -- A named pipe.
<LI><CODE>inet:port@{hostname|ip-address}</CODE> -- An IPV4 socket.
<LI><CODE>inet6:port@{hostname|ip-address}</CODE> -- An IPV6 socket.
+ <LI><CODE>fd:number</CODE> -- Pre-opened file descriptor.
</UL>
</TD></TR>
</TABLE>
--- 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;

60
sendmail.spec Normal file
View File

@ -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 <silvan.calarco@mambasoft.it>
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 <silvan.calarco@mambasoft.it> 8.17.1-1mamba
- package created using the webbuild interface