Skip to content

Commit

Permalink
LDAP DN compare should not be case sensitive
Browse files Browse the repository at this point in the history
According to the LDAP protocol request for comments (RFCs),
RDNs should be compared case-insensitively.

At the moment ou=Groups != ou=groups. This patch addresses
the case sensitivity in the RDNs.
  • Loading branch information
zerodayz committed Jan 30, 2021
1 parent c9551dc commit 977775c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dn.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,9 @@ func (r *RelativeDN) hasAllAttributes(attrs []*AttributeTypeAndValue) bool {
func (a *AttributeTypeAndValue) Equal(other *AttributeTypeAndValue) bool {
return strings.EqualFold(a.Type, other.Type) && a.Value == other.Value
}

// EqualFold returns true if the AttributeTypeAndValue is equivalent to the specified AttributeTypeAndValue
// Case of the attribute type and value is not significant
func (a *AttributeTypeAndValue) EqualFold(other *AttributeTypeAndValue) bool {
return strings.EqualFold(a.Type, other.Type) && strings.EqualFold(a.Type, other.Type)
}

0 comments on commit 977775c

Please sign in to comment.