api: disallow virConnectGetDomainCapabilities on read-only connections

This API can be used to execute arbitrary emulators.
Forbid it on read-only connections.

Fixes: CVE-2019-10167
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 8afa68bac0)
Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Ján Tomko 2019-06-14 09:16:14 +02:00
parent a9e40f2320
commit 1e51b78a92

View File

@ -11309,6 +11309,7 @@ virConnectGetDomainCapabilities(virConnectPtr conn,
virResetLastError(); virResetLastError();
virCheckConnectReturn(conn, NULL); virCheckConnectReturn(conn, NULL);
virCheckReadOnlyGoto(conn->flags, error);
if (conn->driver->connectGetDomainCapabilities) { if (conn->driver->connectGetDomainCapabilities) {
char *ret; char *ret;