ldap3
ldap3 copied to clipboard
Add a way to send an empty AttributeSelection in SearchRequest to request all attributes
- If you call
search(..., attributes=None)
orsearch(..., attributes=[])
, ldap3 sendsattributes=AttributeSelection: 1.1
- If you call
search(..., attributes=ALL_ATTRIBUTES)
, ldap3 sendsattributes=AttributeSelection: *
- If you call
search(..., attributes=ALL_OPERATIONAL_ATTRIBUTES)
, ldap3 sendsattributes=AttributeSelection: +
I'm trying to use ldap3 with a tiny ldap server (https://github.com/dbaarda/LightLdapd) which does not understand *
or +
. But it gives all attributes when the AttributeSelection is empty. (implementation)
RFC 4511 #4.5.1.8 also suggests this is a valid thing you can do:
- An empty list with no attributes requests the return of all user attributes.
There should be a way to force ldap3 to really send an empty list, and not insert "1.1"
.
I'm using this dirty hack as a workaround: search(..., attributes=(x for x in []))
. This works because ldap3 allows GeneratorType in SEQUENCE_TYPES and it doesn't realize in if attributes:
that it's empty.
I know nothing about LDAP so I hope I didn't misunderstand anything. I don't know if this particular server is strictly speaking RFC compliant or not, but I'd still like ldap3 to have this ability.