if (arg_len < 0)
arg_len = strlen(arg);
- cp = arg;
- while (*cp) {
+ for (cp = arg; *cp; cp++) {
if (*cp == '\\' && cp[1]) {
cp++;
} else if (*cp == '[')
cnt++;
- cp++;
}
if (!cnt)
return;
rule->rflags = based_on->rflags;
rule->u.slash_cnt = based_on->u.slash_cnt;
p = rule->pattern = new_array(char, arg_len + cnt + 1);
- cp = arg;
- while (*cp) {
+ for (cp = arg; *cp; ) {
if (*cp == '\\' && cp[1]) {
*p++ = *cp++;
} else if (*cp == '[')
/* Each arg the client sends to the remote sender turns into an implied include
* that the receiver uses to validate the file list from the sender. */
-void add_implied_include(const char *arg)
+void add_implied_include(const char *arg, int skip_daemon_module)
{
filter_rule *rule;
int arg_len, saw_wild = 0, saw_live_open_brkt = 0, backslash_cnt = 0;
partial_string_len = 0;
arg = partial_string_buf;
}
+ if (skip_daemon_module) {
+ if ((cp = strchr(arg, '/')) != NULL)
+ arg = cp + 1;
+ else
+ arg = "";
+ }
if (relative_paths) {
if ((cp = strstr(arg, "/./")) != NULL)
arg = cp + 3;
if (arg_len) {
if (strpbrk(arg, "*[?")) {
/* We need to add room to escape backslashes if wildcard chars are present. */
- cp = arg;
- while ((cp = strchr(cp, '\\')) != NULL) {
+ for (cp = arg; (cp = strchr(cp, '\\')) != NULL; cp++)
arg_len++;
- cp++;
- }
saw_wild = 1;
}
arg_len++; /* Leave room for the prefixed slash */
rule->rflags = FILTRULE_INCLUDE + (saw_wild ? FILTRULE_WILD : 0);
p = rule->pattern = new_array(char, arg_len + 1);
*p++ = '/';
- cp = arg;
- while (*cp) {
+ for (cp = arg; *cp; ) {
switch (*cp) {
case '\\':
if (cp[1] == ']')
if (!saw_wild && backslash_cnt) {
/* We are appending a wildcard, so now the backslashes need to be escaped. */
p = rule->pattern = new_array(char, arg_len + backslash_cnt + 3 + 1);
- cp = arg;
- while (*cp) {
+ for (cp = arg; *cp; ) {
if (*cp == '\\')
*p++ = '\\';
*p++ = *cp++;
while (s != eob) {
if (*s++ == '\0') {
ff_xb.len = s - sob - 1;
- add_implied_include(sob);
+ add_implied_include(sob, 0);
if (iconvbufs(ic_send, &ff_xb, &iobuf.out, flags) < 0)
exit_cleanup(RERR_PROTOCOL); /* impossible? */
write_buf(iobuf.out_fd, s-1, 1); /* Send the '\0'. */
/* Eliminate any multi-'\0' runs. */
while (f != eob) {
if (!(*t++ = *f++)) {
- add_implied_include(cur);
+ add_implied_include(cur, 0);
cur = t;
while (f != eob && *f == '\0')
f++;
int dummy_port = rsync_port;
int i;
if (filesfrom_fd < 0)
- add_implied_include(remote_argv[0]);
+ add_implied_include(remote_argv[0], daemon_connection);
/* For remote source, any extra source args must have either
* the same hostname or an empty hostname. */
for (i = 1; i < remote_argc; i++) {
if (!rsync_port && !*arg) /* Turn an empty arg into a dot dir. */
arg = ".";
remote_argv[i] = arg;
- add_implied_include(arg);
+ add_implied_include(arg, daemon_connection);
}
}