[pve-devel] [PATCH v3 pmg-api 1/1] ensure compatibility with libpve-http-server-perl

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Jan 21 13:54:30 CET 2020


Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---

Notes:
    new in v3
    
    requires depends on libpve-http-server which changed these interfaces

 src/PMG/HTTPServer.pm       | 4 +++-
 src/PMG/Service/pmgproxy.pm | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/PMG/HTTPServer.pm b/src/PMG/HTTPServer.pm
index 8c29059..eb48b5f 100755
--- a/src/PMG/HTTPServer.pm
+++ b/src/PMG/HTTPServer.pm
@@ -42,7 +42,7 @@ sub generate_csrf_prevention_token {
 }
 
 sub auth_handler {
-    my ($self, $method, $rel_uri, $ticket, $token, $peer_host) = @_;
+    my ($self, $method, $rel_uri, $ticket, $token, $api_token, $peer_host) = @_;
 
     my $rpcenv = $self->{rpcenv};
 
@@ -66,6 +66,8 @@ sub auth_handler {
 
     if ($require_auth) {
 
+	die "API tokens not implemented\n" if $api_token;
+
 	die "No ticket\n" if !$ticket;
 
 	if ($ticket =~ m/^PMGQUAR:/) {
diff --git a/src/PMG/Service/pmgproxy.pm b/src/PMG/Service/pmgproxy.pm
index e88d757..ea58b50 100755
--- a/src/PMG/Service/pmgproxy.pm
+++ b/src/PMG/Service/pmgproxy.pm
@@ -192,7 +192,7 @@ sub get_index {
 		$lang = $newlang;
 	    }
 	}
-	my $ticket = PVE::APIServer::Formatter::extract_auth_cookie($cookie, $server->{cookie_name});
+	my $ticket = PVE::APIServer::Formatter::extract_auth_value($cookie, $server->{cookie_name});
 
 	if ($ticket =~ m/^PMGQUAR:/) {
 	    $username = PMG::Ticket::verify_quarantine_ticket($ticket, 1);
-- 
2.20.1




More information about the pve-devel mailing list