unetmsg: fix issuing requests without previously subscribing

Perform ACL check if not subscribed. Helps with one-shot requests.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Felix Fietkau 2025-05-05 11:38:59 +02:00
parent 55cff42121
commit 6fcaf3d589
2 changed files with 6 additions and 2 deletions

View file

@ -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);
}
}

View file

@ -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();