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 = {})
775
775
776
776
instrument "search.net_ldap" , args do |payload |
777
777
@result = use_connection ( args ) do |conn |
778
- conn . search ( args ) { |entry |
778
+ conn . search ( args ) do |entry |
779
779
result_set << entry if result_set
780
780
yield entry if block_given?
781
- }
781
+ end
782
782
end
783
783
784
784
if return_result_set
@@ -917,15 +917,15 @@ def bind(auth = @auth)
917
917
# end
918
918
def bind_as ( args = { } )
919
919
result = false
920
- open { |me |
920
+ open do |me |
921
921
rs = search args
922
922
if rs and rs . first and dn = rs . first . dn
923
923
password = args [ :password ]
924
924
password = password . call if password . respond_to? ( :call )
925
925
result = rs if bind ( :method => :simple , :username => dn ,
926
926
:password => password )
927
927
end
928
- }
928
+ end
929
929
result
930
930
end
931
931
Original file line number Diff line number Diff line change @@ -22,12 +22,10 @@ def bind(auth)
22
22
user , psw = [ auth [ :username ] || auth [ :dn ] , auth [ :password ] ]
23
23
raise Net ::LDAP ::BindingInformationInvalidError , "Invalid binding information" unless ( user && psw )
24
24
25
- nego = proc { |challenge |
26
25
t2_msg = NTLM ::Message . parse ( challenge )
27
26
t3_msg = t2_msg . response ( { :user => user , :password => psw } ,
28
27
{ :ntlmv2 => true } )
29
28
t3_msg . serialize
30
- }
31
29
32
30
Net ::LDAP ::AuthAdapter ::Sasl . new ( @connection ) . bind \
33
31
:method => :sasl ,
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ def bind(auth)
33
33
message_id = @connection . next_msgid
34
34
35
35
n = 0
36
- loop {
36
+ loop do
37
37
sasl = [ mech . to_ber , cred . to_ber ] . to_ber_contextspecific ( 3 )
38
38
request = [
39
39
Net ::LDAP ::Connection ::LdapVersion . to_ber , "" . to_ber , sasl
@@ -50,7 +50,7 @@ def bind(auth)
50
50
raise Net ::LDAP ::SASLChallengeOverflowError , "sasl-challenge overflow" if ( ( n += 1 ) > MaxSaslChallenges )
51
51
52
52
cred = chall . call ( pdu . result_server_sasl_creds )
53
- }
53
+ end
54
54
55
55
raise Net ::LDAP ::SASLChallengeOverflowError , "why are we here?"
56
56
end
Original file line number Diff line number Diff line change @@ -500,14 +500,14 @@ def search(args = nil)
500
500
def self . modify_ops ( operations )
501
501
ops = [ ]
502
502
if operations
503
- operations . each { |op , attrib , values |
503
+ operations . each do |op , attrib , values |
504
504
# TODO, fix the following line, which gives a bogus error if the
505
505
# opcode is invalid.
506
506
op_ber = MODIFY_OPERATIONS [ op . to_sym ] . to_ber_enumerated
507
507
values = [ values ] . flatten . map { |v | v . to_ber if v } . to_ber_set
508
508
values = [ attrib . to_s . to_ber , values ] . to_ber_sequence
509
509
ops << [ op_ber , values ] . to_ber
510
- }
510
+ end
511
511
end
512
512
ops
513
513
end
@@ -594,9 +594,9 @@ def password_modify(args)
594
594
def add ( args )
595
595
add_dn = args [ :dn ] or raise Net ::LDAP ::EmptyDNError , "Unable to add empty DN"
596
596
add_attrs = [ ]
597
- a = args [ :attributes ] and a . each { |k , v |
597
+ a = args [ :attributes ] and a . each do |k , v |
598
598
add_attrs << [ k . to_s . to_ber , Array ( v ) . map { |m | m . to_ber } . to_ber_set ] . to_ber_sequence
599
- }
599
+ end
600
600
601
601
message_id = next_msgid
602
602
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
141
141
# (possibly empty) \Array of data values.
142
142
def each # :yields: attribute-name, data-values-array
143
143
if block_given?
144
- attribute_names . each { |a |
144
+ attribute_names . each do |a |
145
145
attr_name , values = a , self [ a ]
146
146
yield attr_name , values
147
- }
147
+ end
148
148
end
149
149
end
150
150
alias_method :each_attribute , :each
Original file line number Diff line number Diff line change @@ -287,7 +287,7 @@ def parse_ber(ber)
287
287
when 0xa4 # context-specific constructed 4, "substring"
288
288
str = ""
289
289
final = false
290
- ber . last . each { |b |
290
+ ber . last . each do |b |
291
291
case b . ber_identifier
292
292
when 0x80 # context-specific primitive 0, SubstringFilter "initial"
293
293
raise Net ::LDAP ::SubstringFilterError , "Unrecognized substring filter; bad initial value." if str . length > 0
@@ -298,7 +298,7 @@ def parse_ber(ber)
298
298
str += "*#{ escape ( b ) } "
299
299
final = true
300
300
end
301
- }
301
+ end
302
302
str += "*" unless final
303
303
eq ( ber . first . to_s , str )
304
304
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
227
227
error_status . to_ber ,
228
228
error_index . to_ber ,
229
229
[
230
- @variables . map { |n , v |
230
+ @variables . map do |n , v |
231
231
[ n . to_ber_oid , Net ::BER ::BerIdentifiedNull . new . to_ber ] . to_ber_sequence
232
- }
232
+ end
233
233
] . to_ber_sequence
234
234
] . to_ber_contextspecific ( 0 )
235
235
when :get_next_request
@@ -238,9 +238,9 @@ def pdu_to_ber_string
238
238
error_status . to_ber ,
239
239
error_index . to_ber ,
240
240
[
241
- @variables . map { |n , v |
241
+ @variables . map do |n , v |
242
242
[ n . to_ber_oid , Net ::BER ::BerIdentifiedNull . new . to_ber ] . to_ber_sequence
243
- }
243
+ end
244
244
] . to_ber_sequence
245
245
] . to_ber_contextspecific ( 1 )
246
246
when :get_response
@@ -249,9 +249,9 @@ def pdu_to_ber_string
249
249
error_status . to_ber ,
250
250
error_index . to_ber ,
251
251
[
252
- @variables . map { |n , v |
252
+ @variables . map do |n , v |
253
253
[ n . to_ber_oid , v . to_ber ] . to_ber_sequence
254
- }
254
+ end
255
255
] . to_ber_sequence
256
256
] . to_ber_contextspecific ( 2 )
257
257
else
Original file line number Diff line number Diff line change @@ -13,11 +13,11 @@ def test_invalid_filter_string
13
13
end
14
14
15
15
def test_invalid_filter
16
- assert_raises ( Net ::LDAP ::OperatorError ) {
16
+ assert_raises ( Net ::LDAP ::OperatorError ) do
17
17
# This test exists to prove that our constructor blocks unknown filter
18
18
# types. All filters must be constructed using helpers.
19
19
Filter . __send__ ( :new , :xx , nil , nil )
20
- }
20
+ end
21
21
end
22
22
23
23
def test_to_s
Original file line number Diff line number Diff line change @@ -16,9 +16,9 @@ def self.raw_string(s)
16
16
17
17
def test_invalid_packet
18
18
data = "xxxx"
19
- assert_raise ( Net ::BER ::BerError ) {
19
+ assert_raise ( Net ::BER ::BerError ) do
20
20
ary = data . read_ber ( Net ::SNMP ::AsnSyntax )
21
- }
21
+ end
22
22
end
23
23
24
24
# The method String#read_ber! added by Net::BER consumes a well-formed BER
@@ -40,9 +40,9 @@ def _test_consume_string
40
40
end
41
41
42
42
def test_weird_packet
43
- assert_raise ( Net ::SnmpPdu ::Error ) {
43
+ assert_raise ( Net ::SnmpPdu ::Error ) do
44
44
Net ::SnmpPdu . parse ( "aaaaaaaaaaaaaa" )
45
- }
45
+ end
46
46
end
47
47
48
48
def test_get_request
You can’t perform that action at this time.
0 commit comments