ubusd_acl: add support for wildcard in methods
Add support for wildcard in methods to permit access to all methods defined by the object. This can be usefull for process that run as non-root user and needs to access ubus method. Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
parent
13a4438b4e
commit
ad0cd117db
1 changed files with 6 additions and 2 deletions
|
@ -147,13 +147,17 @@ ubusd_acl_check(struct ubus_client *cl, const char *obj,
|
||||||
case UBUS_ACL_ACCESS:
|
case UBUS_ACL_ACCESS:
|
||||||
if (acl->methods) {
|
if (acl->methods) {
|
||||||
struct blob_attr *cur;
|
struct blob_attr *cur;
|
||||||
|
char *cur_method;
|
||||||
size_t rem;
|
size_t rem;
|
||||||
|
|
||||||
blobmsg_for_each_attr(cur, acl->methods, rem)
|
blobmsg_for_each_attr(cur, acl->methods, rem)
|
||||||
if (blobmsg_type(cur) == BLOBMSG_TYPE_STRING)
|
if (blobmsg_type(cur) == BLOBMSG_TYPE_STRING) {
|
||||||
if (!strcmp(method, blobmsg_get_string(cur)))
|
cur_method = blobmsg_get_string(cur);
|
||||||
|
|
||||||
|
if (!strcmp(method, cur_method) || !strcmp("*", cur_method))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue