Commit e4779aef authored by Luke Howard's avatar Luke Howard
Browse files

A pre-operation plugin is not required to set SLAPI_RESULT_CODE in

order to prevent the operation from being passed to the backend. It
need only return a non-zero error code.
parent 20c8128d
......@@ -556,8 +556,10 @@ static int doPreAddPluginFNs( Operation *op )
#else
Debug(LDAP_DEBUG_TRACE, "do_add: add preoperation plugin failed.\n",
0, 0, 0);
if ( slapi_pblock_get( op->o_pb, SLAPI_RESULT_CODE, (void *)&rc ) != 0 )
if ( ( slapi_pblock_get( op->o_pb, SLAPI_RESULT_CODE, (void *)&rc ) != 0 ) ||
rc == LDAP_SUCCESS ) {
rc = LDAP_OTHER;
}
#endif
} else {
rc = LDAP_SUCCESS;
......
......@@ -540,9 +540,10 @@ do_bind(
*/
int ldapRc;
if ( slapi_pblock_get( pb, SLAPI_RESULT_CODE, (void *)&ldapRc ) != 0 )
if ( ( slapi_pblock_get( op->o_pb, SLAPI_RESULT_CODE, (void *)&ldapRc ) != 0 ) ||
ldapRc == LDAP_SUCCESS ) {
ldapRc = LDAP_OTHER;
}
op->orb_edn.bv_val = NULL;
op->orb_edn.bv_len = 0;
if ( rs->sr_err != SLAPI_BIND_FAIL && ldapRc == LDAP_SUCCESS ) {
......
......@@ -272,8 +272,10 @@ do_compare(
Debug(LDAP_DEBUG_TRACE, "do_compare: compare preoperation plugin "
"failed.\n", 0, 0, 0);
#endif
if ( slapi_pblock_get( pb, SLAPI_RESULT_CODE, (void *)&rs->sr_err ) != 0)
if ( ( slapi_pblock_get( op->o_pb, SLAPI_RESULT_CODE, (void *)&rs->sr_err ) != 0 ) ||
rs->sr_err == LDAP_SUCCESS ) {
rs->sr_err = LDAP_OTHER;
}
goto cleanup;
}
#endif /* defined( LDAP_SLAPI ) */
......
......@@ -173,8 +173,10 @@ do_delete(
Debug (LDAP_DEBUG_TRACE, "do_delete: delete preoperation plugin failed.\n",
0, 0, 0);
#endif
if ( slapi_pblock_get( pb, SLAPI_RESULT_CODE, (void *)&rs->sr_err ) != 0 )
if ( ( slapi_pblock_get( op->o_pb, SLAPI_RESULT_CODE, (void *)&rs->sr_err ) != 0 ) ||
rs->sr_err == LDAP_SUCCESS ) {
rs->sr_err = LDAP_OTHER;
}
goto cleanup;
}
#endif /* defined( LDAP_SLAPI ) */
......
......@@ -347,7 +347,8 @@ do_modify(
Debug(LDAP_DEBUG_TRACE, "do_modify: modify preoperation plugin failed.\n",
0, 0, 0);
#endif
if ( slapi_pblock_get( pb, SLAPI_RESULT_CODE, (void *)&rs->sr_err ) != 0) {
if ( ( slapi_pblock_get( op->o_pb, SLAPI_RESULT_CODE, (void *)&rs->sr_err ) != 0 ) ||
rs->sr_err == LDAP_SUCCESS ) {
rs->sr_err = LDAP_OTHER;
}
slapi_x_free_ldapmods( modv );
......
......@@ -336,8 +336,10 @@ do_modrdn(
Debug(LDAP_DEBUG_TRACE, "do_modrdn: modrdn preoperation plugin "
"failed.\n", 0, 0, 0);
#endif
if ( slapi_pblock_get( pb, SLAPI_RESULT_CODE, (void *)&rs->sr_err ) != 0)
if ( ( slapi_pblock_get( pb, SLAPI_RESULT_CODE, (void *)&rs->sr_err ) != 0 ) ||
rs->sr_err == LDAP_SUCCESS ) {
rs->sr_err = LDAP_OTHER;
}
goto cleanup;
}
#endif /* defined( LDAP_SLAPI ) */
......
......@@ -482,8 +482,10 @@ static int doPreSearchPluginFNs( Operation *op )
Debug(LDAP_DEBUG_TRACE, "doPreSearchPluginFNs: search preoperation plugin "
"returned %d.\n", rc, 0, 0);
#endif
if ( slapi_pblock_get( op->o_pb, SLAPI_RESULT_CODE, (void *)&rc ) != 0)
if ( ( slapi_pblock_get( op->o_pb, SLAPI_RESULT_CODE, (void *)&rc ) != 0 ) ||
rc == LDAP_SUCCESS ) {
rc = LDAP_OTHER;
}
} else {
rc = LDAP_SUCCESS;
}
......
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