From 4067c989386b417a82742f165ff37dd1357d1ca5 Mon Sep 17 00:00:00 2001
From: Quanah Gibson-Mount <quanah@openldap.org>
Date: Mon, 17 Jun 2019 17:15:00 +0000
Subject: [PATCH] ITS#8997 - Fix segfault by setting return code value

Fix case with back-ldap where an entry was returned but didn't match the filter being applied by setting the return code value before dropping to cleanup.
---
 servers/slapd/back-ldap/search.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/servers/slapd/back-ldap/search.c b/servers/slapd/back-ldap/search.c
index 63345aed22..82e72aa8a7 100644
--- a/servers/slapd/back-ldap/search.c
+++ b/servers/slapd/back-ldap/search.c
@@ -1006,6 +1006,7 @@ retry:
 	e = ldap_first_entry( lc->lc_ld, result );
 	if ( e == NULL ) {
 		/* the entry exists, but it doesn't match the filter? */
+		rc = LDAP_NO_RESULTS_RETURNED;
 		goto cleanup;
 	}
 
-- 
GitLab