On 08/24/2013 06:37 PM, Jakub Hrozek wrote:
On Thu, Aug 22, 2013 at 02:37:47PM +0200, Pavel Březina wrote:
https://fedorahosted.org/sssd/ticket/2052

From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <[email protected]>
Date: Thu, 22 Aug 2013 13:58:27 +0200
Subject: [PATCH 1/2] sudo: do not strdup usn on ENOENT
ACK

 From 57be0b8c58b15436331dd51511b24af3de203840 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <[email protected]>
Date: Thu, 22 Aug 2013 14:04:38 +0200
Subject: [PATCH 2/2] sudo: do not fail to store the rule if we can't read usn

Resolves:
https://fedorahosted.org/sssd/ticket/2052
---
  src/providers/ldap/sdap_sudo_cache.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/providers/ldap/sdap_sudo_cache.c 
b/src/providers/ldap/sdap_sudo_cache.c
index 
bace80ef24d396f81b9e363fb00110160ccb4c2d..0550fce788130f0fad17a37752b3d6fd6a07efff
 100644
--- a/src/providers/ldap/sdap_sudo_cache.c
+++ b/src/providers/ldap/sdap_sudo_cache.c
@@ -88,9 +88,10 @@ sdap_save_native_sudorule(TALLOC_CTX *mem_ctx,
      }

      ret = sdap_sudo_get_usn(mem_ctx, attrs, map, rule_name, _usn);
-    if (ret != EOK && ret != ENOENT) {
+    if (ret != EOK) {
          DEBUG(SSSDBG_OP_FAILURE, ("Could not read USN from %s\n", rule_name));

Can you change the level to MINOR failure now that we're able to
recover?

Done.

-        return ret;
+        *_usn = NULL;
+        /* but we will store the rule anyway */
      }

      ret = sysdb_save_sudorule(sysdb_ctx, domain, rule_name, attrs);
--
1.7.11.7

_______________________________________________
sssd-devel mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/sssd-devel


From 6d90918ae15c25d3e72836208de5ab126e86c111 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <[email protected]>
Date: Thu, 22 Aug 2013 14:04:38 +0200
Subject: [PATCH] sudo: do not fail to store the rule if we can't read usn

Resolves:
https://fedorahosted.org/sssd/ticket/2052
---
 src/providers/ldap/sdap_sudo_cache.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/providers/ldap/sdap_sudo_cache.c b/src/providers/ldap/sdap_sudo_cache.c
index bace80ef24d396f81b9e363fb00110160ccb4c2d..de4f65c41eedfed14713819e9f1829d086596605 100644
--- a/src/providers/ldap/sdap_sudo_cache.c
+++ b/src/providers/ldap/sdap_sudo_cache.c
@@ -88,9 +88,10 @@ sdap_save_native_sudorule(TALLOC_CTX *mem_ctx,
     }
 
     ret = sdap_sudo_get_usn(mem_ctx, attrs, map, rule_name, _usn);
-    if (ret != EOK && ret != ENOENT) {
-        DEBUG(SSSDBG_OP_FAILURE, ("Could not read USN from %s\n", rule_name));
-        return ret;
+    if (ret != EOK) {
+        DEBUG(SSSDBG_MINOR_FAILURE, ("Could not read USN from %s\n", rule_name));
+        *_usn = NULL;
+        /* but we will store the rule anyway */
     }
 
     ret = sysdb_save_sudorule(sysdb_ctx, domain, rule_name, attrs);
-- 
1.7.11.7

_______________________________________________
sssd-devel mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to