Fix LDAP filter parser : Thunderbird sends values with space as separate strings, rebuild value

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@213 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2008-12-05 18:25:09 +00:00
parent 6618f22c34
commit d66bd4b38c
2 changed files with 16 additions and 6 deletions

View File

@ -399,13 +399,23 @@ public class LdapConnection extends AbstractConnection {
protected void parseSimpleFilter(BerDecoder reqBer, Map<String, String> criteria) throws IOException {
String attributeName = reqBer.parseString(isLdapV3()).toLowerCase();
/*LBER_SEQUENCE*/
reqBer.parseSeq(null);
int ldapFilterMode = reqBer.peekByte();
String value = reqBer.parseStringWithTag(ldapFilterMode, isLdapV3(), null);
String exchangeAttributeName = CRITERIA_MAP.get(attributeName);
// Thunderbird sends values with space as separate strings, rebuild value
StringBuilder value = new StringBuilder();
int[] seqSize = new int[1];
/*LBER_SEQUENCE*/
reqBer.parseSeq(seqSize);
int end = reqBer.getParsePosition() + seqSize[0];
while (reqBer.getParsePosition() < end && reqBer.bytesLeft() > 0) {
int ldapFilterMode = reqBer.peekByte();
if (value.length() > 0) {
value.append(' ');
}
value.append(reqBer.parseStringWithTag(ldapFilterMode, isLdapV3(), null));
}
if (exchangeAttributeName != null) {
criteria.put(exchangeAttributeName, value);
criteria.put(exchangeAttributeName, value.toString());
} else {
DavGatewayTray.warn("Unsupported filter attribute: " + attributeName);
}

View File

@ -32,7 +32,7 @@ public class TestExchangeSession {
messageTest.write(System.out);
System.out.println("Elapsed time " + (System.currentTimeMillis() - startTime) + " ms");
session.purgeOldestTrashMessages();
session.purgeOldestTrashAndSentMessages();
} catch (Exception e) {
e.printStackTrace();