render / rpms / libvirt

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