[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] [PATCH] CA-46738: escape email body properly in vmpp alerts



 ocaml/xapi/xapi_vmpp.ml |  8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)


# HG changeset patch
# User Marcus Granado <marcus.granado@xxxxxxxxxx>
# Date 1291142767 0
# Node ID 186c8e8b09f44d7d1edd6bd5ea301b1f4960f045
# Parent  696e40aae9cab86c97663cbfef6fc5ccf5a8c944
CA-46738: escape email body properly in vmpp alerts

Signed-off-by: Marcus Granado <marcus.granado@xxxxxxxxxxxxx>

diff -r 696e40aae9ca -r 186c8e8b09f4 ocaml/xapi/xapi_vmpp.ml
--- a/ocaml/xapi/xapi_vmpp.ml
+++ b/ocaml/xapi/xapi_vmpp.ml
@@ -61,7 +61,13 @@
   assert_licensed ~__context;
   let value = data in
   let msg = 
-    "<message><email>"^body^"</email><data>"^value^"</data></message>"
+               (* value is expected to be valid xml data,
+                  whereas body is not expected to be a valid xml string
+               *)
+    "<message><email>"
+               (* escape any invalid xml string *)
+               ^(Xml.to_string (Xml.PCData body))
+    ^"</email><data>"^value^"</data></message>"
   in
   let successful = priority < 5L in
   if successful

Attachment: xen-api.hg.patch
Description: Text Data

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.