summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2007-12-16 14:16:37 -0800
committerWayne Davison <wayned@samba.org>2007-12-16 14:16:37 -0800
commita10186910dc0771ea907f92b1364cbb4912f37e3 (patch)
treee92d8fe916868c12637839a7d45b8b9a4b83b6ed /main.c
parenteb7715c1eb5a69a934fe59e1ccafe3b421b9c8fd (diff)
downloadrsync-a10186910dc0771ea907f92b1364cbb4912f37e3.tar.gz
Fixed the check_filter() calls that might be checking an absolute path
in "use chroot = no" mode against a daemon's exclude restriction.
Diffstat (limited to 'main.c')
-rw-r--r--main.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/main.c b/main.c
index b2dcb523..ba470481 100644
--- a/main.c
+++ b/main.c
@@ -65,6 +65,7 @@ extern int batch_fd;
extern int filesfrom_fd;
extern int connect_timeout;
extern pid_t cleanup_child_pid;
+extern unsigned int module_dirlen;
extern struct stats stats;
extern char *filesfrom_host;
extern char *partial_dir;
@@ -332,7 +333,6 @@ static pid_t do_cmd(char *cmd, char *machine, char *user, char **remote_argv, in
int i, argc = 0;
char *args[MAX_ARGS];
pid_t ret;
- char *dir = NULL;
int dash_l_set = 0;
if (!read_batch && !local_server) {
@@ -508,9 +508,6 @@ static pid_t do_cmd(char *cmd, char *machine, char *user, char **remote_argv, in
ret = piped_child(args, f_in_p, f_out_p);
}
- if (dir)
- free(dir);
-
return ret;
oom:
@@ -869,7 +866,6 @@ static void do_server_recv(int f_in, int f_out, int argc, char *argv[])
int exit_code;
struct file_list *flist;
char *local_name = NULL;
- char *dir = NULL;
int save_verbose = verbose;
if (filesfrom_fd >= 0) {
@@ -890,7 +886,7 @@ static void do_server_recv(int f_in, int f_out, int argc, char *argv[])
}
if (argc > 0) {
- dir = argv[0];
+ char *dir = argv[0];
argc--;
argv++;
if (!am_daemon && !push_dir(dir, 0)) {
@@ -940,15 +936,18 @@ static void do_server_recv(int f_in, int f_out, int argc, char *argv[])
check_alt_basis_dirs();
if (server_filter_list.head) {
- char **dir;
+ char **dir_p;
struct filter_list_struct *elp = &server_filter_list;
- for (dir = basis_dir; *dir; dir++) {
- if (check_filter(elp, *dir, 1) < 0)
+ for (dir_p = basis_dir; *dir_p; dir_p++) {
+ char *dir = *dir_p;
+ if (*dir == '/')
+ dir += module_dirlen;
+ if (check_filter(elp, dir, 1) < 0)
goto options_rejected;
}
if (partial_dir && *partial_dir == '/'
- && check_filter(elp, partial_dir, 1) < 0) {
+ && check_filter(elp, partial_dir + module_dirlen, 1) < 0) {
options_rejected:
rprintf(FERROR,
"Your options have been rejected by the server.\n");