Got rid of a superfluous extern.
[rsync/rsync-patches.git] / fake-super.diff
index 18e3890..e4f47c5 100644 (file)
@@ -3,37 +3,8 @@ Depends-On-Patch: xattrs.diff
 
 This patch adds a new option:  --fake-super, which tells rsync to copy in a
 fake super-user mode that stores various file attributes in an extended-
-attribute value instead of as real file-system attributes.  The items
-affected are:
-
-  mode  the real mode of the file always has the special-permission bits
-        cleared (u-s,g-s,o-t) and full owner access is always enabled
-        (u+rw for files and u+rwx for directories).  The former makes
-        the files safe if the user and/or group info was not really
-        preserved, and the latter ensures that our fake-super process
-        can always read & write & scan the files and directories.
-
-  rdev  devices and special files are created as zero-length normal
-        files (with all the attributes preserved in the xattr-stat).
-
-  uid   the real owner will be the executor of the receiving rsync.
-
-  gid   the real group will be the default group of the executor.
-
-The --fake-super option only affects the side where the option is used.  To
-affect the remote side of a remote-shell connection, specify an rsync path:
-
-  rsync -av --rsync-path='rsync --fake-super' /src/ host:/dest/
-
-The --fake-super option affects both sides of a local copy, so if you want
-to affect only one side or the other, you'll need to turn the copy into a
-remote copy to/from localhost.  However, it's always safe to copy from some
-non-fake-super files into some fake-super files using a normal local copy
-since the non-fake source files will just have their normal attributes.
-
-A daemon can set "fake super = yes" in the rsync.conf file for any module
-that you'd like to be able to preserve all attributes without having it
-run as root (the client cannot affect this setting on the daemon).
+attribute value instead of as real file-system attributes.  See the changes
+to the manpages for details.
 
 After applying this patch, run these commands for a successful build:
 
@@ -246,28 +217,9 @@ or, if you want ACL support too:
        if (write_batch && read_batch) {
                snprintf(err_buf, sizeof err_buf,
                        "--write-batch and --read-batch can not be used together\n");
---- old/receiver.c
-+++ new/receiver.c
-@@ -528,7 +528,7 @@ int recv_files(int f_in, struct file_lis
-               if (fd1 == -1) {
-                       st.st_mode = 0;
-                       st.st_size = 0;
--              } else if (do_fstat(fd1,&st) != 0) {
-+              } else if (x_fstat(fd1, &st, NULL) != 0) {
-                       rsyserr(FERROR, errno, "fstat %s failed",
-                               full_fname(fnamecmp));
-                       discard_receive_data(f_in, file->length);
 --- old/rsync.c
 +++ new/rsync.c
-@@ -49,7 +49,6 @@ extern int preserve_gid;
- extern int inplace;
- extern int keep_dirlinks;
- extern int make_backups;
--extern mode_t orig_umask;
- extern struct stats stats;
- extern struct chmod_mode_struct *daemon_chmod_modes;
-@@ -197,7 +196,9 @@ int set_file_attrs(char *fname, struct f
+@@ -196,7 +196,9 @@ int set_file_attrs(char *fname, struct f
                                        (long)sxp->st.st_gid, (long)file->gid);
                        }
                }
@@ -278,7 +230,7 @@ or, if you want ACL support too:
                    change_uid ? file->uid : sxp->st.st_uid,
                    change_gid ? file->gid : sxp->st.st_gid) != 0) {
                        /* shouldn't have attempted to change uid or gid
-@@ -206,7 +207,7 @@ int set_file_attrs(char *fname, struct f
+@@ -205,7 +207,7 @@ int set_file_attrs(char *fname, struct f
                            change_uid ? "chown" : "chgrp",
                            full_fname(fname));
                        goto cleanup;
@@ -287,7 +239,7 @@ or, if you want ACL support too:
                /* a lchown had been done - we have to re-stat if the
                 * destination had the setuid or setgid bits set due
                 * to the side effect of the chown call */
-@@ -223,6 +224,8 @@ int set_file_attrs(char *fname, struct f
+@@ -222,6 +224,8 @@ int set_file_attrs(char *fname, struct f
  #ifdef SUPPORT_XATTRS
        if (preserve_xattrs && set_xattr(fname, file, sxp) == 0)
                updated = 1;
@@ -296,7 +248,7 @@ or, if you want ACL support too:
  #endif
  #ifdef SUPPORT_ACLS
        /* It's OK to call set_acl() now, even for a dir, as the generator
-@@ -237,7 +240,7 @@ int set_file_attrs(char *fname, struct f
+@@ -236,7 +240,7 @@ int set_file_attrs(char *fname, struct f
  
  #ifdef HAVE_CHMOD
        if ((sxp->st.st_mode & CHMOD_BITS) != (new_mode & CHMOD_BITS)) {
@@ -483,12 +435,11 @@ or, if you want ACL support too:
  int preserve_perms = 0;
 --- old/xattr.c
 +++ new/xattr.c
-@@ -28,11 +28,15 @@
+@@ -28,11 +28,14 @@
  extern int dry_run;
  extern int read_only;
  extern int list_only;
 +extern int am_root;
-+extern mode_t orig_umask;
  extern unsigned int file_struct_len;
  
  #define RSYNC_XAL_INITIAL 5
@@ -499,7 +450,7 @@ or, if you want ACL support too:
  typedef struct {
        char *name;
        char *datum;
-@@ -132,9 +136,15 @@ static int rsync_xal_get(const char *fna
+@@ -132,9 +135,15 @@ static int rsync_xal_get(const char *fna
        if (name_size == 0)
                return 0;
        for (left = name_size, name = namebuf; left > 0 ; left -= len, name += len) {
@@ -516,7 +467,7 @@ or, if you want ACL support too:
                datum_size = sys_lgetxattr(fname, name, NULL, 0);
                if (datum_size < 0) {
                        if (errno == ENOTSUP)
-@@ -287,10 +297,19 @@ void receive_xattr(struct file_struct *f
+@@ -287,10 +296,19 @@ void receive_xattr(struct file_struct *f
                                out_of_memory("receive_xattr");
                        read_buf(f, ptr, name_len);
                        read_buf(f, ptr + name_len, datum_len);
@@ -536,7 +487,7 @@ or, if you want ACL support too:
  #ifdef HAVE_OSX_XATTRS
                        if (strncmp(rxa->name, UNIQUE_PREFIX, UPRE_LEN) == 0) {
                                rxa->name_len -= UPRE_LEN;
-@@ -372,4 +391,146 @@ int set_xattr(const char *fname, const s
+@@ -372,4 +390,146 @@ int set_xattr(const char *fname, const s
        return rsync_xal_set(fname, lst + ndx); /* TODO:  This needs to return 1 if no xattrs changed! */
  }