Blame SOURCES/0153-SYSDB-Fixing-of-sudorule-without-a-sudoUser.patch

45d81b
From aed255dd1ae6ec40ca15a53c38a13354dd5c88e8 Mon Sep 17 00:00:00 2001
45d81b
From: =?UTF-8?q?Petr=20=C4=8Cech?= <pcech@redhat.com>
45d81b
Date: Wed, 16 Nov 2016 10:09:18 +0100
45d81b
Subject: [PATCH 153/153] SYSDB: Fixing of sudorule without a sudoUser
45d81b
45d81b
This patch solved a regression caused by the recent patches
45d81b
to lowercase sudoUser -- in case sudoUser is missing completely,
45d81b
we abort the processing of this rule and all others.
45d81b
45d81b
With this patch, we return ERR_MALFORMED_ENTRY and gracefully
45d81b
skip the malformed rule instead.
45d81b
45d81b
Resolves:
45d81b
https://fedorahosted.org/sssd/ticket/3241
45d81b
45d81b
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
45d81b
(cherry picked from commit 7e23edbaa7a6bbd0b461d5792535896b6a77928b)
45d81b
---
45d81b
 src/db/sysdb_sudo.c | 5 +++++
45d81b
 1 file changed, 5 insertions(+)
45d81b
45d81b
diff --git a/src/db/sysdb_sudo.c b/src/db/sysdb_sudo.c
45d81b
index 4bd93ffc60caa1ce48b72ee207899da0c4196d61..f5160f19012028f92723b9012fad85d803aa5137 100644
45d81b
--- a/src/db/sysdb_sudo.c
45d81b
+++ b/src/db/sysdb_sudo.c
45d81b
@@ -874,6 +874,7 @@ static errno_t sysdb_sudo_add_lowered_users(struct sss_domain_info *domain,
45d81b
     if (ret != EOK) {
45d81b
         DEBUG(SSSDBG_OP_FAILURE, "Unable to get %s attribute [%d]: %s\n",
45d81b
               SYSDB_SUDO_CACHE_AT_USER, ret, strerror(ret));
45d81b
+        ret = ERR_MALFORMED_ENTRY;
45d81b
         goto done;
45d81b
     }
45d81b
 
45d81b
@@ -977,6 +978,10 @@ sysdb_sudo_store(struct sss_domain_info *domain,
45d81b
             /* Multiple CNs are error on server side, we can just ignore this
45d81b
              * rule and save the others. Loud debug message is in logs. */
45d81b
             continue;
45d81b
+        } else if (ret == ERR_MALFORMED_ENTRY) {
45d81b
+            /* Attribute SYSDB_SUDO_CACHE_AT_USER is missing but we can
45d81b
+             * continue with next sudoRule. */
45d81b
+            continue;
45d81b
         } else if (ret != EOK) {
45d81b
             goto done;
45d81b
         }
45d81b
-- 
45d81b
2.7.4
45d81b