代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/libvirt 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From a772926f16825d88ea17e09b88afa38ccdb68bc5 Mon Sep 17 00:00:00 2001
From: Jan Tomko <jtomko@redhat.com>
Date: Wed, 14 Oct 2020 17:06:09 +0800
Subject: [PATCH] rpc: add support for filtering @acls by uint params
CVE-2020-25637
Add a new field to @acl annotations for filtering by
unsigned int parameters.
Signed-off-by: Jan Tomko <jtomko@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
cherry-pick from commit 50864dcda191eb35732dbd80fb6ca251a6bba923
Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
---
src/remote/remote_protocol.x | 3 +++
src/rpc/gendispatch.pl | 21 ++++++++++++++++++++-
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index d4393680e9..5f3858c00c 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -3805,6 +3805,7 @@ enum remote_procedure {
*
* - @acl: <object>:<permission>
* - @acl: <object>:<permission>:<flagname>
+ * - @acl: <object>:<permission>::<param>:<value>
*
* Declare the access control requirements for the API. May be repeated
* multiple times, if multiple rules are required.
@@ -3814,6 +3815,8 @@ enum remote_procedure {
* <permission> is one of the permissions in access/viraccessperm.h
* <flagname> indicates the rule only applies if the named flag
* is set in the API call
+ * <param> and <value> can be used to check an unsigned in parameter
+ * against value
*
* - @aclfilter: <object>:<permission>
*
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index 6feb1c8320..590a46ef66 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -2111,10 +2111,12 @@ elsif ($mode eq "client") {
my @acl;
foreach (@{$acl}) {
my @bits = split /:/;
- push @acl, { object => $bits[0], perm => $bits[1], flags => $bits[2] }
+ push @acl, { object => $bits[0], perm => $bits[1], flags => $bits[2],
+ param => $bits[3], value => $bits[4] }
}
my $checkflags = 0;
+ my $paramtocheck = undef;
for (my $i = 1 ; $i <= $#acl ; $i++) {
if ($acl[$i]->{object} ne $acl[0]->{object}) {
die "acl for '$call->{ProcName}' cannot check different objects";
@@ -2122,6 +2124,9 @@ elsif ($mode eq "client") {
if (defined $acl[$i]->{flags} && length $acl[$i]->{flags}) {
$checkflags = 1;
}
+ if (defined $acl[$i]->{param}) {
+ $paramtocheck = $acl[$i]->{param};
+ }
}
my $apiname = $prefix . $call->{ProcName};
@@ -2157,6 +2162,9 @@ elsif ($mode eq "client") {
if ($checkflags) {
push @argdecls, "unsigned int flags";
}
+ if (defined $paramtocheck) {
+ push @argdecls, "unsigned int " . $paramtocheck;
+ }
my $ret;
my $pass;
@@ -2217,6 +2225,17 @@ elsif ($mode eq "client") {
}
print " ";
}
+ if (defined $acl->{param}) {
+ my $param = $acl->{param};
+ my $value = $acl->{value};
+ if ($value =~ /^\!/) {
+ $value = substr $value, 1;
+ print "($param != ($value)) &&\n";
+ } else {
+ print "($param == ($value)) &&\n";
+ }
+ print " ";
+ }
print "(rv = $method(" . join(", ", @argvars, $perm) . ")) <= 0) {\n";
print " virObjectUnref(mgr);\n";
if ($action eq "Ensure") {
--
2.23.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。