mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-26 18:41:17 +00:00
* src/conf.[ch]: restrict VMX syntax parsing types
daniel
This commit is contained in:
parent
c57932c663
commit
a06b407fce
@ -1,3 +1,8 @@
|
|||||||
|
Mon Jun 22 12:27:39 CEST 2009 Daniel Veillard <veillard@redhat.com>
|
||||||
|
|
||||||
|
* src/conf.[ch]: restrict VMX syntax parsing types, patch by Matthias
|
||||||
|
Bolte
|
||||||
|
|
||||||
Mon Jun 22 12:14:48 CEST 2009 Daniel Veillard <veillard@redhat.com>
|
Mon Jun 22 12:14:48 CEST 2009 Daniel Veillard <veillard@redhat.com>
|
||||||
|
|
||||||
* src/storage_driver.c: cleanup when creating a storage pool fails,
|
* src/storage_driver.c: cleanup when creating a storage pool fails,
|
||||||
|
12
src/conf.c
12
src/conf.c
@ -447,6 +447,11 @@ virConfParseValue(virConfParserCtxtPtr ctxt)
|
|||||||
if (str == NULL)
|
if (str == NULL)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
} else if (CUR == '[') {
|
} else if (CUR == '[') {
|
||||||
|
if (ctxt->conf->flags & VIR_CONF_FLAG_VMX_FORMAT) {
|
||||||
|
virConfError(ctxt, VIR_ERR_CONF_SYNTAX,
|
||||||
|
_("lists not allowed in VMX format"));
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
type = VIR_CONF_LIST;
|
type = VIR_CONF_LIST;
|
||||||
NEXT;
|
NEXT;
|
||||||
SKIP_BLANKS_AND_EOL;
|
SKIP_BLANKS_AND_EOL;
|
||||||
@ -486,6 +491,11 @@ virConfParseValue(virConfParserCtxtPtr ctxt)
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
} else if (c_isdigit(CUR) || (CUR == '-') || (CUR == '+')) {
|
} else if (c_isdigit(CUR) || (CUR == '-') || (CUR == '+')) {
|
||||||
|
if (ctxt->conf->flags & VIR_CONF_FLAG_VMX_FORMAT) {
|
||||||
|
virConfError(ctxt, VIR_ERR_CONF_SYNTAX,
|
||||||
|
_("numbers not allowed in VMX format"));
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
if (virConfParseLong(ctxt, &l) < 0) {
|
if (virConfParseLong(ctxt, &l) < 0) {
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
@ -530,7 +540,7 @@ virConfParseName(virConfParserCtxtPtr ctxt)
|
|||||||
}
|
}
|
||||||
while ((ctxt->cur < ctxt->end) &&
|
while ((ctxt->cur < ctxt->end) &&
|
||||||
(c_isalnum(CUR) || (CUR == '_') ||
|
(c_isalnum(CUR) || (CUR == '_') ||
|
||||||
((ctxt->conf->flags & VIR_CONF_FLAG_ALLOW_VMX_NAMES) &&
|
((ctxt->conf->flags & VIR_CONF_FLAG_VMX_FORMAT) &&
|
||||||
((CUR == ':') || (CUR == '.')))))
|
((CUR == ':') || (CUR == '.')))))
|
||||||
NEXT;
|
NEXT;
|
||||||
ret = strndup(base, ctxt->cur - base);
|
ret = strndup(base, ctxt->cur - base);
|
||||||
|
@ -25,8 +25,9 @@ typedef enum {
|
|||||||
} virConfType;
|
} virConfType;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
VIR_CONF_FLAG_ALLOW_VMX_NAMES = 1, /* allow : and . in names for compatibility
|
VIR_CONF_FLAG_VMX_FORMAT = 1, /* allow : and . in names for compatibility with
|
||||||
with VMware VMX configuration file */
|
VMware VMX configuration file, but restrict
|
||||||
|
allowed value types to string only */
|
||||||
} virConfFlags;
|
} virConfFlags;
|
||||||
|
|
||||||
static inline const char *
|
static inline const char *
|
||||||
|
Loading…
Reference in New Issue
Block a user