[jcifs] Re: davenport filters

Michael B Allen mba2000 at ioplex.com
Fri Dec 17 00:24:07 GMT 2004

Mike Manley said:
> Message body follows:
> Hi,
> I'm using davenport in a project to give remote access to
> certain areas of a server and I'm in the process of writing
> a new filter to allow access to only certain shares on the
> server. I've copied the code for the server filter and
> modified it to only allow access to certain shares instead.
> For the most part this is working fine, however one of the
> requirements is to allow access to the connecting users home
> share. i.e. if I'm connecting as mike I want to allow access
> to the shares listed in the properites of the filter and the
> share mike. However, I can't see a way to identify that a
> share is a home share or to get the users name to check if
> the share name matches. I tried using the jcifs.smb.smbFile
> toURL method to get the URL thinking that it would be in the
> form
> (smb://[[[domain;]username[:password]@]server[:port]/[[share/[dir/]file]]][?[param=value[param2=value2[...]])
> and I could extract the username out of that but found out
> that
> the URL returned doesn't include the username. The only
> other way I can think of it to modify jcifs.smb.smbFile to
> add a method that will return the username from the private
> NtlmPasswordAuthentication.
> Is there something I'm missing?

NtlmPasswordAuthentication is not private. Use
NtlmPasswordAuthentication.getName to get the DOMAIN\username part.
Although I'm not certain that's the way to go anyway. Davenport ultimately
constructed the NPA so it knew the username before the NPA did. Find out
where Davenport constructs the NPA and see if there's a good way to expose
the username elsewhere. I don't know a whole lot about Davenport internals
(which is unfortunate considering I'm the maintainer) so you're sort of on
your own. Davenport questions are always welcome on the jCIFS mailing
list. There are people there that probably know Davenport better than I

> - Is there a way to do what
> I want from within the filter or do I need to modify
> jcifs.smb.smbFile to give me what I need?
> Many thanks for any help you can give me. Once the filter is
> working I'll let you have the code so it can be included
> into davenport if you want.
> Regards,
> Mike Manley

More information about the jcifs mailing list