mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-13 03:02:22 -05:00
More session creation enhancements, fix public folder test when /public is 403
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1376 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
c5722222bd
commit
7807ec7fd4
@ -85,7 +85,7 @@ public abstract class ExchangeSession {
|
||||
|
||||
protected static final int FREE_BUSY_INTERVAL = 15;
|
||||
|
||||
protected static final String PUBLIC_ROOT = "/public";
|
||||
protected static final String PUBLIC_ROOT = "/public/";
|
||||
protected static final String CALENDAR = "calendar";
|
||||
/**
|
||||
* Contacts folder logical name
|
||||
|
@ -479,7 +479,7 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
}
|
||||
} else {
|
||||
// Exchange 2007 : get alias and email from options page
|
||||
getEmailAndAliasFromOptions();;
|
||||
getEmailAndAliasFromOptions();
|
||||
// build standard mailbox link with email
|
||||
mailPath = "/exchange/" + email + '/';
|
||||
}
|
||||
@ -487,7 +487,7 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
if (mailPath == null || email == null) {
|
||||
throw new DavMailAuthenticationException("EXCEPTION_AUTHENTICATION_FAILED_PASSWORD_EXPIRED");
|
||||
}
|
||||
LOGGER.debug("Current user email is " + email + ", mailPath is " + mailPath);
|
||||
LOGGER.debug("Current user email is " + email + ", alias is " + alias + ", mailPath is " + mailPath);
|
||||
rootPath = mailPath.substring(0, mailPath.lastIndexOf('/', mailPath.length() - 2) + 1);
|
||||
}
|
||||
|
||||
@ -522,16 +522,12 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
if (email == null) {
|
||||
LOGGER.debug("Unable to get user email with alias " + mailBoxPath
|
||||
+ " or " + getAliasFromLogin()
|
||||
+ " or " +getAliasFromMailboxDisplayName()
|
||||
+ " or " + alias
|
||||
);
|
||||
// last failover: build email from domain name and mailbox display name
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
// most reliable alias
|
||||
alias = getAliasFromMailboxDisplayName();
|
||||
if (alias == null) {
|
||||
alias = getAliasFromLogin();
|
||||
}
|
||||
if (alias != null) {
|
||||
alias = mailBoxPath;
|
||||
buffer.append(alias);
|
||||
if (alias.indexOf('@') < 0) {
|
||||
buffer.append('@');
|
||||
@ -540,7 +536,6 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
buffer.append(hostName.substring(dotIndex + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
email = buffer.toString();
|
||||
}
|
||||
}
|
||||
@ -595,7 +590,7 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
*/
|
||||
public String getEmail(String alias) {
|
||||
String emailResult = null;
|
||||
if (alias != null) {
|
||||
if (alias != null && !disableGalFind) {
|
||||
try {
|
||||
Map<String, Map<String, String>> results = galFind("&AN=" + URIUtil.encodeWithinQuery(alias));
|
||||
Map<String, String> result = results.get(alias.toLowerCase());
|
||||
@ -603,6 +598,8 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
emailResult = result.get("EM");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
// galfind not available
|
||||
disableGalFind = true;
|
||||
LOGGER.debug("getEmail(" + alias + ") failed");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user