len--;
}
+ if (pattern[0] && ubusd_acl_check(cl, pattern, NULL, UBUS_ACL_LISTEN))
+ return UBUS_STATUS_PERMISSION_DENIED;
+
ev = calloc(1, sizeof(*ev) + len + 1);
if (!ev)
return UBUS_STATUS_NO_DATA;
ubus_msg_send(obj->client, *ub);
}
-static bool strmatch_len(const char *s1, const char *s2, int *len)
-{
- for (*len = 0; s1[*len] == s2[*len]; (*len)++)
- if (!s1[*len])
- return true;
-
- return false;
-}
-
int ubusd_send_event(struct ubus_client *cl, const char *id,
event_fill_cb fill_cb, void *cb_priv)
{
struct event_source *ev;
int match_len = 0;
+ if (ubusd_acl_check(cl, id, NULL, UBUS_ACL_SEND))
+ return UBUS_STATUS_PERMISSION_DENIED;
+
obj_event_seq++;
/*
int cur_match_len;
bool full_match;
- full_match = strmatch_len(id, key, &cur_match_len);
+ full_match = ubus_strmatch_len(id, key, &cur_match_len);
if (cur_match_len < match_len)
break;