[jcifs] SMBFile hashcode bug

Michael B Allen mballen at erols.com
Sun Feb 24 16:18:02 EST 2002

On Sun, 24 Feb 2002 05:01:18 +0100
James Nord <teilo at teilo.net> wrote:

> Hi,
> it seems to me at this late hour that the hashcode function of SmbFile 
> ignores any authentication when calculating its hashcode.

Thats true. It is assumed that authentication credentials can be
different without the resources they point to being different. This is
also explained in hashCode and equals methods documentation.

> Also some SMB implementations can be case sensitive so
> smb://server/share/file may not equal smb://server/share/File

And if you don't normalize you have a pretty good chance of hashCode
and equals returning false negatives. There's a caseless flag in the
SMB header that might help with this but I don't know if I have access
to such a server to see if that flag is used properly.

> And shares?

>             if( share != null ) {
>                 hash += 65521 * share.toUpperCase().hashCode();


May The Source be with you.

More information about the jcifs mailing list