@@ -334,8 +334,9 @@ class LdapError < StandardError; end
334334 68 => "Entry Already Exists"
335335 }
336336
337- module LdapControls
338- PagedResults = "1.2.840.113556.1.4.319" # Microsoft evil from RFC 2696
337+ module LDAPControls
338+ PAGED_RESULTS = "1.2.840.113556.1.4.319" # Microsoft evil from RFC 2696
339+ DELETE_TREE = "1.2.840.113556.1.4.805"
339340 end
340341
341342 def self . result2string ( code ) #:nodoc:
@@ -552,7 +553,7 @@ def open
552553 # anything with the bind results. We then pass self to the caller's
553554 # block, where he will execute his LDAP operations. Of course they will
554555 # all generate auth failures if the bind was unsuccessful.
555- raise Net :: LDAP :: LdapError , "Open already in progress" if @open_connection
556+ raise LdapError , "Open already in progress" if @open_connection
556557
557558 begin
558559 @open_connection = Net ::LDAP ::Connection . new ( :host => @host ,
@@ -1033,7 +1034,7 @@ def delete(args)
10331034 # dn = "mail=deleteme@example.com, ou=people, dc=example, dc=com"
10341035 # ldap.delete_tree :dn => dn
10351036 def delete_tree ( args )
1036- delete ( args . merge ( :control_codes => [ [ '1.2.840.113556.1.4.805' , true ] ] ) )
1037+ delete ( args . merge ( :control_codes => [ [ LDAPControls :: DELETE_TREE , true ] ] ) )
10371038 end
10381039 # This method is experimental and subject to change. Return the rootDSE
10391040 # record from the LDAP server as a Net::LDAP::Entry, or an empty Entry if
@@ -1105,7 +1106,7 @@ def search_subschema_entry
11051106 #++
11061107 def paged_searches_supported?
11071108 @server_caps ||= search_root_dse
1108- @server_caps [ :supportedcontrol ] . include? ( Net :: LDAP :: LdapControls :: PagedResults )
1109+ @server_caps [ :supportedcontrol ] . include? ( LDAPControls :: PAGED_RESULTS )
11091110 end
11101111end # class LDAP
11111112
@@ -1402,7 +1403,7 @@ def search(args = {})
14021403 controls = [ ]
14031404 controls <<
14041405 [
1405- Net :: LDAP :: LdapControls :: PagedResults . to_ber ,
1406+ LDAPControls :: PAGED_RESULTS . to_ber ,
14061407 # Criticality MUST be false to interoperate with normal LDAPs.
14071408 false . to_ber ,
14081409 rfc2696_cookie . map { |v | v . to_ber } . to_ber_sequence . to_s . to_ber
@@ -1450,7 +1451,7 @@ def search(args = {})
14501451 more_pages = false
14511452 if result_code == 0 and controls
14521453 controls . each do |c |
1453- if c . oid == Net :: LDAP :: LdapControls :: PagedResults
1454+ if c . oid == LDAPControls :: PAGED_RESULTS
14541455 # just in case some bogus server sends us more than 1 of these.
14551456 more_pages = false
14561457 if c . value and c . value . length > 0
0 commit comments