Skip to content

Commit 6fcaf3d

Browse files
committed
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>
1 parent 55cff42 commit 6fcaf3d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

package/network/services/unetmsg/files/usr/share/ucode/unetmsg/unetmsgd-client.uc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,11 @@ function client_request(cl, req)
7272
return core.handle_message(handle, data, true);
7373
case "request":
7474
handle = cl.subscribe[name];
75-
if (!handle)
76-
return libubus.STATUS_INVALID_ARGUMENT;
75+
if (!handle &&
76+
!core.acl_check("subscribe", cl.acl, [ name ]))
77+
return libubus.STATUS_PERMISSION_DENIED;
78+
79+
handle ??= { client: cl.id };
7780
return core.handle_request(handle, req, data, true);
7881
}
7982
}

package/network/services/unetmsg/files/usr/share/ucode/unetmsg/unetmsgd.uc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ function handle_request(handle, req, data, remote)
111111

112112
for (let cur in handles) {
113113
if (!cur || !cur.get_channel) {
114+
cb();
114115
continue;
115116
}
116117
let chan = cur.get_channel();

0 commit comments

Comments
 (0)