[SCM] The rsync repository. - branch master updated

Rsync CVS commit messages rsync-cvs at lists.samba.org
Sun Sep 13 23:28:25 UTC 2015


The branch, master has been updated
       via  bb853b3 Add -wo option for write-only rrsync mode.
      from  cce4486 Fixed logging of %b & %c when using --log-file.

https://git.samba.org/?p=rsync.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit bb853b32055a16e983267c6f5b8244aac311fdf9
Author: Wayne Davison <wayned at samba.org>
Date:   Sun Sep 13 16:15:17 2015 -0700

    Add -wo option for write-only rrsync mode.

-----------------------------------------------------------------------

Summary of changes:
 NEWS           |  1 +
 support/rrsync | 21 ++++++++++++++++-----
 2 files changed, 17 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/NEWS b/NEWS
index 3ab8b2d..1071988 100644
--- a/NEWS
+++ b/NEWS
@@ -32,6 +32,7 @@ Changes since 3.1.1:
       BackupPC happier.
     - Made configure choose to use linux xattrs on netbsd (rather than not
       supporting xattrs).
+    - Added -wo (write-only) option to rrsync support script.
     - Misc. manpage tweaks.
 
   DEVELOPER RELATED:
diff --git a/support/rrsync b/support/rrsync
index 5d2b8ae..9195aa2 100644
--- a/support/rrsync
+++ b/support/rrsync
@@ -15,11 +15,21 @@ use constant RSYNC => '/usr/bin/rsync';
 use constant LOGFILE => 'rrsync.log';
 
 my $Usage = <<EOM;
-Use 'command="$0 [-ro] SUBDIR"'
+Use 'command="$0 [-ro|-wo] SUBDIR"'
 	in front of lines in $ENV{HOME}/.ssh/authorized_keys
 EOM
 
-our $ro = (@ARGV && $ARGV[0] eq '-ro') ? shift : '';	# -ro = Read-Only
+# Handle the -ro and -wo options.
+our $only = '';
+while (@ARGV && $ARGV[0] =~ /^-([rw])o$/) {
+    my $r_or_w = $1;
+    if ($only && $only ne $r_or_w) {
+	die "$0: the -ro and -wo options conflict.\n";
+    }
+    $only = $r_or_w;
+    shift;
+}
+
 our $subdir = shift;
 die "$0: No subdirectory specified\n$Usage" unless defined $subdir;
 $subdir = abs_path($subdir);
@@ -41,7 +51,8 @@ die "$0: Not invoked via sshd\n$Usage"	unless defined $command;
 die "$0: SSH_ORIGINAL_COMMAND='$command' is not rsync\n" unless $command =~ s/^rsync\s+//;
 die "$0: --server option is not first\n" unless $command =~ /^--server\s/;
 our $am_sender = $command =~ /^--server\s+--sender\s/; # Restrictive on purpose!
-die "$0 -ro: sending to read-only server not allowed\n" if $ro && !$am_sender;
+die "$0 sending to read-only server not allowed\n" if $only eq 'r' && !$am_sender;
+die "$0 reading from write-only server not allowed\n" if $only eq 'w' && $am_sender;
 
 ### START of options data produced by the cull_options script. ###
 
@@ -116,8 +127,8 @@ our %long_opt = (
   'perms' => 0,
   'preallocate' => 0,
   'recursive' => 0,
-  'remove-sent-files' => $ro ? -1 : 0,
-  'remove-source-files' => $ro ? -1 : 0,
+  'remove-sent-files' => $only eq 'r' ? -1 : 0,
+  'remove-source-files' => $only eq 'r' ? -1 : 0,
   'safe-links' => 0,
   'sender' => 0,
   'server' => 0,


-- 
The rsync repository.



More information about the rsync-cvs mailing list