Commit graph

17 commits

Author SHA1 Message Date
Hans Dedecker
221ce7e7ff ubusd_acl: event send access list support
Adds event send access list support in ubus via the "send" keyword

Example of a json file:
{
	"user": "superuser",
	"send": [ "wireless.*" ],
}

Signed-off-by: Koen Dergent <koen.cj.dergent@gmail.com>
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-10-06 20:40:24 +02:00
Hans Dedecker
da503db660 ubusd_acl: event listen access list support
Adds event listen access list support in ubus via the "listen" keyword

Example of a json file:

{
    "user": "superuser",
    "listen": [ "network.*" ],
}

Signed-off-by: Koen Dergent <koen.cj.dergent@gmail.com>
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-10-06 20:39:34 +02:00
Hans Dedecker
c035bab01c ubusd_acl: rework wildcard support
Wildcard access list support was failing in case multiple wildcards
entries were defined and/or when a specific access list string
overlapped a wildcard entry.
Root cause of the problem was the way how wildcard entries were sorted
in the avl tree by the compare function ubusd_acl_match_path resulting
into a non acces list match for a given object path.

The avl_tree sorting has been changed to make use of avl_strcmp; as such
there's no distinction anymore between non-wildcard and wildcard entries
in the avl_tree compare function as the boolean partial marks an access
list entry as a wildcard entry.

When trying to find an access list match for an object path the access list
tree is iterated as long as the number of characters between the access list
string and object path is monotonically increasing.

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-10-06 20:39:20 +02:00
Denis Osvald
ba45b27f8c ubusd: fix inverted check in ubusd_reply_add
Signed-off-by: Denis Osvald <denis.osvald@sartura.hr>
2016-09-05 13:59:34 +02:00
Denis Osvald
d6bb4f1a1d ubusd: don't check ACL when object is NULL
If there are any ACLs present other than global wildcard "*", the AVL
tree comparator will compare ACL key to object name. However, object
name can be NULL in cases where ACL check is done on call to internal
ubus objects (e.g. ubus monitor).

With this change we skip checking ACLs on such NULL objects.

Signed-off-by: Denis Osvald <denis.osvald@sartura.hr>
2016-08-25 13:58:11 +02:00
Felix Fietkau
619f3a160d ubusd: fix a memory leak on user/group client info
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2016-01-26 10:10:39 +01:00
Felix Fietkau
1d2b3bbdbe ubusd: add missing NULL pointer checks for ACL processing
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2016-01-13 12:29:01 +01:00
Felix Fietkau
68da4ceb87 ubusd: allow all object access if uid=0 (ignore gid)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-12-09 20:16:36 +01:00
Felix Fietkau
766d49876f ubusd: simplify/fix avl loop in ubusd_reply_add()
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-12-09 19:40:20 +01:00
Felix Fietkau
0eff70a64c ubusd: simplify/fix avl loop in ubusd_acl_check()
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-12-09 19:36:49 +01:00
Felix Fietkau
83461b9791 ubusd: make ACL path configurable on the command line
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-12-09 17:44:00 +01:00
Felix Fietkau
152dd96f63 ubusd: remove a faulty and redundant check
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-12-09 17:36:08 +01:00
John Crispin
33b2abf631 fix off-by-one in acl match iteration
Signed-off-by: John Crispin <blogic@openwrt.org>
2015-09-22 06:20:55 +02:00
John Crispin
f7f899d2d3 unbreak acl allocation
Signed-off-by: John Crispin <blogic@openwrt.org>
2015-09-22 06:12:08 +02:00
John Crispin
7ec9b8dec7 fix a copy & paste bug
Signed-off-by: John Crispin <blogic@openwrt.org>
2015-07-01 02:22:36 +02:00
Felix Fietkau
e59b445734 ubusd: fix build on non-linux systems without peercred support
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-06-24 18:28:37 +02:00
John Crispin
8309c75828 add acl code
Signed-off-by: John Crispin <blogic@openwrt.org>
2015-06-18 19:01:17 +02:00