[Kimchi-devel] [PATCH V2 3/4] escape < > and & in in xml for network name.

shaohef at linux.vnet.ibm.com shaohef at linux.vnet.ibm.com
Mon Jun 16 04:45:08 UTC 2014


From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>

< > and & are special characters in xml.
so when create a xml, we should escape them.

Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
---
 src/kimchi/model/networks.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/kimchi/model/networks.py b/src/kimchi/model/networks.py
index af9e940..a267af6 100644
--- a/src/kimchi/model/networks.py
+++ b/src/kimchi/model/networks.py
@@ -23,6 +23,8 @@
 import ipaddr
 import libvirt
 
+from xml.sax.saxutils import escape
+
 from kimchi import netinfo
 from kimchi import network as knetwork
 from kimchi import networkxml
@@ -97,6 +99,7 @@ def create(self, params):
         if connection == 'bridge':
             self._set_network_bridge(params)
 
+        params['name'] = escape(params['name'])
         xml = networkxml.to_network_xml(**params)
 
         try:
-- 
1.9.3




More information about the Kimchi-devel mailing list