FAQ SearchLogin
Tuxera Home
View unanswered posts | View active topics It is currently Fri May 14, 2021 15:13



Post new topic Reply to topic  [ 9 posts ] 
SAMBA 3.4.7 support for NTFS-3G times and attributes 
Author Message

Joined: Mon Nov 30, 2009 21:35
Posts: 38
Post SAMBA 3.4.7 support for NTFS-3G times and attributes
Dear jpa and Tuxera,
I have succesfully integrated SMB 3.4.7 with ntfs-3g getxattr/setxattr support.
Currently is does already support dos attribute change over the network, but still has some issues.

First, i'm correct that there is no check in driver if a FILE_ATTRIBUTE_DIRECTORY (0x10) bit is to be cleared on a setxattr call? I have added some strict rules in a smb patch, but still need to be completely sure that this doesn't ruin the filesystem. What happens if somebody tries to reset bits other than 0x27 on a inode?

Second, there is a technical problem. Both setxattr/getxattr always return ENOTSUP (errno=95) on system.ntfs_attrib, regardless bytes were successfully changed or retrieved. Yet don't know if it's a VFS, FUSE or ntfs-3g issue, but does the driver report any errors for set/getxattr via errno?


Fri Apr 16, 2010 12:15
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: SAMBA 3.4.7 support for NTFS-3G times and attributes
Hi,

Quote:
First, i'm correct that there is no check in driver if a FILE_ATTRIBUTE_DIRECTORY (0x10) bit is to be cleared on a setxattr call? I have added some strict rules in a smb patch, but still need to be completely sure that this doesn't ruin the filesystem. What happens if somebody tries to reset bits other than 0x27 on a inode?

Only ten flags (see http://www.tuxera.com/community/ntfs-3g ... attributes) can be changed by setfattr. To my knowledge, Windows has the same limitation in SetFileAttributes(). Moreover the FILE_ATTRIBUTE_DIRECTORY is a fake one, not related to the real attribute stored in the inode.

Quote:
Second, there is a technical problem. Both setxattr/getxattr always return ENOTSUP (errno=95) on system.ntfs_attrib, regardless bytes were successfully changed or retrieved.

Currently, the 22 unchangeable flags are ignored with no error code (is not that the behavior on Windows ?).
Now if there is an error in setting the attribute (file unknown, user not owner of the file, etc.) you should get the appropriate error code. You should get ENOTSUP only if you did not compile ntfs-3g with extended attribute support or if you did not mount the device with extended attribute support. In other situations, this would be a bug somewhere. Do you have an actual example ?

*edit*

Actually 8 flags are changeable and 24 are ignored (left unchanged).

Regards

Jean-Pierre


Fri Apr 16, 2010 17:16
Profile

Joined: Mon Nov 30, 2009 21:35
Posts: 38
Post Re: SAMBA 3.4.7 support for NTFS-3G times and attributes
Dear jpa,
after a brief research i'm suspecting the following code:

Code:
static ntfs_inode *ntfs_check_access_xattr(fuse_req_t req,
         struct SECURITY_CONTEXT *security,
         fuse_ino_t ino, int attr, BOOL setting)
{
   ntfs_inode *dir_ni;
   ntfs_inode *ni;
   BOOL foracl;
   BOOL bad;
   mode_t acctype;

   ni = (ntfs_inode*)NULL;
   foracl = (attr == XATTR_POSIX_ACC)
       || (attr == XATTR_POSIX_DEF);
   /*
    * When accessing Posix ACL, return unsupported if ACL
    * were disabled or no user mapping has been defined.
    * However no error will be returned to getfacl
    */
   if ((!ntfs_fuse_fill_security_context(req, security)
      || (ctx->secure_flags
          & ((1 << SECURITY_DEFAULT) | (1 << SECURITY_RAW))))
       && foracl) {

                      /* !!! */
      errno = EOPNOTSUPP;

   } else {


This bitmask stuff looks pretty weird for me, but EOPNOTSUPP is an acronym for ENOTSUP (#95)

I completely agree with permissive (rather than restrictive) behavior on Administrators owned files (0777), but isn't an issue when a ok retcode setxattr sets errno to a nonzero return value?
Especially on correctly UserMapp'ed, full access file residing in a root:root tree.
If a situation is considered critical, why is not fed to syslogd? If is not, why an error is indicated? :roll:


Tue Apr 20, 2010 22:52
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: SAMBA 3.4.7 support for NTFS-3G times and attributes
Hi,

Code:
static ntfs_inode *ntfs_check_access_xattr(fuse_req_t req,

This code is specific to the fuse low-level interface, which is rather new. Are you really using that interface ? Anyway a very similar check exists in the high-level interface.

Code:
  if ((!ntfs_fuse_fill_security_context(req, security)
      || (ctx->secure_flags
          & ((1 << SECURITY_DEFAULT) | (1 << SECURITY_RAW))))
       && foracl) {
      errno = EOPNOTSUPP;

This code is specific to setting Posix ACLs, which implies translating Posix ACLs to NTFS ACLs, so a user mapping has to be defined, the mount options have to allow its use, and the code needed for the translations has to be compiled in. When these conditions are not met, it is correct to return "not supported".

I know that under some circumstances Samba tries to emulate NTFS ACLs to Posix ACLs, so you may get into this situation. Can you confirm you were setting either "system.posix_acl_access" or "system.posix_acl_default" ? Also did you "./configure" with --enable-posix-acls and what are your mount options ?

Now from your previous reports, I guess you want Samba to store the original NTFS ACLs, so it would be best to avoid double translations to and from Posix ACLs, which can only lead to approximations.
Quote:
but isn't an issue when a ok retcode setxattr sets errno to a nonzero return value?

You are only supposed to check errno when there is an error return value (eg when setxattr() returns -1)

Quote:
If a situation is considered critical, why is not fed to syslogd? If is not, why an error is indicated?

I do not feel the above situation as critical (no damage to the data, hopefully no bug in the code), but I agree that a mention in the syslog would be useful to explain what is going on.

Regards

Jean-Pierre


Wed Apr 21, 2010 09:01
Profile

Joined: Mon Nov 30, 2009 21:35
Posts: 38
Post Re: SAMBA 3.4.7 support for NTFS-3G times and attributes
jpa,
to be correct i never tried to change anything except for system.ntfs_attrib
Not sure which code is in action but the fragment above seems to be the only one with errno=95 not in a "failure" path.

Files are correctly mapped in .NTFS-3G/UserMapping, and shown as myuser:mygroup unlike the legacy ones, which all are root:root (but 777).

-
I have also a little question not related directly to the topic - what is "VCN-LCN Runlist" in ntfsinfo -i ? Does it actually mean fragmentation?


Wed Apr 21, 2010 11:14
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: SAMBA 3.4.7 support for NTFS-3G times and attributes
Hi,

Quote:
to be correct i never tried to change anything except for system.ntfs_attrib
Not sure which code is in action but the fragment above seems to be the only one with errno=95 not in a "failure" path.

Can you try the appended patch, which is supposed to log a few cases of error situations in setxattr() ?

Regards

Jean-Pierre


Attachments:
logxattr.patch.gz [594 Bytes]
Downloaded 792 times
Wed Apr 21, 2010 13:04
Profile

Joined: Thu Apr 29, 2010 12:42
Posts: 4
Post Re: SAMBA 3.4.7 support for NTFS-3G times and attributes
I am setting up Ubuntu server 10.04 with Samba 3.4.7 to act as a NAS for my home network. I came across this posting and wondered if I could get some details on the configuration?

I have made several attempts to preserve the created/modified dates on the NTFS partition via samba configuration and mount configuration (fstab).

I can move my question to a new thread or private message to keep from polluting this thread.


Mon May 24, 2010 10:28
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: SAMBA 3.4.7 support for NTFS-3G times and attributes
Hi,

Quote:
I have made several attempts to preserve the created/modified dates on the NTFS partition via samba configuration and mount configuration (fstab).


Can you be more precise ? My view is that you should get the same modified date as on ext2/3/4, but copying the creation date requires some modification to Samba.

Quote:
I can move my question to a new thread or private message to keep from polluting this thread.

This depends on your concern, this thread is about attributes and times on a Samba connection. I understand the ELBY has been able to preserve the NTFS attrib on a Samba connection, but I have no details.

Regards

Jean-Pierre


Mon May 24, 2010 15:58
Profile

Joined: Thu Apr 29, 2010 12:42
Posts: 4
Post Re: SAMBA 3.4.7 support for NTFS-3G times and attributes
Sounds like the Samba configuration will require more changes that I originally thought. I would be interested in how ELBY has configured Samba/NTFS-3G.

I am using Ubuntu 10.04 server, which has a fairly recent ntfs-3g driver (dated March I think). Should I update to a more recent version?

Derek

P.S. Would ntfs preserve file attributes over an nfs connection?


Tue May 25, 2010 00:59
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Original forum style by Vjacheslav Trushkin.