Skip to content

Commit 756529b

Browse files
author
Jamstah
committed
Only add the paging control if the server supports it. This is partly to work around a bug where a server will not allow all users to page, and will return insufficient access instead of ignoring the control.
1 parent 74e994e commit 756529b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/net/ldap.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,14 +1386,15 @@ def search(args = {})
13861386
search_attributes.to_ber_sequence
13871387
].to_ber_appsequence(3)
13881388

1389-
controls = [
1389+
controls = []
1390+
controls <<
13901391
[
13911392
Net::LDAP::LdapControls::PagedResults.to_ber,
13921393
# Criticality MUST be false to interoperate with normal LDAPs.
13931394
false.to_ber,
13941395
rfc2696_cookie.map{ |v| v.to_ber}.to_ber_sequence.to_s.to_ber
1395-
].to_ber_sequence
1396-
].to_ber_contextspecific(0)
1396+
].to_ber_sequence if paged_searches_supported
1397+
controls = controls.to_ber_contextspecific(0)
13971398

13981399
pkt = [next_msgid.to_ber, request, controls].to_ber_sequence
13991400
@conn.write pkt

0 commit comments

Comments
 (0)