-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
Rspamd/Rmilter update #14992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Rspamd/Rmilter update #14992
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
40f8255
rmilter: use libmilter with patch to socket activation
avnik c84c174
rmilter: socket activation in nixos
avnik 5d26e80
rspamd: typo
avnik 5c26039
rmilter: correct paths to sockets
avnik 36954ee
rspamd: configurable bindSocket and bindUISocket
avnik a817d5b
libmemcached: move cyrus_sasl to propagatedBuildInputs
avnik ebdfc9d
rmilter: 1.7.3 -> 1.8.2
avnik 0503634
rspamd: 1.2.0 -> 1.2.5
avnik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If socket activation is recommended, why make it optional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It recommended for domain socket setup, because rmilter (actually libmilter from sendmail) can't set proper permissions on socket.
So folks who prefer inet socket have option here.