Skip to content

Commit

Permalink
Merging over SIDs was way too generic, but maybe now it's just too st…
Browse files Browse the repository at this point in the history
…rict
  • Loading branch information
lkarlslund committed Nov 10, 2023
1 parent 570cef5 commit 5e1d140
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions modules/engine/processing.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,21 +147,23 @@ func Merge(aos []*Objects) (*Objects, error) {
usao.shard.Iterate(func(addobject *Object) bool {
pb.Add(1)
// Here we'll deduplicate DNs, because sometimes schema and config context slips in twice ...
aosid := addobject.SID()
if !aosid.IsBlank() && aosid.Component(2) == 21 {
// Always merge these, they might belong elsewhere
globalobjects.AddMerge(mergeon, addobject)
return true
}

// FIXME - THIS ISN'T WORKING
// aosid := addobject.SID()
// if !aosid.IsBlank() && aosid.Component(2) == 21 {
// // Always merge these, they might belong elsewhere
// globalobjects.AddMerge(mergeon, addobject)
// return true
// }

// Skip duplicate DNs entirely, just absorb them (solves the issue of duplicates due to shared configuration context etc)
if dn := addobject.OneAttr(DistinguishedName); dn != nil {
// UNLESS it's a predefined one with an objectSID, in that case done merge them at all WTF not a huge fan of this design, Microsoft
if !aosid.IsBlank() && aosid.Component(2) != 21 {
addobject.SetFlex(DistinguishedName, "mutated="+addobject.OneAttrString(DataSource)+","+dn.String())
} else if existing, exists := dnindex.Lookup(AttributeValueToIndex(dn)); exists {
if existing, exists := dnindex.Lookup(AttributeValueToIndex(dn)); exists {
existing.First().AbsorbEx(addobject, true)
return true
}
}

globalobjects.Add(addobject)
return true
})
Expand Down

0 comments on commit 5e1d140

Please sign in to comment.