mirror of
https://github.com/moparisthebest/davmail
synced 2025-01-05 18:58:02 -05:00
LDAP: fix regression on iCal 3 search completion
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1434 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
51bad68fb5
commit
b8e4570681
@ -318,6 +318,12 @@ public class DavExchangeSession extends ExchangeSession {
|
|||||||
buildGalfindContact(contact, result);
|
buildGalfindContact(contact, result);
|
||||||
if (needGalLookup(searchAttributeName, returningAttributes)) {
|
if (needGalLookup(searchAttributeName, returningAttributes)) {
|
||||||
galLookup(contact);
|
galLookup(contact);
|
||||||
|
// iCal fix to suit both iCal 3 and 4: move cn to sn, remove cn
|
||||||
|
} else if (returningAttributes.contains("apple-serviceslocator")) {
|
||||||
|
if (contact.get("cn") != null && returningAttributes.contains("sn")) {
|
||||||
|
contact.put("sn", contact.get("cn"));
|
||||||
|
contact.remove("cn");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (condition.isMatch(contact)) {
|
if (condition.isMatch(contact)) {
|
||||||
contacts.put(contact.getName().toLowerCase(), contact);
|
contacts.put(contact.getName().toLowerCase(), contact);
|
||||||
|
@ -22,7 +22,6 @@ import davmail.DavGateway;
|
|||||||
import davmail.Settings;
|
import davmail.Settings;
|
||||||
import davmail.exchange.AbstractExchangeSessionTestCase;
|
import davmail.exchange.AbstractExchangeSessionTestCase;
|
||||||
import davmail.exchange.ExchangeSessionFactory;
|
import davmail.exchange.ExchangeSessionFactory;
|
||||||
import org.apache.log4j.Level;
|
|
||||||
|
|
||||||
import javax.naming.NamingEnumeration;
|
import javax.naming.NamingEnumeration;
|
||||||
import javax.naming.NamingException;
|
import javax.naming.NamingException;
|
||||||
@ -138,4 +137,12 @@ public class TestLdap extends AbstractExchangeSessionTestCase {
|
|||||||
searchControls.setReturningAttributes(new String[]{"sn"});
|
searchControls.setReturningAttributes(new String[]{"sn"});
|
||||||
NamingEnumeration<SearchResult> searchResults = ldapContext.search("ou=people", "(cn=*)", searchControls);
|
NamingEnumeration<SearchResult> searchResults = ldapContext.search("ou=people", "(cn=*)", searchControls);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testSearchByCnReturnGivenName() throws NamingException {
|
||||||
|
SearchControls searchControls = new SearchControls();
|
||||||
|
searchControls.setSearchScope(SearchControls.ONELEVEL_SCOPE);
|
||||||
|
searchControls.setReturningAttributes(new String[]{"givenName"});
|
||||||
|
NamingEnumeration<SearchResult> searchResults = ldapContext.search("ou=people", "(cn=*a*)", searchControls);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user