From d07ee6fbc7246df45de21096b996f596535ed897 Mon Sep 17 00:00:00 2001 From: Karl Wright Date: Mon, 20 Mar 2017 11:58:46 +0000 Subject: [PATCH] HTTPCLIENT-1834: Fix up the conflicts with patch HTTPCLIENT-1662. git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1787727 13f79535-47bb-0310-9956-ffa450edef68 --- .../client5/http/impl/auth/CredSspScheme.java | 4 +-- .../http/impl/auth/NTLMEngineImpl.java | 29 ++----------------- 2 files changed, 5 insertions(+), 28 deletions(-) diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/CredSspScheme.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/CredSspScheme.java index 6a511d029..d2005849a 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/CredSspScheme.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/CredSspScheme.java @@ -318,7 +318,7 @@ public class CredSspScheme implements AuthScheme final int ntlmFlags = getNtlmFlags(); final ByteBuffer buf = allocateOutBuffer(); type1Message = new NTLMEngineImpl.Type1Message( - ntcredentials.getDomain(), ntcredentials.getWorkstation(), ntlmFlags); + ntcredentials.getNetbiosDomain(), ntcredentials.getWorkstation(), ntlmFlags); final byte[] ntlmNegoMessageEncoded = type1Message.getBytes(); final CredSspTsRequest req = CredSspTsRequest.createNegoToken( ntlmNegoMessageEncoded ); req.encode( buf ); @@ -336,7 +336,7 @@ public class CredSspScheme implements AuthScheme final Certificate peerServerCertificate = getPeerServerCertificate(); type3Message = new NTLMEngineImpl.Type3Message( - ntcredentials.getDomain(), + ntcredentials.getNetbiosDomain(), ntcredentials.getWorkstation(), ntcredentials.getUserName(), ntcredentials.getPassword(), diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/NTLMEngineImpl.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/NTLMEngineImpl.java index 7efa882f0..4c1356c2d 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/NTLMEngineImpl.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/NTLMEngineImpl.java @@ -1085,28 +1085,6 @@ final class NTLMEngineImpl implements NTLMEngine { } } - /** Strip dot suffix from a name */ - private static String stripDotSuffix(final String value) { - if (value == null) { - return null; - } - final int index = value.indexOf("."); - if (index != -1) { - return value.substring(0, index); - } - return value; - } - - /** Convert host to standard form */ - private static String convertHost(final String host) { - return stripDotSuffix(host); - } - - /** Convert domain to standard form */ - private static String convertDomain(final String domain) { - return stripDotSuffix(domain); - } - /** NTLM message generation, base class */ static class NTLMMessage { /** The current response */ @@ -1293,10 +1271,9 @@ final class NTLMEngineImpl implements NTLMEngine { super(); this.flags = ((flags == null)?getDefaultFlags():flags); - // Strip off domain name from the host! - final String unqualifiedHost = convertHost(host); - // Use only the base domain name! - final String unqualifiedDomain = convertDomain(domain); + // See HTTPCLIENT-1662 + final String unqualifiedHost = host; + final String unqualifiedDomain = domain; hostBytes = unqualifiedHost != null ? unqualifiedHost.getBytes(UNICODE_LITTLE_UNMARKED) : null;