slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)(1) );
rc = doPluginFNs( be, SLAPI_PLUGIN_PRE_ADD_FN, pb );
- if ( rc != 0 && rc != LDAP_OTHER ) {
+ if ( rc != 0 ) {
/*
- * either there is no preOp (add) plugins
- * or a plugin failed. Just log it
- *
- * FIXME: is this correct?
+ * A preoperation plugin failure will abort the
+ * entire operation.
*/
#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, INFO, "do_add: add preOps failed\n",
+ LDAP_LOG( OPERATION, INFO, "do_add: add preoperation plugin failed\n",
0, 0, 0);
#else
- Debug(LDAP_DEBUG_TRACE, "do_add: add preOps failed.\n",
+ Debug(LDAP_DEBUG_TRACE, "do_add: add preoperation plugin failed.\n",
0, 0, 0);
+ if ( slapi_pblock_get( pb, SLAPI_RESULT_CODE, (void *)&rc ) != 0 )
+ rc = LDAP_OPERATIONS_ERROR;
+ goto done;
#endif
}
#endif /* defined( LDAP_SLAPI ) */
}
#if defined( LDAP_SLAPI )
- rc = doPluginFNs( be, SLAPI_PLUGIN_POST_ADD_FN, pb );
- if ( rc != 0 && rc != LDAP_OTHER ) {
- /*
- * either there is no postOp (Add) plugins
- * or a plugin failed. Just log it
- *
- * FIXME: is this correct?
- */
+ /*
+ * Postoperation errors are silently ignored; the work has
+ * been done.
+ */
+ if ( doPluginFNs( be, SLAPI_PLUGIN_POST_ADD_FN, pb ) != 0) {
#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, INFO, "do_add: Add postOps failed\n",
+ LDAP_LOG( OPERATION, INFO, "do_add: Add postoperation plugins failed\n",
0, 0, 0);
#else
- Debug(LDAP_DEBUG_TRACE, "do_add: Add postOps failed.\n",
+ Debug(LDAP_DEBUG_TRACE, "do_add: Add postoperation plugins failed.\n",
0, 0, 0);
#endif
}
slapi_pblock_set( pb, SLAPI_BACKEND, (void *)&backends[i] );
rc = doPluginFNs( &backends[i], SLAPI_PLUGIN_PRE_UNBIND_FN,
(Slapi_PBlock *)pb );
- if ( rc != 0 && rc != LDAP_OTHER ) {
+ if ( rc != 0 ) {
/*
- * either there is no preOp (unbind) plugins
- * or a plugin failed. Just log it.
- *
- * FIXME: is this correct?
+ * A preoperation plugin failure will abort the
+ * entire operation.
*/
#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, INFO, "do_bind: Unbind preOps "
+ LDAP_LOG( OPERATION, INFO, "do_bind: Unbind preoperation plugin "
"failed\n", 0, 0, 0);
#else
- Debug(LDAP_DEBUG_TRACE, "do_bind: Unbind preOps "
+ Debug(LDAP_DEBUG_TRACE, "do_bind: Unbind preoperation plugin "
"failed.\n", 0, 0, 0);
#endif
+ return 0;
}
#endif /* defined( LDAP_SLAPI ) */
}
#if defined( LDAP_SLAPI )
- rc = doPluginFNs( &backends[i], SLAPI_PLUGIN_POST_UNBIND_FN,
- (Slapi_PBlock *)pb );
- if ( rc != 0 && rc != LDAP_OTHER ) {
- /*
- * either there is no postOp (unbind) plugins
- * or a plugin failed. Just log it.
- *
- * FIXME: is this correct?
- */
+ if ( doPluginFNs( &backends[i], SLAPI_PLUGIN_POST_UNBIND_FN,
+ (Slapi_PBlock *)pb ) != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, INFO, "do_unbind: Unbind postOps "
+ LDAP_LOG( OPERATION, INFO, "do_unbind: Unbind postoperation plugins "
"failed\n", 0, 0, 0);
#else
- Debug(LDAP_DEBUG_TRACE, "do_unbind: Unbind postOps "
+ Debug(LDAP_DEBUG_TRACE, "do_unbind: Unbind postoperation plugins "
"failed.\n", 0, 0, 0);
#endif
}
slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)(1) );
rc = doPluginFNs( be, SLAPI_PLUGIN_PRE_BIND_FN, pb );
- if ( rc != 0 && rc != LDAP_OTHER ) {
+ if ( rc != SLAPI_BIND_SUCCESS ) {
+ /* XXX: we should support SLAPI_BIND_ANONYMOUS being returned */
/*
- * either there is no preOp (bind) plugins
- * or a plugin failed. Just log it
- *
- * FIXME: is this correct?
+ * A preoperation plugin failure will abort the
+ * entire operation.
*/
#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, INFO, "do_bind: Bind preOps failed\n",
+ LDAP_LOG( OPERATION, INFO, "do_bind: Bind preoperation plugin failed\n",
0, 0, 0);
#else
- Debug(LDAP_DEBUG_TRACE, "do_bind: Bind preOps failed.\n",
+ Debug(LDAP_DEBUG_TRACE, "do_bind: Bind preoperation plugin failed.\n",
0, 0, 0);
#endif
+ if ( slapi_pblock_get( pb, SLAPI_RESULT_CODE, (void *)&rc ) != 0 )
+ rc = LDAP_OPERATIONS_ERROR;
+ goto cleanup;
}
#endif /* defined( LDAP_SLAPI ) */
}
#if defined( LDAP_SLAPI )
- rc = doPluginFNs( be, SLAPI_PLUGIN_POST_BIND_FN, pb );
- if ( rc != 0 && rc != LDAP_OTHER ) {
- /*
- * either there is no pretOp (bind) plugins
- * or a plugin failed. Just log it
- *
- * FIXME: is this correct?
- */
+ if ( doPluginFNs( be, SLAPI_PLUGIN_POST_BIND_FN, pb ) != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, INFO, "do_bind: Bind postOps failed\n",
+ LDAP_LOG( OPERATION, INFO, "do_bind: Bind postoperation plugins failed\n",
0, 0, 0);
#else
- Debug(LDAP_DEBUG_TRACE, "do_bind: Bind postOps failed.\n",
+ Debug(LDAP_DEBUG_TRACE, "do_bind: Bind postoperation plugins failed.\n",
0, 0, 0);
#endif
}
slapi_pblock_set( pb, SLAPI_COMPARE_VALUE, (void *)&value );
rc = doPluginFNs( be, SLAPI_PLUGIN_PRE_COMPARE_FN, pb );
- if ( rc != 0 && rc != LDAP_OTHER ) {
+ if ( rc != 0 ) {
/*
- * either there is no preOp (compare) plugins
- * or a plugin failed. Just log it
- *
- * FIXME: is this correct?
+ * A preoperation plugin failure will abort the
+ * entire operation.
*/
#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, INFO, "do_compare: compare preOps "
+ LDAP_LOG( OPERATION, INFO, "do_compare: compare preoperation plugin "
"failed\n", 0, 0, 0);
#else
- Debug(LDAP_DEBUG_TRACE, "do_compare: compare preOps "
+ Debug(LDAP_DEBUG_TRACE, "do_compare: compare preoperation plugin "
"failed.\n", 0, 0, 0);
#endif
+ if ( slapi_pblock_get( pb, SLAPI_RESULT_CODE, (void *)&rc ) != 0)
+ rc = LDAP_OPERATIONS_ERROR;
+ goto cleanup;
}
#endif /* defined( LDAP_SLAPI ) */
}
#if defined( LDAP_SLAPI )
- rc = doPluginFNs( be, SLAPI_PLUGIN_POST_COMPARE_FN, pb );
- if ( rc != 0 && rc != LDAP_OTHER ) {
- /*
- * either there is no postOp (compare) plugins
- * or a plugin failed. Just log it
- *
- * FIXME: is this correct?
- */
+ if ( doPluginFNs( be, SLAPI_PLUGIN_POST_COMPARE_FN, pb ) != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, INFO, "do_compare: compare postOps "
+ LDAP_LOG( OPERATION, INFO, "do_compare: compare postoperation plugins "
"failed\n", 0, 0, 0 );
#else
- Debug(LDAP_DEBUG_TRACE, "do_compare: compare postOps "
+ Debug(LDAP_DEBUG_TRACE, "do_compare: compare postoperation plugins "
"failed.\n", 0, 0, 0);
#endif
}
slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)(1) );
rc = doPluginFNs( be, SLAPI_PLUGIN_PRE_DELETE_FN, pb );
- if ( rc != 0 && rc != LDAP_OTHER ) {
+ if ( rc != 0 ) {
/*
- * either there is no preOp (delete) plugins
- * or a plugin failed. Just log it
- *
- * FIXME: is this correct?
+ * A preoperation plugin failure will abort the
+ * entire operation.
*/
#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, INFO, "do_delete: delete preOps "
+ LDAP_LOG( OPERATION, INFO, "do_delete: delete preoperation plugin "
"failed\n", 0, 0, 0 );
#else
- Debug (LDAP_DEBUG_TRACE, "do_delete: delete preOps failed.\n",
+ Debug (LDAP_DEBUG_TRACE, "do_delete: delete preoperation plugin failed.\n",
0, 0, 0);
#endif
+ if ( slapi_pblock_get( pb, SLAPI_RESULT_CODE, (void *)&rc ) != 0 )
+ rc = LDAP_OPERATIONS_ERROR;
+ goto cleanup;
}
#endif /* defined( LDAP_SLAPI ) */
}
#if defined( LDAP_SLAPI )
- rc = doPluginFNs( be, SLAPI_PLUGIN_POST_DELETE_FN, pb );
- if ( rc != 0 && rc != LDAP_OTHER ) {
- /*
- * either there is no postOp (delete) plugins
- * or a plugin failed. Just log it
- *
- * FIXME: is this correct?
- */
+ if ( doPluginFNs( be, SLAPI_PLUGIN_POST_DELETE_FN, pb ) != 0) {
#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, INFO, "do_delete: delete postOps "
+ LDAP_LOG( OPERATION, INFO, "do_delete: delete postoperation plugins "
"failed\n", 0, 0, 0 );
#else
- Debug(LDAP_DEBUG_TRACE, "do_delete: delete postOps "
+ Debug(LDAP_DEBUG_TRACE, "do_delete: delete postoperation plugins "
"failed.\n", 0, 0, 0);
#endif
}
slapi_pblock_set( pb, SLAPI_MODIFY_MODS, (void *)modv );
rc = doPluginFNs( be, SLAPI_PLUGIN_PRE_MODIFY_FN, pb );
- if ( rc != 0 && rc != LDAP_OTHER ) {
+ if ( rc != 0 ) {
/*
- * either there is no preOp (modify) plugins
- * or a plugin failed. Just log it
- *
- * FIXME: is this correct?
+ * A preoperation plugin failure will abort the
+ * entire operation.
*/
#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, INFO, "do_modify: modify preOps "
+ LDAP_LOG( OPERATION, INFO, "do_modify: modify preoperation plugin "
"failed\n", 0, 0, 0 );
#else
- Debug(LDAP_DEBUG_TRACE, "do_modify: modify preOps failed.\n",
+ Debug(LDAP_DEBUG_TRACE, "do_modify: modify preoperation plugin failed.\n",
0, 0, 0);
#endif
+ if ( slapi_pblock_get( pb, SLAPI_RESULT_CODE, (void *)&rc ) != 0)
+ rc = LDAP_OPERATIONS_ERROR;
+ goto cleanup;
}
#endif /* defined( LDAP_SLAPI ) */
}
#if defined( LDAP_SLAPI )
- rc = doPluginFNs( be, SLAPI_PLUGIN_POST_MODIFY_FN, pb );
- if ( rc != 0 && rc != LDAP_OTHER ) {
- /*
- * either there is no postOp (modify) plugins
- * or a plugin failed. Just log it
- *
- * FIXME: is this correct?
- */
+ if ( doPluginFNs( be, SLAPI_PLUGIN_POST_MODIFY_FN, pb ) != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, INFO, "do_modify: modify postOps "
+ LDAP_LOG( OPERATION, INFO, "do_modify: modify postoperation plugins "
"failed\n", 0, 0, 0 );
#else
- Debug(LDAP_DEBUG_TRACE, "do_modify: modify postOps "
+ Debug(LDAP_DEBUG_TRACE, "do_modify: modify postoperation plugins "
"failed.\n", 0, 0, 0);
#endif
}
slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)(1) );
rc = doPluginFNs( be, SLAPI_PLUGIN_PRE_MODRDN_FN, pb );
- if ( rc != 0 && rc != LDAP_OTHER ) {
+ if ( rc != 0 ) {
/*
- * either there is no preOp (modrdn) plugins
- * or a plugin failed. Just log it
- *
- * FIXME: is this correct?
+ * A preoperation plugin failure will abort the
+ * entire operation.
*/
#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, INFO, "do_modrdn: modrdn preOps "
+ LDAP_LOG( OPERATION, INFO, "do_modrdn: modrdn preoperation plugin "
"failed\n", 0, 0, 0 );
#else
- Debug(LDAP_DEBUG_TRACE, "do_modrdn: modrdn preOps "
+ Debug(LDAP_DEBUG_TRACE, "do_modrdn: modrdn preoperation plugin "
"failed.\n", 0, 0, 0);
#endif
+ if ( slapi_pblock_get( pb, SLAPI_RESULT_CODE, (void *)&rc ) != 0)
+ rc = LDAP_OPERATIONS_ERROR;
+ goto cleanup;
}
#endif /* defined( LDAP_SLAPI ) */
}
#if defined( LDAP_SLAPI )
- rc = doPluginFNs( be, SLAPI_PLUGIN_POST_MODRDN_FN, pb );
- if ( rc != 0 && rc != LDAP_OTHER ) {
- /*
- * either there is no postOp (modrdn) plugins
- * or a plugin failed. Just log it
- *
- * FIXME: is this correct?
- */
+ if ( doPluginFNs( be, SLAPI_PLUGIN_POST_MODRDN_FN, pb ) != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, INFO, "do_modrdn: modrdn postOps "
+ LDAP_LOG( OPERATION, INFO, "do_modrdn: modrdn postoperation plugins "
"failed\n", 0, 0, 0 );
#else
- Debug(LDAP_DEBUG_TRACE, "do_modrdn: modrdn postOps "
+ Debug(LDAP_DEBUG_TRACE, "do_modrdn: modrdn postoperation plugins "
"failed.\n", 0, 0, 0);
#endif
}
text, ref, resoid, resdata, sasldata, ctrls );
return;
}
-
+
ber_init_w_nullc( ber, LBER_USE_DER );
#ifdef NEW_LOGGING
slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)(1) );
rc = doPluginFNs( be, SLAPI_PLUGIN_PRE_SEARCH_FN, pb );
- if ( rc != 0 && rc != LDAP_OTHER ) {
+ if ( rc != 0 ) {
/*
- * either there is no preOp (search) plugins
- * or a plugin failed. Just log it
- *
- * FIXME: is this correct?
+ * A preoperation plugin failure will abort the
+ * entire operation.
*/
#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, INFO, "do_search: search preOps "
+ LDAP_LOG( OPERATION, INFO, "do_search: search preoperation plugin "
"failed\n", 0, 0, 0 );
#else
- Debug(LDAP_DEBUG_TRACE, "do_search: search preOps "
+ Debug(LDAP_DEBUG_TRACE, "do_search: search preoperation plugin "
"failed.\n", 0, 0, 0);
#endif
- }
+ if ( slapi_pblock_get( pb, SLAPI_RESULT_CODE, (void *)&rc ) != 0)
+ rc = LDAP_OPERATIONS_ERROR;
+ return rc;
+ }
#endif /* defined( LDAP_SLAPI ) */
/* actually do the search and send the result(s) */
}
#if defined( LDAP_SLAPI )
- rc = doPluginFNs( be, SLAPI_PLUGIN_POST_SEARCH_FN, pb );
- if ( rc != 0 && rc != LDAP_OTHER ) {
- /*
- * either there is no postOp (search) plugins
- * or a plugin failed. Just log it
- *
- * FIXME: is this correct?
- */
+ if ( doPluginFNs( be, SLAPI_PLUGIN_POST_SEARCH_FN, pb ) != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, INFO, "do_search: search postOps "
+ LDAP_LOG( OPERATION, INFO, "do_search: search postoperation plugins "
"failed\n", 0, 0, 0 );
#else
- Debug(LDAP_DEBUG_TRACE, "do_search: search postOps "
+ Debug(LDAP_DEBUG_TRACE, "do_search: search postoperation plugins "
"failed.\n", 0, 0, 0);
#endif
- }
+ }
#endif /* defined( LDAP_SLAPI ) */
return_results:;
#define SLAPI_PLUGIN_EXTENDED_SENT_RESULT -1
#define SLAPI_PLUGIN_EXTENDED_NOT_HANDLED -2
+#define SLAPI_BIND_SUCCESS 0
+#define SLAPI_BIND_FAIL 2
+#define SLAPI_BIND_ANONYMOUS 3
+
#define SLAPI_BACKEND 130
#define SLAPI_CONNECTION 131
#define SLAPI_OPERATION 132
#define SLAPI_PLUGIN_SYNTAX_FLAGS 707
#define SLAPI_PLUGIN_SYNTAX_COMPARE 708
+#define SLAPI_RESULT_CODE 881
+#define SLAPI_RESULT_TEXT 882
+#define SLAPI_RESULT_MATCHED 883
+
#define SLAPI_PLUGIN_SYNTAX_FLAG_ORKEYS 1
#define SLAPI_PLUGIN_SYNTAX_FLAG_ORDERING 2
ch_free( str );
}
+ get( pb, SLAPI_RESULT_TEXT, (void **)&str );
+ if ( str != NULL ) {
+ ch_free( str );
+ str = NULL;
+ }
+
+ get( pb, SLAPI_RESULT_MATCHED, (void **)&str );
+ if ( str != NULL ) {
+ ch_free( str );
+ str = NULL;
+ }
+
ldap_pvt_thread_mutex_destroy( &pb->pblockMutex );
ch_free( pb );
return;
}
+ slapi_pblock_set( pb, SLAPI_RESULT_CODE, (void *)err);
+ slapi_pblock_set( pb, SLAPI_RESULT_MATCHED, ( matched != NULL ) ? (void *)ch_strdup( matched ) : NULL );
+ slapi_pblock_set( pb, SLAPI_RESULT_TEXT, ( text != NULL ) ? (void *)ch_strdup( text ) : NULL );
+
send_ldap_result( conn, op, err, matched, text, NULL, NULL );
#endif /* defined(LDAP_SLAPI) */
}