From 2bcad3688990067c1a7c90f781c810f158347c4b Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 6 Jul 2011 17:02:14 -0600 Subject: [PATCH] uml: reject unknown flags * src/uml/uml_driver.c (umlOpen, umlDomainGetXMLDesc) (umlDomainBlockPeek): Reject unknown flags. --- src/uml/uml_driver.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index 10cd5543bc..da91687c10 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -973,7 +973,10 @@ static void umlShutdownVMDaemon(virConnectPtr conn ATTRIBUTE_UNUSED, static virDrvOpenStatus umlOpen(virConnectPtr conn, virConnectAuthPtr auth ATTRIBUTE_UNUSED, - unsigned int flags ATTRIBUTE_UNUSED) { + unsigned int flags) +{ + virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR); + if (conn->uri == NULL) { if (uml_driver == NULL) return VIR_DRV_OPEN_DECLINED; @@ -1590,11 +1593,16 @@ cleanup: static char *umlDomainGetXMLDesc(virDomainPtr dom, - unsigned int flags ATTRIBUTE_UNUSED) { + unsigned int flags) +{ struct uml_driver *driver = dom->conn->privateData; virDomainObjPtr vm; char *ret = NULL; + virCheckFlags(VIR_DOMAIN_XML_SECURE | + VIR_DOMAIN_XML_INACTIVE | + VIR_DOMAIN_XML_UPDATE_CPU, NULL); + umlDriverLock(driver); vm = virDomainFindByUUID(&driver->domains, dom->uuid); umlDriverUnlock(driver); @@ -2078,12 +2086,14 @@ umlDomainBlockPeek(virDomainPtr dom, const char *path, unsigned long long offset, size_t size, void *buffer, - unsigned int flags ATTRIBUTE_UNUSED) + unsigned int flags) { struct uml_driver *driver = dom->conn->privateData; virDomainObjPtr vm; int fd = -1, ret = -1, i; + virCheckFlags(0, -1); + umlDriverLock(driver); vm = virDomainFindByUUID(&driver->domains, dom->uuid); umlDriverUnlock(driver); -- GitLab