[pve-devel] [PATCH common] Ticket: uri-escape colons

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Nov 9 12:27:07 CET 2021


Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
---
 src/PVE/Ticket.pm | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/PVE/Ticket.pm b/src/PVE/Ticket.pm
index d522401..ce8d5c8 100644
--- a/src/PVE/Ticket.pm
+++ b/src/PVE/Ticket.pm
@@ -8,6 +8,7 @@ use Crypt::OpenSSL::RSA;
 use MIME::Base64;
 use Digest::SHA;
 use Time::HiRes qw(gettimeofday);
+use URI::Escape;
 
 use PVE::Exception qw(raise);
 
@@ -60,7 +61,10 @@ sub assemble_rsa_ticket {
 
     my $plain = "$prefix:";
 
-    $plain .= "$data:" if defined($data);
+    if (defined($data)) {
+	$data = uri_escape($data, ':');
+	$plain .= "$data:";
+    }
 
     $plain .= $timestamp;
 
@@ -88,6 +92,10 @@ sub verify_rsa_ticket {
 
 		my $age = time() - $ttime;
 
+		if (defined($data)) {
+		    $data = uri_unescape($data);
+		}
+
 		if (($age > $min_age) && ($age < $max_age)) {
 		    if (defined($data)) {
 			return wantarray ? ($data, $age) : $data;
-- 
2.30.2






More information about the pve-devel mailing list