Skip to content

Commit

Permalink
Added warnings while dumping AD for objects with no attributes and ob…
Browse files Browse the repository at this point in the history
…jects returning attributes but with no values set for one or more attributes
  • Loading branch information
lkarlslund committed Sep 13, 2022
1 parent 4888208 commit 31a52f9
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions modules/integrations/activedirectory/rawobject.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,17 @@ func (r *RawObject) ToObject(onlyKnownAttributes bool) *engine.Object {
return result
}

func (r *RawObject) IngestLDAP(source *ldap.Entry) error {
r.Init()
r.DistinguishedName = source.DN
func (item *RawObject) IngestLDAP(source *ldap.Entry) error {
item.Init()
item.DistinguishedName = source.DN
if len(source.Attributes) == 0 {
ui.Warn().Msgf("No attribute data for %v", source.DN)
}
for _, attr := range source.Attributes {
r.Attributes[attr.Name] = attr.Values
if len(attr.Values) == 0 && attr.Name != "member" {
ui.Warn().Msgf("Object %v attribute %v has no values", item.DistinguishedName, attr.Name)
}
item.Attributes[attr.Name] = attr.Values
}
return nil
}
Expand Down

0 comments on commit 31a52f9

Please sign in to comment.