mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-13 03:02:22 -05:00
LDAP: Improve sizeLimit handling and ignore attributes
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1336 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
e883fad25e
commit
ec5063505d
@ -291,7 +291,9 @@ public class LdapConnection extends AbstractConnection {
|
||||
LDAP_TO_CONTACT_ATTRIBUTE_MAP.put("mozillahomestreet2", null);
|
||||
|
||||
LDAP_TO_CONTACT_ATTRIBUTE_MAP.put("labeleduri", null);
|
||||
|
||||
LDAP_TO_CONTACT_ATTRIBUTE_MAP.put("apple-generateduid", null);
|
||||
LDAP_TO_CONTACT_ATTRIBUTE_MAP.put("apple-serviceslocator", null);
|
||||
LDAP_TO_CONTACT_ATTRIBUTE_MAP.put("uidnumber", null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -963,7 +965,11 @@ public class LdapConnection extends AbstractConnection {
|
||||
Map<String, ExchangeSession.Contact> persons = null;
|
||||
|
||||
for (LdapFilter child : criteria) {
|
||||
Map<String, ExchangeSession.Contact> childFind = child.findInGAL(session, returningAttributes, sizeLimit);
|
||||
int currentSizeLimit = sizeLimit;
|
||||
if (persons != null) {
|
||||
currentSizeLimit -= persons.size();
|
||||
}
|
||||
Map<String, ExchangeSession.Contact> childFind = child.findInGAL(session, returningAttributes, currentSizeLimit);
|
||||
|
||||
if (childFind != null) {
|
||||
if (persons == null) {
|
||||
@ -1319,7 +1325,7 @@ public class LdapConnection extends AbstractConnection {
|
||||
}
|
||||
}
|
||||
if (!abandon && persons.size() < sizeLimit) {
|
||||
for (ExchangeSession.Contact person : ldapFilter.findInGAL(session, returningAttributes, sizeLimit).values()) {
|
||||
for (ExchangeSession.Contact person : ldapFilter.findInGAL(session, returningAttributes, sizeLimit - persons.size()).values()) {
|
||||
if (persons.size() == sizeLimit) {
|
||||
break;
|
||||
}
|
||||
|
@ -98,4 +98,20 @@ public class TestLdap extends AbstractExchangeSessionTestCase {
|
||||
assertEquals(session.getAlias(), attribute.get());
|
||||
assertNotNull(attributes.get("givenName"));
|
||||
}
|
||||
|
||||
public void testOSXSearch() throws NamingException {
|
||||
SearchControls searchControls = new SearchControls();
|
||||
searchControls.setSearchScope(SearchControls.ONELEVEL_SCOPE);
|
||||
searchControls.setReturningAttributes(new String[]{"uid", "jpegphoto", "postalcode", "mail", "sn", "apple-emailcontacts", "c", "street", "givenname", "l", "apple-user-picture", "telephonenumber", "cn", "st", "apple-imhandle"});
|
||||
NamingEnumeration<SearchResult> searchResults = ldapContext.search("cn=users, o=od", "(&(objectclass=inetOrgPerson)(|(givenname=Charles*)(|(uid=Charles*)(cn=Charles*))(sn=Charles*))(objectclass=shadowAccount)(objectclass=extensibleObject)(objectclass=posixAccount)(objectclass=apple-user))", searchControls);
|
||||
assertTrue(searchResults.hasMore());
|
||||
}
|
||||
|
||||
public void testAnotherOSXSearch() throws NamingException {
|
||||
SearchControls searchControls = new SearchControls();
|
||||
searchControls.setSearchScope(SearchControls.ONELEVEL_SCOPE);
|
||||
searchControls.setReturningAttributes(new String[]{"uid", "mail", "sn", "cn", "description", "apple-generateduid", "givenname", "apple-serviceslocator", "uidnumber"});
|
||||
NamingEnumeration<SearchResult> searchResults = ldapContext.search("cn=users, o=od",
|
||||
"(&(objectclass=inetOrgPerson)(objectclass=extensibleObject)(objectclass=apple-user)(|(|(uid=fair*)(cn=fair*))(givenname=fair*)(sn=fair*)(cn=fair*)(mail=fair*))(objectclass=posixAccount)(objectclass=shadowAccount))", searchControls);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user