Update LDAP library to fix auth filter bug

This commit is contained in:
Maxime Dor
2017-09-17 14:01:38 +02:00
parent 23f717579e
commit 221d823f3b
3 changed files with 4 additions and 3 deletions

View File

@@ -227,8 +227,6 @@ key.path: '/path/to/sign.key'
#
# Example: (memberOf=CN=Matrix Users,CN=Users,DC=example,DC=org)
#
# /!\ Currently NOT supported due to a possible bug in LDAP library /!\
#
#ldap.auth.filter: ''

View File

@@ -83,7 +83,7 @@ dependencies {
compile 'net.i2p.crypto:eddsa:0.1.0'
// LDAP connector
compile 'org.apache.directory.api:api-all:1.0.0-RC2'
compile 'org.apache.directory.api:api-all:1.0.0'
// DNS lookups
compile 'dnsjava:dnsjava:2.1.8'

View File

@@ -64,6 +64,9 @@ public class LdapAuthProvider extends LdapGenericBackend implements Authenticato
MatrixID mxIdExt = new MatrixID(id);
String userFilterValue = StringUtils.equals(LdapThreePidProvider.UID, uidType) ? mxIdExt.getLocalPart() : mxIdExt.getId();
String userFilter = "(" + getCfg().getAttribute().getUid().getValue() + "=" + userFilterValue + ")";
if (!StringUtils.isBlank(getCfg().getAuth().getFilter())) {
userFilter = "(&" + getCfg().getAuth().getFilter() + userFilter + ")";
}
EntryCursor cursor = conn.search(getCfg().getConn().getBaseDn(), userFilter, SearchScope.SUBTREE, getUidAttribute(), getCfg().getAttribute().getName());
try {
while (cursor.next()) {