Blame 0001-library-add-missing-strdup.patch

603fc1b
From a64cce9830c2e9c26e120f671b247ee71b45c888 Mon Sep 17 00:00:00 2001
603fc1b
From: Sumit Bose <sbose@redhat.com>
603fc1b
Date: Fri, 12 Apr 2019 17:31:41 +0200
603fc1b
Subject: [PATCH] library: add missing strdup
603fc1b
603fc1b
In add_server_side_service_principals _adcli_strv_add_unique is called
603fc1b
which only adds a string to a list without copying to. Since the
603fc1b
original list will be freed later the value must be copied.
603fc1b
603fc1b
This issue was introduce with 972f1a2f35829ed89f5353bd204683aa9ad6a2d2
603fc1b
and hence
603fc1b
603fc1b
Related to https://bugzilla.redhat.com/show_bug.cgi?id=1630187
603fc1b
---
603fc1b
 library/adenroll.c | 3 ++-
603fc1b
 1 file changed, 2 insertions(+), 1 deletion(-)
603fc1b
603fc1b
diff --git a/library/adenroll.c b/library/adenroll.c
603fc1b
index 1cce86a..52aa8a8 100644
603fc1b
--- a/library/adenroll.c
603fc1b
+++ b/library/adenroll.c
603fc1b
@@ -1987,7 +1987,8 @@ add_server_side_service_principals (adcli_enroll *enroll)
603fc1b
 		_adcli_info ("Checking %s", spn_list[c]);
603fc1b
 		if (!_adcli_strv_has_ex (enroll->service_principals_to_remove, spn_list[c], strcasecmp)) {
603fc1b
 			enroll->service_principals = _adcli_strv_add_unique (enroll->service_principals,
603fc1b
-		                                                             spn_list[c], &length, false);
603fc1b
+			                                                     strdup (spn_list[c]),
603fc1b
+			                                                     &length, false);
603fc1b
 			assert (enroll->service_principals != NULL);
603fc1b
 			_adcli_info ("   Added %s", spn_list[c]);
603fc1b
 		}
603fc1b
-- 
603fc1b
2.20.1
603fc1b