File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -571,12 +571,13 @@ def search(args = nil)
571571 result_pdu || OpenStruct . new ( :status => :failure , :result_code => Net ::LDAP ::ResultCodeOperationsError , :message => "Invalid search" )
572572 end # instrument
573573 ensure
574+
574575 # clean up message queue for this search
575576 messages = message_queue . delete ( message_id )
576577
577578 # in the exceptional case some messages were *not* consumed from the queue,
578579 # instrument the event but do not fail.
579- unless messages . empty?
580+ unless messages . nil? or messages . empty?
580581 instrument "search_messages_unread.net_ldap_connection" ,
581582 message_id : message_id , messages : messages
582583 end
Original file line number Diff line number Diff line change @@ -644,10 +644,18 @@ def match(entry)
644644 end
645645
646646 ##
647- # Converts escaped characters (e.g., "\\28") to unescaped characters
647+ # If the argument is a string, converts escaped characters (e.g., "\\28") to unescaped characters.
648+ # If the argument is a number, just return as-is.
649+ # Otherwise, an exception is thrown and the rhs argument is rejected.
648650 # ("(").
649651 def unescape ( right )
650- right . gsub ( /\\ ([a-fA-F\d ]{2})/ ) { [ $1. hex ] . pack ( "U" ) }
652+ if defined? right . gsub
653+ right . gsub ( /\\ ([a-fA-F\d ]{2})/ ) { [ $1. hex ] . pack ( "U" ) }
654+ elsif right . is_a? Fixnum
655+ right . to_s
656+ else
657+ raise ArgumentError , "Did not know how to convert argument \" #{ right } \" into the rhs of an LDAP filter"
658+ end
651659 end
652660 private :unescape
653661
You can’t perform that action at this time.
0 commit comments