]> git.proxmox.com Git - pve-cluster.git/commitdiff
improve parser for /etc/ssh/ssh_host_rsa_key.pub
authorDietmar Maurer <dietmar@proxmox.com>
Sun, 31 May 2015 06:10:37 +0000 (08:10 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Sun, 31 May 2015 06:10:37 +0000 (08:10 +0200)
data/PVE/Cluster.pm

index 74e020d774e72c87fcb27384f331e539483d7bd7..5a031cbfe48c16552018e5f48aef7b622c8b5779 100644 (file)
@@ -1140,7 +1140,8 @@ sub ssh_merge_known_hosts {
     }
 
     my $hostkey = PVE::Tools::file_get_contents($ssh_host_rsa_id);
-    die "can't parse $ssh_host_rsa_id" if $hostkey !~ m/^(ssh-rsa\s\S+)(\s.*)?$/;
+    # Note: file sometimes containe emty lines at start, so we use multiline match
+    die "can't parse $ssh_host_rsa_id" if $hostkey !~ m/^(ssh-rsa\s\S+)(\s.*)?$/m;
     $hostkey = $1;
 
     my $data = '';