1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 11:12:22 -05:00

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
This commit is contained in:
mguessan 2010-09-08 20:40:19 +00:00
parent 146790a237
commit 5911e0b431
2 changed files with 4 additions and 3 deletions

View File

@ -885,7 +885,8 @@ public class CaldavConnection extends AbstractConnection {
public void sendPrincipal(CaldavRequest request, String prefix, String principal) throws IOException { public void sendPrincipal(CaldavRequest request, String prefix, String principal) throws IOException {
// actual principal is email address // actual principal is email address
String actualPrincipal = principal; 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(); actualPrincipal = session.getEmail();
} }

View File

@ -2663,14 +2663,14 @@ public abstract class ExchangeSession {
* *
* @return user name * @return user name
*/ */
protected String getAliasFromLogin() { public String getAliasFromLogin() {
// login is email, not alias // login is email, not alias
if (this.userName.indexOf('@') >= 0) { if (this.userName.indexOf('@') >= 0) {
return null; return null;
} }
String result = this.userName; String result = this.userName;
// remove domain name // remove domain name
int index = result.indexOf('\\'); int index = Math.max(result.indexOf('\\'), result.indexOf('/'));
if (index >= 0) { if (index >= 0) {
result = result.substring(index + 1); result = result.substring(index + 1);
} }