[jcifs] jcifs.smb.Dfs bugs

Ronny Schuetz Usenet.r96 at gishpuppy.com
Wed Apr 23 11:59:53 GMT 2008


I guess I found two bugs in jcifs.smb.Dfs:

"referrals" cache (CacheEntry referrals member)

The usage of the "referrals" cache seems to be wrong, as it seems to be
flushed at the wrong places and the cache flushes might clear too many 

 From my point of view, entries in this cache should not be removed or 
at least not at the places where they are currently removed. In 
#resolve(), they are removed (if they are expired) immediately before 
they are used; in insert(), too many entries might be removed, as there 
is only one expiry time for the whole map.

Actually I had some SmbAuthExceptions due to this issue that appeared in 
a renameTo() call immediately after this cache has been flushed. I 
changed the referrals object to a simple hashmap and removed the object 
recreation / flush code in order to resolve the issue.

Probably #insert() might need to be called more often in order to 
refresh the referrals, but I don't know where to do that yet. Will 
investigate further.

Btw, accesses to "referrals" cache are unsynchronized, I think this 
needs to be changed as well as there is only one static Dfs instance.

#getTrustedDomains() / Domain address resolution

The domain resolution

  UniAddress addr = UniAddress.getByName(auth.domain);

in this method was very slow for me. I turned out that it was unable to 
resolve my domain, so I changed this line to

  UniAddress addr = UniAddress.getByName(auth.domain, true);

which resolves the issue, as the domain can be resolved properly now.

Best regards,

More information about the jcifs mailing list