Added support for socket activation to libmilter
Resolves: rhbz#1262535
This commit is contained in:
parent
5646875a34
commit
ce4a2dba14
80
sendmail-8.15.2-libmilter-socket-activation.patch
Normal file
80
sendmail-8.15.2-libmilter-socket-activation.patch
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
Description: systemd-like socket activation support for libmilter
|
||||||
|
Author: Mikhail Gusarov <dottedmag@debian.org
|
||||||
|
diff --git a/libmilter/docs/smfi_setconn.html b/libmilter/docs/smfi_setconn.html
|
||||||
|
index eba7c5b..5b272a0 100644
|
||||||
|
--- a/libmilter/docs/smfi_setconn.html
|
||||||
|
+++ b/libmilter/docs/smfi_setconn.html
|
||||||
|
@@ -43,6 +43,7 @@ Set the socket through which this filter should communicate with sendmail.
|
||||||
|
<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>
|
||||||
|
diff --git a/libmilter/listener.c b/libmilter/listener.c
|
||||||
|
index 11d92bb..2ab533d 100644
|
||||||
|
--- a/libmilter/listener.c
|
||||||
|
+++ b/libmilter/listener.c
|
||||||
|
@@ -197,6 +197,11 @@ mi_milteropen(conn, backlog, rmsocket, name)
|
||||||
|
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 @@ mi_milteropen(conn, backlog, rmsocket, name)
|
||||||
|
}
|
||||||
|
#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 @@ mi_milteropen(conn, backlog, rmsocket, name)
|
||||||
|
#if NETUNIX
|
||||||
|
addr.sa.sa_family != AF_UNIX &&
|
||||||
|
#endif /* NETUNIX */
|
||||||
|
+ addr.sa.sa_family != AF_UNSPEC &&
|
||||||
|
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *) &sockopt,
|
||||||
|
sizeof(sockopt)) == -1)
|
||||||
|
{
|
||||||
|
@@ -511,7 +531,8 @@ mi_milteropen(conn, backlog, rmsocket, name)
|
||||||
|
}
|
||||||
|
#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 @@ mi_listener(conn, dbg, smfi, timeout, backlog)
|
||||||
|
# ifdef BSD4_4_SOCKADDR
|
||||||
|
cliaddr.sa.sa_len == 0 ||
|
||||||
|
# endif /* BSD4_4_SOCKADDR */
|
||||||
|
- cliaddr.sa.sa_family != L_family))
|
||||||
|
+ (L_family != AF_UNSPEC && cliaddr.sa.sa_family != L_family)))
|
||||||
|
{
|
||||||
|
(void) closesocket(connfd);
|
||||||
|
connfd = INVALID_SOCKET;
|
@ -21,7 +21,7 @@
|
|||||||
Summary: A widely used Mail Transport Agent (MTA)
|
Summary: A widely used Mail Transport Agent (MTA)
|
||||||
Name: sendmail
|
Name: sendmail
|
||||||
Version: 8.15.2
|
Version: 8.15.2
|
||||||
Release: 2%{?dist}
|
Release: 3%{?dist}
|
||||||
License: Sendmail
|
License: Sendmail
|
||||||
Group: System Environment/Daemons
|
Group: System Environment/Daemons
|
||||||
URL: http://www.sendmail.org/
|
URL: http://www.sendmail.org/
|
||||||
@ -87,6 +87,7 @@ Patch23: sendmail-8.14.8-sasl2-in-etc.patch
|
|||||||
# add QoS support, patch from Philip Prindeville <philipp@fedoraproject.org>
|
# add QoS support, patch from Philip Prindeville <philipp@fedoraproject.org>
|
||||||
# upstream reserved option ID 0xe7 for testing of this new feature, #576643
|
# upstream reserved option ID 0xe7 for testing of this new feature, #576643
|
||||||
Patch25: sendmail-8.15.2-qos.patch
|
Patch25: sendmail-8.15.2-qos.patch
|
||||||
|
Patch26: sendmail-8.15.2-libmilter-socket-activation.patch
|
||||||
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||||
BuildRequires: tcp_wrappers-devel
|
BuildRequires: tcp_wrappers-devel
|
||||||
BuildRequires: libdb-devel
|
BuildRequires: libdb-devel
|
||||||
@ -208,6 +209,7 @@ cp devtools/M4/UNIX/{,shared}library.m4
|
|||||||
%patch18 -p1 -b .switchfile
|
%patch18 -p1 -b .switchfile
|
||||||
%patch23 -p1 -b .sasl2-in-etc
|
%patch23 -p1 -b .sasl2-in-etc
|
||||||
%patch25 -p1 -b .qos
|
%patch25 -p1 -b .qos
|
||||||
|
%patch26 -p1 -b .libmilter-socket-activation
|
||||||
|
|
||||||
for f in RELEASE_NOTES contrib/etrn.0; do
|
for f in RELEASE_NOTES contrib/etrn.0; do
|
||||||
iconv -f iso8859-1 -t utf8 -o ${f}{_,} &&
|
iconv -f iso8859-1 -t utf8 -o ${f}{_,} &&
|
||||||
@ -701,6 +703,10 @@ fi
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Sep 23 2015 Jaroslav Škarvada <jskarvad@redhat.com> - 8.15.2-3
|
||||||
|
- Added support for socket activation to libmilter
|
||||||
|
Resolves: rhbz#1262535
|
||||||
|
|
||||||
* Wed Jul 22 2015 Lubomir Rintel <lkundrak@v3.sk> - 8.15.2-2
|
* Wed Jul 22 2015 Lubomir Rintel <lkundrak@v3.sk> - 8.15.2-2
|
||||||
- nm-dispacher: don't block the connection activation
|
- nm-dispacher: don't block the connection activation
|
||||||
Resolves: rhbz#1237070
|
Resolves: rhbz#1237070
|
||||||
|
Loading…
Reference in New Issue
Block a user