]> git.proxmox.com Git - pve-common.git/commitdiff
assemble_spice_ticket: ensure variable in interpolated string are correct
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 23 May 2019 10:52:18 +0000 (12:52 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 23 May 2019 10:52:22 +0000 (12:52 +0200)
In older perl the following two where the same:

"$foo::$bar" == "${foo}::${bar}"

But in perl 5, version 28 it's not anymore,

"$foo::$bar" would be equivalent to "${foo::}${bar}", the double
colons are now not used as variable name boundary, so mark that
explicitly in the affected case and surrounding ones preventively

This fixes authentication with spice* related stuff again.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/Ticket.pm

index e9f8e3f1d5b8048f7b273ff8c34191c0ba24cd78..5935ba52b6f795503c281b791137ca5ced5efd26 100644 (file)
@@ -125,14 +125,14 @@ sub assemble_spice_ticket {
     # Note: data needs to be lower case only, because virt-viewer needs that
     # Note: RSA signature are too long (>=256 charaters) and make problems with remote-viewer
 
-    my $plain = "pvespiceproxy:$timestamp:$vmid:" . lc($node);
+    my $plain = "pvespiceproxy:${timestamp}:${vmid}:" . lc($node);
 
     # produces 40 characters
     my $sig = unpack("H*", Digest::SHA::sha1($plain, $secret));
 
     #my $sig =  unpack("H*", $rsa_priv->sign($plain)); # this produce too long strings (512)
 
-    my $proxyticket = "$plain::$sig";
+    my $proxyticket = "${plain}::${sig}";
 
     return ($ticket, $proxyticket);
 }