From 2e5a7629c05f4f0e02725e7c31eb28a9a2632537 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Fri, 17 Jun 2005 01:17:44 +0000 Subject: [PATCH] If SUBDIR is specified as a non-absolute path, make it absolute. --- support/rrsync | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/support/rrsync b/support/rrsync index 0a8caa4c..c5584eff 100644 --- a/support/rrsync +++ b/support/rrsync @@ -1,11 +1,12 @@ #!/usr/bin/perl -use strict; # Name: /usr/local/bin/rrsync (should also have a symlink in /usr/bin) # Purpose: Restricts rsync to subdirectory declared in .ssh/authorized_keys # Author: Joe Smith 30-Sep-2004 # Modified by: Wayne Davison +use strict; use Socket; +use Cwd 'abs_path'; use File::Glob ':glob'; use constant RSYNC => 'rsync'; # Optionally set the path of rsync here. use constant LOGFILE => 'rrsync.log'; @@ -17,6 +18,7 @@ EOM our $ro = (@ARGV && $ARGV[0] eq '-ro') ? shift : ''; # -ro = Read-Only our $subdir = shift; die "$0: No subdirectory specified\n$Usage" unless defined $subdir; +$subdir = abs_path($subdir); die "$0: Restricted subdirectory does not exist!\n" if $subdir ne '/' && !-d $subdir; # The client uses "rsync -av -e ssh src/ server:dir/", and sshd on the server -- 2.34.1