Commit 3aabc4ed authored by Howard Chu's avatar Howard Chu
Browse files

doPlugins return code fix

parent 755f7854
......@@ -523,7 +523,7 @@ static int doPreAddPluginFNs( Operation *op )
int rc;
rc = doPluginFNs( op->o_bd, SLAPI_PLUGIN_PRE_ADD_FN, op->o_pb );
if ( rc != 0 ) {
if ( rc < 0 ) {
/*
* A preoperation plugin failure will abort the
* entire operation.
......@@ -549,7 +549,7 @@ static void doPostAddPluginFNs( Operation *op )
int rc;
rc = doPluginFNs( op->o_bd, SLAPI_PLUGIN_POST_ADD_FN, op->o_pb );
if ( rc != 0 ) {
if ( rc < 0 ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, INFO, "do_add: add postoperation plugin failed\n",
0, 0, 0);
......
......@@ -694,7 +694,7 @@ backend_unbind( Operation *op, SlapReply *rs )
slapi_pblock_set( pb, SLAPI_BACKEND, (void *)&backends[i] );
rc = doPluginFNs( &backends[i], SLAPI_PLUGIN_PRE_UNBIND_FN,
(Slapi_PBlock *)pb );
if ( rc != 0 ) {
if ( rc < 0 ) {
/*
* A preoperation plugin failure will abort the
* entire operation.
......@@ -717,7 +717,7 @@ backend_unbind( Operation *op, SlapReply *rs )
#if defined( LDAP_SLAPI )
if ( doPluginFNs( &backends[i], SLAPI_PLUGIN_POST_UNBIND_FN,
(Slapi_PBlock *)pb ) != 0 ) {
(Slapi_PBlock *)pb ) < 0 ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, INFO, "do_unbind: Unbind postoperation plugins "
"failed\n", 0, 0, 0);
......
......@@ -528,7 +528,7 @@ do_bind(
slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)(0) );
rs->sr_err = doPluginFNs( op->o_bd, SLAPI_PLUGIN_PRE_BIND_FN, pb );
if ( rs->sr_err != SLAPI_BIND_SUCCESS ) {
if ( rs->sr_err < 0 ) {
/*
* Binding is a special case for SLAPI plugins. It is
* possible for a bind plugin to be successful *and*
......@@ -641,7 +641,7 @@ do_bind(
}
#if defined( LDAP_SLAPI )
if ( doPluginFNs( op->o_bd, SLAPI_PLUGIN_POST_BIND_FN, pb ) != 0 ) {
if ( doPluginFNs( op->o_bd, SLAPI_PLUGIN_POST_BIND_FN, pb ) < 0 ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, INFO, "do_bind: Bind postoperation plugins failed\n",
0, 0, 0);
......
......@@ -260,7 +260,7 @@ do_compare(
slapi_pblock_set( pb, SLAPI_COMPARE_VALUE, (void *)&value );
rs->sr_err = doPluginFNs( op->o_bd, SLAPI_PLUGIN_PRE_COMPARE_FN, pb );
if ( rs->sr_err != 0 ) {
if ( rs->sr_err < 0 ) {
/*
* A preoperation plugin failure will abort the
* entire operation.
......@@ -287,7 +287,7 @@ do_compare(
}
#if defined( LDAP_SLAPI )
if ( doPluginFNs( op->o_bd, SLAPI_PLUGIN_POST_COMPARE_FN, pb ) != 0 ) {
if ( doPluginFNs( op->o_bd, SLAPI_PLUGIN_POST_COMPARE_FN, pb ) < 0 ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, INFO, "do_compare: compare postoperation plugins "
"failed\n", 0, 0, 0 );
......
......@@ -327,7 +327,7 @@ do_modify(
slapi_pblock_set( pb, SLAPI_MODIFY_MODS, (void *)modv );
rs->sr_err = doPluginFNs( op->o_bd, SLAPI_PLUGIN_PRE_MODIFY_FN, pb );
if ( rs->sr_err != 0 ) {
if ( rs->sr_err < 0 ) {
/*
* A preoperation plugin failure will abort the
* entire operation.
......@@ -355,8 +355,9 @@ do_modify(
* Calling slapi_x_modifications2ldapmods() destroyed modlist so
* we don't need to free it.
*/
slapi_pblock_get( pb, SLAPI_MODIFY_MODS, (void **)&modv );
modlist = slapi_x_ldapmods2modifications( modv );
if ( rs->sr_err == 0 ) {
slapi_pblock_get( pb, SLAPI_MODIFY_MODS, (void **)&modv );
modlist = slapi_x_ldapmods2modifications( modv );
/*
* NB: it is valid for the plugin to return no modifications
......@@ -366,10 +367,11 @@ do_modify(
* then slapi_x_ldapmods2modifications() above will return
* NULL).
*/
if ( modlist == NULL ) {
rs->sr_err = LDAP_SUCCESS;
send_ldap_result( op, rs );
goto cleanup;
if ( modlist == NULL ) {
rs->sr_err = LDAP_SUCCESS;
send_ldap_result( op, rs );
goto cleanup;
}
}
#endif /* defined( LDAP_SLAPI ) */
......@@ -447,7 +449,7 @@ do_modify(
}
#if defined( LDAP_SLAPI )
if ( doPluginFNs( op->o_bd, SLAPI_PLUGIN_POST_MODIFY_FN, pb ) != 0 ) {
if ( doPluginFNs( op->o_bd, SLAPI_PLUGIN_POST_MODIFY_FN, pb ) < 0 ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, INFO, "do_modify: modify postoperation plugins "
"failed\n", 0, 0, 0 );
......
......@@ -319,7 +319,7 @@ do_modrdn(
slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)manageDSAit );
rs->sr_err = doPluginFNs( op->o_bd, SLAPI_PLUGIN_PRE_MODRDN_FN, pb );
if ( rs->sr_err != 0 ) {
if ( rs->sr_err < 0 ) {
/*
* A preoperation plugin failure will abort the
* entire operation.
......@@ -378,7 +378,7 @@ do_modrdn(
}
#if defined( LDAP_SLAPI )
if ( doPluginFNs( op->o_bd, SLAPI_PLUGIN_POST_MODRDN_FN, pb ) != 0 ) {
if ( doPluginFNs( op->o_bd, SLAPI_PLUGIN_POST_MODRDN_FN, pb ) < 0 ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, INFO, "do_modrdn: modrdn postoperation plugins "
"failed\n", 0, 0, 0 );
......
......@@ -448,7 +448,7 @@ static int doPreSearchPluginFNs( Operation *op )
int rc;
rc = doPluginFNs( op->o_bd, SLAPI_PLUGIN_PRE_SEARCH_FN, op->o_pb );
if ( rc != 0 ) {
if ( rc < 0 ) {
/*
* A preoperation plugin failure will abort the
* entire operation.
......@@ -494,7 +494,7 @@ static int doSearchRewriteFNs( Operation *op )
static void doPostSearchPluginFNs( Operation *op )
{
if ( doPluginFNs( op->o_bd, SLAPI_PLUGIN_POST_SEARCH_FN, op->o_pb ) != 0 ) {
if ( doPluginFNs( op->o_bd, SLAPI_PLUGIN_POST_SEARCH_FN, op->o_pb ) < 0 ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, INFO, "doPostSearchPluginFNs: search postoperation plugins "
"failed\n", 0, 0, 0 );
......
......@@ -637,6 +637,8 @@ doPluginFNs(
* failure (confirmed with SLAPI specification).
*/
if ( !SLAPI_PLUGIN_IS_POST_FN( funcType ) && rc != 0 ) {
/* make sure errors are negative */
if ( rc > 0 ) rc = 0 - rc;
break;
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment