Blob Blame History Raw
From 431c7508e0d256b9c712cb9dcb9aa4cb635f4a0b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
Date: Mon, 14 Aug 2017 13:40:58 +0200
Subject: [PATCH 68/93] NSS: Don't error out when deleting an entry which has
 id = 0 from the memcache
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This code path can be easily triggered by calling `id 0` after applying
the previous patch in this series and SSSD should not error out in this
case.

As SSSD doesn't handle "root", this entry never will be part of the
memcache and EOK can be safely returned there.

Related: https://pagure.io/SSSD/sssd/issue/3460

Signed-off-by: Fabiano FidĂȘncio <fidencio@redhat.com>

Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
---
 src/responder/nss/nss_get_object.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/responder/nss/nss_get_object.c b/src/responder/nss/nss_get_object.c
index 9058793ea2d72b57003a7219414af6a0f0c5b89e..e56480af5e3369963d2e8bb17d74d1603af8e014 100644
--- a/src/responder/nss/nss_get_object.c
+++ b/src/responder/nss/nss_get_object.c
@@ -125,6 +125,12 @@ memcache_delete_entry(struct nss_ctx *nss_ctx,
                       name, dom->name);
                 continue;
             }
+        } else if (id == 0) {
+            /*
+             * As "root" is not handled by SSSD, let's just return EOK here
+             * instead of erroring out.
+             */
+            return EOK;
         } else if (id != 0) {
             ret = memcache_delete_entry_by_id(nss_ctx, id, type);
             if (ret != EOK) {
-- 
2.14.1