From: Ian Beckwith Date: Sat, 2 Oct 2010 00:43:08 +0000 (+0100) Subject: complain if files are outside $base X-Git-Tag: debian/1.0-1~149 X-Git-Url: http://erislabs.net/gitweb/?p=id3fs.git;a=commitdiff_plain;h=280fc68258eb39f0df4a103dc497bf56fb17e317 complain if files are outside $base --- diff --git a/bin/id3fs-index b/bin/id3fs-index index 132d81e..93a6ebf 100755 --- a/bin/id3fs-index +++ b/bin/id3fs-index @@ -48,12 +48,17 @@ if($list) else { $db->last_update(time()); - - my $directories_pruned=$db->prune_directories(); + my $base=$db->base_dir(); + my $abs_base=Cwd::abs_path($base); while(my $path=shift) { + if(Cwd::abs_path($path) !~ /^$abs_base/) + { + print "$me, $path is outside $base, skipping\n"; + } File::Find::find( {wanted => \&wanted, follow => 1, no_chdir => 1}, $path); } + my $directories_pruned=$db->prune_directories(); if($files_pruned || $directories_pruned) { print "Removing data from pruned files\n" if $verbose; diff --git a/lib/ID3FS/DB.pm b/lib/ID3FS/DB.pm index d149b6a..96b4f8a 100644 --- a/lib/ID3FS/DB.pm +++ b/lib/ID3FS/DB.pm @@ -94,6 +94,8 @@ sub find_db return $file; } +sub base_dir { return shift->{base}; } + sub create { my($self,$name)=@_;