[OpenWrt-Devel] [PATCH ubus 1/3] ubusd: don't check ACL when object is NULL

Denis Osvald denis.osvald at sartura.hr
Thu Aug 25 07:54:52 EDT 2016


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 at sartura.hr>
---
 ubusd_acl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ubusd_acl.c b/ubusd_acl.c
index 85ada5d..2700c86 100644
--- a/ubusd_acl.c
+++ b/ubusd_acl.c
@@ -101,7 +101,7 @@ ubusd_acl_check(struct ubus_client *cl, const char *obj,
 	struct blob_attr *cur;
 	int rem;
 
-	if (!cl->uid)
+	if (!cl->uid || !obj)
 		return 0;
 
 	acl = avl_find_ge_element(&ubusd_acls, obj, acl, avl);
-- 
2.9.3
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list