From 73b2835a822a52145b077013c190c7b1c5143e38 Mon Sep 17 00:00:00 2001 From: Felix Schumacher Date: Wed, 6 Aug 2008 16:25:50 +0200 Subject: [PATCH] jcifs-1.1.4 from tgz Tue Dec 7 18:34:35 EST 2004 jcifs-1.1.4 released Two bugs regarding the upcasing of domain and username fields with LMv2 authentication (used with lmCompatibility = 3) have been fixed. Additionally the firstCalledName/nextCalledName methods changed in 1.1.0 have been changed back to the old behavior. The change was not warranted as it did not emulate Windows behavior. --- README.txt | 9 +++++++++ build.xml | 4 ++-- src/jcifs/netbios/NbtAddress.java | 32 +++++++++++++++++++++++++++---- src/jcifs/ntlmssp/Type3Message.java | 2 +- src/jcifs/smb/SmbComSessionSetupAndX.java | 2 +- 5 files changed, 41 insertions(+), 8 deletions(-) diff --git a/README.txt b/README.txt index 3ba27d5..ab00b5b 100644 --- a/README.txt +++ b/README.txt @@ -1,3 +1,12 @@ +Tue Dec 7 18:34:35 EST 2004 +jcifs-1.1.4 released + +Two bugs regarding the upcasing of domain and username fields with LMv2 +authentication (used with lmCompatibility = 3) have been fixed. +Additionally the firstCalledName/nextCalledName methods changed in 1.1.0 +have been changed back to the old behavior. The change was not warranted as +it did not emulate Windows behavior. + Tue Nov 30 19:20:57 EST 2004 jcifs-1.1.3 released diff --git a/build.xml b/build.xml index 8448fe9..a2e77da 100644 --- a/build.xml +++ b/build.xml @@ -1,7 +1,7 @@ - - + + diff --git a/src/jcifs/netbios/NbtAddress.java b/src/jcifs/netbios/NbtAddress.java index cbff6e3..18bddbe 100644 --- a/src/jcifs/netbios/NbtAddress.java +++ b/src/jcifs/netbios/NbtAddress.java @@ -582,14 +582,38 @@ public final class NbtAddress { */ public String firstCalledName() { - calledName = SMBSERVER_NAME; + + calledName = hostName.name; + + if( Character.isDigit( calledName.charAt( 0 ))) { + int i, len, dots; + char[] data; + + i = dots = 0; /* quick IP address validation */ + len = calledName.length(); + data = calledName.toCharArray(); + while( i < len && Character.isDigit( data[i++] )) { + if( i == len && dots == 3 ) { + // probably an IP address + calledName = SMBSERVER_NAME; + break; + } + if( i < len && data[i] == '.' ) { + dots++; + i++; + } + } + } else if( hostName.hexCode == 0x1D ) { + calledName = SMBSERVER_NAME; + } + return calledName; } public String nextCalledName() { - if( calledName == SMBSERVER_NAME ) { - calledName = hostName.name; - } else if( calledName == hostName.name ) { + if( calledName == hostName.name ) { + calledName = SMBSERVER_NAME; + } else if( calledName == SMBSERVER_NAME ) { NbtAddress[] addrs; try { diff --git a/src/jcifs/ntlmssp/Type3Message.java b/src/jcifs/ntlmssp/Type3Message.java index bcac159..3523728 100644 --- a/src/jcifs/ntlmssp/Type3Message.java +++ b/src/jcifs/ntlmssp/Type3Message.java @@ -325,7 +325,7 @@ public class Type3Message extends NtlmMessage { byte[] domain = null; if (domainName != null && domainName.length() != 0) { domain = unicode ? - domainName.getBytes("UnicodeLittleUnmarked") : + domainName.toUpperCase().getBytes("UnicodeLittleUnmarked") : domainName.toUpperCase().getBytes(oem); } int domainLength = (domain != null) ? domain.length : 0; diff --git a/src/jcifs/smb/SmbComSessionSetupAndX.java b/src/jcifs/smb/SmbComSessionSetupAndX.java index efe4123..655c750 100644 --- a/src/jcifs/smb/SmbComSessionSetupAndX.java +++ b/src/jcifs/smb/SmbComSessionSetupAndX.java @@ -112,7 +112,7 @@ class SmbComSessionSetupAndX extends AndXServerMessageBlock { int writeBytesWireFormat( byte[] dst, int dstIndex ) { int start = dstIndex; - accountName = auth.username.toUpperCase(); + accountName = useUnicode ? auth.username : auth.username.toUpperCase(); primaryDomain = auth.domain.toUpperCase(); if( session.transport.server.security == SECURITY_USER && -- 2.11.0