objectclass_attrs: Only abort on a missing attribute when an attribute is both MUST...
authorClive Ferreira <cliveferreira@catalyst.net.nz>
Tue, 11 Oct 2016 02:32:54 +0000 (15:32 +1300)
committerGarming Sam <garming@samba.org>
Wed, 2 Nov 2016 00:28:44 +0000 (01:28 +0100)
If an attribute is not replicated or constructed, it is quite normal for
it to be missing. This is the case with both rIDNextRid and
rIDPreviousAllocationPool. This currently prevents us switching the RID
master. On Windows, missing this attribute does not cause any problems
for the RID manager.

We may now remove the knownfail entry added earlier.

Signed-off-by: Clive Ferreira <cliveferreira@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Pair-programmed-with: Garming Sam <garming@catalyst.net.nz>
Pair-programmed-with: Bob Campbell <bobcampbell@catalyst.net.nz>

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12394

Autobuild-User(master): Garming Sam <garming@samba.org>
Autobuild-Date(master): Wed Nov  2 01:28:44 CET 2016 on sn-devel-144

selftest/knownfail
source4/dsdb/samdb/ldb_modules/objectclass_attrs.c

index 8144faf9c6846d4f993c054ee9937b1928fb6748..38b5f51bb369bdf8545c462b83333a2cb3dd01db 100644 (file)
 ^samba4.rpc.echo.*on.*with.object.echo.sinkdata.*nt4_dc
 ^samba4.rpc.echo.*on.*with.object.echo.addone.*nt4_dc
 ^samba4.rpc.echo.*on.*ncacn_ip_tcp.*with.object.*nt4_dc
-^samba4.drs.getnc_exop.python.*getnc_exop.DrsReplicaSyncTestCase.test_edit_rid_master.*
index 616cff8348227ae980e446e9c5f49d712d4c19e8..e239fb946e7ac004e3bfe3ab380e445cdd7d29f9 100644 (file)
@@ -426,12 +426,23 @@ static int attr_handler2(struct oc_context *ac)
         * replicated.
         */
        if (found_must_contain[0] != NULL &&
-           ldb_msg_check_string_attribute(msg, "isDeleted", "TRUE") == 0 &&
-           ldb_request_get_control(ac->req, DSDB_CONTROL_DBCHECK) == NULL) {
-               ldb_asprintf_errstring(ldb, "objectclass_attrs: at least one mandatory attribute ('%s') on entry '%s' wasn't specified!",
-                                      found_must_contain[0],
-                                      ldb_dn_get_linearized(msg->dn));
-               return LDB_ERR_OBJECT_CLASS_VIOLATION;
+           ldb_msg_check_string_attribute(msg, "isDeleted", "TRUE") == 0) {
+
+               for (i = 0; found_must_contain[i] != NULL; i++) {
+                       const struct dsdb_attribute *broken_attr = dsdb_attribute_by_lDAPDisplayName(ac->schema,
+                                                                                                    found_must_contain[i]);
+
+                       bool replicated = (broken_attr->systemFlags &
+                                          (DS_FLAG_ATTR_NOT_REPLICATED | DS_FLAG_ATTR_IS_CONSTRUCTED)) == 0;
+
+                       if (replicated) {
+                               ldb_asprintf_errstring(ldb, "objectclass_attrs: at least one mandatory "
+                                                      "attribute ('%s') on entry '%s' wasn't specified!",
+                                                      found_must_contain[i],
+                                                      ldb_dn_get_linearized(msg->dn));
+                               return LDB_ERR_OBJECT_CLASS_VIOLATION;
+                       }
+               }
        }
 
        if (isSchemaAttr) {