1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-14 03:32:22 -05:00

LDAP: implement cn=* filter for Evolution

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@822 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-11-05 00:11:38 +00:00
parent b357720b7e
commit e839c623bd

View File

@ -550,9 +550,6 @@ public class LdapConnection extends AbstractConnection {
if (reqBer.peekByte() == LDAP_FILTER_PRESENT) { if (reqBer.peekByte() == LDAP_FILTER_PRESENT) {
String attributeName = reqBer.parseStringWithTag(LDAP_FILTER_PRESENT, isLdapV3(), null).toLowerCase(); String attributeName = reqBer.parseStringWithTag(LDAP_FILTER_PRESENT, isLdapV3(), null).toLowerCase();
ldapFilter = new SimpleFilter(attributeName); ldapFilter = new SimpleFilter(attributeName);
if (!"objectclass".equals(attributeName)) {
DavGatewayTray.warn(new BundleMessage("LOG_LDAP_UNSUPPORTED_FILTER", ldapFilter.toString()));
}
} else { } else {
int[] seqSize = new int[1]; int[] seqSize = new int[1];
int ldapFilterType = reqBer.parseSeq(seqSize); int ldapFilterType = reqBer.parseSeq(seqSize);
@ -1036,6 +1033,8 @@ public class LdapConnection extends AbstractConnection {
if (operator == LDAP_FILTER_EQUALITY) { if (operator == LDAP_FILTER_EQUALITY) {
buffer.append("='").append(value).append('\''); buffer.append("='").append(value).append('\'');
} else if ("*".equals(value)) {
buffer.append(" is not null");
} else { } else {
buffer.append(" LIKE '"); buffer.append(" LIKE '");
if (mode == LDAP_SUBSTRING_FINAL || mode == LDAP_SUBSTRING_ANY) { if (mode == LDAP_SUBSTRING_FINAL || mode == LDAP_SUBSTRING_ANY) {
@ -1082,7 +1081,8 @@ public class LdapConnection extends AbstractConnection {
String galFindAttributeName = getGalFindAttributeName(); String galFindAttributeName = getGalFindAttributeName();
if (galFindAttributeName != null) { if (galFindAttributeName != null) {
Map<String, Map<String, String>> galPersons = session.galFind(galFindAttributeName, value); // quick fix for cn=* filter
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