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