summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2008-03-15 11:25:01 -0700
committerWayne Davison <wayned@samba.org>2008-03-15 11:56:18 -0700
commit53936ef935e97d2036ad09b61b7040979d175469 (patch)
tree640fc0feaebe1617cf33389a98fec2e32644d5ae /io.c
parent7f9bf6b710362860ff801855b8939bdd28fc838f (diff)
downloadrsync-53936ef935e97d2036ad09b61b7040979d175469.tar.gz
rsync-53936ef935e97d2036ad09b61b7040979d175469.tar.bz2
rsync-53936ef935e97d2036ad09b61b7040979d175469.zip
Fixed the use of --protect-args (-s) with a daemon.
Diffstat (limited to 'io.c')
-rw-r--r--io.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/io.c b/io.c
index ce675d20..018dd282 100644
--- a/io.c
+++ b/io.c
@@ -874,8 +874,8 @@ int read_line(int fd, char *buf, size_t bufsiz, int flags)
return s - buf;
}
-int read_args(int f_in, char *mod_name, char *buf, size_t bufsiz, int rl_nulls,
- char ***argv_p, int *argc_p, char **request_p)
+void read_args(int f_in, char *mod_name, char *buf, size_t bufsiz, int rl_nulls,
+ char ***argv_p, int *argc_p, char **request_p)
{
int maxargs = MAX_ARGS;
int dot_pos = 0;
@@ -889,14 +889,14 @@ int read_args(int f_in, char *mod_name, char *buf, size_t bufsiz, int rl_nulls,
if (!(argv = new_array(char *, maxargs)))
out_of_memory("read_args");
- if (mod_name)
+ if (mod_name && !protect_args)
argv[argc++] = "rsyncd";
while (1) {
if (read_line(f_in, buf, bufsiz, rl_flags) == 0)
break;
- if (argc == maxargs) {
+ if (argc == maxargs-1) {
maxargs += MAX_ARGS;
if (!(argv = realloc_array(argv, char *, maxargs)))
out_of_memory("read_args");
@@ -919,11 +919,10 @@ int read_args(int f_in, char *mod_name, char *buf, size_t bufsiz, int rl_nulls,
dot_pos = argc;
}
}
+ argv[argc] = NULL;
*argc_p = argc;
*argv_p = argv;
-
- return dot_pos ? dot_pos : argc;
}
int io_start_buffering_out(int f_out)