* Changes for 3.0.0 release
[BackupPC.git] / bin / BackupPC_tarCreate
index 8d8d134..500bd8b 100755 (executable)
@@ -53,7 +53,7 @@
 #
 #========================================================================
 #
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0, released 28 Jan 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -96,7 +96,8 @@ EOF
     exit(1);
 }
 
-if ( $opts{h} !~ /^([\w\.\s-]+)$/ ) {
+if ( $opts{h} !~ /^([\w\.\s-]+)$/
+        || $opts{h} =~ m{(^|/)\.\.(/|$)} ) {
     print(STDERR "$0: bad host name '$opts{h}'\n");
     exit(1);
 }
@@ -130,7 +131,7 @@ $Charset = $opts{e} if ( $opts{e} ne "" );
 
 my $PathRemove = $1 if ( $opts{r} =~ /(.+)/ );
 my $PathAdd    = $1 if ( $opts{p} =~ /(.+)/ );
-if ( $opts{s} !~ /^([\w\s.\/$(){}[\]-]+)$/ && $opts{s} ne "*" ) {
+if ( $opts{s} =~ m{(^|/)\.\.(/|$)} ) {
     print(STDERR "$0: bad share name '$opts{s}'\n");
     exit(1);
 }
@@ -501,7 +502,7 @@ sub TarWriteFile
                $arg = "/" if ( $arg eq "." );
                $arg =~ s{^\./+}{/};
                $arg =~ s{/+$}{};
-               $done = 1 if ( $name eq $arg || $name =~ /^\Q$arg\// );
+               $done = 1 if ( $name eq $arg || $name =~ /^\Q$arg\// || $arg eq "" );
            }
        }
        if ( $done ) {