render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
79b470
From fa5b4100c32d3125eeb0d6b0024892af86ecddb0 Mon Sep 17 00:00:00 2001
79b470
Message-Id: <fa5b4100c32d3125eeb0d6b0024892af86ecddb0@dist-git>
79b470
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
79b470
Date: Tue, 29 Sep 2020 14:43:03 +0200
79b470
Subject: [PATCH] rpc: gendispatch: handle empty flags
79b470
MIME-Version: 1.0
79b470
Content-Type: text/plain; charset=UTF-8
79b470
Content-Transfer-Encoding: 8bit
79b470
79b470
CVE-2020-25637
79b470
79b470
Prepare for omission of the <flagname> in remote_protocol.x
79b470
@acl annotations:
79b470
 @acl: <object>:<permission>:<flagname>
79b470
so that we can add more fields after, e.g.:
79b470
 @acl: <object>:<permission>::<field>
79b470
79b470
Signed-off-by: Ján Tomko <jtomko@redhat.com>
79b470
(cherry picked from commit 955029bd0ad7ef96000f529ac38204a8f4a96401)
79b470
Signed-off-by: Ján Tomko <jtomko@redhat.com>
79b470
Message-Id: <5fda9fc6cfe45eace10b8c2565a8b0c46b51f46c.1601383236.git.jtomko@redhat.com>
79b470
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
79b470
---
79b470
 src/rpc/gendispatch.pl | 4 ++--
79b470
 1 file changed, 2 insertions(+), 2 deletions(-)
79b470
79b470
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
79b470
index 8656c8f205..4cb9701e59 100755
79b470
--- a/src/rpc/gendispatch.pl
79b470
+++ b/src/rpc/gendispatch.pl
79b470
@@ -2112,7 +2112,7 @@ elsif ($mode eq "client") {
79b470
                 if ($acl[$i]->{object} ne $acl[0]->{object}) {
79b470
                     die "acl for '$call->{ProcName}' cannot check different objects";
79b470
                 }
79b470
-                if (defined $acl[$i]->{flags}) {
79b470
+                if (defined $acl[$i]->{flags} && length $acl[$i]->{flags}) {
79b470
                     $checkflags = 1;
79b470
                 }
79b470
             }
79b470
@@ -2200,7 +2200,7 @@ elsif ($mode eq "client") {
79b470
                     my $method = "virAccessManagerCheck" . $object;
79b470
                     my $space = ' ' x length($method);
79b470
                     print "    if (";
79b470
-                    if (defined $acl->{flags}) {
79b470
+                    if (defined $acl->{flags} && length $acl->{flags}) {
79b470
                         my $flags = $acl->{flags};
79b470
                         if ($flags =~ /^\!/) {
79b470
                             $flags = substr $flags, 1;
79b470
-- 
79b470
2.28.0
79b470