Changed the name of the server_filter_list to be

daemon_filter_list, for improved clarity.
This commit is contained in:
Wayne Davison
2008-03-20 10:42:43 -07:00
parent d2f6e19262
commit 819bfe4599
9 changed files with 45 additions and 46 deletions

View File

@@ -56,7 +56,7 @@ extern char *logfile_format;
extern char *files_from;
extern char *tmpdir;
extern struct chmod_mode_struct *chmod_modes;
extern struct filter_list_struct server_filter_list;
extern struct filter_list_struct daemon_filter_list;
extern char curr_dir[];
#ifdef ICONV_OPTION
extern char *iconv_opt;
@@ -532,24 +532,24 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
set_filter_dir(module_dir, module_dirlen);
p = lp_filter(i);
parse_rule(&server_filter_list, p, MATCHFLG_WORD_SPLIT,
parse_rule(&daemon_filter_list, p, MATCHFLG_WORD_SPLIT,
XFLG_ABS_IF_SLASH);
p = lp_include_from(i);
parse_filter_file(&server_filter_list, p, MATCHFLG_INCLUDE,
parse_filter_file(&daemon_filter_list, p, MATCHFLG_INCLUDE,
XFLG_ABS_IF_SLASH | XFLG_OLD_PREFIXES | XFLG_FATAL_ERRORS);
p = lp_include(i);
parse_rule(&server_filter_list, p,
parse_rule(&daemon_filter_list, p,
MATCHFLG_INCLUDE | MATCHFLG_WORD_SPLIT,
XFLG_ABS_IF_SLASH | XFLG_OLD_PREFIXES);
p = lp_exclude_from(i);
parse_filter_file(&server_filter_list, p, 0,
parse_filter_file(&daemon_filter_list, p, 0,
XFLG_ABS_IF_SLASH | XFLG_OLD_PREFIXES | XFLG_FATAL_ERRORS);
p = lp_exclude(i);
parse_rule(&server_filter_list, p, MATCHFLG_WORD_SPLIT,
parse_rule(&daemon_filter_list, p, MATCHFLG_WORD_SPLIT,
XFLG_ABS_IF_SLASH | XFLG_OLD_PREFIXES);
log_init(1);

View File

@@ -43,7 +43,7 @@ extern unsigned int module_dirlen;
struct filter_list_struct filter_list = { 0, 0, "" };
struct filter_list_struct cvs_filter_list = { 0, 0, " [global CVS]" };
struct filter_list_struct server_filter_list = { 0, 0, " [daemon]" };
struct filter_list_struct daemon_filter_list = { 0, 0, " [daemon]" };
/* Need room enough for ":MODS " prefix plus some room to grow. */
#define MAX_RULE_PREFIX (16)
@@ -1009,10 +1009,10 @@ void parse_filter_file(struct filter_list_struct *listp, const char *fname,
return;
if (*fname != '-' || fname[1] || am_server) {
if (server_filter_list.head) {
if (daemon_filter_list.head) {
strlcpy(line, fname, sizeof line);
clean_fname(line, CFN_COLLAPSE_DOT_DOT_DIRS);
if (check_filter(&server_filter_list, line, 0) < 0)
if (check_filter(&daemon_filter_list, line, 0) < 0)
fp = NULL;
else
fp = fopen(line, "rb");

View File

@@ -76,7 +76,7 @@ extern char curr_dir[MAXPATHLEN];
extern struct chmod_mode_struct *chmod_modes;
extern struct filter_list_struct filter_list;
extern struct filter_list_struct server_filter_list;
extern struct filter_list_struct daemon_filter_list;
#ifdef ICONV_OPTION
extern int filesfrom_convert;
@@ -234,8 +234,8 @@ int link_stat(const char *path, STRUCT_STAT *stp, int follow_dirlinks)
static inline int is_daemon_excluded(const char *fname, int is_dir)
{
if (server_filter_list.head
&& check_filter(&server_filter_list, fname, is_dir) < 0) {
if (daemon_filter_list.head
&& check_filter(&daemon_filter_list, fname, is_dir) < 0) {
errno = ENOENT;
return 1;
}

View File

@@ -97,7 +97,7 @@ extern char *backup_dir;
extern char *backup_suffix;
extern int backup_suffix_len;
extern struct file_list *cur_flist, *first_flist, *dir_flist;
extern struct filter_list_struct server_filter_list;
extern struct filter_list_struct daemon_filter_list;
int ignore_perishable = 0;
int non_perishable_cnt = 0;
@@ -1281,8 +1281,8 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
skip_dir = NULL;
}
if (server_filter_list.head) {
if (check_filter(&server_filter_list, fname, is_dir) < 0) {
if (daemon_filter_list.head) {
if (check_filter(&daemon_filter_list, fname, is_dir) < 0) {
if (is_dir < 0)
return;
#ifdef SUPPORT_HARD_LINKS

12
main.c
View File

@@ -78,7 +78,7 @@ extern char *batch_name;
extern char *password_file;
extern char curr_dir[MAXPATHLEN];
extern struct file_list *first_flist;
extern struct filter_list_struct server_filter_list;
extern struct filter_list_struct daemon_filter_list;
uid_t our_uid;
int local_server = 0;
@@ -507,9 +507,9 @@ static char *get_local_name(struct file_list *flist, char *dest_path)
if (!dest_path || list_only)
return NULL;
if (server_filter_list.head
&& (check_filter(&server_filter_list, dest_path, 0 != 0) < 0
|| check_filter(&server_filter_list, dest_path, 1 != 0) < 0)) {
if (daemon_filter_list.head
&& (check_filter(&daemon_filter_list, dest_path, 0 != 0) < 0
|| check_filter(&daemon_filter_list, dest_path, 1 != 0) < 0)) {
rprintf(FERROR, "skipping daemon-excluded destination \"%s\"\n",
dest_path);
exit_cleanup(RERR_FILESELECT);
@@ -908,9 +908,9 @@ static void do_server_recv(int f_in, int f_out, int argc, char *argv[])
}
check_alt_basis_dirs();
if (server_filter_list.head) {
if (daemon_filter_list.head) {
char **dir_p;
struct filter_list_struct *elp = &server_filter_list;
struct filter_list_struct *elp = &daemon_filter_list;
for (dir_p = basis_dir; *dir_p; dir_p++) {
char *dir = *dir_p;

View File

@@ -30,7 +30,7 @@ extern int sanitize_paths;
extern int daemon_over_rsh;
extern unsigned int module_dirlen;
extern struct filter_list_struct filter_list;
extern struct filter_list_struct server_filter_list;
extern struct filter_list_struct daemon_filter_list;
int make_backups = 0;
@@ -1033,7 +1033,7 @@ int parse_arguments(int *argc_p, const char ***argv_p)
arg = poptGetOptArg(pc);
if (sanitize_paths)
arg = sanitize_path(NULL, arg, NULL, 0);
if (server_filter_list.head) {
if (daemon_filter_list.head) {
int rej;
char *dir, *cp = strdup(arg);
if (!cp)
@@ -1042,7 +1042,7 @@ int parse_arguments(int *argc_p, const char ***argv_p)
goto options_rejected;
dir = cp + (*cp == '/' ? module_dirlen : 0);
clean_fname(dir, CFN_COLLAPSE_DOT_DOT_DIRS);
rej = check_filter(&server_filter_list, dir, 0) < 0;
rej = check_filter(&daemon_filter_list, dir, 0) < 0;
free(cp);
if (rej)
goto options_rejected;
@@ -1444,8 +1444,8 @@ int parse_arguments(int *argc_p, const char ***argv_p)
if (backup_dir)
backup_dir = sanitize_path(NULL, backup_dir, NULL, 0);
}
if (server_filter_list.head && !am_sender) {
struct filter_list_struct *elp = &server_filter_list;
if (daemon_filter_list.head && !am_sender) {
struct filter_list_struct *elp = &daemon_filter_list;
if (tmpdir) {
char *dir;
if (!*tmpdir)
@@ -1651,13 +1651,13 @@ int parse_arguments(int *argc_p, const char ***argv_p)
} else {
if (sanitize_paths)
files_from = sanitize_path(NULL, files_from, NULL, 0);
if (server_filter_list.head) {
if (daemon_filter_list.head) {
char *dir;
if (!*files_from)
goto options_rejected;
dir = files_from + (*files_from == '/' ? module_dirlen : 0);
clean_fname(dir, CFN_COLLAPSE_DOT_DOT_DIRS);
if (check_filter(&server_filter_list, dir, 0) < 0)
if (check_filter(&daemon_filter_list, dir, 0) < 0)
goto options_rejected;
}
filesfrom_fd = open(files_from, O_RDONLY|O_BINARY);

View File

@@ -55,7 +55,7 @@ extern char *tmpdir;
extern char *partial_dir;
extern char *basis_dir[];
extern struct file_list *cur_flist, *first_flist, *dir_flist;
extern struct filter_list_struct server_filter_list;
extern struct filter_list_struct daemon_filter_list;
static struct bitbag *delayed_bits = NULL;
static int phase = 0, redoing = 0;
@@ -489,8 +489,8 @@ int recv_files(int f_in, char *local_name)
cleanup_got_literal = 0;
if (server_filter_list.head
&& check_filter(&server_filter_list, fname, 0) < 0) {
if (daemon_filter_list.head
&& check_filter(&daemon_filter_list, fname, 0) < 0) {
rprintf(FERROR, "attempt to hack rsync failed.\n");
exit_cleanup(RERR_PROTOCOL);
}
@@ -555,8 +555,8 @@ int recv_files(int f_in, char *local_name)
fnamecmp = fnamecmpbuf;
break;
}
if (!fnamecmp || (server_filter_list.head
&& check_filter(&server_filter_list, fname, 0) < 0)) {
if (!fnamecmp || (daemon_filter_list.head
&& check_filter(&daemon_filter_list, fname, 0) < 0)) {
fnamecmp = fname;
fnamecmp_type = FNAMECMP_FNAME;
}

View File

@@ -29,7 +29,7 @@ int module_dirlen = 0;
mode_t orig_umask = 002;
char *partial_dir;
char *module_dir;
struct filter_list_struct server_filter_list;
struct filter_list_struct daemon_filter_list;
void rprintf(UNUSED(enum logcode code), const char *format, ...)
{

23
util.c
View File

@@ -33,7 +33,7 @@ extern char *module_dir;
extern unsigned int module_dirlen;
extern mode_t orig_umask;
extern char *partial_dir;
extern struct filter_list_struct server_filter_list;
extern struct filter_list_struct daemon_filter_list;
int sanitize_paths = 0;
@@ -503,14 +503,13 @@ int lock_range(int fd, int offset, int len)
return fcntl(fd,F_SETLK,&lock) == 0;
}
static int filter_server_path(char *arg)
static int filter_daemon_path(char *arg)
{
char *s;
if (server_filter_list.head) {
if (daemon_filter_list.head) {
char *s;
for (s = arg; (s = strchr(s, '/')) != NULL; ) {
*s = '\0';
if (check_filter(&server_filter_list, arg, 1) < 0) {
if (check_filter(&daemon_filter_list, arg, 1) < 0) {
/* We must leave arg truncated! */
return 1;
}
@@ -538,7 +537,7 @@ void glob_expand(char *s, char ***argv_ptr, int *argc_ptr, int *maxargs_ptr)
if (!*s)
s = ".";
s = argv[argc++] = strdup(s);
filter_server_path(s);
filter_daemon_path(s);
#else
glob_t globbuf;
@@ -559,7 +558,7 @@ void glob_expand(char *s, char ***argv_ptr, int *argc_ptr, int *maxargs_ptr)
/* Note: we check the first match against the filter list,
* just in case the user specified a wildcard in the path. */
if ((count = globbuf.gl_pathc) > 0) {
if (filter_server_path(globbuf.gl_pathv[0])) {
if (filter_daemon_path(globbuf.gl_pathv[0])) {
int slashes = 0;
char *cp;
/* Truncate original arg at glob's truncation point. */
@@ -581,7 +580,7 @@ void glob_expand(char *s, char ***argv_ptr, int *argc_ptr, int *maxargs_ptr)
have_glob_results = 1;
} else {
/* This truncates "s" at a filtered element, if present. */
filter_server_path(s);
filter_daemon_path(s);
have_glob_results = 0;
count = 1;
}
@@ -1004,13 +1003,13 @@ char *partial_dir_fname(const char *fname)
fn = fname;
if ((int)pathjoin(t, sz, partial_dir, fn) >= sz)
return NULL;
if (server_filter_list.head) {
if (daemon_filter_list.head) {
t = strrchr(partial_fname, '/');
*t = '\0';
if (check_filter(&server_filter_list, partial_fname, 1) < 0)
if (check_filter(&daemon_filter_list, partial_fname, 1) < 0)
return NULL;
*t = '/';
if (check_filter(&server_filter_list, partial_fname, 0) < 0)
if (check_filter(&daemon_filter_list, partial_fname, 0) < 0)
return NULL;
}