From 5911e0b43177bbe4cb1382ff0fef67209ca70850 Mon Sep 17 00:00:00 2001 From: mguessan Date: Wed, 8 Sep 2010 20:40:19 +0000 Subject: [PATCH] Caldav: accept login as alias in caldav principals path git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1428 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- src/java/davmail/caldav/CaldavConnection.java | 3 ++- src/java/davmail/exchange/ExchangeSession.java | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/java/davmail/caldav/CaldavConnection.java b/src/java/davmail/caldav/CaldavConnection.java index b0f7d5a3..1bb9c6b7 100644 --- a/src/java/davmail/caldav/CaldavConnection.java +++ b/src/java/davmail/caldav/CaldavConnection.java @@ -885,7 +885,8 @@ public class CaldavConnection extends AbstractConnection { public void sendPrincipal(CaldavRequest request, String prefix, String principal) throws IOException { // actual principal is email address String actualPrincipal = principal; - if ("users".equals(prefix) && session.getAlias().equalsIgnoreCase(principal)) { + if ("users".equals(prefix) && + (session.getAlias().equalsIgnoreCase(principal) || session.getAliasFromLogin().equalsIgnoreCase(principal))) { actualPrincipal = session.getEmail(); } diff --git a/src/java/davmail/exchange/ExchangeSession.java b/src/java/davmail/exchange/ExchangeSession.java index c8440b21..91988b3e 100644 --- a/src/java/davmail/exchange/ExchangeSession.java +++ b/src/java/davmail/exchange/ExchangeSession.java @@ -2663,14 +2663,14 @@ public abstract class ExchangeSession { * * @return user name */ - protected String getAliasFromLogin() { + public String getAliasFromLogin() { // login is email, not alias if (this.userName.indexOf('@') >= 0) { return null; } String result = this.userName; // remove domain name - int index = result.indexOf('\\'); + int index = Math.max(result.indexOf('\\'), result.indexOf('/')); if (index >= 0) { result = result.substring(index + 1); }