- Added some calls to die_on_unsafe_path() to the path-sanitizing code.
authorWayne Davison <wayned@samba.org>
Fri, 5 May 2006 15:58:44 +0000 (15:58 +0000)
committerWayne Davison <wayned@samba.org>
Fri, 5 May 2006 15:58:44 +0000 (15:58 +0000)
- Moved the sanitizing of the partial_dir value into main.c.

options.c

index e5f88f7..b6eae4e 100644 (file)
--- 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;