ubusd: don't check ACL when object is NULL
[project/ubus.git] / ubusd_acl.c
index 15a58d8..2700c86 100644 (file)
@@ -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);
@@ -174,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)
 {