summaryrefslogtreecommitdiff
path: root/source4/dsdb/repl/replicated_objects.c
AgeCommit message (Collapse)AuthorFilesLines
2023-08-08s4:dsdb: Add missing newlines to logging messagesJoseph Sutton1-6/+6
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2022-10-21s4-join: Fix typos in recent GET_ANC patch setJoseph Sutton1-2/+2
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2022-10-04s4-libnet: Add messages to object count mismatch failuresAndrew Bartlett1-0/+11
This helps explain these better than WERR_GEN_FAILURE. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15189 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2020-08-17Fix a comment typo copied aroundVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-02-27s4:dsdb: Remove unused header fileAndreas Schneider1-1/+0
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2018-12-17drepl: schema repl race condition fixAaron Haslett1-2/+33
Adds final schema consistency check before committing changes. Aborts if corruption found. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12889 Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-08-22dsdb: Fix a typoVolker Lendecke1-2/+3
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2018-05-30dsdb: Add log when ignoring a replicated object outside of partitionTim Beale1-0/+6
This is probably a note-worthy event for debugging purposes. (Found while developing the domain rename functionality) Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Wed May 30 07:03:51 CEST 2018 on sn-devel-144
2018-05-30s4-repl: Try to give more information in the error codes for prepare_commit ↵Andrew Bartlett1-2/+3
failure. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2018-04-12dsdb: Ensure to cancel the transaction if we fail to save the prefixMapAndrew Bartlett1-0/+1
This rare error case forgot to call ldb_transaction_cancel() Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2017-11-24schema: Make writing indices flag an enum for a new stateGarming Sam1-7/+7
In schema_load_init, we find that the writing of indices is not locked in any way. This leads to race conditions. To resolve this, we need to have a new state (SCHEMA_COMPARE) which can report to the caller that we need to open a transaction to write the indices. Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-09-07debug: Add new debug class "drs_repl" for DRS replication processingAndrew Bartlett1-0/+3
This is used in the client and in the server Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2017-08-18drs: Check target object is known after applying objectsTim Beale1-4/+7
Currently we only check that the target object is known at the end of the transaction (i.e. the .prepare_commit hook). It's too late at this point to resend the request with GET_TGT. Move this processing earlier on, after we've applied all the objects (i.e. off the .extended hook). In reality, we need to perform the checks at both points. I've split the common code that gets the source/target details out of the la_entry into a helper function. It's not the greatest function ever, but seemed to make more sense than duplicating the code. Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Garming Sam <garming@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> BUG: https://bugzilla.samba.org/show_bug.cgi?id=12972
2017-07-28repl: Remove old TODOTim Beale1-2/+0
This TODO was added in 2007 before we supported linked attributes. It's no longer relevant. Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-07-02dsdb: Improve debugging on start transacton failureAndrew Bartlett1-1/+2
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2016-09-28werror: replace WERR_NOMEM with WERR_NOT_ENOUGH_MEMORY in source4/dsdb/Günther Deschner1-7/+7
Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2016-08-25replicated_objects: Add missing newline for debugGarming Sam1-2/+2
Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-08-11s4:dsdb/repl: let dsdb_replicated_objects_convert() change remote to local ↵Stefan Metzmacher1-5/+57
attid for linked attributes We already do that for objects in dsdb_convert_object_ex(). We need to be consistent and do the same for linked attributes. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12128 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2016-08-11s4:dsdb/repl: set working_schema->resolving_in_progress during schema creationStefan Metzmacher1-0/+3
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12128 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2016-08-11s4:dsdb/repl: make sure the working_schema prefix map is populated with the ↵Stefan Metzmacher1-0/+35
remote prefix map We should create the working_schema prefix map before we try to resolve the schema. This allows getting the same mapping (if there's not already a conflict) and allows us to remove the implicit prefix mapping creation in the prefix mapping lookup functions. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12128 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2016-08-11s4:dsdb/repl: Improve memory handling in replicated schema codeAndrew Bartlett1-4/+10
This attempts to make it clear what memory is short term and what memory is long term BUG: https://bugzilla.samba.org/show_bug.cgi?id=12115 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2016-07-23s4:dsdb/replicated_objects: don't skip notifications on resolved conflictsStefan Metzmacher1-4/+16
We should propagate resolved conflicts immediately. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Sat Jul 23 03:18:58 CEST 2016 on sn-devel-144
2016-07-19repl: Remove check for parentGUID being NULL in dsdb_convert_object_ex()Andrew Bartlett1-5/+0
We find that Windows 2012R2 sends a NULL parent_guid here, probably when no change to name is replicated. That is, if there has not been a rename, this is not required information, as we can just merge with the existing object, not matter where it is Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2016-07-13dsdb: Fix CID 1363810: Null pointer dereferencesVolker Lendecke1-3/+6
The if-condition explicitly tests for new_schema==NULL, so this seems to be a valid error case. The DEBUG statement would segfault in this case. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ira Cooper <ira@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Wed Jul 13 06:34:33 CEST 2016 on sn-devel-144
2016-07-06dsdb: Remove 120 second delay and USN from schema refresh checkAndrew Bartlett1-69/+11
We now refresh it once the schema changes, so that replication can proceed right away. We use the sequence number in the metadata.tdb. The previous commit added a cache for this value, protected by tdb_seqnum(). metadata.tdb is now opened at startup to provide this support. Note that while still supported, schemaUpdateNow is essentially rudundent: instead, to ensure we increment the sequence number correctly, we unify that check into repl_meta_data at the transaction close. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-06-07dsdb: Fix rename and RDN handling for replPropertyMetaDataAndrew Bartlett1-64/+22
This matches Windows 2012R2, which both has the RDN not sorted last and has it updated with the local invocation_id and a local version. The RDN attribute, unlike name, is not replicated over DRS, so the impact for interopability extends only to the incorrect RDN values that we were finding with dbcheck (values that did not match the name values). Finally, we always force the RDN to match the name attribute, which avoids issues in dbcheck where these diverge. As such, we can finally remove dbcheck as a flapping test, last re-added in e4bab3a8282d263eb2391bc7e8a6fd64ae068935 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-06-06repl: Do not report all replication failures at level 0Andrew Bartlett1-2/+7
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-06-06dsdb: Clearly fail to replicate objects not NC_HEAD with a all-zero parentGUIDAndrew Bartlett1-0/+5
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-06-06repl: Enforce that we have parent objects for all replicated objectsAndrew Bartlett1-15/+10
The creating of replicated objects without their parent object allows database corruption as they can end up under the wrong object. We need to re-try the replication with the DRSUAPI_DRS_GET_ANC flag set to get the objects in tree order. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-06-06repl: Retry replication of the schema on WERR_DS_DRA_SCHEMA_MISMATCHAndrew Bartlett1-1/+1
This makes us replicate the schema, and then go back to what we asked to replicate originally, when the schema changes. This should make the replication much more robust after schema changes Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-06-06repl: Pass in the full partition DN to dsdb_replicated_objects_convert()Andrew Bartlett1-6/+2
When we were processing an EXOP, we would pass in a DN specific to that operation, but this stopped repl_meta_data from finding the parent object Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-06-02dsdb: Improve syntax clarityAndrew Bartlett1-1/+2
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-03-13dsdb/repl: Ensure we use the LOCAL attid value, not the remote oneAndrew Bartlett1-4/+14
The key here is that while this never was an issue for builtin schema, nor for objects with an msDS-IntID used outside the schema partition, additional attributes added and used in the schema partition were incorrectly using the wrong attributeID value in the replPropertyMetaData. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11783 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Sun Mar 13 23:29:14 CET 2016 on sn-devel-144
2016-02-06dlist: remove unneeded type argument from DLIST_ADD_END()Michael Adam1-1/+1
Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2015-12-24repl: Skip new subdomains and partitions when replicatingAndrew Bartlett1-6/+43
These will need to be handled later, but probably via reading the cross-ref objects. This avoids total failure when cloning a DC that has subdomains. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2015-10-26repl: Give an error if we get a secret when not expecting oneAndrew Bartlett1-3/+20
We should never get a secret from a server when we specify DRSUAPI_DRS_SPECIAL_SECRET_PROCESSING This asserts that this is the case. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2015-09-08dsdb: Fix a confusing parameterVolker Lendecke1-1/+1
LDB_SCOPE_BASE is 0, so this works, but the corresponding parameter is "struct ldb_control **controls", so I'd say NULL is more appropriate here. Fixes a warning I just saw pass by. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2014-03-27dsdb: Do not update notify_uSN until the transaction is genuinely committed ↵Andrew Bartlett1-7/+7
to the DB Signed-off-by: Andrew Bartlett <abartlet@samba.org> Change-Id: I734bc75ed348de8f0a5ff92e18e08de2340b8951 Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-09-22dsdb: Refuse to replicate an all-zero invocationID GUID in replPropertyMetaDataAndrew Bartlett1-0/+9
This matches Windows 2008R2. Andrew Bartlett Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2013-06-11dsdb: use the correct talloc parent in dsdb_repl_merge_working_schema()Stefan Metzmacher1-2/+2
schema->{classes,attributes} are the DLIST pointer not an array. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-05-23dsdb-repl: merge the logic from libnet_vampire_cb_apply_schema()Stefan Metzmacher1-6/+113
This way libnet_vampire_cb_apply_schema() is able to use dsdb_repl_resolve_working_schema(). Pair-Programmed-With: Matthieu Patou <mat@matws.net> Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-05-23dsdb-repl: split out dsdb_repl_resolve_working_schemaStefan Metzmacher1-53/+94
This can be reused later in other places. Pair-Programmed-With: Matthieu Patou <mat@matws.net> Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-05-23dsdb-drs: when replicating schema object checks ask for removal of previous ↵Matthieu Patou1-3/+4
version if exists (bug #8680) Signed-off-by: Matthieu Patou <mat@matws.net> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-05-16dsdb-repl: Allow the name attribute (and name-based schema lookups) to be ↵Andrew Bartlett1-12/+19
skipped in dsdb_repl_make_working_schema() This allows us to use a schema that may only be valid for attributeID based lookups, during the schema load. Andrew Bartlett Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-08dsdb-repl: make message more clearerMatthieu Patou1-2/+2
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2012-08-14s4:dsdb/repl: ldb_errstring() takes a 'struct ldb_context' not 'int'Stefan Metzmacher1-1/+2
metze Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Tue Aug 14 13:58:31 CEST 2012 on sn-devel-104
2012-08-14s4:dsdb/repl: make sure instanceType_e is not changed by a reallocationStefan Metzmacher1-1/+11
Pair-Programmed-With: Björn Baumbach <bb@sernet.de> metze
2012-08-14s4:dsdb/repl: avoid reallocation of msg->elementsStefan Metzmacher1-1/+1
The index into the elements needs to match between msg->elements and md->ctr.ctr1.array, which means we should pre-allocate them with the same size. Pair-Programmed-With: Björn Baumbach <bb@sernet.de> metze
2012-08-11s4-dsdb: Take more care in handling of global schema memoryAndrew Bartlett1-27/+61
This reworks dsdb_replicated_objects_commit() to have a proper local tmp_ctx and to be more careful about what schema is set (only setting a global schema if the original schema was global). In particular, the new working_schema is not given a talloc reference to the old schema. This ensures that the old schema can go away when no longer used. Andrew Bartlett Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Sat Aug 11 10:31:57 CEST 2012 on sn-devel-104
2012-08-03s4:dsdb:replicated_objects: do not move 'instanceType' to the end of ↵Stefan Metzmacher1-1/+22
msg->elements on RODC replication It's very important that the order of msg->elements and md->ctr.ctr1.array is the same. metze