Protect against lookup loops

This commit is contained in:
Maxime Dor
2017-02-11 23:14:12 +01:00
parent 81aaf70c47
commit 40be6e72a1
4 changed files with 24 additions and 1 deletions

View File

@@ -27,12 +27,16 @@ import org.apache.directory.api.ldap.model.entry.Attribute
import org.apache.directory.api.ldap.model.message.SearchScope
import org.apache.directory.ldap.client.api.LdapConnection
import org.apache.directory.ldap.client.api.LdapNetworkConnection
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
@Component
class LdapProvider implements ThreePidProvider {
private Logger log = LoggerFactory.getLogger(LdapProvider.class)
@Autowired
private LdapConfig ldapCfg
@@ -43,6 +47,8 @@ class LdapProvider implements ThreePidProvider {
@Override
Optional<?> find(ThreePidType type, String threePid) {
log.info("Performing LDAP lookup ${threePid} of type ${type}")
LdapConnection conn = new LdapNetworkConnection(ldapCfg.getHost(), ldapCfg.getPort())
try {
conn.bind(ldapCfg.getBindDn(), ldapCfg.getBindPassword())