jcifs-1.1.5 from tgz
authorFelix Schumacher <p0354740@isib001.(none)>
Wed, 6 Aug 2008 14:26:26 +0000 (16:26 +0200)
committerFelix Schumacher <p0354740@isib001.(none)>
Wed, 6 Aug 2008 14:26:26 +0000 (16:26 +0200)
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).

README.txt
build.xml
src/jcifs/http/NtlmHttpFilter.java
src/jcifs/netbios/.NbtSocket.java.swp [new file with mode: 0644]
src/jcifs/netbios/NameServiceClient.java
src/jcifs/netbios/NbtAddress.java
src/jcifs/netbios/NbtSocket.java
src/jcifs/smb/SmbSession.java
src/jcifs/smb/SmbTransport.java

index ab00b5b..bb7ee7d 100644 (file)
@@ -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
 
index a2e77da..a620562 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -1,7 +1,7 @@
 <project name="jcifs" default="usage" basedir=".">
 
-    <property name="version" value="1.1.4"/>
-    <property name="reldate" value="Dec 7, 2004"/>
+    <property name="version" value="1.1.5"/>
+    <property name="reldate" value="Dec 17, 2004"/>
 
     <target name="usage">
         <echo>
index 3ecad04..45c7009 100644 (file)
@@ -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 (file)
index 0000000..c307aee
Binary files /dev/null and b/src/jcifs/netbios/.NbtSocket.java.swp differ
index 2490752..f03bd70 100644 (file)
@@ -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() );
                         }
index 18bddbe..affceb2 100644 (file)
@@ -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;
         }
 
index 0f7fd05..21a2965 100644 (file)
@@ -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();
     }
index 4142d09..545817e 100644 (file)
@@ -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 );
index 48542cd..c51a469 100644 (file)
@@ -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 );