Attached is a small patch which is meant to be applied to a copy of
rsync which has already been patched with acl support (the acls.diff
file in the patches folder).  It 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.

There is a warning issued about the version of libacl which is installed
when I run rsync, but it seems to work fine for me.

-- 
Philip Lowman
diff -u rsync-2.6.6+acls/smb_acls.h rsync-2.6.6+acls+adaptec_acl_mods/smb_acls.h
--- rsync-2.6.6+acls/smb_acls.h 2005-08-31 12:05:24.000000000 -0400
+++ rsync-2.6.6+acls+adaptec_acl_mods/smb_acls.h        2005-08-31 
11:10:07.000000000 -0400
@@ -22,6 +22,12 @@
 #ifndef _SMB_ACLS_H
 #define _SMB_ACLS_H
 
+/* These are custom ACL bits used by Adaptec's modifications
+ * to XFS on their SnapOS units. */
+#define SMB_ACL_DELETE  0x08
+#define SMB_ACL_CHMOD   0x10
+#define SMB_ACL_CHOWN   0x20
+
 #if defined(HAVE_POSIX_ACLS)
 
 /* This is an identity mapping (just remove the SMB_). */
diff -u rsync-2.6.6+acls/acls.c rsync-2.6.6+acls+adaptec_acl_mods/acls.c
--- rsync-2.6.6+acls/acls.c     2005-08-31 12:05:24.000000000 -0400
+++ rsync-2.6.6+acls+adaptec_acl_mods/acls.c    2005-08-31 11:09:48.000000000 
-0400
@@ -145,7 +145,10 @@
                }
                race->access = (sys_acl_get_perm(permset, SMB_ACL_READ) ? 4 : 0)
                             | (sys_acl_get_perm(permset, SMB_ACL_WRITE) ? 2 : 
0)
-                            | (sys_acl_get_perm(permset, SMB_ACL_EXECUTE) ? 1 
: 0);
+                            | (sys_acl_get_perm(permset, SMB_ACL_EXECUTE) ? 1 
: 0)
+           | (sys_acl_get_perm(permset, SMB_ACL_DELETE) ? 0x08 : 0)
+           | (sys_acl_get_perm(permset, SMB_ACL_CHMOD) ? 0x10 : 0)
+           | (sys_acl_get_perm(permset, SMB_ACL_CHOWN) ? 0x20 : 0);
                switch (race->tag_type) {
                case SMB_ACL_USER:
                case SMB_ACL_GROUP:
@@ -574,6 +577,21 @@
                                errfun = "sys_acl_add_perm";
                                break;
                        }
+    if (race->access & 0x08)
+      if (sys_acl_add_perm(permset, SMB_ACL_DELETE)) {
+        errfun = "sys_acl_add_perm";
+        break;
+      }
+    if (race->access & 0x10)
+      if (sys_acl_add_perm(permset, SMB_ACL_CHMOD)) {
+        errfun = "sys_acl_add_perm";
+        break;
+      }
+    if (race->access & 0x20)
+      if (sys_acl_add_perm(permset, SMB_ACL_CHOWN)) {
+        errfun = "sys_acl_add_perm";
+        break;
+      }
                if (sys_acl_set_permset(entry, permset)) {
                        errfun = "sys_acl_set_permset";
                        break;
@@ -633,7 +651,8 @@
                        exit_cleanup(RERR_STREAMIO);
                }
                race->access = read_byte(f);
-               if (race->access & ~ (4 | 2 | 1)) {
+               if (race->access & ~ ( SMB_ACL_READ | SMB_ACL_WRITE | 
SMB_ACL_EXECUTE |
+                           SMB_ACL_DELETE | SMB_ACL_CHMOD | SMB_ACL_CHOWN )) {
                        rprintf(FERROR, "receive_rsync_acl: bogus permset %o\n",
                                race->access);
                        exit_cleanup(RERR_STREAMIO);

Attachment: pgpyQJYMyAdzB.pgp
Description: PGP signature

-- 
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to