[jcifs] Bug listing available shares

Allen, Michael B (RSCH) Michael_B_Allen at ml.com
Tue Jan 15 14:32:56 EST 2002


Are you using Samba? I just ran this against Samba and I get:

[miallen at miallen2 examples]$ java SmnTest
smb://miallen:pass1@172.134.34.39
        tmp
        IPC$
        lp
        miallen
smb://foo:pass2@172.134.34.39
        tmp
        IPC$
        lp
        miallen
        foo
smb://bar:pass3@172.134.34.39
        tmp
        IPC$
        lp
        miallen
        foo
        bar

but you know you're using *a*.getCanonicalPath in each of the three
sections BTW. Is this what mean and how do you know it's wrong? I can
see from traces there is no "wierd caching"; this stuff is coming right
out of Samba 2.0.6-9's NetShareEnum responses verbatum.

I think the problem is a bad interaction with jCIFS reusing the socket
and Samba's dynamic generation of home shares. We could slide
over to samba technical and ask them about it?

Mike

> -----Original Message-----
> From:	Rob Wygand [SMTP:rob at wygand.com]
> Sent:	Monday, January 14, 2002 8:47 PM
> To:	jcifs at samba.org
> Subject:	[jcifs] Bug listing available shares
> 
> 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





More information about the jcifs mailing list