@@ -251,6 +251,12 @@ class LdapError < StandardError; end
251
251
SearchScopes = [ SearchScope_BaseObject , SearchScope_SingleLevel ,
252
252
SearchScope_WholeSubtree ]
253
253
254
+ DerefAliases_Never = 0
255
+ DerefAliases_Search = 1
256
+ DerefAliases_Find = 2
257
+ DerefAliases_Always = 3
258
+ DerefAliasesArray = [ DerefAliases_Never , DerefAliases_Search , DerefAliases_Find , DerefAliases_Always ]
259
+
254
260
primitive = { 2 => :null } # UnbindRequest body
255
261
constructed = {
256
262
0 => :array , # BindRequest
@@ -995,7 +1001,7 @@ def rename(args)
995
1001
begin
996
1002
conn = Connection . new ( :host => @host , :port => @port ,
997
1003
:encryption => @encryption )
998
- if ( @result = conn . bind ( args [ :auth ] || @auth ) ) . result_code == 0
1004
+ if ( @result = conn . bind ( args [ :auth ] || @auth ) ) . result_code == 0
999
1005
@result = conn . rename ( args )
1000
1006
end
1001
1007
ensure
@@ -1396,7 +1402,11 @@ def search(args = {})
1396
1402
scope = args [ :scope ] || Net ::LDAP ::SearchScope_WholeSubtree
1397
1403
raise Net ::LDAP ::LdapError , "invalid search scope" unless Net ::LDAP ::SearchScopes . include? ( scope )
1398
1404
1399
- sort_control = encode_sort_controls ( args . fetch ( :sort_controls ) { false } )
1405
+ deref = args [ :deref ] || Net ::LDAP ::DerefAliases_Never
1406
+ raise LdapError . new ( "invalid alias dereferencing value" ) unless Net ::LDAP ::DerefAliasesArray . include? ( deref )
1407
+
1408
+ sort_control = encode_sort_controls ( args . fetch ( :sort_controls ) { false } )
1409
+
1400
1410
# An interesting value for the size limit would be close to A/D's
1401
1411
# built-in page limit of 1000 records, but openLDAP newer than version
1402
1412
# 2.2.0 chokes on anything bigger than 126. You get a silent error that
@@ -1436,7 +1446,7 @@ def search(args = {})
1436
1446
request = [
1437
1447
search_base . to_ber ,
1438
1448
scope . to_ber_enumerated ,
1439
- 0 . to_ber_enumerated ,
1449
+ deref . to_ber_enumerated ,
1440
1450
query_limit . to_ber , # size limit
1441
1451
0 . to_ber ,
1442
1452
attributes_only . to_ber ,
0 commit comments