From d1e6b0e225fd669aa547eae011691075934308a3 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Fri, 5 May 2006 15:58:44 +0000 Subject: [PATCH] - Added some calls to die_on_unsafe_path() to the path-sanitizing code. - Moved the sanitizing of the partial_dir value into main.c. --- options.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/options.c b/options.c index e5f88f73..b6eae4e1 100644 --- a/options.c +++ b/options.c @@ -890,8 +890,10 @@ int parse_arguments(int *argc, const char ***argv, int frommain) case OPT_EXCLUDE_FROM: case OPT_INCLUDE_FROM: arg = poptGetOptArg(pc); - if (sanitize_paths) + if (sanitize_paths) { arg = sanitize_path(NULL, arg, NULL, 0, NULL); + die_on_unsafe_path((char*)arg, 0); + } if (server_filter_list.head) { char *cp = strdup(arg); if (!cp) @@ -1209,12 +1211,14 @@ int parse_arguments(int *argc, const char ***argv, int frommain) int i; for (i = *argc; i-- > 0; ) (*argv)[i] = sanitize_path(NULL, (*argv)[i], "", 0, NULL); - if (tmpdir) + if (tmpdir) { tmpdir = sanitize_path(NULL, tmpdir, NULL, 0, NULL); - if (partial_dir) - partial_dir = sanitize_path(NULL, partial_dir, NULL, 0, NULL); - if (backup_dir) + die_on_unsafe_path(tmpdir, 0); + } + if (backup_dir) { backup_dir = sanitize_path(NULL, backup_dir, NULL, 0, NULL); + die_on_unsafe_path(backup_dir, 0); + } } if (server_filter_list.head && !am_sender) { struct filter_list_struct *elp = &server_filter_list; @@ -1225,11 +1229,6 @@ int parse_arguments(int *argc, const char ***argv, int frommain) if (check_filter(elp, tmpdir, 1) < 0) goto options_rejected; } - if (partial_dir && *partial_dir) { - clean_fname(partial_dir, 1); - if (check_filter(elp, partial_dir, 1) < 0) - goto options_rejected; - } if (backup_dir) { if (!*backup_dir) goto options_rejected; -- 2.34.1