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