[jcifs] Hosts and shares enumeration
eglass1 at comcast.net
eglass1 at comcast.net
Tue Jun 29 13:13:25 GMT 2004
I did some testing on this; it appears to affect at least back to 0.9.0.
Adding the following to SmbFile.java at line 591-ish appears to fix it:
this.auth = context.auth;
It appears that the SmbFile constructor used in the listFiles methods leaves
the auth field null, causing it to fall back to the account specified by
"jcifs.smb.client.*" (defaulting to GUEST). Setting it to the context SmbFile's
auth seems to fix things.
Eric
-------------- Original message --------------
> Hi, All !
>
> I see one small issue in jcifs(version 0.9.3).
>
> SmbFile doesn't inherit auth information on the listFiles method.
>
> So, when I run
> auth = new NtlmPasswordAuthentication(domain, username, password);
> workgroup = new SmbFile("smb://myworkgroupname/", auth);
> SmbFile[] hosts = workgroup.listFiles();
> It returns list of all hosts in workgroup.
>
> Next, I'm tring to retrieve shares list from hosts:
> SmbFile[] shares = host[0].listFiles();
> And I see SmbAuthException(Access is denied).
>
> When I try this code:
> SmbFile hostToList = new SmbFile(workgroup, host[0].getName, auth);
> SmbFile[] shares = host[0].listFiles();
> It works fine.
>
> Also, when I enumerate share, then I can't enumerate directories, because I
> see SmbAuthException.
>
>
> WBR, Alex.
-------------- next part --------------
HTML attachment scrubbed and removed
More information about the jcifs
mailing list