mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-13 03:02:22 -05:00
LDAP: fix DIGEST-MD5 SASL authentication for OSX Lion
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1798 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
34f31bbd44
commit
44c87d9c05
@ -96,6 +96,16 @@ public final class ExchangeSessionFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String convertUserName(String userName) {
|
||||||
|
String result = userName;
|
||||||
|
// prepend default windows domain prefix
|
||||||
|
String defaultDomain = Settings.getProperty("davmail.defaultDomain");
|
||||||
|
if (userName.indexOf('\\') < 0 && defaultDomain != null) {
|
||||||
|
result = defaultDomain + '\\' + userName;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create authenticated Exchange session
|
* Create authenticated Exchange session
|
||||||
*
|
*
|
||||||
@ -109,12 +119,7 @@ public final class ExchangeSessionFactory {
|
|||||||
ExchangeSession session = null;
|
ExchangeSession session = null;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// prepend default windows domain prefix
|
PoolKey poolKey = new PoolKey(baseUrl, convertUserName(userName), password);
|
||||||
String defaultDomain = Settings.getProperty("davmail.defaultDomain");
|
|
||||||
if (userName.indexOf('\\') < 0 && defaultDomain != null) {
|
|
||||||
userName = defaultDomain + '\\' + userName;
|
|
||||||
}
|
|
||||||
PoolKey poolKey = new PoolKey(baseUrl, userName, password);
|
|
||||||
|
|
||||||
synchronized (LOCK) {
|
synchronized (LOCK) {
|
||||||
session = POOL_MAP.get(poolKey);
|
session = POOL_MAP.get(poolKey);
|
||||||
@ -263,8 +268,9 @@ public final class ExchangeSessionFactory {
|
|||||||
* @return user password
|
* @return user password
|
||||||
*/
|
*/
|
||||||
public static String getUserPassword(String userName) {
|
public static String getUserPassword(String userName) {
|
||||||
|
String fullUserName = convertUserName(userName);
|
||||||
for (PoolKey poolKey : POOL_MAP.keySet()) {
|
for (PoolKey poolKey : POOL_MAP.keySet()) {
|
||||||
if (poolKey.userName.equals(userName)) {
|
if (poolKey.userName.equals(fullUserName)) {
|
||||||
return poolKey.password;
|
return poolKey.password;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -510,7 +510,7 @@ public class LdapConnection extends AbstractConnection {
|
|||||||
protected static final byte[] EMPTY_BYTE_ARRAY= new byte[0];
|
protected static final byte[] EMPTY_BYTE_ARRAY= new byte[0];
|
||||||
|
|
||||||
protected void handleRequest(byte[] inbuf, int offset) throws IOException {
|
protected void handleRequest(byte[] inbuf, int offset) throws IOException {
|
||||||
dumpBer(inbuf, offset);
|
//dumpBer(inbuf, offset);
|
||||||
BerDecoder reqBer = new BerDecoder(inbuf, 0, offset);
|
BerDecoder reqBer = new BerDecoder(inbuf, 0, offset);
|
||||||
int currentMessageId = 0;
|
int currentMessageId = 0;
|
||||||
try {
|
try {
|
||||||
@ -575,7 +575,7 @@ public class LdapConnection extends AbstractConnection {
|
|||||||
} else {
|
} else {
|
||||||
Map<String, String> properties = new HashMap<String, String>();
|
Map<String, String> properties = new HashMap<String, String>();
|
||||||
properties.put("javax.security.sasl.qop", "auth,auth-int");
|
properties.put("javax.security.sasl.qop", "auth,auth-int");
|
||||||
saslServer = Sasl.createSaslServer(mechanism, "ldap", InetAddress.getLocalHost().getHostName(), properties, callbackHandler);
|
saslServer = Sasl.createSaslServer(mechanism, "ldap", client.getLocalAddress().getHostAddress(), properties, callbackHandler);
|
||||||
serverResponse = saslServer.evaluateResponse(EMPTY_BYTE_ARRAY);
|
serverResponse = saslServer.evaluateResponse(EMPTY_BYTE_ARRAY);
|
||||||
status = LDAP_SASL_BIND_IN_PROGRESS;
|
status = LDAP_SASL_BIND_IN_PROGRESS;
|
||||||
}
|
}
|
||||||
@ -792,6 +792,7 @@ public class LdapConnection extends AbstractConnection {
|
|||||||
Map<String, Object> attributes = new HashMap<String, Object>();
|
Map<String, Object> attributes = new HashMap<String, Object>();
|
||||||
attributes.put("objectClass", "top");
|
attributes.put("objectClass", "top");
|
||||||
attributes.put("namingContexts", NAMING_CONTEXTS);
|
attributes.put("namingContexts", NAMING_CONTEXTS);
|
||||||
|
//attributes.put("supportedsaslmechanisms", "PLAIN");
|
||||||
|
|
||||||
sendEntry(currentMessageId, "Root DSE", attributes);
|
sendEntry(currentMessageId, "Root DSE", attributes);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user