]> git.proxmox.com Git - pve-common.git/blobdiff - src/PVE/SectionConfig.pm
SectionConfig: disable duplicate plugin registration
[pve-common.git] / src / PVE / SectionConfig.pm
index 71d296e6574f7a11d47a67083a45c5188c1b4887..6f85b228b81ec82c77d64fbbbc8f0197e5274e01 100644 (file)
@@ -26,6 +26,9 @@ sub register {
     my $type = $class->type();
     my $pdata = $class->private();
 
+    die "duplicate plugin registration (type = $type)"
+       if defined($pdata->{plugins}->{$type});
+
     my $plugindata = $class->plugindata();
     $pdata->{plugindata}->{$type} = $plugindata;
     $pdata->{plugins}->{$type} = $class;
@@ -393,6 +396,9 @@ my $format_config_line = sub {
 
     my $ct = $schema->{type};
 
+    die "property '$key' contains a line feed\n"
+       if ($key =~ m/[\n\r]/) || ($value =~ m/[\n\r]/);
+
     if ($ct eq 'boolean') {
        return $value ? "\t$key\n" : '';
     } else {