[jcifs] Samba home shares - possible bug

Michael Kerley michael at enkoo.com
Sat Oct 18 04:18:22 EST 2003

I'm having a problem with Samba home shares.  If I use SmbFile.listFiles()
to get the list of shares on a Samba server, and I give it a username, I
will see the appropriate home share for that username in the returned list.
If I then make another call to list the shares on the same server but with a
different username, I will see the old user's share along with the new
user's share.  Shouldn't this only show the new user's share?

In case I didn't explain that clearly, here's an example:
Let's say the server has permanent shares called "share1" and "share2".
There are two users on the machine, "mike" and "jim" who each have a home

new SmbFile("smb://server/").listFiles() returns "share1, share2"
new SmbFile("smb://mike:x@server/").listFiles returns "share1, share2, mike"
new SmbFile("smb://jim:x@server/").listFiles returns "share1, share2, mike,

If I make these calls from separate instances of my Java program, I don't
get the leftover directory (so that last call wouldn't show the "mike"
share).  This only happens when I make multiple calls to listFiles() from
within the same program.  When I use smbclient, I don't see this happening
either, so I'm pretty sure it's a problem with JCIFS.

Is this a bug in JCIFS, or is there some sort of caching option I should
experiment with?  I already tried jcifs.netbios.cachePolicy and
jcifs.smb.client.attrExpirationPeriod with no luck.

Michael Kerley

More information about the jcifs mailing list