1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 19:22:22 -05:00

LDAP: fix Kontact ldap filter parsing, allow LDAP_FILTER_PRESENT in subfilter

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@893 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-12-22 13:18:28 +00:00
parent 5df74c320b
commit e53f62b415

View File

@ -568,10 +568,15 @@ public class LdapConnection extends AbstractConnection {
nestedFilter = new CompoundFilter(ldapFilterType); nestedFilter = new CompoundFilter(ldapFilterType);
while (reqBer.getParsePosition() < end && reqBer.bytesLeft() > 0) { while (reqBer.getParsePosition() < end && reqBer.bytesLeft() > 0) {
if (reqBer.peekByte() == LDAP_FILTER_PRESENT) {
String attributeName = reqBer.parseStringWithTag(LDAP_FILTER_PRESENT, isLdapV3(), null).toLowerCase();
nestedFilter.add(new SimpleFilter(attributeName));
} else {
int[] seqSize = new int[1]; int[] seqSize = new int[1];
int ldapFilterOperator = reqBer.parseSeq(seqSize); int ldapFilterOperator = reqBer.parseSeq(seqSize);
int subEnd = reqBer.getParsePosition() + seqSize[0]; int subEnd = reqBer.getParsePosition() + seqSize[0];
nestedFilter.add(parseNestedFilter(reqBer, ldapFilterOperator, subEnd)); nestedFilter.add(parseNestedFilter(reqBer, ldapFilterOperator, subEnd));
}
} }
} else { } else {
// simple filter // simple filter
@ -1082,7 +1087,7 @@ public class LdapConnection extends AbstractConnection {
if (galFindAttributeName != null) { if (galFindAttributeName != null) {
// quick fix for cn=* filter // quick fix for cn=* filter
Map<String, Map<String, String>> galPersons = session.galFind(galFindAttributeName, "*".equals(value)?"A":value); Map<String, Map<String, String>> galPersons = session.galFind(galFindAttributeName, "*".equals(value) ? "A" : value);
if (operator == LDAP_FILTER_EQUALITY) { if (operator == LDAP_FILTER_EQUALITY) {
// Make sure only exact matches are returned // Make sure only exact matches are returned