[jcifs] Create and Write Permissions on a Directory

Michael Matczynski mjm at alum.mit.edu
Fri Feb 19 16:22:11 MST 2010


Thanks for the quick reply!

Do you know if there's a patch or any library that helps in traversing
the ACL?  Also, do you know if this is achievable with only the
classes in jcifs, or are there pieces missing?  Specifically, I'm
wondering about the case where a group has access to a directory, and
a user is in that group - how would I determine if a given user is in
that group?  I'm assuming this would require querying another service
and that isn't related to CIFS?


On Fri, Feb 19, 2010 at 5:12 PM, Michael B Allen <ioplex at gmail.com> wrote:
> Hi Mike,
> The canWrite method just looks at the file attributes which these days
> is totally useless.
> To logically determine if someone can write a directory you would have
> to retrieve the ACL and evaluate it like a Windows server would. This
> is what canWrite should do.
> The most practical method is to simply try to create and write to an
> object in the directory and catch the exception. If it works, they
> have create and write permission. If it fails they don't.
> Mike
> On Fri, Feb 19, 2010 at 11:33 AM, Michael Matczynski <mjm at alum.mit.edu> wrote:
>> Hello!
>> Once authenticated via NtlmPasswordAuthentication, what's the best way
>> to determine if that user has CREATE and WRITE permissions in a CIFS
>> SmbFile directory?
>> I've tried taking the SmbFile of the directory and calling canWrite(),
>> but on an OpenFiler/Samba server this was returning 'true' while on a
>> Windows 2003 Server it was returning 'false' (even though creating a
>> SmbFile inside that directory and calling getOutputStream() was
>> successful).
>> Thanks!
>> Mike
> --
> Michael B Allen
> Java Active Directory Integration
> http://www.ioplex.com/

More information about the jCIFS mailing list