Added missing calls to safe_fname() and full_fname().
authorWayne Davison <wayned@samba.org>
Mon, 7 Feb 2005 20:40:18 +0000 (20:40 +0000)
committerWayne Davison <wayned@samba.org>
Mon, 7 Feb 2005 20:40:18 +0000 (20:40 +0000)
flist.c
hlink.c
main.c
receiver.c

diff --git a/flist.c b/flist.c
index 0e81e9e..de27934 100644 (file)
--- a/flist.c
+++ b/flist.c
@@ -153,7 +153,7 @@ static void list_file_entry(struct file_struct *f)
                rprintf(FINFO, "%s %11.0f %s %s -> %s\n",
                        perms,
                        (double)f->length, timestring(f->modtime),
-                       safe_fname(f_name(f)), f->u.link);
+                       safe_fname(f_name(f)), safe_fname(f->u.link));
        } else
 #endif
        {
@@ -194,7 +194,7 @@ static int readlink_stat(const char *path, STRUCT_STAT *buffer, char *linkbuf)
                if (copy_unsafe_links && unsafe_symlink(linkbuf, path)) {
                        if (verbose > 1) {
                                rprintf(FINFO,"copying unsafe symlink \"%s\" -> \"%s\"\n",
-                                       path, linkbuf);
+                                       safe_fname(path), safe_fname(linkbuf));
                        }
                        return do_stat(path, buffer);
                }
@@ -554,7 +554,7 @@ static void receive_file_entry(struct file_list *flist, int ndx,
        if (l2 >= MAXPATHLEN - l1) {
                rprintf(FERROR,
                        "overflow: flags=0x%x l1=%d l2=%d lastname=%s\n",
-                       flags, l1, l2, lastname);
+                       flags, l1, l2, safe_fname(lastname));
                overflow("receive_file_entry");
        }
 
@@ -772,7 +772,8 @@ struct file_struct *make_file(char *fname, struct file_list *flist,
 
        if (strlcpy(thisname, fname, sizeof thisname)
            >= sizeof thisname - flist_dir_len) {
-               rprintf(FINFO, "skipping overly long name: %s\n", fname);
+               rprintf(FINFO, "skipping overly long name: %s\n",
+                       safe_fname(fname));
                return NULL;
        }
        clean_fname(thisname, 0);
@@ -817,7 +818,7 @@ struct file_struct *make_file(char *fname, struct file_list *flist,
                goto skip_filters;
 
        if (S_ISDIR(st.st_mode) && !xfer_dirs) {
-               rprintf(FINFO, "skipping directory %s\n", thisname);
+               rprintf(FINFO, "skipping directory %s\n", safe_fname(thisname));
                return NULL;
        }
 
@@ -843,7 +844,7 @@ skip_filters:
 
        if (verbose > 2) {
                rprintf(FINFO, "[%s] make_file(%s,*,%d)\n",
-                       who_am_i(), thisname, filter_level);
+                       who_am_i(), safe_fname(thisname), filter_level);
        }
 
        if ((basename = strrchr(thisname, '/')) != NULL) {
@@ -1050,7 +1051,7 @@ static void send_directory(int f, struct file_list *flist,
        if (errno) {
                io_error |= IOERR_GENERAL;
                *p = '\0';
-               rsyserr(FERROR, errno, "readdir(%s)", fbuf);
+               rsyserr(FERROR, errno, "readdir(%s)", full_fname(fbuf));
        }
 
        closedir(d);
@@ -1139,7 +1140,8 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
                }
 
                if (S_ISDIR(st.st_mode) && !xfer_dirs) {
-                       rprintf(FINFO, "skipping directory %s\n", fname);
+                       rprintf(FINFO, "skipping directory %s\n",
+                               safe_fname(fname));
                        continue;
                }
 
@@ -1318,7 +1320,7 @@ struct file_list *recv_file_list(int f)
 
                if (verbose > 2) {
                        rprintf(FINFO, "recv_file_name(%s)\n",
-                               f_name(flist->files[i]));
+                               safe_fname(f_name(flist->files[i])));
                }
        }
        receive_file_entry(NULL, 0, 0, 0); /* Signal that we're done. */
@@ -1474,7 +1476,7 @@ static void clean_flist(struct file_list *flist, int strip_root, int no_dups)
                        if (verbose > 1 && !am_server) {
                                rprintf(FINFO,
                                        "removing duplicate name %s from file list %d\n",
-                                       f_name(flist->files[i]), i);
+                                       safe_fname(f_name(flist->files[i])), i);
                        }
                        /* Make sure that if we unduplicate '.', that we don't
                         * lose track of a user-specified top directory. */
@@ -1527,7 +1529,7 @@ static void output_flist(struct file_list *flist, const char *whose_list)
                        sprintf(depthbuf, "%d", file->dir.depth);
                rprintf(FINFO, "[%s] i=%d %s %s%s%s%s mode=0%o len=%.0f%s%s flags=%x\n",
                        whose_list, i, am_sender ? NS(file->dir.root) : depthbuf,
-                       file->dirname ? file->dirname : "",
+                       file->dirname ? safe_fname(file->dirname) : "",
                        file->dirname ? "/" : "", NS(file->basename),
                        S_ISDIR(file->mode) ? "/" : "", (int)file->mode,
                        (double)file->length, uidbuf, gidbuf, file->flags);
diff --git a/hlink.c b/hlink.c
index 1918319..330ef07 100644 (file)
--- a/hlink.c
+++ b/hlink.c
@@ -143,7 +143,7 @@ int hard_link_check(struct file_struct *file, int skip)
        if (hlink_list[file->F_HLINDEX] != file) {
                if (verbose > 1) {
                        rprintf(FINFO, "\"%s\" is a hard link\n",
-                           f_name(file));
+                               safe_fname(f_name(file)));
                }
                return 1;
        }
@@ -157,11 +157,11 @@ static void hard_link_one(char *hlink1, char *hlink2)
        if (do_link(hlink1, hlink2)) {
                if (verbose) {
                        rsyserr(FINFO, errno, "link %s => %s failed",
-                               hlink2, hlink1);
+                               full_name(hlink2), safe_fname(hlink1));
                }
        }
        else if (verbose)
-               rprintf(FINFO, "%s => %s\n", hlink2, hlink1);
+               rprintf(FINFO, "%s => %s\n", safe_fname(hlink2), safe_fname(hlink1));
 }
 #endif
 
diff --git a/main.c b/main.c
index 02bee6b..fc48c01 100644 (file)
--- a/main.c
+++ b/main.c
@@ -337,7 +337,7 @@ static pid_t do_cmd(char *cmd, char *machine, char *user, char *path,
        if (verbose > 3) {
                rprintf(FINFO,"cmd=");
                for (i = 0; i < argc; i++)
-                       rprintf(FINFO,"%s ",args[i]);
+                       rprintf(FINFO, "%s ", safe_fname(args[i]));
                rprintf(FINFO,"\n");
        }
 
@@ -407,7 +407,7 @@ static char *get_local_name(struct file_list *flist,char *name)
                exit_cleanup(RERR_FILEIO);
        }
        if (verbose > 0)
-               rprintf(FINFO, "created directory %s\n", name);
+               rprintf(FINFO, "created directory %s\n", safe_fname(name));
 
        if (dry_run) {
                dry_run++;
@@ -965,10 +965,10 @@ static int start_client(int argc, char *argv[])
 
        if (verbose > 3) {
                rprintf(FINFO,"cmd=%s machine=%s user=%s path=%s\n",
-                       shell_cmd?shell_cmd:"",
-                       shell_machine?shell_machine:"",
-                       shell_user?shell_user:"",
-                       shell_path?shell_path:"");
+                       shell_cmd ? safe_fname(shell_cmd) : "",
+                       shell_machine ? safe_fname(shell_machine) : "",
+                       shell_user ? safe_fname(shell_user) : "",
+                       shell_path ? safe_fname(shell_path) : "");
        }
 
        /* for remote source, only single dest arg can remain ... */
@@ -1156,7 +1156,7 @@ int main(int argc,char *argv[])
                }
                if (batch_fd < 0) {
                        rsyserr(FERROR, errno, "Batch file %s open error",
-                               batch_name);
+                               full_fname(batch_name));
                        exit_cleanup(RERR_FILEIO);
                }
                if (read_batch)
index b6d30c0..a9a9cd2 100644 (file)
@@ -123,7 +123,8 @@ static int get_tmpname(char *fnametmp, char *fname)
        maxname = MIN(MAXPATHLEN - 7 - length, NAME_MAX - 8);
 
        if (maxname < 1) {
-               rprintf(FERROR, "temporary filename too long: %s\n", fname);
+               rprintf(FERROR, "temporary filename too long: %s\n",
+                       safe_fname(fname));
                fnametmp[0] = '\0';
                return 0;
        }
@@ -577,12 +578,14 @@ int recv_files(int f_in, struct file_list *flist, char *local_name,
                                        continue;
                                if (verbose > 2) {
                                        rprintf(FINFO, "renaming %s to %s\n",
-                                               partialptr, fname);
+                                               safe_fname(partialptr),
+                                               safe_fname(fname));
                                }
                                if (do_rename(partialptr, fname) < 0) {
                                        rsyserr(FERROR, errno,
                                                "rename failed for %s (from %s)",
-                                               fname, partialptr);
+                                               full_fname(fname),
+                                               safe_fname(partialptr));
                                } else {
                                        handle_partial_dir(partialptr,
                                                           PDIR_DELETE);