190568
From 61ea8f6a104da25329e301a8f56944f860de8177 Mon Sep 17 00:00:00 2001
190568
From: Alexander Bokovoy <abokovoy@redhat.com>
190568
Date: Sat, 12 Sep 2020 12:00:22 +0300
190568
Subject: [PATCH] Ignore searches that do not match any of configured tree
190568
190568
Resolves: rhbz#1874015
190568
Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
190568
---
190568
 slapi-nis.spec | 5 ++++-
190568
 src/back-sch.c | 4 ++++
190568
 2 files changed, 8 insertions(+), 1 deletion(-)
190568
190568
diff --git a/slapi-nis.spec b/slapi-nis.spec
190568
index 3eb3e37..8bde325 100644
190568
--- a/slapi-nis.spec
190568
+++ b/slapi-nis.spec
190568
@@ -11,7 +11,7 @@
190568
 
190568
 Name:		slapi-nis
190568
 Version:	0.56.5
190568
-Release:	1%{?dist}
190568
+Release:	3%{?dist}
190568
 Summary:	NIS Server and Schema Compatibility plugins for Directory Server
190568
 License:	GPLv2
190568
 URL:		http://pagure.io/slapi-nis/
190568
@@ -81,6 +81,9 @@ make check
190568
 %{_sbindir}/nisserver-plugin-defs
190568
 
190568
 %changelog
190568
+* Sat Sep 12 2020 Alexander Bokovoy <abokovoy@redhat.com> - 0.56.5-3
190568
+- Ignore searches which don't match any configured map
190568
+
190568
 * Mon May 04 2020 Alexander Bokovoy <abokovoy@redhat.com> - 0.56.5-1
190568
 - New upstream release
190568
 - Resolves: rhbz#1751295: (2) When sync-repl is enabled, slapi-nis can deadlock during retrochanglog trimming
190568
diff --git a/src/back-sch.c b/src/back-sch.c
190568
index f8b04a3..a5e4c04 100644
190568
--- a/src/back-sch.c
190568
+++ b/src/back-sch.c
190568
@@ -1790,6 +1790,10 @@ backend_search_cb(Slapi_PBlock *pb)
190568
 			}
190568
 		}
190568
 		slapi_ch_free_string(&target);
190568
+		if (cbdata.answer == FALSE) {
190568
+			/* None of the configured trees in the sets matched the target at all, ignore search */
190568
+			return 0;
190568
+		}
190568
 	}
190568
 	cbdata.answer = FALSE;
190568
 #endif
190568
-- 
190568
2.26.2
190568