summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2016-11-20 17:05:00 +0100
committerFelix Fietkau <nbd@nbd.name>2016-12-24 14:30:13 +0100
commit5ca6bae3a27ca02e304339ed0d94a8baa461b609 (patch)
treec9b66c7921c75bc4516ccded63765983809778b4
parentd009a084735c7e0bca28ca05919fa9c60007f314 (diff)
downloadubus-5ca6bae3a27ca02e304339ed0d94a8baa461b609.tar.gz
ubusd: fix id lookup of objects with path and no methods
Signed-off-by: Felix Fietkau <nbd@nbd.name>
-rw-r--r--ubusd_proto.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ubusd_proto.c b/ubusd_proto.c
index b591384..d2feed9 100644
--- a/ubusd_proto.c
+++ b/ubusd_proto.c
@@ -156,7 +156,7 @@ static int ubusd_handle_add_object(struct ubus_client *cl, struct ubus_msg_buf *
static void ubusd_send_obj(struct ubus_client *cl, struct ubus_msg_buf *ub, struct ubus_object *obj)
{
struct ubus_method *m;
- int cnt = 0;
+ int all_cnt = 0, cnt = 0;
void *s;
if (!obj->type)
@@ -170,6 +170,7 @@ static void ubusd_send_obj(struct ubus_client *cl, struct ubus_msg_buf *ub, stru
s = blob_nest_start(&b, UBUS_ATTR_SIGNATURE);
list_for_each_entry(m, &obj->type->methods, list) {
+ all_cnt++;
if (!ubusd_acl_check(cl, obj->path.key, blobmsg_name(m->data), UBUS_ACL_ACCESS)) {
blobmsg_add_blob(&b, m->data);
cnt++;
@@ -177,7 +178,7 @@ static void ubusd_send_obj(struct ubus_client *cl, struct ubus_msg_buf *ub, stru
}
blob_nest_end(&b, s);
- if (cnt)
+ if (cnt || !all_cnt)
ubus_proto_send_msg_from_blob(cl, ub, UBUS_MSG_DATA);
}