net-ldap 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of net-ldap might be problematic. Click here for more details.

@@ -1,6 +1,28 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class TestLDAPInstrumentation < Test::Unit::TestCase
4
+ # Fake Net::LDAP::Connection for testing
5
+ class FakeConnection
6
+ # It's difficult to instantiate Net::LDAP::PDU objects. Faking out what we
7
+ # need here until that object is brought under test and has it's constructor
8
+ # cleaned up.
9
+ class Result < Struct.new(:success?, :result_code); end
10
+
11
+ def initialize
12
+ @bind_success = Result.new(true, Net::LDAP::ResultCodeSuccess)
13
+ @search_success = Result.new(true, Net::LDAP::ResultCodeSizeLimitExceeded)
14
+ end
15
+
16
+ def bind(args = {})
17
+ @bind_success
18
+ end
19
+
20
+ def search(*args)
21
+ yield @search_success if block_given?
22
+ @search_success
23
+ end
24
+ end
25
+
4
26
  def setup
5
27
  @connection = flexmock(:connection, :close => true)
6
28
  flexmock(Net::LDAP::Connection).should_receive(:new).and_return(@connection)
@@ -15,8 +37,9 @@ class TestLDAPInstrumentation < Test::Unit::TestCase
15
37
  def test_instrument_bind
16
38
  events = @service.subscribe "bind.net_ldap"
17
39
 
18
- bind_result = flexmock(:bind_result, :success? => true)
19
- flexmock(@connection).should_receive(:bind).with(Hash).and_return(bind_result)
40
+ fake_connection = FakeConnection.new
41
+ @subject.connection = fake_connection
42
+ bind_result = fake_connection.bind
20
43
 
21
44
  assert @subject.bind
22
45
 
@@ -28,10 +51,9 @@ class TestLDAPInstrumentation < Test::Unit::TestCase
28
51
  def test_instrument_search
29
52
  events = @service.subscribe "search.net_ldap"
30
53
 
31
- flexmock(@connection).should_receive(:bind).and_return(flexmock(:bind_result, :result_code => Net::LDAP::ResultCodeSuccess))
32
- flexmock(@connection).should_receive(:search).with(Hash, Proc).
33
- yields(entry = Net::LDAP::Entry.new("uid=user1,ou=users,dc=example,dc=com")).
34
- and_return(flexmock(:search_result, :success? => true, :result_code => Net::LDAP::ResultCodeSuccess))
54
+ fake_connection = FakeConnection.new
55
+ @subject.connection = fake_connection
56
+ entry = fake_connection.search
35
57
 
36
58
  refute_nil @subject.search(:filter => "(uid=user1)")
37
59
 
@@ -44,10 +66,9 @@ class TestLDAPInstrumentation < Test::Unit::TestCase
44
66
  def test_instrument_search_with_size
45
67
  events = @service.subscribe "search.net_ldap"
46
68
 
47
- flexmock(@connection).should_receive(:bind).and_return(flexmock(:bind_result, :result_code => Net::LDAP::ResultCodeSuccess))
48
- flexmock(@connection).should_receive(:search).with(Hash, Proc).
49
- yields(entry = Net::LDAP::Entry.new("uid=user1,ou=users,dc=example,dc=com")).
50
- and_return(flexmock(:search_result, :success? => true, :result_code => Net::LDAP::ResultCodeSizeLimitExceeded))
69
+ fake_connection = FakeConnection.new
70
+ @subject.connection = fake_connection
71
+ entry = fake_connection.search
51
72
 
52
73
  refute_nil @subject.search(:filter => "(uid=user1)", :size => 1)
53
74
 
@@ -70,4 +91,24 @@ class TestLDAPInstrumentation < Test::Unit::TestCase
70
91
 
71
92
  assert_equal enc[:method], :start_tls
72
93
  end
94
+
95
+ def test_normalize_encryption_symbol
96
+ enc = @subject.send(:normalize_encryption, :start_tls)
97
+ assert_equal enc, {:method => :start_tls, :tls_options => {}}
98
+ end
99
+
100
+ def test_normalize_encryption_nil
101
+ enc = @subject.send(:normalize_encryption, nil)
102
+ assert_equal enc, nil
103
+ end
104
+
105
+ def test_normalize_encryption_string
106
+ enc = @subject.send(:normalize_encryption, 'start_tls')
107
+ assert_equal enc, {:method => :start_tls, :tls_options => {}}
108
+ end
109
+
110
+ def test_normalize_encryption_hash
111
+ enc = @subject.send(:normalize_encryption, {:method => :start_tls, :tls_options => {:foo => :bar}})
112
+ assert_equal enc, {:method => :start_tls, :tls_options => {:foo => :bar}}
113
+ end
73
114
  end
@@ -9,44 +9,55 @@ class TestLDAPConnection < Test::Unit::TestCase
9
9
  $stderr = stderr
10
10
  end
11
11
 
12
+ # Fake socket for testing
13
+ #
14
+ # FakeTCPSocket.new("success", 636)
15
+ # FakeTCPSocket.new("fail.SocketError", 636) # raises SocketError
16
+ class FakeTCPSocket
17
+ def initialize(host, port, socket_opts = {})
18
+ status, error = host.split(".")
19
+ if status == "fail"
20
+ raise Object.const_get(error)
21
+ end
22
+ end
23
+ end
24
+
12
25
  def test_list_of_hosts_with_first_host_successful
13
26
  hosts = [
14
- ['test.mocked.com', 636],
15
- ['test2.mocked.com', 636],
16
- ['test3.mocked.com', 636],
27
+ ["success.host", 636],
28
+ ["fail.SocketError", 636],
29
+ ["fail.SocketError", 636],
17
30
  ]
18
- flexmock(Socket).should_receive(:tcp).ordered.with(*hosts[0], { connect_timeout: 5 }).once.and_return(nil)
19
- flexmock(Socket).should_receive(:tcp).ordered.never
20
- Net::LDAP::Connection.new(:hosts => hosts)
31
+
32
+ connection = Net::LDAP::Connection.new(:hosts => hosts, :socket_class => FakeTCPSocket)
33
+ connection.socket
21
34
  end
22
35
 
23
36
  def test_list_of_hosts_with_first_host_failure
24
37
  hosts = [
25
- ['test.mocked.com', 636],
26
- ['test2.mocked.com', 636],
27
- ['test3.mocked.com', 636],
38
+ ["fail.SocketError", 636],
39
+ ["success.host", 636],
40
+ ["fail.SocketError", 636],
28
41
  ]
29
- flexmock(Socket).should_receive(:tcp).ordered.with(*hosts[0], { connect_timeout: 5 }).once.and_raise(SocketError)
30
- flexmock(Socket).should_receive(:tcp).ordered.with(*hosts[1], { connect_timeout: 5 }).once.and_return(nil)
31
- flexmock(Socket).should_receive(:tcp).ordered.never
32
- Net::LDAP::Connection.new(:hosts => hosts)
42
+
43
+ connection = Net::LDAP::Connection.new(:hosts => hosts, :socket_class => FakeTCPSocket)
44
+ connection.socket
33
45
  end
34
46
 
35
47
  def test_list_of_hosts_with_all_hosts_failure
36
48
  hosts = [
37
- ['test.mocked.com', 636],
38
- ['test2.mocked.com', 636],
39
- ['test3.mocked.com', 636],
49
+ ["fail.SocketError", 636],
50
+ ["fail.SocketError", 636],
51
+ ["fail.SocketError", 636],
40
52
  ]
41
- flexmock(Socket).should_receive(:tcp).ordered.with(*hosts[0], { connect_timeout: 5 }).once.and_raise(SocketError)
42
- flexmock(Socket).should_receive(:tcp).ordered.with(*hosts[1], { connect_timeout: 5 }).once.and_raise(SocketError)
43
- flexmock(Socket).should_receive(:tcp).ordered.with(*hosts[2], { connect_timeout: 5 }).once.and_raise(SocketError)
44
- flexmock(Socket).should_receive(:tcp).ordered.never
53
+
54
+ connection = Net::LDAP::Connection.new(:hosts => hosts, :socket_class => FakeTCPSocket)
45
55
  assert_raise Net::LDAP::ConnectionError do
46
- Net::LDAP::Connection.new(:hosts => hosts)
56
+ connection.socket
47
57
  end
48
58
  end
49
59
 
60
+ # This belongs in test_ldap, not test_ldap_connection
50
61
  def test_result_for_connection_failed_is_set
51
62
  flexmock(Socket).should_receive(:tcp).and_raise(Errno::ECONNREFUSED)
52
63
 
@@ -61,63 +72,63 @@ class TestLDAPConnection < Test::Unit::TestCase
61
72
  end
62
73
 
63
74
  def test_unresponsive_host
75
+ connection = Net::LDAP::Connection.new(:host => "fail.Errno::ETIMEDOUT", :port => 636, :socket_class => FakeTCPSocket)
64
76
  assert_raise Net::LDAP::Error do
65
- Net::LDAP::Connection.new(:host => 'test.mocked.com', :port => 636)
77
+ connection.socket
66
78
  end
67
79
  end
68
80
 
69
81
  def test_blocked_port
70
- flexmock(Socket).should_receive(:tcp).and_raise(SocketError)
82
+ connection = Net::LDAP::Connection.new(:host => "fail.SocketError", :port => 636, :socket_class => FakeTCPSocket)
71
83
  assert_raise Net::LDAP::Error do
72
- Net::LDAP::Connection.new(:host => 'test.mocked.com', :port => 636)
84
+ connection.socket
73
85
  end
74
86
  end
75
87
 
76
88
  def test_connection_refused
77
- flexmock(Socket).should_receive(:tcp).and_raise(Errno::ECONNREFUSED)
89
+ connection = Net::LDAP::Connection.new(:host => "fail.Errno::ECONNREFUSED", :port => 636, :socket_class => FakeTCPSocket)
78
90
  stderr = capture_stderr do
79
91
  assert_raise Net::LDAP::ConnectionRefusedError do
80
- Net::LDAP::Connection.new(:host => 'test.mocked.com', :port => 636)
92
+ connection.socket
81
93
  end
82
94
  end
83
95
  assert_equal("Deprecation warning: Net::LDAP::ConnectionRefused will be deprecated. Use Errno::ECONNREFUSED instead.\n", stderr)
84
96
  end
85
97
 
86
- def test_connection_timedout
87
- flexmock(Socket).should_receive(:tcp).and_raise(Errno::ETIMEDOUT)
98
+ def test_connection_timeout
99
+ connection = Net::LDAP::Connection.new(:host => "fail.Errno::ETIMEDOUT", :port => 636, :socket_class => FakeTCPSocket)
88
100
  stderr = capture_stderr do
89
101
  assert_raise Net::LDAP::Error do
90
- Net::LDAP::Connection.new(:host => 'test.mocked.com', :port => 636)
102
+ connection.socket
91
103
  end
92
104
  end
93
105
  end
94
106
 
95
107
  def test_raises_unknown_exceptions
96
- error = Class.new(StandardError)
97
- flexmock(Socket).should_receive(:tcp).and_raise(error)
98
- assert_raise error do
99
- Net::LDAP::Connection.new(:host => 'test.mocked.com', :port => 636)
108
+ connection = Net::LDAP::Connection.new(:host => "fail.StandardError", :port => 636, :socket_class => FakeTCPSocket)
109
+ assert_raise StandardError do
110
+ connection.socket
100
111
  end
101
112
  end
102
113
 
103
114
  def test_modify_ops_delete
104
- args = { :operations => [ [ :delete, "mail" ] ] }
115
+ args = { :operations => [[:delete, "mail"]] }
105
116
  result = Net::LDAP::Connection.modify_ops(args[:operations])
106
- expected = [ "0\r\n\x01\x010\b\x04\x04mail1\x00" ]
117
+ expected = ["0\r\n\x01\x010\b\x04\x04mail1\x00"]
107
118
  assert_equal(expected, result)
108
119
  end
109
120
 
110
121
  def test_modify_ops_add
111
- args = { :operations => [ [ :add, "mail", "testuser@example.com" ] ] }
122
+ args = { :operations => [[:add, "mail", "testuser@example.com"]] }
112
123
  result = Net::LDAP::Connection.modify_ops(args[:operations])
113
- expected = [ "0#\n\x01\x000\x1E\x04\x04mail1\x16\x04\x14testuser@example.com" ]
124
+ expected = ["0#\n\x01\x000\x1E\x04\x04mail1\x16\x04\x14testuser@example.com"]
114
125
  assert_equal(expected, result)
115
126
  end
116
127
 
117
128
  def test_modify_ops_replace
118
- args = { :operations =>[ [ :replace, "mail", "testuser@example.com" ] ] }
129
+ args = { :operations =>[[:replace, "mail", "testuser@example.com"]] }
119
130
  result = Net::LDAP::Connection.modify_ops(args[:operations])
120
- expected = [ "0#\n\x01\x020\x1E\x04\x04mail1\x16\x04\x14testuser@example.com" ]
131
+ expected = ["0#\n\x01\x020\x1E\x04\x04mail1\x16\x04\x14testuser@example.com"]
121
132
  assert_equal(expected, result)
122
133
  end
123
134
 
@@ -151,7 +162,7 @@ class TestLDAPConnectionSocketReads < Test::Unit::TestCase
151
162
  app_tag: Net::LDAP::PDU::SearchResult,
152
163
  code: Net::LDAP::ResultCodeSuccess,
153
164
  matched_dn: "",
154
- error_message: ""
165
+ error_message: "",
155
166
  }.merge(options)
156
167
  result = Net::BER::BerIdentifiedArray.new([options[:code], options[:matched_dn], options[:error_message]])
157
168
  result.ber_identifier = options[:app_tag]
@@ -246,7 +257,7 @@ class TestLDAPConnectionSocketReads < Test::Unit::TestCase
246
257
 
247
258
  assert result = conn.rename(
248
259
  olddn: "uid=renamable-user1,ou=People,dc=rubyldap,dc=com",
249
- newrdn: "uid=renamed-user1"
260
+ newrdn: "uid=renamed-user1",
250
261
  )
251
262
  assert result.success?
252
263
  assert_equal 2, result.message_id
@@ -388,8 +399,8 @@ class TestLDAPConnectionInstrumentation < Test::Unit::TestCase
388
399
 
389
400
  # a write event
390
401
  payload, result = events.pop
391
- assert payload.has_key?(:result)
392
- assert payload.has_key?(:content_length)
402
+ assert payload.key?(:result)
403
+ assert payload.key?(:content_length)
393
404
  end
394
405
 
395
406
  def test_read_net_ldap_connection_event
@@ -405,7 +416,7 @@ class TestLDAPConnectionInstrumentation < Test::Unit::TestCase
405
416
 
406
417
  # a read event
407
418
  payload, result = events.pop
408
- assert payload.has_key?(:result)
419
+ assert payload.key?(:result)
409
420
  assert_equal read_result, result
410
421
  end
411
422
 
@@ -422,9 +433,9 @@ class TestLDAPConnectionInstrumentation < Test::Unit::TestCase
422
433
 
423
434
  # a parse_pdu event
424
435
  payload, result = events.pop
425
- assert payload.has_key?(:pdu)
426
- assert payload.has_key?(:app_tag)
427
- assert payload.has_key?(:message_id)
436
+ assert payload.key?(:pdu)
437
+ assert payload.key?(:app_tag)
438
+ assert payload.key?(:message_id)
428
439
  assert_equal Net::LDAP::PDU::BindResult, payload[:app_tag]
429
440
  assert_equal 1, payload[:message_id]
430
441
  pdu = payload[:pdu]
@@ -444,7 +455,7 @@ class TestLDAPConnectionInstrumentation < Test::Unit::TestCase
444
455
 
445
456
  # a read event
446
457
  payload, result = events.pop
447
- assert payload.has_key?(:result)
458
+ assert payload.key?(:result)
448
459
  assert result.success?, "should be success"
449
460
  end
450
461
 
@@ -452,7 +463,7 @@ class TestLDAPConnectionInstrumentation < Test::Unit::TestCase
452
463
  # search data
453
464
  search_data_ber = Net::BER::BerIdentifiedArray.new([1, [
454
465
  "uid=user1,ou=People,dc=rubyldap,dc=com",
455
- [ ["uid", ["user1"]] ]
466
+ [["uid", ["user1"]]],
456
467
  ]])
457
468
  search_data_ber.ber_identifier = Net::LDAP::PDU::SearchReturnedData
458
469
  search_data = [1, search_data_ber]
@@ -471,8 +482,8 @@ class TestLDAPConnectionInstrumentation < Test::Unit::TestCase
471
482
 
472
483
  # a search event
473
484
  payload, result = events.pop
474
- assert payload.has_key?(:result)
475
- assert payload.has_key?(:filter)
485
+ assert payload.key?(:result)
486
+ assert payload.key?(:filter)
476
487
  assert_equal "(uid=user1)", payload[:filter].to_s
477
488
  assert result
478
489
 
@@ -38,40 +38,40 @@ class TestLdif < Test::Unit::TestCase
38
38
 
39
39
  def test_ldif_with_continuation_lines
40
40
  ds = Net::LDAP::Dataset::read_ldif(StringIO.new("dn: abcdefg\r\n hijklmn\r\n\r\n"))
41
- assert_equal(true, ds.has_key?("abcdefghijklmn"))
41
+ assert_equal(true, ds.key?("abcdefghijklmn"))
42
42
  end
43
43
 
44
44
  def test_ldif_with_continuation_lines_and_extra_whitespace
45
45
  ds1 = Net::LDAP::Dataset::read_ldif(StringIO.new("dn: abcdefg\r\n hijklmn\r\n\r\n"))
46
- assert_equal(true, ds1.has_key?("abcdefg hijklmn"))
46
+ assert_equal(true, ds1.key?("abcdefg hijklmn"))
47
47
  ds2 = Net::LDAP::Dataset::read_ldif(StringIO.new("dn: abcdefg\r\n hij klmn\r\n\r\n"))
48
- assert_equal(true, ds2.has_key?("abcdefghij klmn"))
48
+ assert_equal(true, ds2.key?("abcdefghij klmn"))
49
49
  end
50
50
 
51
51
  def test_ldif_tab_is_not_continuation
52
52
  ds = Net::LDAP::Dataset::read_ldif(StringIO.new("dn: key\r\n\tnotcontinued\r\n\r\n"))
53
- assert_equal(true, ds.has_key?("key"))
53
+ assert_equal(true, ds.key?("key"))
54
54
  end
55
55
 
56
56
  def test_ldif_with_base64_dn
57
57
  str = "dn:: Q049QmFzZTY0IGRuIHRlc3QsT1U9VGVzdCxPVT1Vbml0cyxEQz1leGFtcGxlLERDPWNvbQ==\r\n\r\n"
58
58
  ds = Net::LDAP::Dataset::read_ldif(StringIO.new(str))
59
- assert_equal(true, ds.has_key?("CN=Base64 dn test,OU=Test,OU=Units,DC=example,DC=com"))
59
+ assert_equal(true, ds.key?("CN=Base64 dn test,OU=Test,OU=Units,DC=example,DC=com"))
60
60
  end
61
61
 
62
62
  def test_ldif_with_base64_dn_and_continuation_lines
63
63
  str = "dn:: Q049QmFzZTY0IGRuIHRlc3Qgd2l0aCBjb250aW51YXRpb24gbGluZSxPVT1UZXN0LE9VPVVua\r\n XRzLERDPWV4YW1wbGUsREM9Y29t\r\n\r\n"
64
64
  ds = Net::LDAP::Dataset::read_ldif(StringIO.new(str))
65
- assert_equal(true, ds.has_key?("CN=Base64 dn test with continuation line,OU=Test,OU=Units,DC=example,DC=com"))
65
+ assert_equal(true, ds.key?("CN=Base64 dn test with continuation line,OU=Test,OU=Units,DC=example,DC=com"))
66
66
  end
67
67
 
68
68
  # TODO, INADEQUATE. We need some more tests
69
69
  # to verify the content.
70
70
  def test_ldif
71
- File.open(TestLdifFilename, "r") {|f|
71
+ File.open(TestLdifFilename, "r") do |f|
72
72
  ds = Net::LDAP::Dataset::read_ldif(f)
73
73
  assert_equal(13, ds.length)
74
- }
74
+ end
75
75
  end
76
76
 
77
77
  # Must test folded lines and base64-encoded lines as well as normal ones.
@@ -84,13 +84,13 @@ class TestLdif < Test::Unit::TestCase
84
84
  entries = data.lines.grep(/^dn:\s*/) { $'.chomp }
85
85
  dn_entries = entries.dup
86
86
 
87
- ds = Net::LDAP::Dataset::read_ldif(io) { |type, value|
87
+ ds = Net::LDAP::Dataset::read_ldif(io) do |type, value|
88
88
  case type
89
89
  when :dn
90
90
  assert_equal(dn_entries.first, value)
91
91
  dn_entries.shift
92
92
  end
93
- }
93
+ end
94
94
  assert_equal(entries.size, ds.size)
95
95
  assert_equal(entries.sort, ds.to_ldif.grep(/^dn:\s*/) { $'.chomp })
96
96
  end
@@ -32,8 +32,8 @@ class TestSearch < Test::Unit::TestCase
32
32
  @connection.search(:filter => "test")
33
33
 
34
34
  payload, result = events.pop
35
- assert payload.has_key?(:result)
36
- assert payload.has_key?(:filter)
35
+ assert payload.key?(:result)
36
+ assert payload.key?(:filter)
37
37
  assert_equal "test", payload[:filter]
38
38
  end
39
39
  end
@@ -16,9 +16,9 @@ class TestSnmp < Test::Unit::TestCase
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 @@ ary = data.read_ber(Net::SNMP::AsnSyntax)
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
@@ -24,7 +24,7 @@ module LdapServer
24
24
  },
25
25
  :primitive => {
26
26
  2 => :string, # ldapsearch sends this to unbind
27
- }
27
+ },
28
28
  },
29
29
  :context_specific => {
30
30
  :primitive => {
@@ -34,7 +34,7 @@ module LdapServer
34
34
  :constructed => {
35
35
  3 => :array # equality filter
36
36
  },
37
- }
37
+ },
38
38
  }
39
39
 
40
40
  def post_init
@@ -119,7 +119,7 @@ module LdapServer
119
119
  # pdu[1][7] is the list of requested attributes.
120
120
  # If it's an empty array, that means that *all* attributes were requested.
121
121
  requested_attrs = if pdu[1][7].length > 0
122
- pdu[1][7].map {|a| a.downcase}
122
+ pdu[1][7].map(&:downcase)
123
123
  else
124
124
  :all
125
125
  end
@@ -133,21 +133,21 @@ module LdapServer
133
133
  # TODO, what if this returns nil?
134
134
  filter = Net::LDAP::Filter.parse_ldap_filter( filters )
135
135
 
136
- $ldif.each {|dn, entry|
136
+ $ldif.each do |dn, entry|
137
137
  if filter.match( entry )
138
138
  attrs = []
139
- entry.each {|k, v|
139
+ entry.each do |k, v|
140
140
  if requested_attrs == :all or requested_attrs.include?(k.downcase)
141
- attrvals = v.map {|v1| v1.to_ber}.to_ber_set
141
+ attrvals = v.map(&:to_ber).to_ber_set
142
142
  attrs << [k.to_ber, attrvals].to_ber_sequence
143
143
  end
144
- }
144
+ end
145
145
 
146
146
  appseq = [dn.to_ber, attrs.to_ber_sequence].to_ber_appsequence(4)
147
147
  pkt = [msgid.to_ber, appseq].to_ber_sequence
148
148
  send_data pkt
149
149
  end
150
- }
150
+ end
151
151
 
152
152
 
153
153
  send_ldap_response 5, pdu[0].to_i, 0, "", "Was that what you wanted?"
@@ -156,7 +156,7 @@ module LdapServer
156
156
 
157
157
 
158
158
  def send_ldap_response pkt_tag, msgid, code, dn, text
159
- send_data( [msgid.to_ber, [code.to_ber, dn.to_ber, text.to_ber].to_ber_appsequence(pkt_tag) ].to_ber )
159
+ send_data( [msgid.to_ber, [code.to_ber, dn.to_ber, text.to_ber].to_ber_appsequence(pkt_tag)].to_ber )
160
160
  end
161
161
 
162
162
  end
@@ -201,10 +201,9 @@ if __FILE__ == $0
201
201
 
202
202
  require 'net/ldap'
203
203
 
204
- EventMachine.run {
204
+ EventMachine.run do
205
205
  $logger.info "starting LDAP server on 127.0.0.1 port 3890"
206
206
  EventMachine.start_server "127.0.0.1", 3890, LdapServer
207
207
  EventMachine.add_periodic_timer 60, proc {$logger.info "heartbeat"}
208
- }
208
+ end
209
209
  end
210
-