SmbFile.canWrite() question

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

SmbFile.canWrite() question

Tony Thompson
I have a share on a Windows server that I have given a user read only
access to.  If I connect to that share with a Windows client, I really
do not have any rights to update anything on the share.  However, with
jCIFS, SmbFile.canWrite() returns true for any file/directory on the
share.  Is there some debug that I can turn on to see what is going on
here or is this a known issue?

I am using jCIFS 1.2.7.

Tony
Reply | Threaded
Open this post in threaded view
|

Re: SmbFile.canWrite() question

Michael B Allen-4
On Thu, 02 Feb 2006 11:42:32 -0500
"Tony Thompson" <[hidden email]> wrote:

> I have a share on a Windows server that I have given a user read only
> access to.  If I connect to that share with a Windows client, I really
> do not have any rights to update anything on the share.  However, with
> jCIFS, SmbFile.canWrite() returns true for any file/directory on the
> share.  Is there some debug that I can turn on to see what is going on
> here or is this a known issue?

JCIFS only looks at file attributes. Meaning canWrite will return true
if FILE_ATTRIBUTE_READONLY is not set. It doesn't know anything about
ACLs. The only way to really know if the user can open and write to the
file is to try to open and write to the file.

Mike
Reply | Threaded
Open this post in threaded view
|

Re: SmbFile.canWrite() question

Tony Thompson
In reply to this post by Tony Thompson
OK, that is it.  Is there any way to make jCIFS check your "effective
rights" for a particular file or directory?

Tony

>>> Michael B Allen <[hidden email]> 02/02/06 01:05PM >>>
On Thu, 02 Feb 2006 11:42:32 -0500
"Tony Thompson" <[hidden email]> wrote:

> I have a share on a Windows server that I have given a user read
only
> access to.  If I connect to that share with a Windows client, I
really
> do not have any rights to update anything on the share.  However,
with
> jCIFS, SmbFile.canWrite() returns true for any file/directory on the
> share.  Is there some debug that I can turn on to see what is going
on
> here or is this a known issue?

JCIFS only looks at file attributes. Meaning canWrite will return true
if FILE_ATTRIBUTE_READONLY is not set. It doesn't know anything about
ACLs. The only way to really know if the user can open and write to
the
file is to try to open and write to the file.

Mike
Reply | Threaded
Open this post in threaded view
|

Re: SmbFile.canWrite() question

Michael B Allen-4
In reply to this post by Tony Thompson
On Thu, 02 Feb 2006 13:58:24 -0500
"Tony Thompson" <[hidden email]> wrote:

> OK, that is it.  Is there any way to make jCIFS check your "effective
> rights" for a particular file or directory?

Not stock jCIFS no. You could use Jarapac to do the necessary RPCs or
you could use JNDI to query AD but I can't direct you further wrt that.

Mike

>
> Tony
>
> >>> Michael B Allen <[hidden email]> 02/02/06 01:05PM >>>
> On Thu, 02 Feb 2006 11:42:32 -0500
> "Tony Thompson" <[hidden email]> wrote:
>
> > I have a share on a Windows server that I have given a user read
> only
> > access to.  If I connect to that share with a Windows client, I
> really
> > do not have any rights to update anything on the share.  However,
> with
> > jCIFS, SmbFile.canWrite() returns true for any file/directory on the
> > share.  Is there some debug that I can turn on to see what is going
> on
> > here or is this a known issue?
>
> JCIFS only looks at file attributes. Meaning canWrite will return true
> if FILE_ATTRIBUTE_READONLY is not set. It doesn't know anything about
> ACLs. The only way to really know if the user can open and write to
> the
> file is to try to open and write to the file.
>
> Mike
>