Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP1:GA
sendmail.10026
sendmail-fd-passing-libmilter.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File sendmail-fd-passing-libmilter.patch of Package sendmail.10026
Description: systemd-like socket activation support for libmilter Author: Mikhail Gusarov <dottedmag@debian.org diff --git a/sendmail-8.15.2/libmilter/docs/smfi_setconn.html b/sendmail-8.15.2/libmilter/docs/smfi_setconn.html --- a/libmilter/docs/smfi_setconn.html +++ b/libmilter/docs/smfi_setconn.html @@ -43,6 +43,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> diff --git a/sendmail-8.15.2/libmilter/listener.c b/sendmail-8.15.2/libmilter/listener.c --- a/libmilter/listener.c +++ b/libmilter/listener.c @@ -197,6 +197,11 @@ mi_milteropen(conn, backlog, rmsocket, n 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, n } #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, n #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, n } #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, ba # 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;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor