OK
This commit is contained in:
+22
-1
@@ -2,11 +2,32 @@
|
|||||||
dc=pvincent,dc=re:
|
dc=pvincent,dc=re:
|
||||||
cn:
|
cn:
|
||||||
- Top object
|
- Top object
|
||||||
cn=admin,dc=pvincent,dc=re:
|
mail=admin@pvincent.re,dc=zourit,dc=re:
|
||||||
cn:
|
cn:
|
||||||
- admin
|
- admin
|
||||||
sn:
|
sn:
|
||||||
- Vincentdmin
|
- Vincentdmin
|
||||||
mail:
|
mail:
|
||||||
- admin@pvincent.re
|
- admin@pvincent.re
|
||||||
|
mail=test1@pvincent.re,dc=zourit,dc=re:
|
||||||
|
cn:
|
||||||
|
- test1
|
||||||
|
sn:
|
||||||
|
- Test1
|
||||||
|
mail:
|
||||||
|
- test1@pvincent.re
|
||||||
|
mail=test2@pvincent.re,dc=zourit,dc=re:
|
||||||
|
cn:
|
||||||
|
- test2
|
||||||
|
sn:
|
||||||
|
- Test2
|
||||||
|
mail:
|
||||||
|
- test2@pvincent.re
|
||||||
|
mail=test3@pvincent.re,dc=zourit,dc=re:
|
||||||
|
cn:
|
||||||
|
- test3
|
||||||
|
sn:
|
||||||
|
- Test3
|
||||||
|
mail:
|
||||||
|
- test3@pvincent.re
|
||||||
|
|
||||||
|
|||||||
+7
-18
@@ -26,25 +26,16 @@ class HashOperation < LDAP::Server::Operation
|
|||||||
version = protocolOp.value[0].value
|
version = protocolOp.value[0].value
|
||||||
authentication = protocolOp.value[2]
|
authentication = protocolOp.value[2]
|
||||||
password = authentication.value
|
password = authentication.value
|
||||||
$logger.info("AUTHENTICATION ..version=#{version}, dn=#{dn}, password=#{password}")
|
valid = password == 'toto'
|
||||||
super
|
$logger.info("AUTHENTICATION ..version=#{version}, dn=#{dn}, valid=#{valid}")
|
||||||
|
send_BindResponse(valid ? 0 : 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
# def simple_bind(version, dn, password)
|
|
||||||
# super.simple_bind(version, dn, password)
|
|
||||||
# $logger.info("SIMPLE BIND...version=#{version}, dn=#{dn}")
|
|
||||||
#
|
|
||||||
# raise LDAP::ResultError::ProtocolError, 'version 3 only' if version != 3
|
|
||||||
# raise LDAP::ResultError::InvalidCredentials, 'Invalid credentials' if password.nil? || password == ''
|
|
||||||
#
|
|
||||||
# $logger.info('authentication SUCCESS')
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
def search(basedn, scope, deref, filter)
|
def search(basedn, scope, deref, filter)
|
||||||
$logger.info("SEARCHING...basedn=#{basedn}, scope=#{scope}, deref=#{deref}, filter=#{filter}")
|
$logger.info("SEARCHING...basedn=#{basedn}, scope=#{scope}, deref=#{deref}, filter=#{filter}")
|
||||||
|
|
||||||
basedn = basedn.downcase
|
basedn = basedn.downcase
|
||||||
result = nil
|
nil
|
||||||
case scope
|
case scope
|
||||||
when LDAP::Server::BaseObject
|
when LDAP::Server::BaseObject
|
||||||
# client asked for single object by DN
|
# client asked for single object by DN
|
||||||
@@ -52,22 +43,20 @@ class HashOperation < LDAP::Server::Operation
|
|||||||
raise LDAP::ResultError::NoSuchObject unless obj
|
raise LDAP::ResultError::NoSuchObject unless obj
|
||||||
|
|
||||||
$logger.info('BaseObject')
|
$logger.info('BaseObject')
|
||||||
result = send_SearchResultEntry(basedn, obj) if LDAP::Server::Filter.run(filter, obj)
|
send_SearchResultEntry(basedn, obj) if LDAP::Server::Filter.run(filter, obj)
|
||||||
when LDAP::Server::WholeSubtree
|
when LDAP::Server::WholeSubtree
|
||||||
@hash.each do |dn, av|
|
@hash.each do |dn, av|
|
||||||
next unless dn.index(basedn, -basedn.length) # under basedn?
|
next unless dn.index(basedn, -basedn.length) # under basedn?
|
||||||
next unless LDAP::Server::Filter.run(filter, av) # attribute filter?
|
next unless LDAP::Server::Filter.run(filter, av) # attribute filter?
|
||||||
|
|
||||||
$logger.info('WholeSubtree')
|
$logger.info("WholeSubtree av=#{av}")
|
||||||
result = send_SearchResultEntry(dn, av)
|
send_SearchResultEntry(dn, av)
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
raise LDAP::ResultError::UnwillingToPerform, 'OneLevel not implemented'
|
raise LDAP::ResultError::UnwillingToPerform, 'OneLevel not implemented'
|
||||||
|
|
||||||
end
|
end
|
||||||
$logger.info "result=#{result}"
|
|
||||||
# result
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user