ubus: use network order in ubus message header fields
[project/ubus.git] / ubusd_acl.c
index eb5cec5..85ada5d 100644 (file)
@@ -105,6 +105,9 @@ ubusd_acl_check(struct ubus_client *cl, const char *obj,
                return 0;
 
        acl = avl_find_ge_element(&ubusd_acls, obj, acl, avl);
+       if (!acl)
+               return -1;
+
        avl_for_element_to_last(&ubusd_acls, acl, acl, avl) {
                int diff = ubusd_acl_match_path(obj, acl->avl.key, NULL);
 
@@ -171,6 +174,13 @@ ubusd_acl_init_client(struct ubus_client *cl, int fd)
        return 0;
 }
 
+void
+ubusd_acl_free_client(struct ubus_client *cl)
+{
+       free(cl->group);
+       free(cl->user);
+}
+
 static void
 ubusd_acl_file_free(struct ubusd_acl_file *file)
 {
@@ -415,6 +425,9 @@ ubusd_reply_add(struct ubus_object *obj)
                return;
 
        acl = avl_find_ge_element(&ubusd_acls, obj->path.key, acl, avl);
+       if (!acl)
+               return;
+
        avl_for_element_to_last(&ubusd_acls, acl, acl, avl) {
                void *c;