[jcifs] Bug listing available shares

Rob Wygand rob at wygand.com
Tue Jan 15 12:46:42 EST 2002


Mike,

When listing shares, I'm seeing some weird caching issue.  Basically, if 
I list shares on a server as user1, then as user2 I see the home share I 
saw in the user1 listing. Then if I list again as user1, I see the 
user2's home dir. These should not be showing up at all. here's a sample 
program and it's output:

===== SmnTest.java =====
import jcifs.smb.*;

public class SmbTest extends Object
{
   public static void main (String[] args)
   {
     try
     {
       SmbFile[] files = null;

       SmbFile a = new SmbFile ("smb://DOMAIN;user1:pass@10.1.3.161/");
       System.out.println (a.getCanonicalPath());
       files = a.listFiles();
       for (int i = 0; i < files.length; ++i)
       {
         System.out.println ("\t" + files[i].getName());
       }

       SmbFile b = new SmbFile ("smb://DOMAIN;user2:pass2@10.1.3.161/");
       System.out.println (a.getCanonicalPath());
       files = b.listFiles();
       for (int i = 0; i < files.length; ++i)
       {
         System.out.println ("\t" + files[i].getName());
       }

       SmbFile c = new SmbFile ("smb://DOMAIN;user1:pass@10.1.3.161/");
       System.out.println (a.getCanonicalPath());
       files = c.listFiles();
       for (int i = 0; i < files.length; ++i)
       {
         System.out.println ("\t" + files[i].getName());
       }
     }
     catch (Exception e)
     {
       System.out.println ("Exception: " + e.toString());
     }
   }
}

===== Sample Output =====
[rob at elbereth]$ /usr/java/jdk1.3.1_01/bin/java SmbTest

smb://DOMAIN;user1:pass@10.1.3.161
	rootdir
	CVSROOT
	IPC$
	user1
smb://DOMAIN;user2:pass2@10.1.3.161
	rootdir
	CVSROOT
	IPC$
	user1
	user2
smb://DOMAIN;user1:pass@10.1.3.161
	rootdir
	CVSROOT
	IPC$
	user1
	user2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3229 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.samba.org/archive/jcifs/attachments/20020114/5112bcc2/smime.bin


More information about the jcifs mailing list