From 668bbc0a0c53e18c8eeaf6985057de5a9e61e7f4 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Sat, 21 Oct 2006 21:00:47 +0000 Subject: [PATCH] Fixed a bug when acls are being preserved and one of the --*-dest options are in effect. Matt pointed out that the ACL-checking code was trying to check the perms of a non-existent destination file instead of an alternate basis file (when the dest does not exist and an alt-basis does). --- acls.diff | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/acls.diff b/acls.diff index 94a7cd0..f14b5fe 100644 --- a/acls.diff +++ b/acls.diff @@ -1328,7 +1328,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. #ifdef SUPPORT_LINKS if (preserve_links && S_ISLNK(f->mode)) { rprintf(FINFO, "%s %11.0f %s %s -> %s\n", -@@ -491,6 +494,9 @@ static struct file_struct *receive_file_ +@@ -495,6 +498,9 @@ static struct file_struct *receive_file_ char thisname[MAXPATHLEN]; unsigned int l1 = 0, l2 = 0; int alloc_len, basename_len, dirname_len, linkname_len, sum_len; @@ -1338,7 +1338,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. OFF_T file_length; char *basename, *dirname, *bp; struct file_struct *file; -@@ -594,13 +600,27 @@ static struct file_struct *receive_file_ +@@ -598,13 +604,27 @@ static struct file_struct *receive_file_ sum_len = always_checksum && S_ISREG(mode) ? MD4_SUM_LENGTH : 0; @@ -1366,7 +1366,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. file->modtime = modtime; file->length = file_length; -@@ -695,6 +715,11 @@ static struct file_struct *receive_file_ +@@ -699,6 +719,11 @@ static struct file_struct *receive_file_ read_buf(f, sum, checksum_len); } @@ -1378,7 +1378,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. return file; } -@@ -944,6 +969,9 @@ static struct file_struct *send_file_nam +@@ -949,6 +974,9 @@ static struct file_struct *send_file_nam unsigned short flags) { struct file_struct *file; @@ -1388,7 +1388,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. file = make_file(fname, flist, stp, flags, f == -2 ? SERVER_FILTERS : ALL_FILTERS); -@@ -953,6 +981,15 @@ static struct file_struct *send_file_nam +@@ -958,6 +986,15 @@ static struct file_struct *send_file_nam if (chmod_modes && !S_ISLNK(file->mode)) file->mode = tweak_mode(file->mode, chmod_modes); @@ -1404,7 +1404,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. maybe_emit_filelist_progress(flist->count + flist_count_offset); flist_expand(flist); -@@ -960,6 +997,15 @@ static struct file_struct *send_file_nam +@@ -965,6 +1002,15 @@ static struct file_struct *send_file_nam if (file->basename[0]) { flist->files[flist->count++] = file; send_file_entry(file, f); @@ -1954,7 +1954,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. - itemize(file, ndx, real_ret, &real_st, +#ifdef SUPPORT_ACLS + if (preserve_acls && real_ret == 0) -+ get_acl(fname, &real_sx); ++ get_acl(fnamecmp, &real_sx); +#endif + itemize(file, ndx, real_ret, &real_sx, 0, 0, NULL); @@ -2114,7 +2114,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. extern int make_backups; extern int remove_source_files; extern int stdout_format_has_i; -@@ -145,15 +146,19 @@ void init_hard_links(void) +@@ -147,15 +148,19 @@ void init_hard_links(void) #ifdef SUPPORT_HARD_LINKS static int maybe_hard_link(struct file_struct *file, int ndx, @@ -2138,7 +2138,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS, 0, ""); } -@@ -168,13 +173,13 @@ static int maybe_hard_link(struct file_s +@@ -170,13 +175,13 @@ static int maybe_hard_link(struct file_s return -1; } } @@ -2154,7 +2154,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. enum logcode code, int skip) { #ifdef SUPPORT_HARD_LINKS -@@ -215,7 +220,7 @@ int hard_link_check(struct file_struct * +@@ -217,7 +222,7 @@ int hard_link_check(struct file_struct * || st2.st_ino != st3.st_ino) continue; statret = 1; @@ -2163,7 +2163,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. if (verbose < 2 || !stdout_format_has_i) { itemizing = 0; code = FNONE; -@@ -225,12 +230,16 @@ int hard_link_check(struct file_struct * +@@ -227,12 +232,16 @@ int hard_link_check(struct file_struct * if (!unchanged_file(cmpbuf, file, &st3)) continue; statret = 1; @@ -2183,7 +2183,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. toname, &st2, itemizing, code); if (remove_source_files == 1 && do_xfers) { char numbuf[4]; -@@ -248,7 +257,7 @@ int hard_link_check(struct file_struct * +@@ -250,7 +259,7 @@ int hard_link_check(struct file_struct * #ifdef SUPPORT_HARD_LINKS int hard_link_one(struct file_struct *file, int ndx, char *fname, @@ -2192,7 +2192,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. int itemizing, enum logcode code) { if (do_link(toname, fname)) { -@@ -264,7 +273,11 @@ int hard_link_one(struct file_struct *fi +@@ -266,7 +275,11 @@ int hard_link_one(struct file_struct *fi } if (itemizing) { @@ -2205,7 +2205,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS, 0, terse ? "" : toname); } -@@ -281,11 +294,12 @@ void hard_link_cluster(struct file_struc +@@ -283,11 +296,12 @@ void hard_link_cluster(struct file_struc #ifdef SUPPORT_HARD_LINKS char hlink1[MAXPATHLEN]; char *hlink2; @@ -2220,7 +2220,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. return; if (!(file->flags & FLAG_HLINK_TOL)) { while (!(file->flags & FLAG_HLINK_EOL)) { -@@ -299,9 +313,13 @@ void hard_link_cluster(struct file_struc +@@ -301,9 +315,13 @@ void hard_link_cluster(struct file_struc if (file->F_HLINDEX != SKIPPED_LINK) continue; hlink2 = f_name(file, NULL); @@ -5518,7 +5518,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. +int sys_acl_free_qualifier(void *qual, SMB_ACL_TAG_T tagtype); --- old/log.c +++ new/log.c -@@ -615,8 +615,10 @@ static void log_formatted(enum logcode c +@@ -606,8 +606,10 @@ static void log_formatted(enum logcode c n[5] = !(iflags & ITEM_REPORT_PERMS) ? '.' : 'p'; n[6] = !(iflags & ITEM_REPORT_OWNER) ? '.' : 'o'; n[7] = !(iflags & ITEM_REPORT_GROUP) ? '.' : 'g'; @@ -5601,7 +5601,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. {"times", 't', POPT_ARG_VAL, &preserve_times, 1, 0, 0 }, {"no-times", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 }, {"no-t", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 }, -@@ -1082,6 +1094,24 @@ int parse_arguments(int *argc, const cha +@@ -1085,6 +1097,24 @@ int parse_arguments(int *argc, const cha usage(FINFO); exit_cleanup(0); @@ -5626,7 +5626,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. default: /* A large opt value means that set_refuse_options() * turned this option off. */ -@@ -1523,6 +1553,10 @@ void server_options(char **args,int *arg +@@ -1526,6 +1556,10 @@ void server_options(char **args,int *arg if (preserve_hard_links) argstr[x++] = 'H'; @@ -6677,7 +6677,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. extern int numeric_ids; extern int am_root; -@@ -275,7 +276,7 @@ void send_uid_list(int f) +@@ -273,7 +274,7 @@ void send_uid_list(int f) if (numeric_ids) return; @@ -6686,7 +6686,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. int len; /* we send sequences of uid/byte-length/name */ for (list = uidlist; list; list = list->next) { -@@ -292,7 +293,7 @@ void send_uid_list(int f) +@@ -290,7 +291,7 @@ void send_uid_list(int f) write_int(f, 0); } @@ -6695,7 +6695,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. int len; for (list = gidlist; list; list = list->next) { if (!list->name) -@@ -313,7 +314,7 @@ void recv_uid_list(int f, struct file_li +@@ -311,7 +312,7 @@ void recv_uid_list(int f, struct file_li int id, i; char *name; @@ -6704,7 +6704,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. /* read the uid list */ while ((id = read_int(f)) != 0) { int len = read_byte(f); -@@ -325,7 +326,7 @@ void recv_uid_list(int f, struct file_li +@@ -323,7 +324,7 @@ void recv_uid_list(int f, struct file_li } } @@ -6713,7 +6713,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. /* read the gid list */ while ((id = read_int(f)) != 0) { int len = read_byte(f); -@@ -337,6 +338,16 @@ void recv_uid_list(int f, struct file_li +@@ -335,6 +336,16 @@ void recv_uid_list(int f, struct file_li } } -- 2.34.1