The Samba-Bugzilla – Attachment 12419 Details for
Bug 12178
samba-tool dbcheck fails to fix replPropertyMetaData
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Patches for v4-3-test
tmp43.diff.txt (text/plain), 5.59 KB, created by
Stefan Metzmacher
on 2016-08-30 07:27:10 UTC
(
hide
)
Description:
Patches for v4-3-test
Filename:
MIME Type:
Creator:
Stefan Metzmacher
Created:
2016-08-30 07:27:10 UTC
Size:
5.59 KB
patch
obsolete
>From 551c24d9880c26866c9ece4df7c5b1d09a96f891 Mon Sep 17 00:00:00 2001 >From: Andrew Bartlett <abartlet@samba.org> >Date: Fri, 26 Aug 2016 15:54:35 +1200 >Subject: [PATCH 1/2] 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 <abartlet@samba.org> >Reviewed-by: Stefan Metzmacher <metze@samba.org> >(cherry picked from commit 9d0c869e36ba2f43fd2ed4cd090b48102d499bc8) >--- > source4/dsdb/samdb/ldb_modules/objectclass_attrs.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > >diff --git a/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c b/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c >index 316dcf8..5ac0ce5 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)); >-- >1.9.1 > > >From 2be24d15f3f4e374177e67fdaf86215d3a889989 Mon Sep 17 00:00:00 2001 >From: Andrew Bartlett <abartlet@samba.org> >Date: Fri, 26 Aug 2016 15:53:19 +1200 >Subject: [PATCH 2/2] dbcheck: Abandon dbcheck if we get an error during a > transaction > >Otherwise, anything that the transaction has already done to the DB will be left in the DB >even despite the failure. For example, if a fix wrote to the DB, but then failed a post-write >check, then the fix will not be unrolled. > >This is because we do not have nested transactions in TDB. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=12178 > >Signed-off-by: Andrew Bartlett <abartlet@samba.org> >Reviewed-by: Stefan Metzmacher <metze@samba.org> > >Autobuild-User(master): Stefan Metzmacher <metze@samba.org> >Autobuild-Date(master): Mon Aug 29 12:46:21 CEST 2016 on sn-devel-144 > >(cherry picked from commit db32a0e5ea8f652857e45480cc31ecb1ef884c1a) >--- > python/samba/dbchecker.py | 7 +++++++ > testprogs/blackbox/dbcheck-oldrelease.sh | 10 ++++++++++ > 2 files changed, 17 insertions(+) > >diff --git a/python/samba/dbchecker.py b/python/samba/dbchecker.py >index 69b4c61..295033f 100644 >--- a/python/samba/dbchecker.py >+++ b/python/samba/dbchecker.py >@@ -31,6 +31,7 @@ from samba.common import dsdb_Dn > from samba.dcerpc import security > from samba.descriptor import get_wellknown_sds, get_diff_sds > from samba.auth import system_session, admin_session >+from samba.netcmd import CommandError > > > class dbcheck(object): >@@ -192,6 +193,8 @@ class dbcheck(object): > controls = controls + ["local_oid:%s:0" % dsdb.DSDB_CONTROL_DBCHECK] > self.samdb.delete(dn, controls=controls) > except Exception, err: >+ if self.in_transaction: >+ raise CommandError("%s : %s" % (msg, err)) > self.report("%s : %s" % (msg, err)) > return False > return True >@@ -204,6 +207,8 @@ class dbcheck(object): > controls = controls + ["local_oid:%s:0" % dsdb.DSDB_CONTROL_DBCHECK] > self.samdb.modify(m, controls=controls, validate=validate) > except Exception, err: >+ if self.in_transaction: >+ raise CommandError("%s : %s" % (msg, err)) > self.report("%s : %s" % (msg, err)) > return False > return True >@@ -221,6 +226,8 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base))) > controls = controls + ["local_oid:%s:0" % dsdb.DSDB_CONTROL_DBCHECK] > self.samdb.rename(from_dn, to_dn, controls=controls) > except Exception, err: >+ if self.in_transaction: >+ raise CommandError("%s : %s" % (msg, err)) > self.report("%s : %s" % (msg, err)) > return False > return True >diff --git a/testprogs/blackbox/dbcheck-oldrelease.sh b/testprogs/blackbox/dbcheck-oldrelease.sh >index 22942dd..1927fac7 100755 >--- a/testprogs/blackbox/dbcheck-oldrelease.sh >+++ b/testprogs/blackbox/dbcheck-oldrelease.sh >@@ -154,6 +154,15 @@ check_expected_before_values() { > } > > # This should 'fail', because it returns the number of modified records >+dbcheck_objectclass() { >+ if [ x$RELEASE = x"release-4-1-6-partial-object" ]; then >+ $PYTHON $BINDIR/samba-tool dbcheck --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb --attrs=objectclass $@ >+ else >+ return 1 >+ fi >+} >+ >+# This should 'fail', because it returns the number of modified records > dbcheck() { > $PYTHON $BINDIR/samba-tool dbcheck --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@ > } >@@ -229,6 +238,7 @@ if [ -d $release_dir ]; then > testit $RELEASE undump > testit "reindex" reindex > testit "check_expected_before_values" check_expected_before_values >+ testit_expect_failure "dbcheck_objectclass" dbcheck_objectclass > testit_expect_failure "dbcheck" dbcheck > testit "check_expected_after_values" check_expected_after_values > testit "dbcheck_clean" dbcheck_clean >-- >1.9.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
abartlet
:
review+
mmuehlfeld
:
review+
Actions:
View
Attachments on
bug 12178
:
12406
|
12407
|
12409
|
12417
|
12418
| 12419