From 76f40fa55fea4857584a9c846c2d98fa6d39c6a6 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 6 Jul 2011 16:36:33 -0600 Subject: [PATCH] phyp: reject unknown flags * src/phyp/phyp_driver.c (phypOpen, phypDomainReboot) (phypVIOSDriverOpen): Reject unknown flags. --- src/phyp/phyp_driver.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index f6f55c4050..62ba192e2f 100644 --- a/src/phyp/phyp_driver.c +++ b/src/phyp/phyp_driver.c @@ -1128,7 +1128,7 @@ exit: static virDrvOpenStatus phypOpen(virConnectPtr conn, - virConnectAuthPtr auth, unsigned int flags ATTRIBUTE_UNUSED) + virConnectAuthPtr auth, unsigned int flags) { LIBSSH2_SESSION *session = NULL; ConnectionData *connection_data = NULL; @@ -1138,6 +1138,8 @@ phypOpen(virConnectPtr conn, char *char_ptr; char *managed_system = NULL; + virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR); + if (!conn || !conn->uri) return VIR_DRV_OPEN_DECLINED; @@ -3389,7 +3391,7 @@ cleanup: } static int -phypDomainReboot(virDomainPtr dom, unsigned int flags ATTRIBUTE_UNUSED) +phypDomainReboot(virDomainPtr dom, unsigned int flags) { int result = -1; ConnectionData *connection_data = dom->conn->networkPrivateData; @@ -3402,6 +3404,8 @@ phypDomainReboot(virDomainPtr dom, unsigned int flags ATTRIBUTE_UNUSED) char *ret = NULL; virBuffer buf = VIR_BUFFER_INITIALIZER; + virCheckFlags(0, -1); + virBufferAddLit(&buf, "chsysstate"); if (system_type == HMC) virBufferAsprintf(&buf, " -m %s", managed_system); @@ -3726,8 +3730,10 @@ phypDomainSetCPU(virDomainPtr dom, unsigned int nvcpus) static virDrvOpenStatus phypVIOSDriverOpen(virConnectPtr conn, virConnectAuthPtr auth ATTRIBUTE_UNUSED, - unsigned int flags ATTRIBUTE_UNUSED) + unsigned int flags) { + virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR); + if (conn->driver->no != VIR_DRV_PHYP) return VIR_DRV_OPEN_DECLINED; -- GitLab