diff --git a/src/java/davmail/ldap/LdapConnection.java b/src/java/davmail/ldap/LdapConnection.java index a54cdda8..3c4d5735 100644 --- a/src/java/davmail/ldap/LdapConnection.java +++ b/src/java/davmail/ldap/LdapConnection.java @@ -639,6 +639,7 @@ public class LdapConnection extends AbstractConnection { */ protected void sendPersons(int currentMessageId, String baseContext, Map> persons, Set returningAttributes) throws IOException { boolean needObjectClasses = returningAttributes.contains("objectclass") || returningAttributes.size() == 0; + boolean iCalSearch = returningAttributes.contains("apple-serviceslocator"); boolean returnAllAttributes = returningAttributes.size() == 0; for (Map person : persons.values()) { boolean needDetails = returnAllAttributes; @@ -650,6 +651,10 @@ public class LdapConnection extends AbstractConnection { } } } + // iCal search, do not lookup details + if (iCalSearch) { + needDetails = false; + } // add detailed information if (needDetails) { @@ -671,6 +676,11 @@ public class LdapConnection extends AbstractConnection { ldapPerson.put(ldapAttribute, value); } } + // iCal: copy cn to sn + if (iCalSearch && ldapPerson.get("cn") != null) { + ldapPerson.put("sn", ldapPerson.get("cn")); + } + // Process all attributes which have static mappings for (Map.Entry entry : STATIC_ATTRIBUTE_MAP.entrySet()) {