hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1425332 - /httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java
Date Sat, 22 Dec 2012 18:29:49 GMT
Author: kwright
Date: Sat Dec 22 18:29:45 2012
New Revision: 1425332

URL: http://svn.apache.org/viewvc?rev=1425332&view=rev
Log:
Use flags comparable to those used by IE 9.  Test on all settings of the LAN Manager Authentication
Security Level policy.  Part of HTTPCLIENT-1268.

Modified:
    httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java

Modified: httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java?rev=1425332&r1=1425331&r2=1425332&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java
(original)
+++ httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java
Sat Dec 22 18:29:45 2012
@@ -966,7 +966,7 @@ final class NTLMEngineImpl implements NT
         String getResponse() {
             // Now, build the message. Calculate its length first, including
             // signature or type.
-            int finalLength = 32 + 8 + hostBytes.length + domainBytes.length;
+            int finalLength = 32 + 8 /*+ hostBytes.length + domainBytes.length */;
 
             // Set up the response. This will initialize the signature, message
             // type, and flags.
@@ -974,11 +974,11 @@ final class NTLMEngineImpl implements NT
 
             // Flags. These are the complete set of flags we support.
             addULong(
-                    FLAG_WORKSTATION_PRESENT |
-                    FLAG_DOMAIN_PRESENT |
+                    //FLAG_WORKSTATION_PRESENT |
+                    //FLAG_DOMAIN_PRESENT |
 
                     // Required flags
-                    //FLAG_REQUEST_LAN_MANAGER_KEY |
+                    FLAG_REQUEST_LAN_MANAGER_KEY |
                     FLAG_REQUEST_NTLMv1 |
                     FLAG_REQUEST_NTLM2_SESSION |
 
@@ -986,28 +986,27 @@ final class NTLMEngineImpl implements NT
                     FLAG_REQUEST_VERSION |
 
                     // Recommended privacy settings
-                    //FLAG_REQUEST_ALWAYS_SIGN |
+                    FLAG_REQUEST_ALWAYS_SIGN |
                     //FLAG_REQUEST_SEAL |
-                    //FLAG_REQUEST_SIGN |
+                    FLAG_REQUEST_SIGN |
 
                     // These must be set according to documentation, based on use of SEAL
above
-                    //FLAG_REQUEST_128BIT_KEY_EXCH |
-                    //FLAG_REQUEST_56BIT_ENCRYPTION |
-                    //FLAG_REQUEST_EXPLICIT_KEY_EXCH |
+                    FLAG_REQUEST_128BIT_KEY_EXCH |
+                    FLAG_REQUEST_56BIT_ENCRYPTION |
+                    FLAG_REQUEST_EXPLICIT_KEY_EXCH |
 
-                    FLAG_REQUEST_UNICODE_ENCODING |
-                    FLAG_REQUEST_TARGET);
+                    FLAG_REQUEST_UNICODE_ENCODING);
 
             // Domain length (two times).
-            addUShort(domainBytes.length);
-            addUShort(domainBytes.length);
+            addUShort(/*domainBytes.length*/0);
+            addUShort(/*domainBytes.length*/0);
 
             // Domain offset.
-            addULong(hostBytes.length + 32 + 8);
+            addULong(/*hostBytes.length +*/ 32 + 8);
 
             // Host length (two times).
-            addUShort(hostBytes.length);
-            addUShort(hostBytes.length);
+            addUShort(/*hostBytes.length*/0);
+            addUShort(/*hostBytes.length*/0);
 
             // Host offset (always 32 + 8).
             addULong(32 + 8);
@@ -1017,14 +1016,14 @@ final class NTLMEngineImpl implements NT
             // Build
             addULong(2600);
             // NTLM revision
-            addUShort(15);
+            addUShort(0x0f00);
 
 
             // Host (workstation) String.
-            addBytes(hostBytes);
+            //addBytes(hostBytes);
 
             // Domain String.
-            addBytes(domainBytes);
+            //addBytes(domainBytes);
 
 
             return super.getResponse();
@@ -1151,7 +1150,7 @@ final class NTLMEngineImpl implements NT
             try {
                 // This conditional may not work on Windows Server 2008 R2 and above, where
it has not yet
                 // been tested
-                if (((type2Flags & FLAG_REQUEST_NTLM2_SESSION) == 0) &&
+                if (((type2Flags & FLAG_TARGETINFO_PRESENT) != 0) &&
                     targetInformation != null && target != null) {
                     // NTLMv2
                     ntResp = gen.getNTLMv2Response();
@@ -1301,8 +1300,9 @@ final class NTLMEngineImpl implements NT
                     (type2Flags & FLAG_REQUEST_56BIT_ENCRYPTION) |
                     (type2Flags & FLAG_REQUEST_EXPLICIT_KEY_EXCH) |
 
-                    FLAG_REQUEST_UNICODE_ENCODING |
-                    FLAG_REQUEST_TARGET
+                    (type2Flags & FLAG_TARGETINFO_PRESENT) |
+                    (type2Flags & FLAG_REQUEST_UNICODE_ENCODING) |
+                    (type2Flags & FLAG_REQUEST_TARGET)
             );
 
             // Version
@@ -1310,7 +1310,7 @@ final class NTLMEngineImpl implements NT
             // Build
             addULong(2600);
             // NTLM revision
-            addUShort(15);
+            addUShort(0x0f00);
 
             // Add the actual data
             addBytes(lmResp);



Mime
View raw message