]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix bad quoting of multiline mxml opaque_data that caused invalid xml.
authorWalter Doekes <walter+asterisk@wjd.nu>
Fri, 11 Nov 2011 21:29:05 +0000 (21:29 +0000)
committerWalter Doekes <walter+asterisk@wjd.nu>
Fri, 11 Nov 2011 21:29:05 +0000 (21:29 +0000)
The opaque_data was added and enclosed in single quotes, assuming it
would be only a single line. The rest of the lines were appended after
the closing quote.

(closes issue ASTERISK-18852)
Reported by: peep_ on IRC

Review: https://reviewboard.asterisk.org/r/1577
........

Merged revisions 344835 from http://svn.asterisk.org/svn/asterisk/branches/1.8

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@344836 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/manager.c

index 56caa0561fbec2c0e0b11ab12dbfdbefd40d7e8e..78147ce9a9eed6a60410b2d9352e2fd085838f22 100644 (file)
@@ -5745,9 +5745,10 @@ static void xml_translate(struct ast_str **out, char *in, struct ast_variable *g
                }
 
                if (in_data) {
-                       /* Process data field in Opaque mode */
-                       xml_copy_escape(out, val, 0);   /* data field */
+                       /* Process data field in Opaque mode. This is a
+                        * followup, so we re-add line feeds. */
                        ast_str_append(out, 0, xml ? "\n" : "<br>\n");
+                       xml_copy_escape(out, val, 0);   /* data field */
                        continue;
                }
 
@@ -5783,7 +5784,9 @@ static void xml_translate(struct ast_str **out, char *in, struct ast_variable *g
                ao2_ref(vc, -1);
                ast_str_append(out, 0, xml ? "='" : "</td><td>");
                xml_copy_escape(out, val, 0);   /* data field */
-               ast_str_append(out, 0, xml ? "'" : "</td></tr>\n");
+               if (!in_data || !*in) {
+                       ast_str_append(out, 0, xml ? "'" : "</td></tr>\n");
+               }
        }
 
        if (inobj) {