]> git.proxmox.com Git - pve-storage.git/blobdiff - PVE/Storage/LunCmd/LIO.pm
LIO: untaint values read from remote config
[pve-storage.git] / PVE / Storage / LunCmd / LIO.pm
index 15ddabf380b4d6de3aceea0547fe88f52ed528fd..f9e7143d1c30dde88fa9c02e8315e4288078be96 100644 (file)
@@ -154,8 +154,22 @@ my $parser = sub {
        # find correct TPG
        foreach my $tpg (@{$target->{tpgs}}) {
            if ($tpg->{tag} == $tpg_tag) {
+               my $res = [];
+               foreach my $lun (@{$tpg->{luns}}) {
+                   my ($idx, $storage_object);
+                   if ($lun->{index} =~ /^(\d+)$/) {
+                       $idx = $1;
+                   }
+                   if ($lun->{storage_object} =~ m|^($BACKSTORE/.*)$|) {
+                       $storage_object = $1;
+                   }
+                   die "Invalid lun definition in config!\n"
+                       if !(defined($idx) && defined($storage_object));
+                   push @$res, { index => $idx, storage_object => $storage_object };
+               }
+
                my $id = "$scfg->{portal}.$scfg->{target}";
-               $SETTINGS->{$id} = $tpg;
+               $SETTINGS->{$id}->{luns} = $res;
                $haveTarget = 1;
                last;
            }