File tree Expand file tree Collapse file tree 9 files changed +26
-28
lines changed Expand file tree Collapse file tree 9 files changed +26
-28
lines changed Original file line number Diff line number Diff line change @@ -775,10 +775,10 @@ def search(args = {})
775775
776776 instrument "search.net_ldap" , args do |payload |
777777 @result = use_connection ( args ) do |conn |
778- conn . search ( args ) { |entry |
778+ conn . search ( args ) do |entry |
779779 result_set << entry if result_set
780780 yield entry if block_given?
781- }
781+ end
782782 end
783783
784784 if return_result_set
@@ -917,15 +917,15 @@ def bind(auth = @auth)
917917 # end
918918 def bind_as ( args = { } )
919919 result = false
920- open { |me |
920+ open do |me |
921921 rs = search args
922922 if rs and rs . first and dn = rs . first . dn
923923 password = args [ :password ]
924924 password = password . call if password . respond_to? ( :call )
925925 result = rs if bind ( :method => :simple , :username => dn ,
926926 :password => password )
927927 end
928- }
928+ end
929929 result
930930 end
931931
Original file line number Diff line number Diff line change @@ -22,12 +22,10 @@ def bind(auth)
2222 user , psw = [ auth [ :username ] || auth [ :dn ] , auth [ :password ] ]
2323 raise Net ::LDAP ::BindingInformationInvalidError , "Invalid binding information" unless ( user && psw )
2424
25- nego = proc { |challenge |
2625 t2_msg = NTLM ::Message . parse ( challenge )
2726 t3_msg = t2_msg . response ( { :user => user , :password => psw } ,
2827 { :ntlmv2 => true } )
2928 t3_msg . serialize
30- }
3129
3230 Net ::LDAP ::AuthAdapter ::Sasl . new ( @connection ) . bind \
3331 :method => :sasl ,
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ def bind(auth)
3333 message_id = @connection . next_msgid
3434
3535 n = 0
36- loop {
36+ loop do
3737 sasl = [ mech . to_ber , cred . to_ber ] . to_ber_contextspecific ( 3 )
3838 request = [
3939 Net ::LDAP ::Connection ::LdapVersion . to_ber , "" . to_ber , sasl
@@ -50,7 +50,7 @@ def bind(auth)
5050 raise Net ::LDAP ::SASLChallengeOverflowError , "sasl-challenge overflow" if ( ( n += 1 ) > MaxSaslChallenges )
5151
5252 cred = chall . call ( pdu . result_server_sasl_creds )
53- }
53+ end
5454
5555 raise Net ::LDAP ::SASLChallengeOverflowError , "why are we here?"
5656 end
Original file line number Diff line number Diff line change @@ -500,14 +500,14 @@ def search(args = nil)
500500 def self . modify_ops ( operations )
501501 ops = [ ]
502502 if operations
503- operations . each { |op , attrib , values |
503+ operations . each do |op , attrib , values |
504504 # TODO, fix the following line, which gives a bogus error if the
505505 # opcode is invalid.
506506 op_ber = MODIFY_OPERATIONS [ op . to_sym ] . to_ber_enumerated
507507 values = [ values ] . flatten . map { |v | v . to_ber if v } . to_ber_set
508508 values = [ attrib . to_s . to_ber , values ] . to_ber_sequence
509509 ops << [ op_ber , values ] . to_ber
510- }
510+ end
511511 end
512512 ops
513513 end
@@ -594,9 +594,9 @@ def password_modify(args)
594594 def add ( args )
595595 add_dn = args [ :dn ] or raise Net ::LDAP ::EmptyDNError , "Unable to add empty DN"
596596 add_attrs = [ ]
597- a = args [ :attributes ] and a . each { |k , v |
597+ a = args [ :attributes ] and a . each do |k , v |
598598 add_attrs << [ k . to_s . to_ber , Array ( v ) . map { |m | m . to_ber } . to_ber_set ] . to_ber_sequence
599- }
599+ end
600600
601601 message_id = next_msgid
602602 request = [ add_dn . to_ber , add_attrs . to_ber_sequence ] . to_ber_appsequence ( Net ::LDAP ::PDU ::AddRequest )
Original file line number Diff line number Diff line change @@ -141,10 +141,10 @@ def attribute_names
141141 # (possibly empty) \Array of data values.
142142 def each # :yields: attribute-name, data-values-array
143143 if block_given?
144- attribute_names . each { |a |
144+ attribute_names . each do |a |
145145 attr_name , values = a , self [ a ]
146146 yield attr_name , values
147- }
147+ end
148148 end
149149 end
150150 alias_method :each_attribute , :each
Original file line number Diff line number Diff line change @@ -287,7 +287,7 @@ def parse_ber(ber)
287287 when 0xa4 # context-specific constructed 4, "substring"
288288 str = ""
289289 final = false
290- ber . last . each { |b |
290+ ber . last . each do |b |
291291 case b . ber_identifier
292292 when 0x80 # context-specific primitive 0, SubstringFilter "initial"
293293 raise Net ::LDAP ::SubstringFilterError , "Unrecognized substring filter; bad initial value." if str . length > 0
@@ -298,7 +298,7 @@ def parse_ber(ber)
298298 str += "*#{ escape ( b ) } "
299299 final = true
300300 end
301- }
301+ end
302302 str += "*" unless final
303303 eq ( ber . first . to_s , str )
304304 when 0xa5 # context-specific constructed 5, "greaterOrEqual"
Original file line number Diff line number Diff line change @@ -227,9 +227,9 @@ def pdu_to_ber_string
227227 error_status . to_ber ,
228228 error_index . to_ber ,
229229 [
230- @variables . map { |n , v |
230+ @variables . map do |n , v |
231231 [ n . to_ber_oid , Net ::BER ::BerIdentifiedNull . new . to_ber ] . to_ber_sequence
232- }
232+ end
233233 ] . to_ber_sequence
234234 ] . to_ber_contextspecific ( 0 )
235235 when :get_next_request
@@ -238,9 +238,9 @@ def pdu_to_ber_string
238238 error_status . to_ber ,
239239 error_index . to_ber ,
240240 [
241- @variables . map { |n , v |
241+ @variables . map do |n , v |
242242 [ n . to_ber_oid , Net ::BER ::BerIdentifiedNull . new . to_ber ] . to_ber_sequence
243- }
243+ end
244244 ] . to_ber_sequence
245245 ] . to_ber_contextspecific ( 1 )
246246 when :get_response
@@ -249,9 +249,9 @@ def pdu_to_ber_string
249249 error_status . to_ber ,
250250 error_index . to_ber ,
251251 [
252- @variables . map { |n , v |
252+ @variables . map do |n , v |
253253 [ n . to_ber_oid , v . to_ber ] . to_ber_sequence
254- }
254+ end
255255 ] . to_ber_sequence
256256 ] . to_ber_contextspecific ( 2 )
257257 else
Original file line number Diff line number Diff line change @@ -13,11 +13,11 @@ def test_invalid_filter_string
1313 end
1414
1515 def test_invalid_filter
16- assert_raises ( Net ::LDAP ::OperatorError ) {
16+ assert_raises ( Net ::LDAP ::OperatorError ) do
1717 # This test exists to prove that our constructor blocks unknown filter
1818 # types. All filters must be constructed using helpers.
1919 Filter . __send__ ( :new , :xx , nil , nil )
20- }
20+ end
2121 end
2222
2323 def test_to_s
Original file line number Diff line number Diff line change @@ -16,9 +16,9 @@ def self.raw_string(s)
1616
1717 def test_invalid_packet
1818 data = "xxxx"
19- assert_raise ( Net ::BER ::BerError ) {
19+ assert_raise ( Net ::BER ::BerError ) do
2020ary = data . read_ber ( Net ::SNMP ::AsnSyntax )
21- }
21+ end
2222 end
2323
2424 # The method String#read_ber! added by Net::BER consumes a well-formed BER
@@ -40,9 +40,9 @@ def _test_consume_string
4040 end
4141
4242 def test_weird_packet
43- assert_raise ( Net ::SnmpPdu ::Error ) {
43+ assert_raise ( Net ::SnmpPdu ::Error ) do
4444Net ::SnmpPdu . parse ( "aaaaaaaaaaaaaa" )
45- }
45+ end
4646 end
4747
4848 def test_get_request
You can’t perform that action at this time.
0 commit comments