[jcifs] JCIFS 1.1.2: Bug in SmbTransport.getSmbSession

Roland Knight rknight at conceptwave.com
Wed Nov 24 15:43:04 GMT 2004


The code to remove expired sessions has a bug and may cause the following
exception:
+java.util.ConcurrentModificationException
java.util.ConcurrentModificationException
 at java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:552)
 at java.util.LinkedList$ListItr.next(LinkedList.java:488)
 at jcifs.smb.SmbTransport.getSmbSession(SmbTransport.java:235)
 at jcifs.smb.SmbSession.logon(SmbSession.java:155)
 at jcifs.smb.SmbSession.logon(SmbSession.java:150)
 at jcifs.http.NtlmServlet.service(NtlmServlet.java:137)
...
 
The fix to getSmbSession is below:
 
    synchronized SmbSession getSmbSession( NtlmPasswordAuthentication auth )
{
...
            while( iter.hasNext() ) {
                ssn = (SmbSession)iter.next();
                if( ssn.expiration < now ) {
                    ssn.logoff( false );
                    iter.remove();                    // WAS:
sessions.remove( ssn );
                }
            }
...
    }

-------------- next part --------------
HTML attachment scrubbed and removed


More information about the jcifs mailing list