- Mustn't override a user-specified list_only value.
authorWayne Davison <wayned@samba.org>
Sat, 22 Jan 2005 22:48:27 +0000 (22:48 +0000)
committerWayne Davison <wayned@samba.org>
Sat, 22 Jan 2005 22:48:27 +0000 (22:48 +0000)
- Moved the computing of the options for the server down until
  after we've figured out the protocol_version for the transfer.
- If we're talking to a protocol-29 server in list-only mode,
  force the new --list-only mode (which avoids the -r with
  --exclude="/*/*" kluge).
- Output the options we sent to the daemon if verbose > 1.

clientserver.c

index ec74054..58a2f2c 100644 (file)
@@ -112,7 +112,7 @@ int start_inband_exchange(char *user, char *path, int f_in, int f_out,
        char *p;
 
        if (argc == 0 && !am_sender)
-               list_only = 1;
+               list_only |= 1;
 
        if (*path == '/') {
                rprintf(FERROR,
@@ -125,19 +125,6 @@ int start_inband_exchange(char *user, char *path, int f_in, int f_out,
        if (!user)
                user = getenv("LOGNAME");
 
-       /* set daemon_over_rsh to false since we need to build the
-        * true set of args passed through the rsh/ssh connection;
-        * this is a no-op for direct-socket-connection mode */
-       daemon_over_rsh = 0;
-       server_options(sargs, &sargc);
-
-       sargs[sargc++] = ".";
-
-       if (path && *path)
-               sargs[sargc++] = path;
-
-       sargs[sargc] = NULL;
-
        io_printf(f_out, "@RSYNCD: %d\n", protocol_version);
 
        if (!read_line(f_in, line, sizeof line - 1)) {
@@ -154,6 +141,25 @@ int start_inband_exchange(char *user, char *path, int f_in, int f_out,
        if (protocol_version > remote_protocol)
                protocol_version = remote_protocol;
 
+       if (list_only && protocol_version >= 29)
+               list_only |= 2;
+
+       /* set daemon_over_rsh to false since we need to build the
+        * true set of args passed through the rsh/ssh connection;
+        * this is a no-op for direct-socket-connection mode */
+       daemon_over_rsh = 0;
+       server_options(sargs, &sargc);
+
+       sargs[sargc++] = ".";
+
+       if (path && *path)
+               sargs[sargc++] = path;
+
+       sargs[sargc] = NULL;
+
+       if (verbose > 1)
+               print_child_argv(sargs);
+
        p = strchr(path,'/');
        if (p) *p = 0;
        io_printf(f_out, "%s\n", path);