[pve-devel] applied: [PATCH] assemble_spice_ticket: ensure variable in interpolated string are correct

Thomas Lamprecht t.lamprecht at proxmox.com
Thu May 23 12:59:58 CEST 2019


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 at proxmox.com>
---
 src/PVE/Ticket.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PVE/Ticket.pm b/src/PVE/Ticket.pm
index e9f8e3f..5935ba5 100644
--- a/src/PVE/Ticket.pm
+++ b/src/PVE/Ticket.pm
@@ -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);
 }
-- 
2.20.1





More information about the pve-devel mailing list