Blame SOURCES/0040-sudo-runas-do-not-add-to-external-groups-in-IPA.patch

bac598
From cd48ef5071741443e3b84e100a4d4d28e3578e4f Mon Sep 17 00:00:00 2001
bac598
From: Alexander Bokovoy <abokovoy@redhat.com>
bac598
Date: Mon, 25 Jan 2021 15:14:05 +0200
bac598
Subject: [PATCH] sudo runas: do not add '%' to external groups in IPA
bac598
MIME-Version: 1.0
bac598
Content-Type: text/plain; charset=UTF-8
bac598
Content-Transfer-Encoding: 8bit
bac598
bac598
When IPA allows to add AD users and groups directly to sudo rules
bac598
(FreeIPA 4.9.1 or later), external groups will already have '%' prefix.
bac598
Thus, we don't need to add additional '%'.
bac598
bac598
Resolves: https://github.com/SSSD/sssd/issues/5475
bac598
Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
bac598
bac598
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
bac598
---
bac598
 src/providers/ipa/ipa_sudo_conversion.c | 6 ++++++
bac598
 1 file changed, 6 insertions(+)
bac598
bac598
diff --git a/src/providers/ipa/ipa_sudo_conversion.c b/src/providers/ipa/ipa_sudo_conversion.c
bac598
index cfb41d8b0..1bfee096d 100644
bac598
--- a/src/providers/ipa/ipa_sudo_conversion.c
bac598
+++ b/src/providers/ipa/ipa_sudo_conversion.c
bac598
@@ -939,6 +939,12 @@ convert_runasextusergroup(TALLOC_CTX *mem_ctx,
bac598
                           const char *value,
bac598
                           bool *skip_entry)
bac598
 {
bac598
+    if (value == NULL)
bac598
+        return NULL;
bac598
+
bac598
+    if (value[0] == '%')
bac598
+        return talloc_strdup(mem_ctx, value);
bac598
+
bac598
     return talloc_asprintf(mem_ctx, "%%%s", value);
bac598
 }
bac598
 
bac598
-- 
bac598
2.21.3
bac598