summaryrefslogtreecommitdiff
path: root/ubusd_acl.c
Commit message (Collapse)AuthorAgeFilesLines
* iron out all extra compiler warningsPetr Štetiar2019-12-161-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | clang-9 on x86/64 has reported following warnings/errors: libubus-acl.c:123:2: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare] libubus-io.c:108:18: error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare] libubus-io.c:395:56: error: comparison of integers of different signs: 'ssize_t' (aka 'long') and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare] libubus-req.c:441:4: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare] ubusd_acl.c:119:18: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare] ubusd_acl.c:152:5: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare] ubusd_acl.c:348:3: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare] ubusd_acl.c:352:3: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare] ubusd_acl.c:357:3: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare] ubusd_acl.c:362:3: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare] ubusd_acl.c:367:3: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare] ubusd_acl.c:447:16: error: comparison of integers of different signs: 'int' and '__size_t' (aka 'unsigned long') [-Werror,-Wsign-compare] ubusd_acl.c:502:18: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare] ubusd.c:123:13: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare] ubusd.c:170:15: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare] ubusd.c:262:43: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare] ubusd.c:287:30: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare] ubusd_event.c:170:18: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare] ubusd_obj.c:71:2: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare] Signed-off-by: Petr Štetiar <ynezz@true.cz>
* ubusd_acl: event send access list supportHans Dedecker2018-10-061-0/+20
| | | | | | | | | | | | | 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>
* ubusd_acl: event listen access list supportHans Dedecker2018-10-061-0/+20
| | | | | | | | | | | | | | 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>
* ubusd_acl: rework wildcard supportHans Dedecker2018-10-061-42/+69
| | | | | | | | | | | | | | | | | | | | 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>
* ubusd: fix inverted check in ubusd_reply_addDenis Osvald2016-09-051-1/+1
| | | | Signed-off-by: Denis Osvald <denis.osvald@sartura.hr>
* ubusd: don't check ACL when object is NULLDenis Osvald2016-08-251-1/+1
| | | | | | | | | | | 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>
* ubusd: fix a memory leak on user/group client infoFelix Fietkau2016-01-261-0/+7
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* ubusd: add missing NULL pointer checks for ACL processingFelix Fietkau2016-01-131-0/+6
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* ubusd: allow all object access if uid=0 (ignore gid)Felix Fietkau2015-12-091-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* ubusd: simplify/fix avl loop in ubusd_reply_add()Felix Fietkau2015-12-091-15/+17
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* ubusd: simplify/fix avl loop in ubusd_acl_check()Felix Fietkau2015-12-091-5/+2
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* ubusd: make ACL path configurable on the command lineFelix Fietkau2015-12-091-1/+5
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* ubusd: remove a faulty and redundant checkFelix Fietkau2015-12-091-3/+0
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* fix off-by-one in acl match iterationJohn Crispin2015-09-221-1/+1
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* unbreak acl allocationJohn Crispin2015-09-221-1/+1
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* fix a copy & paste bugJohn Crispin2015-07-011-1/+1
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* ubusd: fix build on non-linux systems without peercred supportFelix Fietkau2015-06-241-1/+14
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* add acl codeJohn Crispin2015-06-181-0/+469
Signed-off-by: John Crispin <blogic@openwrt.org>