2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 * Copyright 2002-2005 The OpenLDAP Foundation.
5 * Portions Copyright 1997,2002-2003 IBM Corporation.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted only as authorized by the OpenLDAP
12 * A copy of this license is available in the file LICENSE in the
13 * top-level directory of the distribution or, alternatively, at
14 * <http://www.OpenLDAP.org/license.html>.
17 * This work was initially developed by IBM Corporation for use in
18 * IBM products and subsequently ported to OpenLDAP Software by
19 * Steve Omrani. Additional significant contributors include:
25 #include <ac/string.h>
26 #include <ac/stdarg.h>
28 #include <ac/unistd.h>
35 * use a fake listener when faking a connection,
36 * so it can be used in ACLs
38 static struct slap_listener slap_unknown_listener = {
39 BER_BVC("unknown"), /* FIXME: use a URI form? (e.g. slapi://) */
44 slapi_int_send_ldap_result_shim(
48 LDAPControl **controls = NULL;
50 plugin_result_callback prc = NULL;
51 void *callback_data = NULL;
53 assert( op->o_pb != NULL );
55 slapi_pblock_get( op->o_pb, SLAPI_RESCONTROLS, (void **)&controls );
56 slapi_pblock_get( op->o_pb, SLAPI_X_INTOP_RESULT_CALLBACK, (void **)&prc );
57 slapi_pblock_get( op->o_pb, SLAPI_X_INTOP_CALLBACK_DATA, &callback_data );
59 assert( controls == NULL );
61 /* Copy these before they go out of scope */
62 if ( rs->sr_ctrls != NULL ) {
63 for ( i = 0; rs->sr_ctrls[i] != NULL; i++ )
66 controls = (LDAPControl **)slapi_ch_calloc( i + 1,
67 sizeof(LDAPControl ));
69 for ( i = 0; rs->sr_ctrls[i] != NULL; i++ )
70 controls[i] = slapi_dup_control( rs->sr_ctrls[i] );
75 slapi_pblock_set( op->o_pb, SLAPI_RESCONTROLS, (void *)controls );
76 slapi_pblock_set( op->o_pb, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs->sr_err );
79 (*prc)( rs->sr_err, callback_data );
86 slapi_int_send_search_entry_shim(
90 plugin_search_entry_callback psec = NULL;
91 void *callback_data = NULL;
93 assert( op->o_pb != NULL );
95 slapi_pblock_get( op->o_pb, SLAPI_X_INTOP_SEARCH_ENTRY_CALLBACK, &psec );
96 slapi_pblock_get( op->o_pb, SLAPI_X_INTOP_CALLBACK_DATA, &callback_data );
99 return (*psec)( rs->sr_entry, callback_data );
106 slapi_int_send_ldap_extended_shim(
110 assert( op->o_pb != NULL );
116 slapi_int_send_search_reference_shim(
120 int i, rc = LDAP_SUCCESS;
121 plugin_referral_entry_callback prec = NULL;
122 void *callback_data = NULL;
124 assert( op->o_pb != NULL );
126 slapi_pblock_get( op->o_pb, SLAPI_X_INTOP_REFERRAL_ENTRY_CALLBACK, &prec );
127 slapi_pblock_get( op->o_pb, SLAPI_X_INTOP_CALLBACK_DATA, &callback_data );
129 if ( prec != NULL ) {
130 for ( i = 0; rs->sr_ref[i].bv_val != NULL; i++ ) {
131 rc = (*prec)( rs->sr_ref[i].bv_val, callback_data );
132 if ( rc != LDAP_SUCCESS ) {
142 slapi_int_get_ctrls( Operation *op, SlapReply *rs, LDAPControl **controls )
147 op->o_ctrls = controls;
148 if ( op->o_ctrls == NULL ) {
152 for ( c = op->o_ctrls; *c != NULL; c++ ) {
153 rc = slap_parse_ctrl( op, rs, *c, &rs->sr_text );
154 if ( rc != LDAP_SUCCESS )
162 * To allow plugins to forward frontend requests to internal operations,
163 * the internal operation and connection structures should import as
164 * much state as practicable from the supplied parameter block.
168 * Select the backend to be used for an internal operation, either
169 * from the operation target DN or from the parameter block.
172 slapi_int_pblock_get_backend( Slapi_PBlock *pb, Operation *op )
174 int manageDsaIt = 0, isCritical;
175 LDAPControl **controls = NULL;
178 slapi_pblock_get( pb, SLAPI_REQCONTROLS, (void **)&controls );
180 slapi_pblock_get( pb, SLAPI_MANAGEDSAIT, (void **)&manageDsaIt );
181 if ( manageDsaIt != 0 )
182 manageDsaIt = SLAP_CONTROL_CRITICAL;
183 else if ( slapi_control_present( controls, SLAPI_CONTROL_MANAGEDSAIT_OID,
185 manageDsaIt = isCritical ? SLAP_CONTROL_CRITICAL : SLAP_CONTROL_NONCRITICAL;
187 /* let caller force a specific backend */
188 slapi_pblock_get( pb, SLAPI_BACKEND, (void **)&op->o_bd );
189 if ( op->o_bd == NULL ) {
190 op->o_bd = select_backend( &op->o_req_ndn, manageDsaIt, 1 );
191 if ( op->o_bd == NULL ) {
192 if ( op->o_tag == LDAP_REQ_SEARCH && manageDsaIt > SLAP_CONTROL_NONE )
193 rc = LDAP_NO_SUCH_OBJECT;
195 rc = LDAP_PARTIAL_RESULTS;
199 if ( op->o_bd != NULL ) {
207 slapi_int_pblock_get_connection( Slapi_PBlock *pb, Connection *conn )
212 slapi_pblock_get( pb, SLAPI_X_CONN_SSF, (void **)&conn->c_ssf );
213 slapi_pblock_get( pb, SLAPI_X_CONN_SASL_CONTEXT, (void **)&conn->c_sasl_authctx );
215 if ( slapi_pblock_get( pb, SLAPI_CONN_DN, (void **)&connDn ) != 0 ||
217 /* default to operation DN */
218 conn->c_ndn = op->o_ndn;
219 conn->c_dn = op->o_ndn;
221 /* NB: conn DN must be normalized */
222 conn->c_ndn.bv_val = connDn;
223 conn->c_ndn.bv_len = strlen( connDn );
225 conn->c_dn = conn->c_ndn;
232 slapi_int_pblock_get_operation( Slapi_PBlock *pb, Operation *op, SlapReply *rs )
236 char *requestorDn = NULL;
237 struct berval targetDn = BER_BVNULL;
238 LDAPControl **controls;
241 /* All internal operations must specify a target DN */
242 if ( slapi_pblock_get( pb, SLAPI_TARGET_DN, (void **)&targetDn.bv_val ) != 0 ||
243 targetDn.bv_val == NULL ) {
244 return LDAP_PARAM_ERROR;
247 targetDn.bv_len = strlen( targetDn.bv_val );
249 rc = dnPrettyNormal( NULL, &targetDn, &op->o_req_dn, &op->o_req_ndn, NULL );
250 if ( rc != LDAP_SUCCESS ) {
254 rc = slapi_int_pblock_get_connection( pb, op->o_conn );
255 if ( rc != LDAP_SUCCESS ) {
259 rc = slapi_int_pblock_get_backend( pb, op );
260 if ( rc != LDAP_SUCCESS ) {
264 slapi_pblock_get( pb, SLAPI_REQUESTOR_ISROOT, (void **)&isRoot );
265 slapi_pblock_get( pb, SLAPI_REQUESTOR_ISUPDATEDN, (void **)&isUpdateDn );
266 /* NB: requestor DN must be normalized */
267 slapi_pblock_get( pb, SLAPI_REQUESTOR_DN, (void **)&requestorDn );
269 /* Default authorization identity for internal operations is root DN */
270 if ( isRoot || requestorDn == NULL ) {
271 op->o_dn = op->o_bd->be_rootdn;
272 op->o_ndn = op->o_bd->be_rootndn;
274 op->o_ndn.bv_val = requestorDn;
275 op->o_ndn.bv_len = strlen( requestorDn );
276 op->o_dn = op->o_ndn;
279 slapi_pblock_get( pb, SLAPI_REQCONTROLS, (void **)&controls );
280 rc = slapi_int_get_ctrls( op, rs, controls );
281 if ( rc != LDAP_SUCCESS ) {
289 slapi_int_init_connection( Slapi_PBlock *pb,
296 ber_len_t max = sockbuf_max_incoming;
299 conn = (Connection *) slapi_ch_calloc(1, sizeof(Connection));
301 LDAP_STAILQ_INIT( &conn->c_pending_ops );
303 op = (Operation *) slapi_ch_calloc( 1, OPERATION_BUFFER_SIZE );
304 op->o_hdr = (Opheader *)(op + 1);
305 op->o_controls = (void **)(op->o_hdr + 1);
307 op->o_extensions = NULL;
309 conn->c_pending_ops.stqh_first = op;
311 /* connection object authorization information */
312 conn->c_authtype = LDAP_AUTH_NONE;
313 conn->c_authmech.bv_val = NULL;
314 conn->c_authmech.bv_len = 0;
315 conn->c_dn.bv_val = NULL;
316 conn->c_dn.bv_len = 0;
317 conn->c_ndn.bv_val = NULL;
318 conn->c_ndn.bv_len = 0;
320 conn->c_listener = &slap_unknown_listener;
321 ber_dupbv( &conn->c_peer_domain, (struct berval *)&slap_unknown_bv );
322 ber_dupbv( &conn->c_peer_name, (struct berval *)&slap_unknown_bv );
324 LDAP_STAILQ_INIT( &conn->c_ops );
326 conn->c_sasl_bind_mech.bv_val = NULL;
327 conn->c_sasl_bind_mech.bv_len = 0;
328 conn->c_sasl_authctx = NULL;
329 conn->c_sasl_sockctx = NULL;
330 conn->c_sasl_extra = NULL;
332 conn->c_sb = ber_sockbuf_alloc( );
334 ber_sockbuf_ctrl( conn->c_sb, LBER_SB_OPT_SET_MAX_INCOMING, &max );
336 conn->c_currentber = NULL;
338 /* should check status of thread calls */
339 ldap_pvt_thread_mutex_init( &conn->c_mutex );
340 ldap_pvt_thread_mutex_init( &conn->c_write_mutex );
341 ldap_pvt_thread_cond_init( &conn->c_write_cv );
343 ldap_pvt_thread_mutex_lock( &conn->c_mutex );
345 conn->c_n_ops_received = 0;
346 conn->c_n_ops_executing = 0;
347 conn->c_n_ops_pending = 0;
348 conn->c_n_ops_completed = 0;
354 conn->c_protocol = LDAP_VERSION3;
356 conn->c_activitytime = conn->c_starttime = slap_get_time();
359 * A real connection ID is required, because syncrepl associates
360 * pending CSNs with unique ( connection, operation ) tuples.
361 * Setting a fake connection ID will cause slap_get_commit_csn()
362 * to return a stale value.
364 connection_assign_nextid( conn );
366 conn->c_conn_state = 0x01; /* SLAP_C_ACTIVE */
367 conn->c_struct_state = 0x02; /* SLAP_C_USED */
369 conn->c_ssf = conn->c_transport_ssf = 0;
372 backend_connection_init( conn );
374 conn->c_send_ldap_result = slapi_int_send_ldap_result_shim;
375 conn->c_send_search_entry = slapi_int_send_search_entry_shim;
376 conn->c_send_ldap_extended = slapi_int_send_ldap_extended_shim;
377 conn->c_send_search_reference = slapi_int_send_search_reference_shim;
379 /* operation object */
381 op->o_protocol = LDAP_VERSION3;
382 op->o_authmech.bv_val = NULL;
383 op->o_authmech.bv_len = 0;
384 op->o_time = slap_get_time();
385 op->o_do_not_cache = 1;
386 op->o_threadctx = ldap_pvt_thread_pool_context();
387 op->o_tmpmemctx = NULL;
388 op->o_tmpmfuncs = &ch_mfuncs;
390 op->o_connid = conn->c_connid;
392 rc = slapi_int_pblock_get_operation( pb, op, rs );
394 slapi_pblock_set( op->o_pb, SLAPI_OPERATION, op );
395 slapi_pblock_set( op->o_pb, SLAPI_CONNECTION, conn );
397 ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
399 if ( rc != LDAP_SUCCESS ) {
400 slapi_int_connection_destroy( &conn );
409 void slapi_int_connection_destroy( Connection **pConn )
411 Connection *conn = *pConn;
414 if ( conn == NULL ) {
418 op = (Operation *)conn->c_pending_ops.stqh_first;
420 slap_graduate_commit_csn( op );
422 if ( op->o_req_dn.bv_val != NULL ) {
423 slapi_ch_free( (void **)&op->o_req_dn.bv_val );
425 if ( op->o_req_ndn.bv_val != NULL ) {
426 slapi_ch_free( (void **)&op->o_req_ndn.bv_val );
429 if ( conn->c_sb != NULL ) {
430 ber_sockbuf_free( conn->c_sb );
433 slapi_pblock_set( op->o_pb, SLAPI_OPERATION, NULL );
434 slapi_pblock_set( op->o_pb, SLAPI_CONNECTION, NULL );
437 slapi_ch_free( (void **)&op );
440 slapi_ch_free( (void **)pConn );
444 * Function : values2obj
445 * Convert an array of strings into a BerVarray.
456 if ( ppValue == NULL ) {
461 for ( i = 0; ppValue[i] != NULL; i++ )
464 tmpberval = (BerVarray)slapi_ch_malloc( (i+1) * (sizeof(struct berval)) );
465 if ( tmpberval == NULL ) {
466 return LDAP_NO_MEMORY;
468 for ( i = 0; ppValue[i] != NULL; i++ ) {
469 size_t len = strlen( ppValue[i] );
471 tmpberval[i].bv_val = slapi_ch_malloc( len + 1 );
472 AC_MEMCPY( tmpberval[i].bv_val, ppValue[i], len + 1 );
473 tmpberval[i].bv_len = len;
475 tmpberval[i].bv_val = NULL;
476 tmpberval[i].bv_len = 0;
485 struct berval **bvptr,
491 if ( bvptr == NULL ) {
496 for ( i = 0; bvptr[i] != NULL; i++ )
499 tmpberval = (BerVarray)slapi_ch_malloc( (i + 1) * sizeof(struct berval));
500 if ( tmpberval == NULL ) {
501 return LDAP_NO_MEMORY;
504 for ( i = 0; bvptr[i] != NULL; i++ ) {
505 tmpberval[i].bv_val = slapi_ch_malloc( bvptr[i]->bv_len );
506 tmpberval[i].bv_len = bvptr[i]->bv_len;
507 AC_MEMCPY( tmpberval[i].bv_val, bvptr[i]->bv_val, bvptr[i]->bv_len );
510 tmpberval[i].bv_val = NULL;
511 tmpberval[i].bv_len = 0;
519 * Function : slapi_int_ldapmod_to_entry
520 * convert a dn plus an array of LDAPMod struct ptrs to an entry structure
521 * with a link list of the correspondent attributes.
522 * Return value : LDAP_SUCCESS
527 slapi_int_ldapmod_to_entry(
532 struct berval dn = BER_BVNULL;
538 Modifications *modlist = NULL;
539 Modifications **modtail = &modlist;
542 int rc = LDAP_SUCCESS;
545 const char *text = NULL;
547 op = (Operation *)pConn->c_pending_ops.stqh_first;
549 pEntry = (Entry *) ch_calloc( 1, sizeof(Entry) );
550 if ( pEntry == NULL) {
556 dn.bv_len = strlen( ldn );
558 rc = dnPrettyNormal( NULL, &dn, &pEntry->e_name, &pEntry->e_nname, NULL );
559 if ( rc != LDAP_SUCCESS ) {
563 if ( rc == LDAP_SUCCESS ) {
564 for ( i = 0, pMod = mods[0]; rc == LDAP_SUCCESS && pMod != NULL; pMod = mods[++i]) {
567 if ( (pMod->mod_op & LDAP_MOD_BVALUES) != 0 ) {
569 * Convert an array of pointers to bervals to
570 * an array of bervals. Note that we need to copy the
571 * values too, as the slap_mods_check() will free the
572 * original values after prettying; the modifications
573 * being passed in may not have been allocated on the
576 rc = bvptr2obj_copy( pMod->mod_bvalues, &bv );
577 if ( rc != LDAP_SUCCESS ) goto cleanup;
578 tmp.sml_type.bv_val = pMod->mod_type;
579 tmp.sml_type.bv_len = strlen( pMod->mod_type );
581 tmp.sml_nvalues = NULL;
583 mod = (Modifications *) ch_malloc( sizeof(Modifications) );
585 mod->sml_op = LDAP_MOD_ADD;
587 mod->sml_next = NULL;
588 mod->sml_desc = NULL;
589 mod->sml_type = tmp.sml_type;
590 mod->sml_values = tmp.sml_values;
591 mod->sml_nvalues = tmp.sml_nvalues;
594 modtail = &mod->sml_next;
597 /* attr values are in string format, need to be converted */
598 /* to an array of bervals */
599 if ( pMod->mod_values == NULL ) {
602 rc = values2obj_copy( pMod->mod_values, &bv );
603 if ( rc != LDAP_SUCCESS ) goto cleanup;
604 tmp.sml_type.bv_val = pMod->mod_type;
605 tmp.sml_type.bv_len = strlen( pMod->mod_type );
607 tmp.sml_nvalues = NULL;
609 mod = (Modifications *) ch_malloc( sizeof(Modifications) );
611 mod->sml_op = LDAP_MOD_ADD;
613 mod->sml_next = NULL;
614 mod->sml_desc = NULL;
615 mod->sml_type = tmp.sml_type;
616 mod->sml_values = tmp.sml_values;
617 mod->sml_nvalues = tmp.sml_nvalues;
620 modtail = &mod->sml_next;
623 } /* for each LDAPMod */
626 op->o_bd = select_backend( &pEntry->e_nname, 0, 0 );
627 if ( op->o_bd == NULL ) {
628 rc = LDAP_PARTIAL_RESULTS;
630 int repl_user = be_isupdate_dn( op->o_bd, &op->o_bd->be_rootdn );
631 if ( !op->o_bd->be_update_ndn.bv_len || repl_user ) {
632 int update = !BER_BVISNULL( &op->o_bd->be_update_ndn );
633 char textbuf[ SLAP_TEXT_BUFLEN ];
634 size_t textlen = sizeof( textbuf );
636 rc = slap_mods_check( modlist, &text,
637 textbuf, textlen, NULL );
639 if ( rc != LDAP_SUCCESS) {
644 rc = slap_mods_no_user_mod_check( op, modlist,
645 &text, textbuf, textlen );
646 if ( rc != LDAP_SUCCESS) {
652 rc = slap_mods_opattrs( op, modlist, modtail,
653 &text, textbuf, textlen, 1 );
654 if ( rc != LDAP_SUCCESS) {
659 rc = slap_mods2entry( modlist, &pEntry, repl_user,
660 0, &text, textbuf, textlen );
661 if (rc != LDAP_SUCCESS) {
671 if ( modlist != NULL )
672 slap_mods_free( modlist );
673 if ( rc != LDAP_SUCCESS ) {
674 if ( pEntry != NULL ) {
675 slapi_entry_free( pEntry );
684 slapi_delete_internal_pb( Slapi_PBlock *pb )
687 Connection *conn = NULL;
688 Operation *op = NULL;
689 int operation_flags = 0;
691 SlapReply rs = { REP_RESULT };
697 slapi_pblock_get( pb, SLAPI_X_INTOP_FLAGS, &operation_flags );
699 rs.sr_err = slapi_int_init_connection( pb, &rs, LDAP_REQ_DELETE, &conn );
700 if ( rs.sr_err != LDAP_SUCCESS ) {
704 op = conn->c_pending_ops.stqh_first;
706 if ( op->o_bd->be_delete != NULL ) {
707 int repl_user = be_isupdate( op );
708 if ( !op->o_bd->be_update_ndn.bv_len || repl_user ) {
709 slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
710 if ( operation_flags & SLAPI_OP_FLAG_LOG_CHANGE )
711 op->o_callback = &cb;
713 op->o_bd->be_delete( op, &rs );
715 rs.sr_err = LDAP_REFERRAL;
718 rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
722 slapi_pblock_set( pb, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs.sr_err );
723 slapi_int_connection_destroy( &conn );
728 #endif /* LDAP_SLAPI */
732 slapi_add_internal_pb( Slapi_PBlock *pb )
735 Connection *conn = NULL;
736 Slapi_Entry *entry = NULL;
737 Slapi_Entry *argEntry = NULL;
739 LDAPMod **mods = NULL;
740 int operation_flags = 0;
741 Operation *op = NULL;
744 SlapReply rs = { REP_RESULT };
750 slapi_pblock_get( pb, SLAPI_ADD_ENTRY, &argEntry );
751 slapi_pblock_get( pb, SLAPI_ADD_TARGET, &dn );
752 slapi_pblock_get( pb, SLAPI_MODIFY_MODS, &mods );
753 slapi_pblock_get( pb, SLAPI_X_INTOP_FLAGS, &operation_flags );
755 if ( argEntry != NULL ) {
757 * The caller can specify a new entry, or a target DN and set
758 * of modifications, but not both.
761 rs.sr_err = LDAP_PARAM_ERROR;
766 * Set the DN here so that slapi_int_init_backend() will select
769 dn = slapi_entry_get_dn( argEntry );
770 slapi_pblock_set( pb, SLAPI_ADD_TARGET, &entry->e_nname.bv_val );
773 rs.sr_err = slapi_int_init_connection( pb, &rs, LDAP_REQ_ADD, &conn );
774 if ( rs.sr_err != LDAP_SUCCESS )
777 if ( argEntry != NULL ) {
778 entry = slapi_entry_dup( argEntry );
780 if ( mods == NULL || dn == NULL ) {
781 rs.sr_err = LDAP_PARAM_ERROR;
785 for ( i = 0; mods[i] != NULL; i++ ) {
786 if ( (mods[i]->mod_op & LDAP_MOD_OP ) != LDAP_MOD_ADD ) {
787 rs.sr_err = LDAP_PARAM_ERROR;
792 entry = slapi_int_ldapmod_to_entry( conn, dn, mods );
793 if ( entry == NULL ) {
794 rs.sr_err = LDAP_OTHER;
799 op = (Operation *)conn->c_pending_ops.stqh_first;
800 op->oq_add.rs_e = entry;
802 if ( op->o_bd->be_add != NULL ) {
803 int repl_user = be_isupdate( op );
804 if ( !op->o_bd->be_update_ndn.bv_len || repl_user ) {
805 slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
807 if ( operation_flags & SLAPI_OP_FLAG_LOG_CHANGE )
808 op->o_callback = &cb;
810 if ( op->o_bd->be_add( op, &rs ) == LDAP_SUCCESS ) {
811 be_entry_release_w( op, entry );
815 rs.sr_err = LDAP_REFERRAL;
818 rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
822 slapi_pblock_set( pb, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs.sr_err );
824 if ( entry != NULL ) {
825 slapi_entry_free( entry );
827 if ( argEntry != NULL ) {
828 slapi_pblock_set( pb, SLAPI_ADD_TARGET, NULL );
831 slapi_int_connection_destroy( &conn );
836 #endif /* LDAP_SLAPI */
840 slapi_modrdn_internal_pb( Slapi_PBlock *pb )
843 struct berval dn = BER_BVNULL;
844 struct berval newrdn = BER_BVNULL;
845 struct berval newsupdn = BER_BVNULL;
846 struct berval newSuperiorPretty = BER_BVNULL;
847 struct berval newSuperiorNormalized = BER_BVNULL;
848 Connection *conn = NULL;
849 Operation *op = NULL;
850 int manageDsaIt = SLAP_CONTROL_NONE;
858 SlapReply rs = { REP_RESULT };
864 slapi_pblock_get( pb, SLAPI_MODRDN_NEWRDN, &lnewrdn );
865 slapi_pblock_get( pb, SLAPI_MODRDN_NEWSUPERIOR, &newsuperior );
866 slapi_pblock_get( pb, SLAPI_MODRDN_DELOLDRDN, &deloldrdn );
867 slapi_pblock_get( pb, SLAPI_X_INTOP_FLAGS, &operation_flags );
869 rs.sr_err = slapi_int_init_connection( pb, &rs, LDAP_REQ_MODRDN, &conn );
870 if ( rs.sr_err != LDAP_SUCCESS ) {
874 op = (Operation *)conn->c_pending_ops.stqh_first;
876 if ( op->o_req_dn.bv_len == 0 ) {
877 rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
881 newrdn.bv_val = lnewrdn;
882 newrdn.bv_len = strlen( lnewrdn );
884 rs.sr_err = dnPrettyNormal( NULL, &newrdn, &op->oq_modrdn.rs_newrdn, &op->oq_modrdn.rs_nnewrdn, NULL );
885 if ( rs.sr_err != LDAP_SUCCESS ) {
889 if ( rdn_validate( &op->oq_modrdn.rs_nnewrdn ) != LDAP_SUCCESS ) {
893 if ( newsuperior != NULL ) {
894 newsupdn.bv_val = (char *)newsuperior;
895 newsupdn.bv_len = strlen( newsuperior );
897 rs.sr_err = dnPrettyNormal( NULL, &newsupdn, &newSuperiorPretty, &newSuperiorNormalized, NULL );
898 if ( rs.sr_err != LDAP_SUCCESS )
901 op->oq_modrdn.rs_newSup = &newSuperiorPretty;
902 op->oq_modrdn.rs_nnewSup = &newSuperiorNormalized;
904 op->oq_modrdn.rs_newSup = NULL;
905 op->oq_modrdn.rs_nnewSup = NULL;
908 op->oq_modrdn.rs_deleteoldrdn = deloldrdn;
910 if ( op->o_bd->be_modrdn != NULL ) {
911 int repl_user = be_isupdate( op );
912 if ( !op->o_bd->be_update_ndn.bv_len || repl_user ) {
913 slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
915 if ( operation_flags & SLAPI_OP_FLAG_LOG_CHANGE )
916 op->o_callback = &cb;
918 op->o_bd->be_modrdn( op, &rs );
920 rs.sr_err = LDAP_REFERRAL;
923 rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
927 slapi_pblock_set( pb, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs.sr_err );
929 if ( op->oq_modrdn.rs_newrdn.bv_val != NULL )
930 slapi_ch_free_string( &op->oq_modrdn.rs_newrdn.bv_val );
931 if ( op->oq_modrdn.rs_nnewrdn.bv_val != NULL )
932 slapi_ch_free_string( &op->oq_modrdn.rs_nnewrdn.bv_val );
933 if ( newSuperiorPretty.bv_val != NULL )
934 slapi_ch_free_string( &newSuperiorPretty.bv_val );
935 if ( newSuperiorNormalized.bv_val != NULL )
936 slapi_ch_free_string( &newSuperiorNormalized.bv_val );
938 slapi_int_connection_destroy( &conn );
943 #endif /* LDAP_SLAPI */
946 int slapi_modify_internal_pb( Slapi_PBlock *pb )
950 Connection *conn = NULL;
951 Operation *op = NULL;
953 struct berval dn = BER_BVNULL;
955 int manageDsaIt = SLAP_CONTROL_NONE;
960 Modifications *modlist = NULL;
961 Modifications **modtail = &modlist;
964 LDAPMod **mods = NULL;
965 int operation_flags = 0;
967 SlapReply rs = { REP_RESULT };
973 slapi_pblock_get( pb, SLAPI_MODIFY_MODS, &mods );
974 slapi_pblock_get( pb, SLAPI_X_INTOP_FLAGS, &operation_flags );
976 if ( mods == NULL || mods[0] == NULL ) {
977 rs.sr_err = LDAP_PARAM_ERROR ;
981 rs.sr_err = slapi_int_init_connection( pb, &rs, LDAP_REQ_MODIFY, &conn );
982 if ( rs.sr_err != LDAP_SUCCESS ) {
986 for ( i = 0, pMod = mods[0];
987 rs.sr_err == LDAP_SUCCESS && pMod != NULL;
992 if ( (pMod->mod_op & LDAP_MOD_BVALUES) != 0 ) {
994 * attr values are in berval format
995 * convert an array of pointers to bervals
996 * to an array of bervals
998 rs.sr_err = bvptr2obj_copy( pMod->mod_bvalues, &bv );
999 if ( rs.sr_err != LDAP_SUCCESS )
1001 tmp.sml_type.bv_val = pMod->mod_type;
1002 tmp.sml_type.bv_len = strlen( pMod->mod_type );
1003 tmp.sml_values = bv;
1004 tmp.sml_nvalues = NULL;
1006 mod = (Modifications *)ch_malloc( sizeof(Modifications) );
1008 mod->sml_op = pMod->mod_op & LDAP_MOD_OP;
1010 mod->sml_next = NULL;
1011 mod->sml_desc = NULL;
1012 mod->sml_type = tmp.sml_type;
1013 mod->sml_values = tmp.sml_values;
1014 mod->sml_nvalues = tmp.sml_nvalues;
1016 rs.sr_err = values2obj_copy( pMod->mod_values, &bv );
1017 if ( rs.sr_err != LDAP_SUCCESS )
1019 tmp.sml_type.bv_val = pMod->mod_type;
1020 tmp.sml_type.bv_len = strlen( pMod->mod_type );
1021 tmp.sml_values = bv;
1022 tmp.sml_nvalues = NULL;
1024 mod = (Modifications *) ch_malloc( sizeof(Modifications) );
1026 mod->sml_op = pMod->mod_op & LDAP_MOD_OP;
1028 mod->sml_next = NULL;
1029 mod->sml_desc = NULL;
1030 mod->sml_type = tmp.sml_type;
1031 mod->sml_values = tmp.sml_values;
1032 mod->sml_nvalues = tmp.sml_nvalues;
1035 modtail = &mod->sml_next;
1037 switch( pMod->mod_op & LDAP_MOD_OP ) {
1039 if ( mod->sml_values == NULL ) {
1040 rs.sr_err = LDAP_PROTOCOL_ERROR;
1045 case LDAP_MOD_DELETE:
1046 case LDAP_MOD_REPLACE:
1047 case LDAP_MOD_INCREMENT:
1051 rs.sr_err = LDAP_PROTOCOL_ERROR;
1057 op = (Operation *)conn->c_pending_ops.stqh_first;
1059 if ( op->o_req_ndn.bv_len == 0 ) {
1060 rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
1064 op->oq_modify.rs_modlist = modlist;
1066 if ( op->o_bd->be_modify != NULL ) {
1067 int repl_user = be_isupdate( op );
1068 if ( !op->o_bd->be_update_ndn.bv_len || repl_user ) {
1069 int update = !BER_BVISEMPTY( &op->o_bd->be_update_ndn );
1070 const char *text = NULL;
1071 char textbuf[ SLAP_TEXT_BUFLEN ];
1072 size_t textlen = sizeof( textbuf );
1073 slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
1075 rs.sr_err = slap_mods_check( modlist,
1076 &text, textbuf, textlen, NULL );
1077 if ( rs.sr_err != LDAP_SUCCESS ) {
1082 rs.sr_err = slap_mods_no_user_mod_check( op, modlist,
1083 &text, textbuf, textlen );
1084 if ( rs.sr_err != LDAP_SUCCESS ) {
1090 rs.sr_err = slap_mods_opattrs( op, modlist,
1091 modtail, &text, textbuf,
1093 if ( rs.sr_err != LDAP_SUCCESS ) {
1098 if ( operation_flags & SLAPI_OP_FLAG_LOG_CHANGE )
1099 op->o_callback = &cb;
1101 op->o_bd->be_modify( op, &rs );
1103 rs.sr_err = LDAP_REFERRAL;
1106 rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
1110 slapi_pblock_set( pb, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs.sr_err );
1112 if ( modlist != NULL )
1113 slap_mods_free( modlist );
1115 slapi_int_connection_destroy( &conn );
1120 #endif /* LDAP_SLAPI */
1125 slapi_int_search_entry_callback( Slapi_Entry *entry, void *callback_data )
1127 int nentries = 0, i = 0;
1128 Slapi_Entry **head = NULL, **tp;
1129 Slapi_PBlock *pb = (Slapi_PBlock *)callback_data;
1131 entry = slapi_entry_dup( entry );
1132 if ( entry == NULL ) {
1136 slapi_pblock_get( pb, SLAPI_NENTRIES, &nentries );
1137 slapi_pblock_get( pb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, &head );
1140 if ( nentries == 0 ) {
1141 tp = (Slapi_Entry **)slapi_ch_malloc( 2 * sizeof(Slapi_Entry *) );
1143 slapi_entry_free( entry );
1149 tp = (Slapi_Entry **)slapi_ch_realloc( (char *)head,
1150 sizeof(Slapi_Entry *) * ( i + 1 ) );
1152 slapi_entry_free( entry );
1155 tp[ i - 1 ] = entry;
1159 slapi_pblock_set( pb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, (void *)tp );
1160 slapi_pblock_set( pb, SLAPI_NENTRIES, (void *)i );
1162 return LDAP_SUCCESS;
1164 #endif /* LDAP_SLAPI */
1166 int slapi_search_internal_pb( Slapi_PBlock *pb )
1169 return slapi_search_internal_callback_pb( pb,
1172 slapi_int_search_entry_callback,
1179 int slapi_search_internal_callback_pb( Slapi_PBlock *pb,
1180 void *callback_data,
1181 plugin_result_callback prc,
1182 plugin_search_entry_callback psec,
1183 plugin_referral_entry_callback prec )
1186 Connection *conn = NULL;
1187 Operation *op = NULL;
1188 struct berval dn = BER_BVNULL;
1189 Filter *filter = NULL;
1190 struct berval fstr = BER_BVNULL;
1191 AttributeName *an = NULL;
1192 const char *text = NULL;
1194 int manageDsaIt = SLAP_CONTROL_NONE;
1198 int scope = LDAP_SCOPE_BASE;
1199 char *filStr = NULL;
1200 LDAPControl **controls = NULL;
1201 char **attrs = NULL;
1202 char *uniqueid = NULL;
1204 int operation_flags = 0;
1207 SlapReply rs = { REP_RESULT };
1213 slapi_pblock_get( pb, SLAPI_SEARCH_SCOPE, &scope );
1214 slapi_pblock_get( pb, SLAPI_SEARCH_FILTER, &filter );
1215 slapi_pblock_get( pb, SLAPI_SEARCH_STRFILTER, &filStr );
1216 slapi_pblock_get( pb, SLAPI_SEARCH_ATTRS, &attrs );
1217 slapi_pblock_get( pb, SLAPI_SEARCH_ATTRSONLY, &attrsonly );
1218 slapi_pblock_get( pb, SLAPI_REQCONTROLS, &controls );
1219 slapi_pblock_get( pb, SLAPI_TARGET_UNIQUEID, &uniqueid );
1220 slapi_pblock_get( pb, SLAPI_X_INTOP_FLAGS, &operation_flags );
1222 rs.sr_err = slapi_int_init_connection( pb, &rs, LDAP_REQ_SEARCH, &conn );
1223 if ( rs.sr_err != LDAP_SUCCESS )
1226 /* search callback and arguments */
1227 slapi_pblock_set( pb, SLAPI_X_INTOP_RESULT_CALLBACK, prc );
1228 slapi_pblock_set( pb, SLAPI_X_INTOP_SEARCH_ENTRY_CALLBACK, psec );
1229 slapi_pblock_set( pb, SLAPI_X_INTOP_REFERRAL_ENTRY_CALLBACK, prec );
1230 slapi_pblock_set( pb, SLAPI_X_INTOP_CALLBACK_DATA, callback_data );
1232 op = (Operation *)conn->c_pending_ops.stqh_first;
1235 case LDAP_SCOPE_BASE:
1236 case LDAP_SCOPE_ONELEVEL:
1237 case LDAP_SCOPE_SUBTREE:
1238 #ifdef LDAP_SCOPE_SUBORDINATE
1239 case LDAP_SCOPE_SUBORDINATE:
1243 rs.sr_err = LDAP_PROTOCOL_ERROR;
1247 if ( filter == NULL ) {
1248 if ( filStr == NULL ) {
1249 rs.sr_err = LDAP_PARAM_ERROR;
1253 filter = slapi_str2filter( filStr );
1254 if ( filter == NULL ) {
1255 rs.sr_err = LDAP_PROTOCOL_ERROR;
1262 filter2bv( filter, &fstr );
1264 for ( i = 0; attrs != NULL && attrs[i] != NULL; i++ ) {
1265 ; /* count the number of attributes */
1269 an = (AttributeName *)slapi_ch_calloc( (i + 1), sizeof(AttributeName) );
1270 for (i = 0; attrs[i] != 0; i++) {
1271 an[i].an_desc = NULL;
1273 an[i].an_oc_exclude = 0;
1274 an[i].an_name.bv_val = slapi_ch_strdup(attrs[i]);
1275 an[i].an_name.bv_len = strlen(attrs[i]);
1276 slap_bv2ad( &an[i].an_name, &an[i].an_desc, &text );
1278 an[i].an_name.bv_val = NULL;
1281 rs.sr_type = REP_RESULT;
1282 rs.sr_err = LDAP_SUCCESS;
1283 rs.sr_entry = NULL; /* paranoia */
1285 if ( scope == LDAP_SCOPE_BASE ) {
1288 if ( op->o_req_ndn.bv_len == 0 ) {
1289 rs.sr_err = root_dse_info( conn, &rs.sr_entry, &rs.sr_text );
1292 if( rs.sr_err != LDAP_SUCCESS ) {
1293 send_ldap_result( op, &rs );
1295 } else if ( rs.sr_entry != NULL ) {
1296 rs.sr_err = test_filter( op, rs.sr_entry, filter );
1298 if ( rs.sr_err == LDAP_COMPARE_TRUE ) {
1299 rs.sr_type = REP_SEARCH;
1300 rs.sr_err = LDAP_SUCCESS;
1302 rs.sr_operational_attrs = NULL;
1303 rs.sr_flags = REP_ENTRY_MODIFIABLE;
1305 send_search_entry( op, &rs );
1308 entry_free( rs.sr_entry );
1310 rs.sr_type = REP_RESULT;
1311 rs.sr_err = LDAP_SUCCESS;
1313 send_ldap_result( op, &rs );
1319 op->oq_search.rs_scope = scope;
1320 op->oq_search.rs_deref = 0;
1321 op->oq_search.rs_slimit = SLAP_NO_LIMIT;
1322 op->oq_search.rs_tlimit = SLAP_NO_LIMIT;
1323 op->oq_search.rs_attrsonly = attrsonly;
1324 op->oq_search.rs_attrs = an;
1325 op->oq_search.rs_filter = filter;
1326 op->oq_search.rs_filterstr = fstr;
1328 if ( BER_BVISEMPTY( &op->o_req_ndn ) &&
1329 !BER_BVISEMPTY( &default_search_nbase ) ) {
1330 slapi_ch_free( (void **)&op->o_req_dn.bv_val );
1331 slapi_ch_free( (void **)&op->o_req_ndn.bv_val );
1333 ber_dupbv( &op->o_req_dn, &default_search_base );
1334 ber_dupbv( &op->o_req_ndn, &default_search_nbase );
1336 rs.sr_err = slapi_int_pblock_get_backend( pb, op );
1337 if ( rs.sr_err != LDAP_SUCCESS )
1341 if ( op->o_bd->be_search != NULL ) {
1342 (*op->o_bd->be_search)( op, &rs );
1344 rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
1348 slapi_pblock_set( pb, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs.sr_err );
1349 slapi_pblock_set( pb, SLAPI_X_INTOP_RESULT_CALLBACK, NULL );
1350 slapi_pblock_set( pb, SLAPI_X_INTOP_SEARCH_ENTRY_CALLBACK, NULL );
1351 slapi_pblock_set( pb, SLAPI_X_INTOP_REFERRAL_ENTRY_CALLBACK, NULL );
1352 slapi_pblock_set( pb, SLAPI_X_INTOP_CALLBACK_DATA, NULL );
1354 if ( freeFilter && filter != NULL )
1355 slapi_filter_free( filter, 1 );
1357 slapi_ch_free( (void **)&fstr.bv_val );
1359 slapi_ch_free( (void **)&an );
1361 slapi_int_connection_destroy( &conn );
1366 #endif /* LDAP_SLAPI */
1369 /* Wrappers for old API */
1371 void slapi_search_internal_set_pb( Slapi_PBlock *pb,
1377 LDAPControl **controls,
1378 const char *uniqueid,
1379 Slapi_ComponentId *plugin_identity,
1380 int operation_flags )
1383 slapi_pblock_set( pb, SLAPI_SEARCH_TARGET, (void *)base );
1384 slapi_pblock_set( pb, SLAPI_SEARCH_SCOPE, (void *)scope );
1385 slapi_pblock_set( pb, SLAPI_SEARCH_FILTER, NULL );
1386 slapi_pblock_set( pb, SLAPI_SEARCH_STRFILTER, (void *)filter );
1387 slapi_pblock_set( pb, SLAPI_SEARCH_ATTRS, (void *)attrs );
1388 slapi_pblock_set( pb, SLAPI_SEARCH_ATTRSONLY, (void *)attrsonly );
1389 slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
1390 slapi_pblock_set( pb, SLAPI_TARGET_UNIQUEID, (void *)uniqueid );
1391 slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
1392 slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)operation_flags );
1393 #endif /* LDAP_SLAPI */
1397 slapi_search_internal(
1401 LDAPControl **controls,
1408 pb = slapi_pblock_new();
1413 slapi_search_internal_set_pb( pb, ldn, scope, filStr, attrs, attrsonly,
1414 controls, NULL, NULL, 0 );
1416 slapi_search_internal_pb( pb );
1421 #endif /* LDAP_SLAPI */
1424 void slapi_modify_internal_set_pb( Slapi_PBlock *pb,
1427 LDAPControl **controls,
1428 const char *uniqueid,
1429 Slapi_ComponentId *plugin_identity,
1430 int operation_flags )
1433 slapi_pblock_set( pb, SLAPI_MODIFY_TARGET, (void *)dn );
1434 slapi_pblock_set( pb, SLAPI_MODIFY_MODS, (void *)mods );
1435 slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
1436 slapi_pblock_set( pb, SLAPI_TARGET_UNIQUEID, (void *)uniqueid );
1437 slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
1438 slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)operation_flags );
1439 #endif /* LDAP_SLAPI */
1442 /* Function : slapi_modify_internal
1444 * Description: Plugin functions call this routine to modify an entry
1445 * in the backend directly
1446 * Return values : LDAP_SUCCESS
1450 * LDAP_UNWILLING_TO_PERFORM
1453 slapi_modify_internal(
1456 LDAPControl **controls,
1462 pb = slapi_pblock_new();
1467 slapi_modify_internal_set_pb( pb, ldn, mods, controls, NULL, NULL,
1468 log_change ? SLAPI_OP_FLAG_LOG_CHANGE : 0 );
1470 slapi_modify_internal_pb( pb );
1475 #endif /* LDAP_SLAPI */
1478 int slapi_add_internal_set_pb( Slapi_PBlock *pb,
1481 LDAPControl **controls,
1482 Slapi_ComponentId *plugin_identity,
1483 int operation_flags )
1486 slapi_pblock_set( pb, SLAPI_ADD_TARGET, (void *)dn );
1487 slapi_pblock_set( pb, SLAPI_MODIFY_MODS, (void *)attrs );
1488 slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
1489 slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
1490 slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)operation_flags );
1495 #endif /* LDAP_SLAPI */
1498 Slapi_PBlock *slapi_add_internal(
1501 LDAPControl **controls,
1507 pb = slapi_pblock_new();
1511 slapi_add_internal_set_pb( pb, dn, attrs, controls, NULL,
1512 log_changes ? SLAPI_OP_FLAG_LOG_CHANGE : 0 );
1514 slapi_add_internal_pb( pb );
1519 #endif /* LDAP_SLAPI */
1522 void slapi_add_entry_internal_set_pb( Slapi_PBlock *pb,
1524 LDAPControl **controls,
1525 Slapi_ComponentId *plugin_identity,
1526 int operation_flags )
1529 slapi_pblock_set( pb, SLAPI_ADD_ENTRY, (void *)e );
1530 slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
1531 slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
1532 slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)operation_flags );
1533 #endif /* LDAP_SLAPI */
1537 slapi_add_entry_internal(
1539 LDAPControl **controls,
1545 pb = slapi_pblock_new();
1549 slapi_add_entry_internal_set_pb( pb, e, controls, NULL,
1550 log_changes ? SLAPI_OP_FLAG_LOG_CHANGE : 0 );
1552 slapi_add_internal_pb( pb );
1557 #endif /* LDAP_SLAPI */
1560 void slapi_rename_internal_set_pb( Slapi_PBlock *pb,
1563 const char *newsuperior,
1565 LDAPControl **controls,
1566 const char *uniqueid,
1567 Slapi_ComponentId *plugin_identity,
1568 int operation_flags )
1571 slapi_pblock_set( pb, SLAPI_MODRDN_TARGET, (void *)olddn );
1572 slapi_pblock_set( pb, SLAPI_MODRDN_NEWRDN, (void *)newrdn );
1573 slapi_pblock_set( pb, SLAPI_MODRDN_NEWSUPERIOR, (void *)newsuperior );
1574 slapi_pblock_set( pb, SLAPI_MODRDN_DELOLDRDN, (void *)deloldrdn );
1575 slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
1576 slapi_pblock_set( pb, SLAPI_TARGET_UNIQUEID, (void *)uniqueid );
1577 slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
1578 slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)operation_flags );
1579 #endif /* LDAP_SLAPI */
1582 /* Function : slapi_modrdn_internal
1584 * Description : Plugin functions call this routine to modify the rdn
1585 * of an entry in the backend directly
1586 * Return values : LDAP_SUCCESS
1590 * LDAP_UNWILLING_TO_PERFORM
1592 * NOTE: This function does not support the "newSuperior" option from LDAP V3.
1595 slapi_modrdn_internal(
1599 LDAPControl **controls,
1605 pb = slapi_pblock_new();
1610 slapi_rename_internal_set_pb( pb, olddn, lnewrdn, NULL,
1611 deloldrdn, controls, NULL, NULL,
1612 log_change ? SLAPI_OP_FLAG_LOG_CHANGE : 0 );
1614 slapi_modrdn_internal_pb( pb );
1619 #endif /* LDAP_SLAPI */
1622 void slapi_delete_internal_set_pb( Slapi_PBlock *pb,
1624 LDAPControl **controls,
1625 const char *uniqueid,
1626 Slapi_ComponentId *plugin_identity,
1627 int operation_flags )
1630 slapi_pblock_set( pb, SLAPI_TARGET_DN, (void *)dn );
1631 slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
1632 slapi_pblock_set( pb, SLAPI_TARGET_UNIQUEID, (void *)uniqueid );
1633 slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
1634 slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)operation_flags );
1635 #endif /* LDAP_SLAPI */
1638 /* Function : slapi_delete_internal
1640 * Description : Plugin functions call this routine to delete an entry
1641 * in the backend directly
1642 * Return values : LDAP_SUCCESS
1646 * LDAP_UNWILLING_TO_PERFORM
1649 slapi_delete_internal(
1651 LDAPControl **controls,
1657 pb = slapi_pblock_new();
1661 slapi_delete_internal_set_pb( pb, ldn, controls, NULL, NULL,
1662 log_change ? SLAPI_OP_FLAG_LOG_CHANGE : 0 );
1664 slapi_delete_internal_pb( pb );
1669 #endif /* LDAP_SLAPI */