8007761: NTLM coding errors
authorweijun
Sat, 09 Feb 2013 16:43:58 +0800
changeset 15650 04ebec48c104
parent 15649 f6bd3d34f844
child 15651 7a8fde31786a
8007761: NTLM coding errors Reviewed-by: chegar
jdk/src/share/classes/com/sun/security/ntlm/Client.java
jdk/src/share/classes/com/sun/security/ntlm/NTLM.java
--- a/jdk/src/share/classes/com/sun/security/ntlm/Client.java	Sat Feb 09 16:43:49 2013 +0800
+++ b/jdk/src/share/classes/com/sun/security/ntlm/Client.java	Sat Feb 09 16:43:58 2013 +0800
@@ -138,8 +138,7 @@
             domain = domainFromServer;
         }
         if (domain == null) {
-            throw new NTLMException(NTLMException.NO_DOMAIN_INFO,
-                    "No domain info");
+            domain = "";
         }
 
         int flags = 0x88200 | (inputFlags & 3);
--- a/jdk/src/share/classes/com/sun/security/ntlm/NTLM.java	Sat Feb 09 16:43:49 2013 +0800
+++ b/jdk/src/share/classes/com/sun/security/ntlm/NTLM.java	Sat Feb 09 16:43:58 2013 +0800
@@ -136,10 +136,10 @@
 
         int readInt(int offset) throws NTLMException {
             try {
-                return internal[offset] & 0xff +
-                        (internal[offset+1] & 0xff << 8) +
-                        (internal[offset+2] & 0xff << 16) +
-                        (internal[offset+3] & 0xff << 24);
+                return (internal[offset] & 0xff) +
+                        ((internal[offset+1] & 0xff) << 8) +
+                        ((internal[offset+2] & 0xff) << 16) +
+                        ((internal[offset+3] & 0xff) << 24);
             } catch (ArrayIndexOutOfBoundsException ex) {
                 throw new NTLMException(NTLMException.PACKET_READ_ERROR,
                         "Input message incorrect size");
@@ -148,8 +148,8 @@
 
         int readShort(int offset) throws NTLMException {
             try {
-                return internal[offset] & 0xff +
-                        (internal[offset+1] & 0xff << 8);
+                return (internal[offset] & 0xff) +
+                        ((internal[offset+1] & 0xff << 8));
             } catch (ArrayIndexOutOfBoundsException ex) {
                 throw new NTLMException(NTLMException.PACKET_READ_ERROR,
                         "Input message incorrect size");