1
0
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:
mguessan 2011-01-14 09:42:25 +00:00
parent 404bcf96be
commit 9225305e48
2 changed files with 7 additions and 5 deletions

View File

@ -117,7 +117,7 @@ public final class DavGatewayHttpClientFacade {
public static void setCredentials(HttpClient httpClient, String userName, String password) {
// some Exchange servers redirect to a different host for freebusy, use wide auth scope
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) {
httpClient.getState().setProxyCredentials(authScope,
new NTCredentials(proxyUser.substring(backslashindex + 1),
proxyPassword, "",
proxyPassword, "UNKNOWN",
proxyUser.substring(0, backslashindex)));
} else {
httpClient.getState().setProxyCredentials(authScope,
new NTCredentials(proxyUser, proxyPassword, "", ""));
new NTCredentials(proxyUser, proxyPassword, "UNKNOWN", ""));
}
}
}
@ -508,7 +508,7 @@ public final class DavGatewayHttpClientFacade {
if (backSlashIndex >= 0) {
String domain = userName.substring(0, backSlashIndex);
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);
}

View File

@ -186,8 +186,10 @@ public class NTLMv2Scheme implements AuthScheme {
response = EncodingUtil.getAsciiString(Base64.encodeBase64(type1Message.toByteArray()));
this.state = TYPE1_MSG_GENERATED;
} 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(),
ntcredentials.getDomain(), ntcredentials.getUserName(), ntcredentials.getHost(), 0);
ntcredentials.getDomain(), ntcredentials.getUserName(), ntcredentials.getHost(), flags);
response = EncodingUtil.getAsciiString(Base64.encodeBase64(type3Message.toByteArray()));
this.state = TYPE3_MSG_GENERATED;
}