[jcifs] setReadOnly, setReadWrite, or setAttributes?
Christopher R. Hertel
crh at ubiqx.mn.org
Wed Oct 29 14:58:57 EST 2003
Michael B Allen wrote:
>
> Anyone notice java.io.File.setReadOnly will set a file to read-only but
> there's no way to remove read-only from a file? I suppose someone was
> concerned with security issues on filesystems that do not provide the
> concept of ownership. I don't think this will be acceptable for us...
>
> I am thinking of one of three possible solutions;
>
> 1) Provide both setReadOnly and setReadWrite.
>
> 2) Change the signature of setReadOnly to:
>
> setReadOnly( boolean readonly );
>
> where specifying false will remove read-only access.
>
> 3) Implement a more advanced set/getAttributes API such as:
>
> static final int ATTR_ARCHIVE = 0x020;
> static final int ATTR_COMPRESSED = 0x800;
> static final int ATTR_NORMAL = 0x080;
> static final int ATTR_HIDDEN = 0x002;
> static final int ATTR_READONLY = 0x001;
> static final int ATTR_TEMPORARY = 0x100;
> static final int ATTR_DIRECTORY = 0x010;
> static final int ATTR_SYSTEM = 0x004;
>
> public int getAttributes() throws SmbException;
> public void setAttributes( int attrs ) throws SmbException;
>
> Any opinions?
I am a fan of completeness.
Note, though, that these shoul have names like FAT_ATTR_ARCHIVE. The NTFS
filesystem offers a completely different set of attributes, extended
attributes, ACE's, etc. The protocol is tuned to provide support for both
FAT and NTFS semantics.
Chris -)-----
--
"Implementing CIFS - the Common Internet FileSystem" ISBN: 013047116X
Samba Team -- http://www.samba.org/ -)----- Christopher R. Hertel
jCIFS Team -- http://jcifs.samba.org/ -)----- ubiqx development, uninq.
ubiqx Team -- http://www.ubiqx.org/ -)----- crh at ubiqx.mn.org
OnLineBook -- http://ubiqx.org/cifs/ -)----- crh at ubiqx.org
More information about the jcifs
mailing list