partially revert: daemon: refactor and cleanup
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 13 Nov 2017 09:31:58 +0000 (10:31 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 13 Nov 2017 09:32:01 +0000 (10:32 +0100)
Reverts a hunk of 0da5a3e43b16 which removed checking &
untainting of pids from the PVE_DAEMON_WORKER_PIDS env var.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/PVE/Daemon.pm

index ee3c67c..9e03c80 100644 (file)
@@ -280,7 +280,12 @@ sub setup {
 
     if ($restart && $self->{max_workers}) {
        if (my $wpids = $ENV{PVE_DAEMON_WORKER_PIDS}) {
-           $self->{old_workers}->{$_} = 1 foreach (split(':', $wpids));
+           foreach my $pid (split(':', $wpids)) {
+               # check & untaint
+               if ($pid =~ m/^(\d+)$/) {
+                   $self->{old_workers}->{$1} = 1;
+               }
+           }
        }
     }