From: Felix Schumacher Date: Wed, 6 Aug 2008 14:26:26 +0000 (+0200) Subject: jcifs-1.1.5 from tgz X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=b6db5920a0d4541311bccb415f68b9e65d2a8da6;p=jcifs_without_docs.git jcifs-1.1.5 from tgz Thu Dec 16 21:57:23 EST 2004 jcifs-1.1.5 released It was discovered that an ArrayIndexOutOfBoundsException could occur if the list of domain controllers returned by NbtAddress.getAllByName was shorter than the list returned in the previous call (possibly because the WINS query timed out and switched to an alternate WINS server). All NTLM HTTP Authentication Filter users should upgrade to prevent this error. Also, the value of jcifs.netbios.cachePolicy set by the NTLM HTTP Filter if it is not specified has been doubled to 20 minutes. Finally, some log levels have been increased such that running with jcifs.util.loglevel = 3 temporarily is actually reasonable in a production environment (must use loglevel > 3 to see individual SMB messages and loglevel > 5 to get hexdumps). --- diff --git a/README.txt b/README.txt index ab00b5b..bb7ee7d 100644 --- a/README.txt +++ b/README.txt @@ -1,3 +1,17 @@ +Thu Dec 16 21:57:23 EST 2004 +jcifs-1.1.5 released + +It was discovered that an ArrayIndexOutOfBoundsException could occur if the +list of domain controllers returned by NbtAddress.getAllByName was shorter +than the list returned in the previous call (possibly because the WINS +query timed out and switched to an alternate WINS server). All NTLM HTTP +Authentication Filter users should upgrade to prevent this error. Also, the +value of jcifs.netbios.cachePolicy set by the NTLM HTTP Filter if it is +not specified has been doubled to 20 minutes. Finally, some log levels have +been increased such that running with jcifs.util.loglevel = 3 temporarily +is actually reasonable in a production environment (must use loglevel > 3 +to see individual SMB messages and loglevel > 5 to get hexdumps). + Tue Dec 7 18:34:35 EST 2004 jcifs-1.1.4 released diff --git a/build.xml b/build.xml index a2e77da..a620562 100644 --- a/build.xml +++ b/build.xml @@ -1,7 +1,7 @@ - - + + diff --git a/src/jcifs/http/NtlmHttpFilter.java b/src/jcifs/http/NtlmHttpFilter.java index 3ecad04..45c7009 100644 --- a/src/jcifs/http/NtlmHttpFilter.java +++ b/src/jcifs/http/NtlmHttpFilter.java @@ -62,7 +62,7 @@ public class NtlmHttpFilter implements Filter { /* Set jcifs properties we know we want; soTimeout and cachePolicy to 10min. */ Config.setProperty( "jcifs.smb.client.soTimeout", "300000" ); - Config.setProperty( "jcifs.netbios.cachePolicy", "600" ); + Config.setProperty( "jcifs.netbios.cachePolicy", "1200" ); Enumeration e = filterConfig.getInitParameterNames(); while( e.hasMoreElements() ) { @@ -154,6 +154,10 @@ public class NtlmHttpFilter implements Filter { SmbSession.logon( dc, ntlm ); + if( log.level > 2 ) { + log.println( "NtlmHttpFilter: " + ntlm + + " successfully authenticated against " + dc ); + } } catch( SmbAuthException sae ) { if( log.level > 1 ) { log.println( "NtlmHttpFilter: " + ntlm.getName() + diff --git a/src/jcifs/netbios/.NbtSocket.java.swp b/src/jcifs/netbios/.NbtSocket.java.swp new file mode 100644 index 0000000..c307aee Binary files /dev/null and b/src/jcifs/netbios/.NbtSocket.java.swp differ diff --git a/src/jcifs/netbios/NameServiceClient.java b/src/jcifs/netbios/NameServiceClient.java index 2490752..f03bd70 100644 --- a/src/jcifs/netbios/NameServiceClient.java +++ b/src/jcifs/netbios/NameServiceClient.java @@ -186,7 +186,7 @@ class NameServiceClient implements Runnable { break; } - if( log.level > 2 ) + if( log.level > 3 ) log.println( "NetBIOS: new data read from socket" ); nameTrnId = NameServicePacket.readNameTrnId( rcv_buf, 0 ); @@ -198,7 +198,7 @@ class NameServiceClient implements Runnable { response.readWireFormat( rcv_buf, 0 ); response.received = true; - if( log.level > 2 ) { + if( log.level > 3 ) { log.println( response ); Hexdump.hexdump( log, rcv_buf, 0, in.getLength() ); } @@ -227,7 +227,7 @@ class NameServiceClient implements Runnable { ensureOpen( timeout + 1000 ); socket.send( out ); - if( log.level > 2 ) { + if( log.level > 3 ) { log.println( request ); Hexdump.hexdump( log, snd_buf, 0, out.getLength() ); } diff --git a/src/jcifs/netbios/NbtAddress.java b/src/jcifs/netbios/NbtAddress.java index 18bddbe..affceb2 100644 --- a/src/jcifs/netbios/NbtAddress.java +++ b/src/jcifs/netbios/NbtAddress.java @@ -603,7 +603,7 @@ public final class NbtAddress { i++; } } - } else if( hostName.hexCode == 0x1D ) { + } else if( hostName.hexCode == 0x1D || hostName.hexCode == 0x1C ) { calledName = SMBSERVER_NAME; } diff --git a/src/jcifs/netbios/NbtSocket.java b/src/jcifs/netbios/NbtSocket.java index 0f7fd05..21a2965 100644 --- a/src/jcifs/netbios/NbtSocket.java +++ b/src/jcifs/netbios/NbtSocket.java @@ -127,7 +127,7 @@ public class NbtSocket extends Socket { } } public void close() throws IOException { - if( log.level > 2 ) + if( log.level > 3 ) log.println( "close: " + this ); super.close(); } diff --git a/src/jcifs/smb/SmbSession.java b/src/jcifs/smb/SmbSession.java index 4142d09..545817e 100644 --- a/src/jcifs/smb/SmbSession.java +++ b/src/jcifs/smb/SmbSession.java @@ -56,8 +56,7 @@ public final class SmbSession { private static final int LOOKUP_RESP_LIMIT = jcifs.Config.getInt( "jcifs.netbios.lookupRespLimit", 5 ); private static final String DOMAIN = Config.getProperty("jcifs.smb.client.domain", null); private static final String USERNAME = Config.getProperty("jcifs.smb.client.username", null); - private static final int DEFAULT_CACHE_POLICY = 30; - private static final int CACHE_POLICY = Config.getInt( "jcifs.netbios.cachePolicy", DEFAULT_CACHE_POLICY ); + private static final int CACHE_POLICY = Config.getInt( "jcifs.netbios.cachePolicy", 1200 ); static long dc_list_expiration; static NbtAddress[] dc_list = null; @@ -79,8 +78,24 @@ public final class SmbSession { } synchronized( DOMAIN ) { if( dc_list_expiration < System.currentTimeMillis() ) { - dc_list = NbtAddress.getAllByName( DOMAIN, 0x1C, null, null ); dc_list_expiration = System.currentTimeMillis() + CACHE_POLICY * 1000L; + + if( SmbTransport.log.level > 2 ) { + SmbTransport.log.println( (new java.util.Date()) + + ": LOGON_SHARE=" + LOGON_SHARE + + ",LOOKUP_RESP_LIMIT=" + LOOKUP_RESP_LIMIT + + ",DOMAIN=" + DOMAIN + + ",USERNAME=" + USERNAME + + ",CACHE_POLICY=" + CACHE_POLICY + + ",dc_list.length=" + (dc_list == null ? 0 : dc_list.length) + + ",dc_list_range=" + dc_list_range + + ",dc_list_index=" + dc_list_index ); + } + + NbtAddress[] new_dc_list = NbtAddress.getAllByName( DOMAIN, 0x1C, null, null ); + if( new_dc_list != null && new_dc_list.length >= dc_list_range ) { + dc_list = new_dc_list; + } if( dc_list_range > 1 ) { dc_list_range /= 2; /* shrink dc_list_range */ } @@ -97,7 +112,7 @@ synchronized( DOMAIN ) { UniAddress dc = new UniAddress( addr ); SmbTransport trans = SmbTransport.getSmbTransport( dc, 0 ); if( USERNAME == null ) { - if( SmbTransport.log.level > 1 ) + if( SmbTransport.log.level > 2 ) SmbTransport.log.println( "Default credentials (jcifs.smb.client.username/password) not specified. SMB signing may not work propertly. Skipping DC interrogation." ); trans.negotiate(); } else { @@ -249,7 +264,7 @@ synchronized( transport() ) { * Session Setup And X Request / Response */ - if( transport.log.level > 2 ) + if( transport.log.level > 3 ) transport.log.println( "sessionSetup: accountName=" + auth.username + ",primaryDomain=" + auth.domain ); SmbComSessionSetupAndX request = new SmbComSessionSetupAndX( this, andx ); diff --git a/src/jcifs/smb/SmbTransport.java b/src/jcifs/smb/SmbTransport.java index 48542cd..c51a469 100644 --- a/src/jcifs/smb/SmbTransport.java +++ b/src/jcifs/smb/SmbTransport.java @@ -446,7 +446,7 @@ synchronized( rcv_buf ) { synchronized( response ) { response.useUnicode = useUnicode; - if( log.level > 2 ) + if( log.level > 3 ) log.println( "new data read from socket: " + address ); if( response instanceof SmbComTransactionResponse ) { @@ -467,7 +467,7 @@ synchronized( rcv_buf ) { } response.received = true; - if( log.level > 2 ) + if( log.level > 3 ) log.println( response ); if( response.errorCode != 0 || e.hasMoreElements() == false ) { @@ -483,7 +483,7 @@ synchronized( rcv_buf ) { response.readWireFormat( in, rcv_buf, 0 ); response.received = true; - if( log.level > 2 ) { + if( log.level > 3 ) { ServerMessageBlock smb = response; do { @@ -602,7 +602,7 @@ synchronized( snd_buf ) { out.write(snd_buf, 4, length); out.flush(); - if( log.level > 2 ) { + if( log.level > 3 ) { ServerMessageBlock smb = request; do { @@ -643,7 +643,7 @@ synchronized( snd_buf ) { out.write(snd_buf, 4, length); out.flush(); - if( log.level > 2 ) { + if( log.level > 3 ) { ServerMessageBlock smb = request; do { @@ -740,7 +740,7 @@ synchronized(snd_buf) { out.write(snd_buf, 4, length); out.flush(); - if( log.level > 2 ) { + if( log.level > 3 ) { log.println( request ); if( log.level > 5 ) { Hexdump.hexdump( log, snd_buf, 0, request.length ); @@ -803,7 +803,7 @@ synchronized( snd_buf ) { out.write(snd_buf, 4, length); out.flush(); - if( log.level > 2 ) { + if( log.level > 3 ) { log.println( request ); if( log.level > 5 ) { Hexdump.hexdump( log, snd_buf, 0, request.length );