[openwrt/openwrt] unetmsg: fix issuing requests without previously subscribing
LEDE Commits
lede-commits at lists.infradead.org
Mon May 5 04:57:22 PDT 2025
nbd pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/6fcaf3d589f9cd5c9e5cdf89cc0e651a97175174
commit 6fcaf3d589f9cd5c9e5cdf89cc0e651a97175174
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Mon May 5 11:38:59 2025 +0200
unetmsg: fix issuing requests without previously subscribing
Perform ACL check if not subscribed. Helps with one-shot requests.
Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
.../unetmsg/files/usr/share/ucode/unetmsg/unetmsgd-client.uc | 7 +++++--
.../services/unetmsg/files/usr/share/ucode/unetmsg/unetmsgd.uc | 1 +
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/package/network/services/unetmsg/files/usr/share/ucode/unetmsg/unetmsgd-client.uc b/package/network/services/unetmsg/files/usr/share/ucode/unetmsg/unetmsgd-client.uc
index cc971b562b..8b42882152 100644
--- a/package/network/services/unetmsg/files/usr/share/ucode/unetmsg/unetmsgd-client.uc
+++ b/package/network/services/unetmsg/files/usr/share/ucode/unetmsg/unetmsgd-client.uc
@@ -72,8 +72,11 @@ function client_request(cl, req)
return core.handle_message(handle, data, true);
case "request":
handle = cl.subscribe[name];
- if (!handle)
- return libubus.STATUS_INVALID_ARGUMENT;
+ if (!handle &&
+ !core.acl_check("subscribe", cl.acl, [ name ]))
+ return libubus.STATUS_PERMISSION_DENIED;
+
+ handle ??= { client: cl.id };
return core.handle_request(handle, req, data, true);
}
}
diff --git a/package/network/services/unetmsg/files/usr/share/ucode/unetmsg/unetmsgd.uc b/package/network/services/unetmsg/files/usr/share/ucode/unetmsg/unetmsgd.uc
index 68b0600fe9..393a6ea47a 100644
--- a/package/network/services/unetmsg/files/usr/share/ucode/unetmsg/unetmsgd.uc
+++ b/package/network/services/unetmsg/files/usr/share/ucode/unetmsg/unetmsgd.uc
@@ -111,6 +111,7 @@ function handle_request(handle, req, data, remote)
for (let cur in handles) {
if (!cur || !cur.get_channel) {
+ cb();
continue;
}
let chan = cur.get_channel();
More information about the lede-commits
mailing list