diff options
author | Ansuel Smith <ansuelsmth@gmail.com> | 2020-10-23 03:01:55 +0200 |
---|---|---|
committer | Daniel Golle <daniel@makrotopia.org> | 2020-10-25 18:01:19 +0000 |
commit | ad0cd117db74934385d81605514e041b1a9cdda9 (patch) | |
tree | 43bd09f8f3ec2e1c9c02b06e7a4e5265c5da4f88 | |
parent | 13a4438b4ebdf85d301999e0a615640ac4c9b0a8 (diff) | |
download | ubus-ad0cd117db74934385d81605514e041b1a9cdda9.tar.gz |
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>
-rw-r--r-- | ubusd_acl.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ubusd_acl.c b/ubusd_acl.c index e426a4a..e050e2c 100644 --- a/ubusd_acl.c +++ b/ubusd_acl.c @@ -147,12 +147,16 @@ ubusd_acl_check(struct ubus_client *cl, const char *obj, case UBUS_ACL_ACCESS: if (acl->methods) { struct blob_attr *cur; + char *cur_method; size_t rem; blobmsg_for_each_attr(cur, acl->methods, rem) - if (blobmsg_type(cur) == BLOBMSG_TYPE_STRING) - if (!strcmp(method, blobmsg_get_string(cur))) + if (blobmsg_type(cur) == BLOBMSG_TYPE_STRING) { + cur_method = blobmsg_get_string(cur); + + if (!strcmp(method, cur_method) || !strcmp("*", cur_method)) return 0; + } } break; } |