extern int sanitize_paths;
extern int daemon_over_rsh;
extern unsigned int module_dirlen;
extern int sanitize_paths;
extern int daemon_over_rsh;
extern unsigned int module_dirlen;
static const char *info_verbosity[1+MAX_VERBOSITY] = {
/*0*/ NULL,
/*1*/ "COPY,DEL,FLIST,MISC,NAME,STATS,SYMSAFE",
static const char *info_verbosity[1+MAX_VERBOSITY] = {
/*0*/ NULL,
/*1*/ "COPY,DEL,FLIST,MISC,NAME,STATS,SYMSAFE",
- /*2*/ "BACKUP,MOUNT,NAME2,REMOVE,SKIP",
+ /*2*/ "BACKUP,MISC2,MOUNT,NAME2,REMOVE,SKIP",
INFO_WORD(COPY, W_REC, "Mention files copied locally on the receiving side"),
INFO_WORD(DEL, W_REC, "Mention deletions on the receiving side"),
INFO_WORD(FLIST, W_CLI, "Mention file-list receiving/sending (levels 1-2)"),
INFO_WORD(COPY, W_REC, "Mention files copied locally on the receiving side"),
INFO_WORD(DEL, W_REC, "Mention deletions on the receiving side"),
INFO_WORD(FLIST, W_CLI, "Mention file-list receiving/sending (levels 1-2)"),
- INFO_WORD(MISC, W_SND|W_REC, "Mention miscellaneous information"),
+ INFO_WORD(MISC, W_SND|W_REC, "Mention miscellaneous information (levels 1-2)"),
INFO_WORD(MOUNT, W_SND|W_REC, "Mention mounts that were found or skipped"),
INFO_WORD(NAME, W_SND|W_REC, "Mention 1) updated file/dir names, 2) unchanged names"),
INFO_WORD(PROGRESS, W_CLI, "Mention 1) per-file progress or 2) total transfer progress"),
INFO_WORD(MOUNT, W_SND|W_REC, "Mention mounts that were found or skipped"),
INFO_WORD(NAME, W_SND|W_REC, "Mention 1) updated file/dir names, 2) unchanged names"),
INFO_WORD(PROGRESS, W_CLI, "Mention 1) per-file progress or 2) total transfer progress"),
DEBUG_WORD(HASH, W_SND|W_REC, "Debug hashtable code"),
DEBUG_WORD(HLINK, W_SND|W_REC, "Debug hard-link actions"),
DEBUG_WORD(ICONV, W_CLI|W_SRV, "Debug iconv character conversions (levels 1-2)"),
DEBUG_WORD(HASH, W_SND|W_REC, "Debug hashtable code"),
DEBUG_WORD(HLINK, W_SND|W_REC, "Debug hard-link actions"),
DEBUG_WORD(ICONV, W_CLI|W_SRV, "Debug iconv character conversions (levels 1-2)"),
DEBUG_WORD(OWN, W_REC, "Debug ownership changes in users & groups (levels 1-2)"),
DEBUG_WORD(PROTO, W_CLI|W_SRV, "Debug protocol information"),
DEBUG_WORD(RECV, W_REC, "Debug receiver functions"),
DEBUG_WORD(OWN, W_REC, "Debug ownership changes in users & groups (levels 1-2)"),
DEBUG_WORD(PROTO, W_CLI|W_SRV, "Debug protocol information"),
DEBUG_WORD(RECV, W_REC, "Debug receiver functions"),
static int refused_delete_during;
static int refused_inplace, refused_no_iconv;
static BOOL usermap_via_chown, groupmap_via_chown;
static int refused_delete_during;
static int refused_inplace, refused_no_iconv;
static BOOL usermap_via_chown, groupmap_via_chown;
static char tmp_partialdir[] = ".~tmp~";
/** Local address to bind. As a character string because it's
static char tmp_partialdir[] = ".~tmp~";
/** Local address to bind. As a character string because it's
rprintf(F," --log-file-format=FMT log updates using the specified FMT\n");
rprintf(F," --password-file=FILE read daemon-access password from FILE\n");
rprintf(F," --list-only list the files instead of copying them\n");
rprintf(F," --log-file-format=FMT log updates using the specified FMT\n");
rprintf(F," --password-file=FILE read daemon-access password from FILE\n");
rprintf(F," --list-only list the files instead of copying them\n");
rprintf(F," --write-batch=FILE write a batched update to FILE\n");
rprintf(F," --only-write-batch=FILE like --write-batch but w/o updating destination\n");
rprintf(F," --read-batch=FILE read a batched update from FILE\n");
rprintf(F," --write-batch=FILE write a batched update to FILE\n");
rprintf(F," --only-write-batch=FILE like --write-batch but w/o updating destination\n");
rprintf(F," --read-batch=FILE read a batched update from FILE\n");
OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW, OPT_MIN_SIZE, OPT_CHMOD,
OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH, OPT_MAX_SIZE,
OPT_NO_D, OPT_APPEND, OPT_NO_ICONV, OPT_INFO, OPT_DEBUG,
OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW, OPT_MIN_SIZE, OPT_CHMOD,
OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH, OPT_MAX_SIZE,
OPT_NO_D, OPT_APPEND, OPT_NO_ICONV, OPT_INFO, OPT_DEBUG,
- OPT_USERMAP, OPT_GROUPMAP, OPT_CHOWN,
+ OPT_USERMAP, OPT_GROUPMAP, OPT_CHOWN, OPT_BWLIMIT,
OPT_SERVER, OPT_REFUSED_BASE = 9000};
static struct poptOption long_options[] = {
OPT_SERVER, OPT_REFUSED_BASE = 9000};
static struct poptOption long_options[] = {
{"itemize-changes", 'i', POPT_ARG_NONE, 0, 'i', 0, 0 },
{"no-itemize-changes",0, POPT_ARG_VAL, &itemize_changes, 0, 0, 0 },
{"no-i", 0, POPT_ARG_VAL, &itemize_changes, 0, 0, 0 },
{"itemize-changes", 'i', POPT_ARG_NONE, 0, 'i', 0, 0 },
{"no-itemize-changes",0, POPT_ARG_VAL, &itemize_changes, 0, 0, 0 },
{"no-i", 0, POPT_ARG_VAL, &itemize_changes, 0, 0, 0 },
- {"bwlimit", 0, POPT_ARG_INT, &bwlimit, 0, 0, 0 },
+ {"bwlimit", 0, POPT_ARG_STRING, &bwlimit_arg, OPT_BWLIMIT, 0, 0 },
{"no-bwlimit", 0, POPT_ARG_VAL, &bwlimit, 0, 0, 0 },
{"backup", 'b', POPT_ARG_VAL, &make_backups, 1, 0, 0 },
{"no-backup", 0, POPT_ARG_VAL, &make_backups, 0, 0, 0 },
{"no-bwlimit", 0, POPT_ARG_VAL, &bwlimit, 0, 0, 0 },
{"backup", 'b', POPT_ARG_VAL, &make_backups, 1, 0, 0 },
{"no-backup", 0, POPT_ARG_VAL, &make_backups, 0, 0, 0 },
rprintf(F,"\n");
rprintf(F,"Usage: rsync --daemon [OPTION]...\n");
rprintf(F," --address=ADDRESS bind to the specified address\n");
rprintf(F,"\n");
rprintf(F,"Usage: rsync --daemon [OPTION]...\n");
rprintf(F," --address=ADDRESS bind to the specified address\n");
rprintf(F," --config=FILE specify alternate rsyncd.conf file\n");
rprintf(F," -M, --dparam=OVERRIDE override global daemon config parameter\n");
rprintf(F," --no-detach do not detach from the parent\n");
rprintf(F," --config=FILE specify alternate rsyncd.conf file\n");
rprintf(F," -M, --dparam=OVERRIDE override global daemon config parameter\n");
rprintf(F," --no-detach do not detach from the parent\n");
/* We convert this manually because we may need %lld precision,
* and that's not a portable sprintf() escape. */
char buf[128], *s = buf + sizeof buf - 1;
/* We convert this manually because we may need %lld precision,
* and that's not a portable sprintf() escape. */
char buf[128], *s = buf + sizeof buf - 1;
- parse_rule(&filter_list, poptGetOptArg(pc), 0, 0);
+ parse_filter_str(&filter_list, poptGetOptArg(pc),
+ rule_template(0), 0);
- parse_rule(&filter_list, poptGetOptArg(pc),
- 0, XFLG_OLD_PREFIXES);
+ parse_filter_str(&filter_list, poptGetOptArg(pc),
+ rule_template(0), XFLG_OLD_PREFIXES);
- parse_rule(&filter_list, poptGetOptArg(pc),
- FILTRULE_INCLUDE, XFLG_OLD_PREFIXES);
+ parse_filter_str(&filter_list, poptGetOptArg(pc),
+ rule_template(FILTRULE_INCLUDE), XFLG_OLD_PREFIXES);
arg = sanitize_path(NULL, arg, NULL, 0, SP_DEFAULT);
if (daemon_filter_list.head) {
int rej;
arg = sanitize_path(NULL, arg, NULL, 0, SP_DEFAULT);
if (daemon_filter_list.head) {
int rej;
- goto options_rejected;
- dir = cp + (*cp == '/' ? module_dirlen : 0);
- clean_fname(dir, CFN_COLLAPSE_DOT_DOT_DIRS);
- rej = check_filter(&daemon_filter_list, FLOG, dir, 0) < 0;
+ rej = 1;
+ else {
+ char *dir = cp + (*cp == '/' ? module_dirlen : 0);
+ clean_fname(dir, CFN_COLLAPSE_DOT_DOT_DIRS);
+ rej = check_filter(&daemon_filter_list, FLOG, dir, 0) < 0;
+ }
- parse_rule(&filter_list,": /.rsync-filter",0,0);
+ parse_filter_str(&filter_list,": /.rsync-filter",rule_template(0),0);
- parse_rule(&filter_list,"- .rsync-filter",0,0);
+ parse_filter_str(&filter_list,"- .rsync-filter",rule_template(0),0);
+ case OPT_BWLIMIT:
+ {
+ OFF_T limit = parse_size_arg(&bwlimit_arg, 'K');
+ if (limit < 0) {
+ snprintf(err_buf, sizeof err_buf,
+ "--bwlimit value is invalid: %s\n", bwlimit_arg);
+ return 0;
+ }
+ bwlimit = (limit + 512) / 1024;
+ if (limit && !bwlimit) {
+ snprintf(err_buf, sizeof err_buf,
+ "--bwlimit value is too small: %s\n", bwlimit_arg);
+ return 0;
+ }
+ }
+ break;
+
- parse_rule(&filter_list, "- /*/*", 0, 0);
+ parse_filter_str(&filter_list, "- /*/*", rule_template(0), 0);
}
if (!xfer_dirs && delete_mode) {
snprintf(err_buf, sizeof err_buf,
}
if (!xfer_dirs && delete_mode) {
snprintf(err_buf, sizeof err_buf,
backup_dir = sanitize_path(NULL, backup_dir, NULL, 0, SP_DEFAULT);
}
if (daemon_filter_list.head && !am_sender) {
backup_dir = sanitize_path(NULL, backup_dir, NULL, 0, SP_DEFAULT);
}
if (daemon_filter_list.head && !am_sender) {
} else if (make_backups && delete_mode && !delete_excluded && !am_server) {
snprintf(backup_dir_buf, sizeof backup_dir_buf,
"P *%s", backup_suffix);
} else if (make_backups && delete_mode && !delete_excluded && !am_server) {
snprintf(backup_dir_buf, sizeof backup_dir_buf,
"P *%s", backup_suffix);
- parse_rule(&filter_list, backup_dir_buf, 0, 0);
+ parse_filter_str(&filter_list, backup_dir_buf, rule_template(0), 0);