From e53f62b415c98d8955be5fa9ef0357057a57f1c2 Mon Sep 17 00:00:00 2001 From: mguessan Date: Tue, 22 Dec 2009 13:18:28 +0000 Subject: [PATCH] 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 --- src/java/davmail/ldap/LdapConnection.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/java/davmail/ldap/LdapConnection.java b/src/java/davmail/ldap/LdapConnection.java index e81d8c73..99f716a0 100644 --- a/src/java/davmail/ldap/LdapConnection.java +++ b/src/java/davmail/ldap/LdapConnection.java @@ -568,10 +568,15 @@ public class LdapConnection extends AbstractConnection { nestedFilter = new CompoundFilter(ldapFilterType); 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 ldapFilterOperator = reqBer.parseSeq(seqSize); int subEnd = reqBer.getParsePosition() + seqSize[0]; nestedFilter.add(parseNestedFilter(reqBer, ldapFilterOperator, subEnd)); + } } } else { // simple filter @@ -1082,7 +1087,7 @@ public class LdapConnection extends AbstractConnection { if (galFindAttributeName != null) { // quick fix for cn=* filter - Map> galPersons = session.galFind(galFindAttributeName, "*".equals(value)?"A":value); + Map> galPersons = session.galFind(galFindAttributeName, "*".equals(value) ? "A" : value); if (operator == LDAP_FILTER_EQUALITY) { // Make sure only exact matches are returned