dsbenghe / Novell.Directory.Ldap.NETStandard

.NET LDAP client library for .NET Standard >= 2.0, .NET Core >=1.0, NET5/NET6/NET7/NET8 - works with any LDAP protocol compatible directory server (including Microsoft Active Directory).
MIT License
555 stars 151 forks source link

LDAPConnection.Search doesn't get repeated attribute names #222

Closed 240026763 closed 1 year ago

240026763 commented 1 year ago

Our LDAP server has many 'memberOf' membership attributes and other attributes that repeat the same attribute name and this can be seen using LDAPAdmin or other means. Where I should be seeing ~135 attributes, this library is only pulling 91. It seems to be only grabbing the first attribute of each unique name. For example, where I have 31 'memberOf' roles, it only shows 1 'memberOf' attributes in the entity's AttributeSet.

I'm using version 3.6.0.

Mcheimech commented 1 year ago

You need to make sure you're retrieving all attributes by passing the array parameter attrs as below:

ldapConnection.Search(ContainerDN, LdapConnection.ScopeSub, EntryCN, new[] { LdapConnection.AllUserAttrs }, false);