Blame SOURCES/bz1207982-fence2rng-quotes.patch

e4ffb1
From 4bedbd33645d22a4da2c623ccccacb2175d49b99 Mon Sep 17 00:00:00 2001
e4ffb1
From: Marek 'marx' Grac <mgrac@redhat.com>
e4ffb1
Date: Wed, 17 Jun 2015 19:57:05 +0200
e4ffb1
Subject: [PATCH 10/10] fence2rng.xsl: Correctly handle quotes in description
e4ffb1
e4ffb1
Resolves: rhbz#1207982
e4ffb1
---
e4ffb1
 fence/agents/lib/fence2rng.xsl | 25 ++++++++++++++++++++++++-
e4ffb1
 1 file changed, 24 insertions(+), 1 deletion(-)
e4ffb1
e4ffb1
diff --git a/fence/agents/lib/fence2rng.xsl b/fence/agents/lib/fence2rng.xsl
e4ffb1
index 432bc89..f6d465e 100644
e4ffb1
--- a/fence/agents/lib/fence2rng.xsl
e4ffb1
+++ b/fence/agents/lib/fence2rng.xsl
e4ffb1
@@ -124,6 +124,12 @@
e4ffb1
         <xsl:value-of select="$NL"/>
e4ffb1
 
e4ffb1
         <xsl:for-each select="parameters/parameter">
e4ffb1
+            <xsl:variable name="escapeddesc">
e4ffb1
+                <xsl:call-template name="escape_quot">
e4ffb1
+                    <xsl:with-param name="replace" select="shortdesc"/>
e4ffb1
+                </xsl:call-template>
e4ffb1
+        </xsl:variable>
e4ffb1
+
e4ffb1
             
e4ffb1
             <xsl:call-template name="tag-start">
e4ffb1
                 <xsl:with-param name="name" select="'optional'"/>
e4ffb1
@@ -136,7 +142,7 @@
e4ffb1
                 <xsl:with-param name="name" select="'attribute'"/>
e4ffb1
                 
e4ffb1
                     'name=',            $Q, @name,                      $Q, $SP,
e4ffb1
-                    'rha:description=', $Q, normalize-space(shortdesc), $Q, $SP)"/>
e4ffb1
+                    'rha:description=', $Q, normalize-space($escapeddesc), $Q, $SP)"/>
e4ffb1
                 <xsl:with-param name="indent" select="concat($indent, $indent)"/>
e4ffb1
             </xsl:call-template>
e4ffb1
             <xsl:value-of select="$NL"/>
e4ffb1
@@ -158,4 +164,21 @@
e4ffb1
     <xsl:value-of select="$NL"/>
e4ffb1
 </xsl:template>
e4ffb1
 
e4ffb1
+<xsl:template name="escape_quot">
e4ffb1
+    <xsl:param name="replace"/>
e4ffb1
+    <xsl:choose>
e4ffb1
+        <xsl:when test="contains($replace,'"')">
e4ffb1
+            <xsl:value-of select="substring-before($replace,'"')"/>
e4ffb1
+            
e4ffb1
+            <xsl:text>&quot;</xsl:text>
e4ffb1
+            <xsl:call-template name="escape_quot">
e4ffb1
+                <xsl:with-param name="replace" select="substring-after($replace,'"')"/>
e4ffb1
+            </xsl:call-template>
e4ffb1
+        </xsl:when>
e4ffb1
+    <xsl:otherwise>
e4ffb1
+        <xsl:value-of select="$replace"/>
e4ffb1
+    </xsl:otherwise>
e4ffb1
+    </xsl:choose>
e4ffb1
+    </xsl:template>
e4ffb1
+
e4ffb1
 </xsl:stylesheet>
e4ffb1
-- 
e4ffb1
1.9.3
e4ffb1