Fixed handling of filenames with an embedded $, @, or %.
authorWayne Davison <wayned@samba.org>
Thu, 31 Aug 2006 20:30:16 +0000 (20:30 +0000)
committerWayne Davison <wayned@samba.org>
Thu, 31 Aug 2006 20:30:16 +0000 (20:30 +0000)
support/file-attr-restore

index 11d7524..8c25310 100755 (executable)
@@ -47,7 +47,9 @@ while (<>) {
     my($type, $perms, $owner, $group, $name) = /$detail_line/;
     die "Invalid input line $.:\n$_" unless defined $name;
     die "A filename is not properly escaped:\n$_" unless $name =~ /^[^"\\]*(\\(\d\d\d|\D)[^"\\]*)*$/;
-    my $fn = eval "\"$name\"";
+    my $fn = $name;
+    $fn =~ s/([\$\@\%])/\\$1/g;
+    $fn = eval "\"$fn\"";
     if ($type eq '-') {
        undef $type unless -f $fn;
     } elsif ($type eq 'd') {