s4:acl LDB module - adaption for "objectclass_attrs" module
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Sat, 5 Jun 2010 18:19:31 +0000 (20:19 +0200)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Mon, 7 Jun 2010 12:47:24 +0000 (14:47 +0200)
Since the attribute schema checking code moved back we need to give here the
"LDB_ERR_NO_SUCH_ATTRIBUTE" error.

source4/dsdb/samdb/ldb_modules/acl.c

index 1b84e8a02f2b7a2dd1318cb034b348abe3faf89f..46644daeb3244aef7c219cb001c5e7990605f034 100644 (file)
@@ -736,15 +736,25 @@ static int acl_modify(struct ldb_module *module, struct ldb_request *req)
                        attr = dsdb_attribute_by_lDAPDisplayName(schema,
                                                                 req->op.mod.message->elements[i].name);
                }
+
+               /* This basic attribute existence check with the right errorcode
+                * is needed since this module is the first one which requests
+                * schema attribute informations.
+                * The complete attribute checking is done in the
+                * "objectclass_attrs" module behind this one.
+                */
+               if (!attr) {
+                       ldb_asprintf_errstring(ldb, "acl_modify: attribute '%s' on entry '%s' was not found in the schema!",
+                                              req->op.mod.message->elements[i].name,
+                                              ldb_dn_get_linearized(req->op.mod.message->dn));
+                       talloc_free(tmp_ctx);
+                       return LDB_ERR_NO_SUCH_ATTRIBUTE;
+               }
+
                if (strcmp("nTSecurityDescriptor", req->op.mod.message->elements[i].name) == 0) {
                        modify_sd = true;
                } else {
 
-                       if (!attr) {
-                               DEBUG(10, ("acl_modify: cannot find attribute %s\n",
-                                          req->op.mod.message->elements[i].name));
-                               goto fail;
-                       }
                        if (!insert_in_object_tree(tmp_ctx,
                                                   &attr->attributeSecurityGUID, SEC_ADS_WRITE_PROP,
                                                   &new_node, &new_node)) {