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)
571
571
result_pdu || OpenStruct . new ( :status => :failure , :result_code => Net ::LDAP ::ResultCodeOperationsError , :message => "Invalid search" )
572
572
end # instrument
573
573
ensure
574
+
574
575
# clean up message queue for this search
575
576
messages = message_queue . delete ( message_id )
576
577
577
578
# in the exceptional case some messages were *not* consumed from the queue,
578
579
# instrument the event but do not fail.
579
- unless messages . empty?
580
+ unless messages . nil? or messages . empty?
580
581
instrument "search_messages_unread.net_ldap_connection" ,
581
582
message_id : message_id , messages : messages
582
583
end
Original file line number Diff line number Diff line change @@ -644,10 +644,18 @@ def match(entry)
644
644
end
645
645
646
646
##
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.
648
650
# ("(").
649
651
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
651
659
end
652
660
private :unescape
653
661
You can’t perform that action at this time.
0 commit comments