mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-20 18:03:50 +03:00
libxl: reject unknown flags
* src/libxl/libxl_driver.c (libxlOpen, libxlDomainReboot) (libxlDomainXMLFromNative, libxlDomainXMLToNative) (libxlDomainCreateWithFlags): Reject unknown flags.
This commit is contained in:
parent
23cbf1e0d4
commit
9110941cfd
@ -1063,8 +1063,10 @@ libxlActive(void)
|
|||||||
static virDrvOpenStatus
|
static virDrvOpenStatus
|
||||||
libxlOpen(virConnectPtr conn,
|
libxlOpen(virConnectPtr conn,
|
||||||
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
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 (conn->uri == NULL) {
|
||||||
if (libxl_driver == NULL)
|
if (libxl_driver == NULL)
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
@ -1482,13 +1484,15 @@ cleanup:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
libxlDomainReboot(virDomainPtr dom, unsigned int flags ATTRIBUTE_UNUSED)
|
libxlDomainReboot(virDomainPtr dom, unsigned int flags)
|
||||||
{
|
{
|
||||||
libxlDriverPrivatePtr driver = dom->conn->privateData;
|
libxlDriverPrivatePtr driver = dom->conn->privateData;
|
||||||
virDomainObjPtr vm;
|
virDomainObjPtr vm;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
libxlDomainObjPrivatePtr priv;
|
libxlDomainObjPrivatePtr priv;
|
||||||
|
|
||||||
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
libxlDriverLock(driver);
|
libxlDriverLock(driver);
|
||||||
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
|
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
|
||||||
if (!vm) {
|
if (!vm) {
|
||||||
@ -2511,7 +2515,7 @@ libxlDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
|||||||
static char *
|
static char *
|
||||||
libxlDomainXMLFromNative(virConnectPtr conn, const char * nativeFormat,
|
libxlDomainXMLFromNative(virConnectPtr conn, const char * nativeFormat,
|
||||||
const char * nativeConfig,
|
const char * nativeConfig,
|
||||||
unsigned int flags ATTRIBUTE_UNUSED)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
libxlDriverPrivatePtr driver = conn->privateData;
|
libxlDriverPrivatePtr driver = conn->privateData;
|
||||||
const libxl_version_info *ver_info;
|
const libxl_version_info *ver_info;
|
||||||
@ -2519,6 +2523,8 @@ libxlDomainXMLFromNative(virConnectPtr conn, const char * nativeFormat,
|
|||||||
virConfPtr conf = NULL;
|
virConfPtr conf = NULL;
|
||||||
char *xml = NULL;
|
char *xml = NULL;
|
||||||
|
|
||||||
|
virCheckFlags(0, NULL);
|
||||||
|
|
||||||
if (STRNEQ(nativeFormat, LIBXL_CONFIG_FORMAT_XM)) {
|
if (STRNEQ(nativeFormat, LIBXL_CONFIG_FORMAT_XM)) {
|
||||||
libxlError(VIR_ERR_INVALID_ARG,
|
libxlError(VIR_ERR_INVALID_ARG,
|
||||||
_("unsupported config type %s"), nativeFormat);
|
_("unsupported config type %s"), nativeFormat);
|
||||||
@ -2551,7 +2557,7 @@ cleanup:
|
|||||||
static char *
|
static char *
|
||||||
libxlDomainXMLToNative(virConnectPtr conn, const char * nativeFormat,
|
libxlDomainXMLToNative(virConnectPtr conn, const char * nativeFormat,
|
||||||
const char * domainXml,
|
const char * domainXml,
|
||||||
unsigned int flags ATTRIBUTE_UNUSED)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
libxlDriverPrivatePtr driver = conn->privateData;
|
libxlDriverPrivatePtr driver = conn->privateData;
|
||||||
const libxl_version_info *ver_info;
|
const libxl_version_info *ver_info;
|
||||||
@ -2560,6 +2566,8 @@ libxlDomainXMLToNative(virConnectPtr conn, const char * nativeFormat,
|
|||||||
int len = MAX_CONFIG_SIZE;
|
int len = MAX_CONFIG_SIZE;
|
||||||
char *ret = NULL;
|
char *ret = NULL;
|
||||||
|
|
||||||
|
virCheckFlags(0, NULL);
|
||||||
|
|
||||||
if (STRNEQ(nativeFormat, LIBXL_CONFIG_FORMAT_XM)) {
|
if (STRNEQ(nativeFormat, LIBXL_CONFIG_FORMAT_XM)) {
|
||||||
libxlError(VIR_ERR_INVALID_ARG,
|
libxlError(VIR_ERR_INVALID_ARG,
|
||||||
_("unsupported config type %s"), nativeFormat);
|
_("unsupported config type %s"), nativeFormat);
|
||||||
@ -2623,7 +2631,7 @@ libxlNumDefinedDomains(virConnectPtr conn)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
libxlDomainCreateWithFlags(virDomainPtr dom,
|
libxlDomainCreateWithFlags(virDomainPtr dom,
|
||||||
unsigned int flags ATTRIBUTE_UNUSED)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
libxlDriverPrivatePtr driver = dom->conn->privateData;
|
libxlDriverPrivatePtr driver = dom->conn->privateData;
|
||||||
virDomainObjPtr vm;
|
virDomainObjPtr vm;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user