Skip to content

Commit 8e481a4

Browse files
fix syntax
1 parent 364c924 commit 8e481a4

File tree

1 file changed

+22
-25
lines changed

1 file changed

+22
-25
lines changed

testserver/ldapserver.rb

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,27 @@
1414

1515
#------------------------------------------------
1616

17-
module LdapServer
17+
module LdapServer
18+
LdapServerAsnSyntaxTemplate = {
19+
:application => {
20+
:constructed => {
21+
0 => :array, # LDAP BindRequest
22+
3 => :array # LDAP SearchRequest
23+
},
24+
:primitive => {
25+
2 => :string, # ldapsearch sends this to unbind
26+
},
27+
},
28+
:context_specific => {
29+
:primitive => {
30+
0 => :string, # simple auth (password)
31+
7 => :string # present filter
32+
},
33+
:constructed => {
34+
3 => :array # equality filter
35+
},
36+
},
37+
}
1838

1939
def post_init
2040
$logger.info "Accepted LDAP connection"
@@ -171,30 +191,7 @@ def load_test_data
171191
$ldif = load_test_data
172192

173193
require 'net/ldap'
174-
175-
LdapServerAsnSyntax = Net::BER.compile_syntax(
176-
{
177-
:application => {
178-
:constructed => {
179-
0 => :array, # LDAP BindRequest
180-
3 => :array # LDAP SearchRequest
181-
},
182-
:primitive => {
183-
2 => :string, # ldapsearch sends this to unbind
184-
},
185-
},
186-
:context_specific => {
187-
:primitive => {
188-
0 => :string, # simple auth (password)
189-
7 => :string # present filter
190-
},
191-
:constructed => {
192-
3 => :array # equality filter
193-
},
194-
},
195-
}
196-
)
197-
194+
LdapServerAsnSyntax = Net::BER.compile_syntax(LdapServerAsnSyntaxTemplate)
198195
EventMachine.run do
199196
$logger.info "starting LDAP server on 127.0.0.1 port 3890"
200197
EventMachine.start_server "127.0.0.1", 3890, LdapServer

0 commit comments

Comments
 (0)