mirror of
https://github.com/moparisthebest/davmail
synced 2025-01-12 22:18:11 -05:00
New NTLMv2 patch: provide fake workstation name and adjust Type3 message flags
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1611 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
404bcf96be
commit
9225305e48
@ -117,7 +117,7 @@ public final class DavGatewayHttpClientFacade {
|
|||||||
public static void setCredentials(HttpClient httpClient, String userName, String password) {
|
public static void setCredentials(HttpClient httpClient, String userName, String password) {
|
||||||
// some Exchange servers redirect to a different host for freebusy, use wide auth scope
|
// some Exchange servers redirect to a different host for freebusy, use wide auth scope
|
||||||
AuthScope authScope = new AuthScope(null, -1);
|
AuthScope authScope = new AuthScope(null, -1);
|
||||||
httpClient.getState().setCredentials(authScope, new NTCredentials(userName, password, "", ""));
|
httpClient.getState().setCredentials(authScope, new NTCredentials(userName, password, "UNKNOWN", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -200,11 +200,11 @@ public final class DavGatewayHttpClientFacade {
|
|||||||
if (backslashindex > 0) {
|
if (backslashindex > 0) {
|
||||||
httpClient.getState().setProxyCredentials(authScope,
|
httpClient.getState().setProxyCredentials(authScope,
|
||||||
new NTCredentials(proxyUser.substring(backslashindex + 1),
|
new NTCredentials(proxyUser.substring(backslashindex + 1),
|
||||||
proxyPassword, "",
|
proxyPassword, "UNKNOWN",
|
||||||
proxyUser.substring(0, backslashindex)));
|
proxyUser.substring(0, backslashindex)));
|
||||||
} else {
|
} else {
|
||||||
httpClient.getState().setProxyCredentials(authScope,
|
httpClient.getState().setProxyCredentials(authScope,
|
||||||
new NTCredentials(proxyUser, proxyPassword, "", ""));
|
new NTCredentials(proxyUser, proxyPassword, "UNKNOWN", ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -508,7 +508,7 @@ public final class DavGatewayHttpClientFacade {
|
|||||||
if (backSlashIndex >= 0) {
|
if (backSlashIndex >= 0) {
|
||||||
String domain = userName.substring(0, backSlashIndex);
|
String domain = userName.substring(0, backSlashIndex);
|
||||||
userName = userName.substring(backSlashIndex + 1);
|
userName = userName.substring(backSlashIndex + 1);
|
||||||
credentials = new NTCredentials(userName, credentials.getPassword(), "", domain);
|
credentials = new NTCredentials(userName, credentials.getPassword(), "UNKNOWN", domain);
|
||||||
httpClient.getState().setCredentials(authScope, credentials);
|
httpClient.getState().setCredentials(authScope, credentials);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,8 +186,10 @@ public class NTLMv2Scheme implements AuthScheme {
|
|||||||
response = EncodingUtil.getAsciiString(Base64.encodeBase64(type1Message.toByteArray()));
|
response = EncodingUtil.getAsciiString(Base64.encodeBase64(type1Message.toByteArray()));
|
||||||
this.state = TYPE1_MSG_GENERATED;
|
this.state = TYPE1_MSG_GENERATED;
|
||||||
} else {
|
} else {
|
||||||
|
int flags = NtlmFlags.NTLMSSP_NEGOTIATE_NTLM2 | NtlmFlags.NTLMSSP_NEGOTIATE_ALWAYS_SIGN |
|
||||||
|
NtlmFlags.NTLMSSP_NEGOTIATE_NTLM | NtlmFlags.NTLMSSP_NEGOTIATE_UNICODE;
|
||||||
Type3Message type3Message = new Type3Message(type2Message, ntcredentials.getPassword(),
|
Type3Message type3Message = new Type3Message(type2Message, ntcredentials.getPassword(),
|
||||||
ntcredentials.getDomain(), ntcredentials.getUserName(), ntcredentials.getHost(), 0);
|
ntcredentials.getDomain(), ntcredentials.getUserName(), ntcredentials.getHost(), flags);
|
||||||
response = EncodingUtil.getAsciiString(Base64.encodeBase64(type3Message.toByteArray()));
|
response = EncodingUtil.getAsciiString(Base64.encodeBase64(type3Message.toByteArray()));
|
||||||
this.state = TYPE3_MSG_GENERATED;
|
this.state = TYPE3_MSG_GENERATED;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user