dsdb-acl: attr is not optional to acl_check_access_on_attribute()
[amitay/samba.git] / source4 / dsdb / samdb / ldb_modules / acl_util.c
index fc6a55a2de1c6d0d01e9fe7dfb369588bab66148..13d6098a2135f8c65b004bdc9f7e5d8841b08308 100644 (file)
@@ -105,34 +105,33 @@ int acl_check_access_on_attribute(struct ldb_module *module,
        struct object_tree *new_node = NULL;
        TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
        struct security_token *token = acl_user_token(module);
-       if (attr) {
-               if (!GUID_all_zero(&attr->attributeSecurityGUID)) {
-                       if (!insert_in_object_tree(tmp_ctx,
-                                                  &attr->attributeSecurityGUID,
-                                                  access_mask, &root,
-                                                  &new_node)) {
-                               DEBUG(10, ("acl_search: cannot add to object tree securityGUID\n"));
-                               goto fail;
-                       }
-
-                       if (!insert_in_object_tree(tmp_ctx,
-                                                  &attr->schemaIDGUID,
-                                                  access_mask, &new_node,
-                                                  &new_node)) {
-                               DEBUG(10, ("acl_search: cannot add to object tree attributeGUID\n"));
-                               goto fail;
-                       }
+
+       if (!GUID_all_zero(&attr->attributeSecurityGUID)) {
+               if (!insert_in_object_tree(tmp_ctx,
+                                          &attr->attributeSecurityGUID,
+                                          access_mask, &root,
+                                          &new_node)) {
+                       DEBUG(10, ("acl_search: cannot add to object tree securityGUID\n"));
+                       goto fail;
+               }
+
+               if (!insert_in_object_tree(tmp_ctx,
+                                          &attr->schemaIDGUID,
+                                          access_mask, &new_node,
+                                          &new_node)) {
+                       DEBUG(10, ("acl_search: cannot add to object tree attributeGUID\n"));
+                       goto fail;
                }
-               else {
-                       if (!insert_in_object_tree(tmp_ctx,
-                                                  &attr->schemaIDGUID,
-                                                  access_mask, &root,
-                                                  &new_node)) {
-                               DEBUG(10, ("acl_search: cannot add to object tree attributeGUID\n"));
-                               goto fail;
-                       }
+       } else {
+               if (!insert_in_object_tree(tmp_ctx,
+                                          &attr->schemaIDGUID,
+                                          access_mask, &root,
+                                          &new_node)) {
+                       DEBUG(10, ("acl_search: cannot add to object tree attributeGUID\n"));
+                       goto fail;
                }
        }
+
        status = sec_access_check_ds(sd, token,
                                     access_mask,
                                     &access_granted,