[Date Prev][Date Next] [Chronological] [Thread] [Top]

JLDAP DSMLWriter replacing special characters (ITS#3102)



Full_Name: Jon Roberts
Version: n/a
OS: linux
URL: ftp://ftp.openldap.org/incoming/jon-roberts-040420.patch
Submission from: (NULL) (68.1.36.89)


Already submitted this issue (ITS # 3099), but now I can add the patch:

--- com/novell/ldap/util/DSMLWriter.java        23 Jan 2004 10:12:51 -0000     
1.42
+++ com/novell/ldap/util/DSMLWriter.java        20 Apr 2004 18:46:39 -0000
@@ -1272,7 +1272,12 @@
             newLine(4);
             if (Base64.isValidUTF8(bytevalues[i], false)){
                 out.write("<value>");
-                out.write(values[i]);
+                               String xmlvalue = values[i];
+                               xmlvalue = xmlvalue.replaceAll("<", "&lt;");
+                               xmlvalue = xmlvalue.replaceAll(">", "&gt;");
+                               xmlvalue = xmlvalue.replaceAll("&", "&amp;");
+                               xmlvalue = xmlvalue.replaceAll("\"", "&quot;");
+                out.write(xmlvalue);
                 out.write("</value>");
             } else {
                 out.write("<value xsi:type=\"xsd:base64Binary\">");

The same patch is also already sitting in the ftp incoming.