From: Andrew Bartlett Date: Fri, 26 Aug 2016 03:54:35 +0000 (+1200) Subject: dsdb: Allow missing a mandatory attribute from a dbcheck fix X-Git-Tag: samba-4.3.12~57 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ee8b79af7cebfc4b5a6ec4a87aeade7c1e6763d;p=thirdparty%2Fsamba.git dsdb: Allow missing a mandatory attribute from a dbcheck fix dbcheck of the rid pool (CN=RID Set) for another server will otherwise fail because rIDNextRid is not replicated, and so it not present BUG: https://bugzilla.samba.org/show_bug.cgi?id=12178 Signed-off-by: Andrew Bartlett Reviewed-by: Stefan Metzmacher (cherry picked from commit 9d0c869e36ba2f43fd2ed4cd090b48102d499bc8) --- diff --git a/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c b/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c index 316dcf8c14b..5ac0ce5a6a9 100644 --- a/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c +++ b/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c @@ -419,8 +419,15 @@ static int attr_handler2(struct oc_context *ac) } } + /* + * We skip this check under dbcheck to allow fixing of other + * attributes even if an attribute is missing. This matters + * for CN=RID Set as the required attribute rIDNextRid is not + * replicated. + */ if (found_must_contain[0] != NULL && - ldb_msg_check_string_attribute(msg, "isDeleted", "TRUE") == 0) { + 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));