commit 0eaa19a: [Fix] Bind AF_UNIX DGRAM client connection to annonymous address
Timo Rothenpieler
timo at rothenpieler.org
Mon Sep 26 13:14:04 UTC 2022
Author: Timo Rothenpieler
Date: 2022-09-26 00:35:49 +0200
URL: https://github.com/rspamd/rspamd/commit/0eaa19a09a573ac9e1a77290b57557cd39860eff
[Fix] Bind AF_UNIX DGRAM client connection to annonymous address
Fixes #4278
---
src/libutil/addr.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/libutil/addr.c b/src/libutil/addr.c
index 2e32d4bd1..4c3de70cf 100644
--- a/src/libutil/addr.c
+++ b/src/libutil/addr.c
@@ -1060,6 +1060,19 @@ rspamd_inet_address_connect (const rspamd_inet_addr_t *addr, gint type,
if (addr->af == AF_UNIX) {
sa = (const struct sockaddr *)&addr->u.un->addr;
+
+ if (type == (int)SOCK_DGRAM) {
+ struct sockaddr ca;
+
+ memset (&ca, 0, sizeof(ca));
+ ca.sa_family = AF_UNIX;
+
+ r = bind (fd, &ca, sizeof (sa_family_t));
+ if (r == -1) {
+ msg_info ("unix socket client autobind failed: %s, '%s'",
+ addr->u.un->addr.sun_path, strerror (errno));
+ }
+ }
}
else {
sa = &addr->u.in.addr.sa;
More information about the Commits
mailing list