Fix alignment issue on 64-bit. Solution from Steve Ortiz.
[rsync-patches.git] / acls.diff
index bdf529c32c04ed98d1ce31bd75f30ebbfa47a013..ff1f17870f56b9e7764f9c52fa38d9a4d33dff41 100644 (file)
--- a/acls.diff
+++ b/acls.diff
@@ -9,10 +9,20 @@ To use this patch, run these commands for a successful build:
     ./configure                         (optional if already run)
     make
 
---- old/acls.c
-+++ new/acls.c
-@@ -98,6 +98,18 @@ static const char *str_acl_type(SMB_ACL_
-            : "unknown SMB_ACL_TYPE_T";
+based-on: a01e3b490eb36ccf9e704840e1b6683dab867550
+diff --git a/acls.c b/acls.c
+--- a/acls.c
++++ b/acls.c
+@@ -31,6 +31,7 @@ extern int list_only;
+ extern int orig_umask;
+ extern int numeric_ids;
+ extern int inc_recurse;
++extern int protocol_version;
+ /* Flags used to indicate what items are being transmitted for an entry. */
+ #define XMIT_USER_OBJ (1<<0)
+@@ -110,6 +111,18 @@ static const char *str_acl_type(SMB_ACL_TYPE_T type)
+       return "unknown ACL type!";
  }
  
 +#define OTHER_TYPE(t) (SMB_ACL_TYPE_ACCESS+SMB_ACL_TYPE_DEFAULT-(t))
@@ -30,7 +40,7 @@ To use this patch, run these commands for a successful build:
  static int calc_sacl_entries(const rsync_acl *racl)
  {
        /* A System ACL always gets user/group/other permission entries. */
-@@ -522,6 +534,96 @@ int get_acl(const char *fname, statx *sx
+@@ -555,6 +568,96 @@ int get_acl(const char *fname, stat_x *sxp)
        return 0;
  }
  
@@ -82,9 +92,9 @@ To use this patch, run these commands for a successful build:
 +      }
 +}
 +
-+/* Send the ACL from the statx structure down the indicated file descriptor.
++/* Send the ACL from the stat_x structure down the indicated file descriptor.
 + * This also frees the ACL data. */
-+void old_send_acl(statx *sxp, int f)
++void old_send_acl(stat_x *sxp, int f)
 +{
 +      SMB_ACL_TYPE_T type;
 +      rsync_acl *racl, *new_racl;
@@ -126,10 +136,10 @@ To use this patch, run these commands for a successful build:
 +
  /* === Send functions === */
  
- /* The general strategy with the tag_type <-> character mapping is that
-@@ -604,6 +706,11 @@ static void send_rsync_acl(rsync_acl *ra
+ /* Send the ida list over the file descriptor. */
+@@ -630,6 +733,11 @@ static void send_rsync_acl(int f, rsync_acl *racl, SMB_ACL_TYPE_T type,
   * This also frees the ACL data. */
- void send_acl(statx *sxp, int f)
+ void send_acl(int f, stat_x *sxp)
  {
 +      if (protocol_version < 30) {
 +              old_send_acl(sxp, f);
@@ -139,7 +149,7 @@ To use this patch, run these commands for a successful build:
        if (!sxp->acc_acl) {
                sxp->acc_acl = create_racl();
                rsync_acl_fake_perms(sxp->acc_acl, sxp->st.st_mode);
-@@ -621,6 +728,160 @@ void send_acl(statx *sxp, int f)
+@@ -647,6 +755,160 @@ void send_acl(int f, stat_x *sxp)
        }
  }
  
@@ -292,32 +302,33 @@ To use this patch, run these commands for a successful build:
 +              if (type == SMB_ACL_TYPE_ACCESS)
 +                      F_ACL(file) = ndx;
 +              else
-+                      F_DEF_ACL(file) = ndx;
++                      F_DIR_DEFACL(file) = ndx;
 +              racl_list = &default_acl_list;
 +      } while (BUMP_TYPE(type) && S_ISDIR(file->mode));
 +}
 +
  /* === Receive functions === */
  
- static uint32 recv_acl_access(uchar *name_follows_ptr, int f)
-@@ -738,6 +999,11 @@ static int recv_rsync_acl(item_list *rac
+ static uint32 recv_acl_access(int f, uchar *name_follows_ptr)
+@@ -768,6 +1030,11 @@ static int recv_rsync_acl(int f, item_list *racl_list, SMB_ACL_TYPE_T type, mode
  /* Receive the ACL info the sender has included for this file-list entry. */
- void receive_acl(struct file_struct *file, int f)
+ void receive_acl(int f, struct file_struct *file)
  {
 +      if (protocol_version < 30) {
 +              old_recv_acl(file, f);
 +              return;
 +      }
 +
-       F_ACL(file) = recv_rsync_acl(&access_acl_list, SMB_ACL_TYPE_ACCESS, f);
+       F_ACL(file) = recv_rsync_acl(f, &access_acl_list, SMB_ACL_TYPE_ACCESS, file->mode);
  
        if (S_ISDIR(file->mode))
---- old/compat.c
-+++ new/compat.c
-@@ -147,13 +147,6 @@ void setup_protocol(int f_out,int f_in)
-                           protocol_version);
-                       exit_cleanup(RERR_PROTOCOL);
-               }
+diff --git a/compat.c b/compat.c
+--- a/compat.c
++++ b/compat.c
+@@ -191,13 +191,6 @@ void setup_protocol(int f_out,int f_in)
+       if (protocol_version < 30) {
+               if (append_mode == 1)
+                       append_mode = 2;
 -              if (preserve_acls && !local_server) {
 -                      rprintf(FERROR,
 -                          "--acls requires protocol 30 or higher"