diff options
author | Mikhail Gusarov <dottedmag@debian.org> | 2014-03-10 14:33:22 +0100 |
---|---|---|
committer | Andreas Beckmann <anbe@debian.org> | 2014-04-22 17:49:02 +0200 |
commit | fde7e9f6b674b69cd6f4cf502d7096e1fbd9c63c (patch) | |
tree | fd637860efa87ef644b69b33fab45076fcfa6427 | |
parent | eaf77321b70d0fc0ae75a7ac3f8d5971d8a5632c (diff) | |
download | sendmail-fde7e9f6b674b69cd6f4cf502d7096e1fbd9c63c.tar.gz |
systemd socket activation support for libmilter
-rw-r--r-- | debian/changelog | 2 | ||||
-rw-r--r-- | debian/patches/8.14/8.14.4/series | 1 | ||||
-rw-r--r-- | debian/patches/8.14/8.14.4/socket_activation.patch | 80 |
3 files changed, 83 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog index 23ee427..0c9e510 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,8 @@ sendmail (8.14.4-6) UNRELEASED; urgency=medium * QA upload. * Set maintainer to Debian QA Group. (See: #740070) + * Add systemd socket activation support for libmilter, thanks to Mikhail + Gusarov. (Closes: #741257) -- Andreas Beckmann <anbe@debian.org> Tue, 22 Apr 2014 17:01:07 +0200 diff --git a/debian/patches/8.14/8.14.4/series b/debian/patches/8.14/8.14.4/series index d4e169b..4349920 100644 --- a/debian/patches/8.14/8.14.4/series +++ b/debian/patches/8.14/8.14.4/series @@ -15,3 +15,4 @@ raise-max-daemons.patch hurd.patch manpage-section.patch conf.c-ipv6.patch +socket_activation.patch diff --git a/debian/patches/8.14/8.14.4/socket_activation.patch b/debian/patches/8.14/8.14.4/socket_activation.patch new file mode 100644 index 0000000..3ab61a6 --- /dev/null +++ b/debian/patches/8.14/8.14.4/socket_activation.patch @@ -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 70a510e..013f04e 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 48c552f..2249a1f 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", +@@ -817,7 +838,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; |