提交 a06b407f 编写于 作者: D Daniel Veillard

* src/conf.[ch]: restrict VMX syntax parsing types

daniel
上级 c57932c6
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>
* src/storage_driver.c: cleanup when creating a storage pool fails,
......
......@@ -447,6 +447,11 @@ virConfParseValue(virConfParserCtxtPtr ctxt)
if (str == NULL)
return(NULL);
} 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;
NEXT;
SKIP_BLANKS_AND_EOL;
......@@ -486,6 +491,11 @@ virConfParseValue(virConfParserCtxtPtr ctxt)
return(NULL);
}
} 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) {
return(NULL);
}
......@@ -530,7 +540,7 @@ virConfParseName(virConfParserCtxtPtr ctxt)
}
while ((ctxt->cur < ctxt->end) &&
(c_isalnum(CUR) || (CUR == '_') ||
((ctxt->conf->flags & VIR_CONF_FLAG_ALLOW_VMX_NAMES) &&
((ctxt->conf->flags & VIR_CONF_FLAG_VMX_FORMAT) &&
((CUR == ':') || (CUR == '.')))))
NEXT;
ret = strndup(base, ctxt->cur - base);
......
......@@ -25,8 +25,9 @@ typedef enum {
} virConfType;
typedef enum {
VIR_CONF_FLAG_ALLOW_VMX_NAMES = 1, /* allow : and . in names for compatibility
with VMware VMX configuration file */
VIR_CONF_FLAG_VMX_FORMAT = 1, /* allow : and . in names for compatibility with
VMware VMX configuration file, but restrict
allowed value types to string only */
} virConfFlags;
static inline const char *
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册