From 9e779b282678ce352e373ea507591f29e9d2b93e Mon Sep 17 00:00:00 2001 From: mguessan Date: Tue, 27 Jul 2010 21:11:23 +0000 Subject: [PATCH] LDAP: fix regression on OSX directory request on iCal start: filter invalid imapUid condition git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1307 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- src/java/davmail/ldap/LdapConnection.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/java/davmail/ldap/LdapConnection.java b/src/java/davmail/ldap/LdapConnection.java index 09dbc1ac..596528c1 100644 --- a/src/java/davmail/ldap/LdapConnection.java +++ b/src/java/davmail/ldap/LdapConnection.java @@ -1091,11 +1091,19 @@ public class LdapConnection extends AbstractConnection { ExchangeSession.Condition condition = null; if (operator == LDAP_FILTER_EQUALITY) { - condition = session.isEqualTo(contactAttributeName, value); + try { + // check imapUid value + if ("imapUid".equals(contactAttributeName)) { + Integer.parseInt(value); + } + condition = session.isEqualTo(contactAttributeName, value); + } catch (NumberFormatException e) { + // ignore condition + } } else if ("*".equals(value)) { condition = session.not(session.isNull(contactAttributeName)); - // do not allow substring search on integer field imapUid - } else if (!"imapUid".equals(contactAttributeName)){ + // do not allow substring search on integer field imapUid + } else if (!"imapUid".equals(contactAttributeName)) { // endsWith not supported by exchange, convert to contains if (mode == LDAP_SUBSTRING_FINAL || mode == LDAP_SUBSTRING_ANY) { condition = session.contains(contactAttributeName, value); @@ -1387,7 +1395,7 @@ public class LdapConnection extends AbstractConnection { * * @param condition search filter * @param returningAttributes requested attributes - * @param maxCount maximum item count + * @param maxCount maximum item count * @return List of users * @throws IOException on error */