session: make object and function arguments of session.access optional, dump effective acls in this case
This commit is contained in:
parent
49f6e218a4
commit
967d815022
1 changed files with 18 additions and 9 deletions
13
session.c
13
session.c
|
@ -580,13 +580,17 @@ rpc_handle_access(struct ubus_context *ctx, struct ubus_object *obj,
|
|||
|
||||
blobmsg_parse(perm_policy, __RPC_SP_MAX, tb, blob_data(msg), blob_len(msg));
|
||||
|
||||
if (!tb[RPC_SP_SID] || !tb[RPC_SP_OBJECT] || !tb[RPC_SP_FUNCTION])
|
||||
if (!tb[RPC_SP_SID])
|
||||
return UBUS_STATUS_INVALID_ARGUMENT;
|
||||
|
||||
ses = rpc_session_get(blobmsg_data(tb[RPC_SP_SID]));
|
||||
if (!ses)
|
||||
return UBUS_STATUS_NOT_FOUND;
|
||||
|
||||
blob_buf_init(&buf, 0);
|
||||
|
||||
if (tb[RPC_SP_OBJECT] && tb[RPC_SP_FUNCTION])
|
||||
{
|
||||
if (tb[RPC_SP_SCOPE])
|
||||
scope = blobmsg_data(tb[RPC_SP_SCOPE]);
|
||||
|
||||
|
@ -594,8 +598,13 @@ rpc_handle_access(struct ubus_context *ctx, struct ubus_object *obj,
|
|||
blobmsg_data(tb[RPC_SP_OBJECT]),
|
||||
blobmsg_data(tb[RPC_SP_FUNCTION]));
|
||||
|
||||
blob_buf_init(&buf, 0);
|
||||
blobmsg_add_u8(&buf, "access", allow);
|
||||
}
|
||||
else
|
||||
{
|
||||
rpc_session_dump_acls(ses, &buf);
|
||||
}
|
||||
|
||||
ubus_send_reply(ctx, req, buf.head);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue