Again: Extended Attributes and Hidden, System, Archive attrs?
Thomas Mieslinger
Thomas.Mieslinger at gls-germany.com
Tue Mar 9 16:23:49 GMT 2004
Hi Jeremy,
has this feature been implemented? I would really like to use it, but
couldn't find it in 3.0.2.
Thanks in advance
Thomas
On Fri, Mar 21, 2003 at 09:44:26AM +0100, Olaf Fr±czyk wrote:
> Hi,
>
> I remember some time ago several people were discussing about putting
> the Hidden, System, Archive, Read-Only bits in EAs.
>
> Has it been done in 3.0?
> Will it be in 2.2.x serie?
Not done for 2.2., I'm thinking about it for 3.0.
Jeremy.
-- CUT --
I did this in a May 17th cut of in 2.2.x, which was right around the 2.2.4
release. I didn't submit a patch, because I didn't think there were that
many people using a file system that has extended attributes.
NOTE: Need to define lp_store_dos_mode config option and pick a name for
DOSMODE_ATTR_NAME for this code to work.
This is how I did it in 2.2:
sambma/source/smbd/dosmode.c:
/***************************************************************************
*
change a unix mode to a dos mode
****************************************************************************
/
int dos_mode(connection_struct *conn,char *path,SMB_STRUCT_STAT *sbuf)
{
int result = 0;
DEBUG(8,("dos_mode: %s\n", path));
+ /* Load dos mode from EAs if enabled */
+ if (lp_store_dos_mode()) {
+
+ int size = sizeof(result);
+ if (conn->vfs_ops.get_ea(conn, path,
DOSMODE_ATTR_NAME,
(char*)&result, &size) == -1) {
+
+ if (S_ISDIR(sbuf->st_mode)) {
+ result =
FILE_ATTRIBUTE_DIRECTORY;
+ }
+ else {
+ result =
FILE_ATTRIBUTE_ARCHIVE;
+ }
+ }
+ }
+
+ /* Otherwise perform the usual mapping */
+ else {
...
/*******************************************************************
chmod a file - but preserve some bits
********************************************************************/
int file_chmod(connection_struct *conn,char *fname,int
dosmode,SMB_STRUCT_STAT *st)
{
SMB_STRUCT_STAT st1;
int mask=0;
mode_t tmp;
mode_t unixmode;
int ret = -1;
if (!st) {
st = &st1;
if (vfs_stat(conn,fname,st))
return(-1);
}
if (S_ISDIR(st->st_mode))
dosmode |= aDIR;
else
dosmode &= ~aDIR;
+ /* Store dos mode in EAs if enabled */
+ if (lp_store_dos_mode()) {
+ return conn->vfs_ops.set_ea(conn, fname,
DOSMODE_ATTR_NAME,
(char*)&dosmode, sizeof(dosmode));
+ }
if (dos_mode(conn,fname,st) == dosmode)
return(0);
unixmode = unix_mode(conn,dosmode,fname);
/* preserve the s bits */
mask |= (S_ISUID | S_ISGID);
--
General Logistics Systems
Thomas Mieslinger
German-Parcel-Str. 1-7 fon: +49 6677 17 463
36286 Neuenstein fax: +49 6677 17 111
Germany eMail: thomas.mieslinger at gls-germany.com
More information about the samba-technical
mailing list