File rh#2050259-0001-Low-libcrmservice-Escape-systemd-agent-descriptions.patch of Package pacemaker.27546

From 7e2002965ab1ccf76d4c5179d6e402f30a8c9fc3 Mon Sep 17 00:00:00 2001
From: Chris Lumens <clumens@redhat.com>
Date: Fri, 11 Feb 2022 13:23:01 -0500
Subject: [PATCH 1/2] Low: libcrmservice: Escape systemd agent descriptions.

This deals with converting characters like ampersands into XML that
will validate.

See: rhbz#2050259
---
 lib/services/systemd.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/services/systemd.c b/lib/services/systemd.c
index d87b28742..eda360261 100644
--- a/lib/services/systemd.c
+++ b/lib/services/systemd.c
@@ -664,6 +664,8 @@ systemd_unit_metadata(const char *name, int timeout)
     char *desc = NULL;
     char *path = NULL;
 
+    char *escaped = NULL;
+
     if (invoke_unit_by_name(name, NULL, &path) == pcmk_rc_ok) {
         /* TODO: Worth a making blocking call for? Probably not. Possibly if cached. */
         desc = systemd_get_property(path, "Description", NULL, NULL, NULL,
@@ -672,9 +674,12 @@ systemd_unit_metadata(const char *name, int timeout)
         desc = crm_strdup_printf("Systemd unit file for %s", name);
     }
 
-    meta = crm_strdup_printf(METADATA_FORMAT, name, desc, name);
+    escaped = crm_xml_escape(desc);
+
+    meta = crm_strdup_printf(METADATA_FORMAT, name, escaped, name);
     free(desc);
     free(path);
+    free(escaped);
     return meta;
 }
 
-- 
2.34.1

openSUSE Build Service is sponsored by