]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
unetmsg: fix issuing requests without previously subscribing
authorFelix Fietkau <nbd@nbd.name>
Mon, 5 May 2025 09:38:59 +0000 (11:38 +0200)
committerFelix Fietkau <nbd@nbd.name>
Mon, 5 May 2025 11:57:08 +0000 (13:57 +0200)
Perform ACL check if not subscribed. Helps with one-shot requests.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
package/network/services/unetmsg/files/usr/share/ucode/unetmsg/unetmsgd-client.uc
package/network/services/unetmsg/files/usr/share/ucode/unetmsg/unetmsgd.uc

index cc971b562b93e3be2f04456fa45068c573277c14..8b428821520539a34dade5c738c609b4ec181be7 100644 (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);
        }
 }
index 68b0600fe9fc70311e56a063a373ab48d4c480b0..393a6ea47adf5b65f84cad65f813cec3c2b385c0 100644 (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();