[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
(ITS#3529) SLAPI plugins called multiple times with glue
Full_Name: Luke Howard
Version: 2.2.23
OS: Linux
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (203.13.32.92)
When using backglue (or likely anything that inserts callbacks into the result
chain), SLAPI result preoperation plugins are called multiple times.
(We have a plugin that generates referrals from cross-reference information
stored in the DSA, and we saw referrals being returned twice.)
The following patch appears to fix this.
Index: result.c
===================================================================
RCS file: /repo/OpenLDAP/pkg/ldap/servers/slapd/result.c,v
retrieving revision 1.186.2.20
diff -u -r1.186.2.20 result.c
--- result.c 20 Jan 2005 17:01:09 -0000 1.186.2.20
+++ result.c 1 Feb 2005 07:17:14 -0000
@@ -605,26 +605,6 @@
}
}
-#ifdef LDAP_SLAPI
- /*
- * Call pre-result plugins. To avoid infinite recursion plugins
- * should just set SLAPI_RESULT_CODE rather than sending a
- * result if they wish to change the result.
- */
- if ( op->o_pb != NULL ) {
- slapi_int_pblock_set_operation( op->o_pb, op );
- slapi_pblock_set( op->o_pb, SLAPI_RESULT_CODE,
- (void *)rs->sr_err );
- slapi_pblock_set( op->o_pb, SLAPI_RESULT_TEXT,
- (void *)rs->sr_text );
- slapi_pblock_set( op->o_pb, SLAPI_RESULT_MATCHED,
- (void *)rs->sr_matched );
-
- (void) slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_PRE_RESULT_FN,
- op->o_pb );
- }
-#endif /* LDAP_SLAPI */
-
if ( op->o_protocol < LDAP_VERSION3 ) {
tmp = v2ref( rs->sr_ref, rs->sr_text );
rs->sr_text = tmp;
@@ -651,6 +631,26 @@
rs->sr_text ? rs->sr_text : "" );
}
}
+#ifdef LDAP_SLAPI
+ /*
+ * Call pre-result plugins. To avoid infinite recursion plugins
+ * should just set SLAPI_RESULT_CODE rather than sending a
+ * result if they wish to change the result.
+ */
+ else if ( op->o_pb != NULL ) {
+ slapi_int_pblock_set_operation( op->o_pb, op );
+ slapi_pblock_set( op->o_pb, SLAPI_RESULT_CODE,
+ (void *)rs->sr_err );
+ slapi_pblock_set( op->o_pb, SLAPI_RESULT_TEXT,
+ (void *)rs->sr_text );
+ slapi_pblock_set( op->o_pb, SLAPI_RESULT_MATCHED,
+ (void *)rs->sr_matched );
+
+ (void) slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_PRE_RESULT_FN,
+ op->o_pb );
+ }
+#endif /* LDAP_SLAPI */
+
if( tmp != NULL ) ch_free(tmp);
rs->sr_text = otext;