[jcifs] SMBFile hashcode bug

James Nord teilo at teilo.net
Mon Feb 25 01:19:49 EST 2002


Michael B Allen wrote:

>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.
>
Sorry missed it in the docs. It was late :-(

>>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.
>
OK

>
>
>>And shares?
>>
>
><snip>
>
>>            if( share != null ) {
>>                hash += 65521 * share.toUpperCase().hashCode();
>>
><snip>
>
>Mike
>







More information about the jcifs mailing list