Skip to content
Browse files

Do not add controls when it is empty. Fixed #17

Some LDAP servers, such as ApacheDS, consider as invalid protocol, if controls
is an empty array.
  • Loading branch information...
1 parent 7dd6c3a commit f102f50d9c2bf9b635a94240949f53a4d928a12a @doitian doitian committed
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/net/ldap.rb
View
4 lib/net/ldap.rb
@@ -1389,9 +1389,9 @@ def search(args = {})
false.to_ber,
rfc2696_cookie.map{ |v| v.to_ber}.to_ber_sequence.to_s.to_ber
].to_ber_sequence if paged_searches_supported
- controls = controls.to_ber_contextspecific(0)
+ controls = controls.empty? ? nil : controls.to_ber_contextspecific(0)
- pkt = [next_msgid.to_ber, request, controls].to_ber_sequence
+ pkt = [next_msgid.to_ber, request, controls].compact.to_ber_sequence
@conn.write pkt
result_code = 0

0 comments on commit f102f50

Please sign in to comment.
Something went wrong with that request. Please try again.