mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-13 11:12: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 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";
|
protected static final String CALENDAR = "calendar";
|
||||||
/**
|
/**
|
||||||
* Contacts folder logical name
|
* Contacts folder logical name
|
||||||
|
@ -479,7 +479,7 @@ public class DavExchangeSession extends ExchangeSession {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Exchange 2007 : get alias and email from options page
|
// Exchange 2007 : get alias and email from options page
|
||||||
getEmailAndAliasFromOptions();;
|
getEmailAndAliasFromOptions();
|
||||||
// build standard mailbox link with email
|
// build standard mailbox link with email
|
||||||
mailPath = "/exchange/" + email + '/';
|
mailPath = "/exchange/" + email + '/';
|
||||||
}
|
}
|
||||||
@ -487,7 +487,7 @@ public class DavExchangeSession extends ExchangeSession {
|
|||||||
if (mailPath == null || email == null) {
|
if (mailPath == null || email == null) {
|
||||||
throw new DavMailAuthenticationException("EXCEPTION_AUTHENTICATION_FAILED_PASSWORD_EXPIRED");
|
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);
|
rootPath = mailPath.substring(0, mailPath.lastIndexOf('/', mailPath.length() - 2) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -522,23 +522,18 @@ public class DavExchangeSession extends ExchangeSession {
|
|||||||
if (email == null) {
|
if (email == null) {
|
||||||
LOGGER.debug("Unable to get user email with alias " + mailBoxPath
|
LOGGER.debug("Unable to get user email with alias " + mailBoxPath
|
||||||
+ " or " + getAliasFromLogin()
|
+ " or " + getAliasFromLogin()
|
||||||
+ " or " +getAliasFromMailboxDisplayName()
|
+ " or " + alias
|
||||||
);
|
);
|
||||||
// last failover: build email from domain name and mailbox display name
|
// last failover: build email from domain name and mailbox display name
|
||||||
StringBuilder buffer = new StringBuilder();
|
StringBuilder buffer = new StringBuilder();
|
||||||
// most reliable alias
|
// most reliable alias
|
||||||
alias = getAliasFromMailboxDisplayName();
|
alias = mailBoxPath;
|
||||||
if (alias == null) {
|
buffer.append(alias);
|
||||||
alias = getAliasFromLogin();
|
if (alias.indexOf('@') < 0) {
|
||||||
}
|
buffer.append('@');
|
||||||
if (alias != null) {
|
int dotIndex = hostName.indexOf('.');
|
||||||
buffer.append(alias);
|
if (dotIndex >= 0) {
|
||||||
if (alias.indexOf('@') < 0) {
|
buffer.append(hostName.substring(dotIndex + 1));
|
||||||
buffer.append('@');
|
|
||||||
int dotIndex = hostName.indexOf('.');
|
|
||||||
if (dotIndex >= 0) {
|
|
||||||
buffer.append(hostName.substring(dotIndex + 1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
email = buffer.toString();
|
email = buffer.toString();
|
||||||
@ -595,7 +590,7 @@ public class DavExchangeSession extends ExchangeSession {
|
|||||||
*/
|
*/
|
||||||
public String getEmail(String alias) {
|
public String getEmail(String alias) {
|
||||||
String emailResult = null;
|
String emailResult = null;
|
||||||
if (alias != null) {
|
if (alias != null && !disableGalFind) {
|
||||||
try {
|
try {
|
||||||
Map<String, Map<String, String>> results = galFind("&AN=" + URIUtil.encodeWithinQuery(alias));
|
Map<String, Map<String, String>> results = galFind("&AN=" + URIUtil.encodeWithinQuery(alias));
|
||||||
Map<String, String> result = results.get(alias.toLowerCase());
|
Map<String, String> result = results.get(alias.toLowerCase());
|
||||||
@ -603,6 +598,8 @@ public class DavExchangeSession extends ExchangeSession {
|
|||||||
emailResult = result.get("EM");
|
emailResult = result.get("EM");
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
// galfind not available
|
||||||
|
disableGalFind = true;
|
||||||
LOGGER.debug("getEmail(" + alias + ") failed");
|
LOGGER.debug("getEmail(" + alias + ") failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user