]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
* src/conf.[ch]: restrict VMX syntax parsing types
authorDaniel Veillard <veillard@redhat.com>
Mon, 22 Jun 2009 11:54:49 +0000 (11:54 +0000)
committerDaniel Veillard <veillard@redhat.com>
Mon, 22 Jun 2009 11:54:49 +0000 (11:54 +0000)
daniel

ChangeLog
src/conf.c
src/conf.h

index f959dca9f8b74d75518ca542ae7bbfa5fdc3b773..4c77baa1b944f2590cf5e049c30d6642e7a35128 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * src/storage_driver.c: cleanup when creating a storage pool fails,
index ef1a28f404c437a3b2734fe4c28082e44451922e..c51531e51cabba1a8be787f60a97191c4b7a1ff1 100644 (file)
@@ -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);
index 4bb825aff7fdc25962d95f4bfb7c49fe876d6e5b..40d9586a16d38093896212b35572eb2b42233abc 100644 (file)
@@ -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 *