Dir storage creation: check for a sane path
Ideally we don't need this, but this with the directory storage this is a user-input field which gets returned by the storage's path() method which is used in various external command calls.
This commit is contained in:
committed by
Dietmar Maurer
parent
602eacfe6a
commit
5c95e48479
@ -62,5 +62,14 @@ sub activate_storage {
|
||||
$class->SUPER::activate_storage($storeid, $scfg, $cache);
|
||||
}
|
||||
|
||||
sub check_config {
|
||||
my ($self, $sectionId, $config, $create, $skipSchemaCheck) = @_;
|
||||
my $opts = PVE::SectionConfig::check_config($self, $sectionId, $config, $create, $skipSchemaCheck);
|
||||
return $opts if !$create;
|
||||
if ($opts->{path} !~ m@^/[-/a-zA-Z0-9_.]+$@) {
|
||||
die "illegal path for directory storage: $opts->{path}\n";
|
||||
}
|
||||
return $opts;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
Reference in New Issue
Block a user