dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

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

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