ldap/servers/slapd/plugin_syntax.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
New commits:
commit 2eba67c469e7946321b0707f51e63ecb3cb74aaa
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Sun May 3 22:59:02 2015 -0700
Ticket #48109 - substring index with nssubstrbegin: 1 is not being used with filters
like (attr=x*)
Description: In the commit ae69e4aa1dcec1c5f79af502b77d9e19a3d348ee,
when pblock is passed to slapi_attr_assertion2keys_sub_sv_pb from the
caller, the original slapdplugin is overwritten in the function. In
the case, the original slapdplugin has to be backed up and restored.
https://fedorahosted.org/389/ticket/48109
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!!)
diff --git a/ldap/servers/slapd/plugin_syntax.c b/ldap/servers/slapd/plugin_syntax.c
index fa05b0b..06a9514 100644
--- a/ldap/servers/slapd/plugin_syntax.c
+++ b/ldap/servers/slapd/plugin_syntax.c
@@ -924,6 +924,7 @@ slapi_attr_assertion2keys_sub_sv_pb(
int rc;
Slapi_PBlock pipb;
struct slapdplugin *pi = NULL;
+ struct slapdplugin *origpi = NULL;
IFP a2k_fn = NULL;
LDAPDebug( LDAP_DEBUG_FILTER,
@@ -943,8 +944,11 @@ slapi_attr_assertion2keys_sub_sv_pb(
if (NULL == pb) {
pblock_init( &pipb );
pb = &pipb;
+ } else {
+ /* back up the original slapdplugin if any */
+ slapi_pblock_get(pb, SLAPI_PLUGIN, &origpi);
}
- slapi_pblock_set( pb, SLAPI_PLUGIN, pi );
+ slapi_pblock_set(pb, SLAPI_PLUGIN, pi);
rc = -1; /* means no assertion2keys function */
*ivals = NULL;
@@ -952,6 +956,11 @@ slapi_attr_assertion2keys_sub_sv_pb(
rc = (*a2k_fn)( pb, initial, any, final, ivals );
}
+ if (pb != &pipb) {
+ /* restore the original slapdplugin if pb is not local. */
+ slapi_pblock_set(pb, SLAPI_PLUGIN, origpi);
+ }
+
LDAPDebug( LDAP_DEBUG_FILTER,
"<= slapi_attr_assertion2keys_sub_sv %d\n", rc, 0, 0 );
return( rc );