Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- Extended the "refuse options" daemon setting to allow wildcards
[rsync/rsync.git]
/
options.c
diff --git
a/options.c
b/options.c
index
b017c11
..
a27e68b
100644
(file)
--- a/
options.c
+++ b/
options.c
@@
-440,20
+440,31
@@
static void set_refuse_options(char *bp)
{
struct poptOption *op;
char *cp;
{
struct poptOption *op;
char *cp;
+ int match_short, is_wild;
while (1) {
while (1) {
+ while (*bp == ' ') bp++;
+ if (!*bp)
+ break;
if ((cp = strchr(bp, ' ')) != NULL)
*cp= '\0';
if ((cp = strchr(bp, ' ')) != NULL)
*cp= '\0';
+ /* If they specify "delete", reject all delete options. */
+ if (strcmp(bp, "delete") == 0)
+ bp = "delete*";
+ match_short = !bp[1] && *bp != '*';
+ is_wild = !match_short && strpbrk(bp, "*?[") != NULL;
for (op = long_options; ; op++) {
if (!op->longName) {
rprintf(FLOG,
for (op = long_options; ; op++) {
if (!op->longName) {
rprintf(FLOG,
- "
Unknown option %s in \"refuse options\" setting
\n",
+ "
No match for refuse-options string \"%s\"
\n",
bp);
break;
}
bp);
break;
}
- if (strcmp(bp, op->longName) == 0) {
- op->val = (op - long_options)+OPT_REFUSED_BASE;
- break;
+ if (match_short ? *bp == op->shortName
+ : wildmatch(bp, op->longName)) {
+ op->val = (op - long_options) + OPT_REFUSED_BASE;
+ if (!is_wild)
+ break;
}
}
if (!cp)
}
}
if (!cp)
@@
-1000,10
+1011,19
@@
void server_options(char **args,int *argc)
args[ac++] = arg;
}
args[ac++] = arg;
}
- if (delete_excluded)
- args[ac++] = "--delete-excluded";
- else if (delete_mode)
- args[ac++] = "--delete";
+ if (am_sender) {
+ if (delete_excluded)
+ args[ac++] = "--delete-excluded";
+ else if (delete_mode
+ && (!delete_after || protocol_version < 27))
+ args[ac++] = "--delete";
+
+ if (delete_after)
+ args[ac++] = "--delete-after";
+
+ if (force_delete)
+ args[ac++] = "--force";
+ }
if (size_only)
args[ac++] = "--size-only";
if (size_only)
args[ac++] = "--size-only";
@@
-1026,12
+1046,6
@@
void server_options(char **args,int *argc)
} else if (keep_partial)
args[ac++] = "--partial";
} else if (keep_partial)
args[ac++] = "--partial";
- if (force_delete)
- args[ac++] = "--force";
-
- if (delete_after)
- args[ac++] = "--delete-after";
-
if (ignore_errors)
args[ac++] = "--ignore-errors";
if (ignore_errors)
args[ac++] = "--ignore-errors";