To use this patch, run these commands for a successful build: patch -p1 Attached is a small patch which allows the preservation of the delete, > chmod, and chown bits which Adaptec has added to XFS on their SnapOS NAS > units. This is nice for backing up files between different NAS units > and preserving all of the Samba ACLs. > > I'm not sure how useful this patch will be because I'm not sure if any > other NAS vendors have standardized on their extensions to POSIX ACLs to > support Samba in the same manner that Adaptec has. FWIW, though, this > will allow you to preserve acls when copying between different Adaptec > based NAS units running SnapOS. I (Wayne) tweaked the patch to work with the latest source. Todo: Fix a bug that could lose some bits when stripping some (supposedly) superfluous ACL info. --- old/lib/sysacls.c +++ new/lib/sysacls.c @@ -30,6 +30,18 @@ #endif #define DEBUG(x,y) +/* These are custom ACL bits used by Adaptec's modifications + * to XFS on their SnapOS units. */ +#ifndef ACL_DELETE +#define ACL_DELETE 8 +#endif +#ifndef ACL_CHMOD +#define ACL_CHMOD 16 +#endif +#ifndef ACL_CHOWN +#define ACL_CHOWN 32 +#endif + void SAFE_FREE(void *mem) { if (mem) @@ -99,6 +111,9 @@ int sys_acl_get_info(SMB_ACL_ENTRY_T ent return -1; *bits_p = (acl_get_perm(permset, ACL_READ) ? 4 : 0) + | (acl_get_perm(permset, ACL_CHOWN) ? 32 : 0) + | (acl_get_perm(permset, ACL_CHMOD) ? 16 : 0) + | (acl_get_perm(permset, ACL_DELETE) ? 8 : 0) | (acl_get_perm(permset, ACL_WRITE) ? 2 : 0) | (acl_get_perm(permset, ACL_EXECUTE) ? 1 : 0); @@ -143,6 +158,12 @@ int sys_acl_set_access_bits(SMB_ACL_ENTR if ((rc = acl_get_permset(entry, &permset)) != 0) return rc; acl_clear_perms(permset); + if (bits & 32) + acl_add_perm(permset, ACL_CHOWN); + if (bits & 16) + acl_add_perm(permset, ACL_CHMOD); + if (bits & 8) + acl_add_perm(permset, ACL_DELETE); if (bits & 4) acl_add_perm(permset, ACL_READ); if (bits & 2) --- old/lib/sysacls.h +++ new/lib/sysacls.h @@ -58,8 +58,8 @@ #define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS #define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT -#define SMB_ACL_VALID_NAME_BITS (4 | 2 | 1) -#define SMB_ACL_VALID_OBJ_BITS (4 | 2 | 1) +#define SMB_ACL_VALID_NAME_BITS (32 | 16 | 8 | 4 | 2 | 1) +#define SMB_ACL_VALID_OBJ_BITS (32 | 16 | 8 | 4 | 2 | 1) #define SMB_ACL_NEED_SORT