]> git.proxmox.com Git - pve-common.git/commitdiff
Ticket: uri-escape colons
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 9 Nov 2021 11:27:07 +0000 (12:27 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 9 Nov 2021 12:13:46 +0000 (13:13 +0100)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/PVE/Ticket.pm

index d522401436f9873f7cc07d07b86ce1d09adc0ffc..ce8d5c8c6c158ed8a9c0b8b89bd55a5bc7d01431 100644 (file)
@@ -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;