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;
52 Slapi_PBlock *pb = SLAPI_OPERATION_PBLOCK( op );
56 slapi_pblock_get( pb, SLAPI_RESCONTROLS, (void **)&controls );
57 slapi_pblock_get( pb, SLAPI_X_INTOP_RESULT_CALLBACK, (void **)&prc );
58 slapi_pblock_get( pb, SLAPI_X_INTOP_CALLBACK_DATA, &callback_data );
60 assert( controls == NULL );
62 /* Copy these before they go out of scope */
63 if ( rs->sr_ctrls != NULL ) {
64 for ( i = 0; rs->sr_ctrls[i] != NULL; i++ )
67 controls = (LDAPControl **)slapi_ch_calloc( i + 1,
68 sizeof(LDAPControl ));
70 for ( i = 0; rs->sr_ctrls[i] != NULL; i++ )
71 controls[i] = slapi_dup_control( rs->sr_ctrls[i] );
76 slapi_pblock_set( pb, SLAPI_RESCONTROLS, (void *)controls );
77 slapi_pblock_set( pb, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs->sr_err );
80 (*prc)( rs->sr_err, callback_data );
87 slapi_int_send_search_entry_shim(
91 plugin_search_entry_callback psec = NULL;
92 void *callback_data = NULL;
93 Slapi_PBlock *pb = SLAPI_OPERATION_PBLOCK( op );
97 slapi_pblock_get( pb, SLAPI_X_INTOP_SEARCH_ENTRY_CALLBACK, (void **)&psec );
98 slapi_pblock_get( pb, SLAPI_X_INTOP_CALLBACK_DATA, &callback_data );
100 if ( psec != NULL ) {
101 return (*psec)( rs->sr_entry, callback_data );
108 slapi_int_send_ldap_extended_shim(
112 assert( SLAPI_OPERATION_PBLOCK( op ) != NULL );
118 slapi_int_send_search_reference_shim(
122 int i, rc = LDAP_SUCCESS;
123 plugin_referral_entry_callback prec = NULL;
124 void *callback_data = NULL;
125 Slapi_PBlock *pb = SLAPI_OPERATION_PBLOCK( op );
127 assert( pb != NULL );
129 slapi_pblock_get( pb, SLAPI_X_INTOP_REFERRAL_ENTRY_CALLBACK, (void **)&prec );
130 slapi_pblock_get( pb, SLAPI_X_INTOP_CALLBACK_DATA, &callback_data );
132 if ( prec != NULL ) {
133 for ( i = 0; rs->sr_ref[i].bv_val != NULL; i++ ) {
134 rc = (*prec)( rs->sr_ref[i].bv_val, callback_data );
135 if ( rc != LDAP_SUCCESS ) {
145 slapi_int_get_ctrls( Operation *op, SlapReply *rs, LDAPControl **controls )
150 op->o_ctrls = controls;
151 if ( op->o_ctrls == NULL ) {
155 for ( c = op->o_ctrls; *c != NULL; c++ ) {
156 rc = slap_parse_ctrl( op, rs, *c, &rs->sr_text );
157 if ( rc != LDAP_SUCCESS )
165 * To allow plugins to forward frontend requests to internal operations,
166 * the internal operation and connection structures should import as
167 * much state as practicable from the supplied parameter block.
171 * Select the backend to be used for an internal operation, either
172 * from the operation target DN or from the parameter block.
175 slapi_int_pblock_get_backend( Slapi_PBlock *pb, Operation *op )
177 int manageDsaIt = 0, isCritical;
178 LDAPControl **controls = NULL;
181 slapi_pblock_get( pb, SLAPI_REQCONTROLS, (void **)&controls );
183 slapi_pblock_get( pb, SLAPI_MANAGEDSAIT, (void **)&manageDsaIt );
184 if ( manageDsaIt != 0 )
185 manageDsaIt = SLAP_CONTROL_CRITICAL;
186 else if ( slapi_control_present( controls, SLAPI_CONTROL_MANAGEDSAIT_OID,
188 manageDsaIt = isCritical ? SLAP_CONTROL_CRITICAL : SLAP_CONTROL_NONCRITICAL;
190 /* let caller force a specific backend */
191 slapi_pblock_get( pb, SLAPI_BACKEND, (void **)&op->o_bd );
192 if ( op->o_bd == NULL ) {
193 op->o_bd = select_backend( &op->o_req_ndn, manageDsaIt, 1 );
194 if ( op->o_bd == NULL ) {
195 if ( op->o_tag == LDAP_REQ_SEARCH && manageDsaIt > SLAP_CONTROL_NONE )
196 rc = LDAP_NO_SUCH_OBJECT;
198 rc = LDAP_PARTIAL_RESULTS;
202 if ( op->o_bd != NULL ) {
210 slapi_int_pblock_get_connection( Slapi_PBlock *pb, Operation *op )
213 Connection *conn = op->o_conn;
215 slapi_pblock_get( pb, SLAPI_X_CONN_SSF, (void **)&conn->c_ssf );
216 slapi_pblock_get( pb, SLAPI_X_CONN_SASL_CONTEXT, (void **)&conn->c_sasl_authctx );
218 if ( slapi_pblock_get( pb, SLAPI_CONN_DN, (void **)&connDn ) != 0 ||
220 /* default to operation DN */
221 conn->c_ndn = op->o_ndn;
222 conn->c_dn = op->o_ndn;
224 /* NB: conn DN must be normalized */
225 conn->c_ndn.bv_val = connDn;
226 conn->c_ndn.bv_len = strlen( connDn );
228 conn->c_dn = conn->c_ndn;
235 slapi_int_pblock_get_operation( Slapi_PBlock *pb, Operation *op, SlapReply *rs )
239 char *requestorDn = NULL;
240 struct berval targetDn = BER_BVNULL;
241 LDAPControl **controls;
244 /* All internal operations must specify a target DN */
245 if ( slapi_pblock_get( pb, SLAPI_TARGET_DN, (void **)&targetDn.bv_val ) != 0 ||
246 targetDn.bv_val == NULL ) {
247 return LDAP_PARAM_ERROR;
250 targetDn.bv_len = strlen( targetDn.bv_val );
252 rc = dnPrettyNormal( NULL, &targetDn, &op->o_req_dn, &op->o_req_ndn, NULL );
253 if ( rc != LDAP_SUCCESS ) {
257 rc = slapi_int_pblock_get_backend( pb, op );
258 if ( rc != LDAP_SUCCESS ) {
262 slapi_pblock_get( pb, SLAPI_REQUESTOR_ISROOT, (void **)&isRoot );
263 slapi_pblock_get( pb, SLAPI_REQUESTOR_ISUPDATEDN, (void **)&isUpdateDn );
264 /* NB: requestor DN must be normalized */
265 slapi_pblock_get( pb, SLAPI_REQUESTOR_DN, (void **)&requestorDn );
267 /* Default authorization identity for internal operations is root DN */
268 if ( isRoot || requestorDn == NULL ) {
269 op->o_dn = op->o_bd->be_rootdn;
270 op->o_ndn = op->o_bd->be_rootndn;
273 op->o_ndn.bv_val = requestorDn;
274 op->o_ndn.bv_len = strlen( requestorDn );
275 op->o_dn = op->o_ndn;
279 slapi_pblock_set( pb, SLAPI_REQUESTOR_ISROOT, (void *)isRoot );
281 rc = slapi_int_pblock_get_connection( pb, op );
282 if ( rc != LDAP_SUCCESS ) {
286 slapi_pblock_get( pb, SLAPI_REQCONTROLS, (void **)&controls );
287 rc = slapi_int_get_ctrls( op, rs, controls );
288 if ( rc != LDAP_SUCCESS ) {
296 slapi_int_init_connection( Slapi_PBlock *pb,
303 ber_len_t max = sockbuf_max_incoming;
306 conn = (Connection *) slapi_ch_calloc(1, sizeof(Connection));
308 LDAP_STAILQ_INIT( &conn->c_pending_ops );
310 op = (Operation *) slapi_ch_calloc( 1, OPERATION_BUFFER_SIZE );
311 op->o_hdr = (Opheader *)(op + 1);
312 op->o_hdr->oh_extensions = NULL;
314 op->o_callback = (slap_callback *) slapi_ch_calloc( 1, sizeof(slap_callback) );
315 op->o_callback->sc_response = NULL;
316 op->o_callback->sc_cleanup = NULL;
317 op->o_callback->sc_private = pb;
318 op->o_callback->sc_next = NULL;
320 op->o_controls = (void **)(op->o_hdr + 1);
322 conn->c_pending_ops.stqh_first = op;
324 /* connection object authorization information */
325 conn->c_authtype = LDAP_AUTH_NONE;
326 conn->c_authmech.bv_val = NULL;
327 conn->c_authmech.bv_len = 0;
328 conn->c_dn.bv_val = NULL;
329 conn->c_dn.bv_len = 0;
330 conn->c_ndn.bv_val = NULL;
331 conn->c_ndn.bv_len = 0;
333 conn->c_listener = &slap_unknown_listener;
334 ber_dupbv( &conn->c_peer_domain, (struct berval *)&slap_unknown_bv );
335 ber_dupbv( &conn->c_peer_name, (struct berval *)&slap_unknown_bv );
337 LDAP_STAILQ_INIT( &conn->c_ops );
339 conn->c_sasl_bind_mech.bv_val = NULL;
340 conn->c_sasl_bind_mech.bv_len = 0;
341 conn->c_sasl_authctx = NULL;
342 conn->c_sasl_sockctx = NULL;
343 conn->c_sasl_extra = NULL;
345 conn->c_sb = ber_sockbuf_alloc( );
347 ber_sockbuf_ctrl( conn->c_sb, LBER_SB_OPT_SET_MAX_INCOMING, &max );
349 conn->c_currentber = NULL;
351 /* should check status of thread calls */
352 ldap_pvt_thread_mutex_init( &conn->c_mutex );
353 ldap_pvt_thread_mutex_init( &conn->c_write_mutex );
354 ldap_pvt_thread_cond_init( &conn->c_write_cv );
356 ldap_pvt_thread_mutex_lock( &conn->c_mutex );
358 conn->c_n_ops_received = 0;
359 conn->c_n_ops_executing = 0;
360 conn->c_n_ops_pending = 0;
361 conn->c_n_ops_completed = 0;
367 conn->c_protocol = LDAP_VERSION3;
369 conn->c_activitytime = conn->c_starttime = slap_get_time();
372 * A real connection ID is required, because syncrepl associates
373 * pending CSNs with unique ( connection, operation ) tuples.
374 * Setting a fake connection ID will cause slap_get_commit_csn()
375 * to return a stale value.
377 connection_assign_nextid( conn );
379 conn->c_conn_state = 0x01; /* SLAP_C_ACTIVE */
380 conn->c_struct_state = 0x02; /* SLAP_C_USED */
382 conn->c_ssf = conn->c_transport_ssf = 0;
385 backend_connection_init( conn );
387 conn->c_send_ldap_result = slapi_int_send_ldap_result_shim;
388 conn->c_send_search_entry = slapi_int_send_search_entry_shim;
389 conn->c_send_ldap_extended = slapi_int_send_ldap_extended_shim;
390 conn->c_send_search_reference = slapi_int_send_search_reference_shim;
392 /* operation object */
394 op->o_protocol = LDAP_VERSION3;
395 op->o_authmech.bv_val = NULL;
396 op->o_authmech.bv_len = 0;
397 op->o_time = slap_get_time();
398 op->o_do_not_cache = 1;
399 op->o_threadctx = ldap_pvt_thread_pool_context();
400 op->o_tmpmemctx = NULL;
401 op->o_tmpmfuncs = &ch_mfuncs;
403 op->o_connid = conn->c_connid;
405 rc = slapi_int_pblock_get_operation( pb, op, rs );
407 slapi_pblock_set( pb, SLAPI_OPERATION, op );
408 slapi_pblock_set( pb, SLAPI_CONNECTION, conn );
410 ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
412 if ( rc != LDAP_SUCCESS ) {
413 slapi_int_connection_destroy( &conn );
422 void slapi_int_connection_destroy( Connection **pConn )
424 Connection *conn = *pConn;
428 if ( conn == NULL ) {
432 op = (Operation *)conn->c_pending_ops.stqh_first;
433 pb = SLAPI_OPERATION_PBLOCK( op );
435 slap_graduate_commit_csn( op );
437 if ( op->o_req_dn.bv_val != NULL ) {
438 slapi_ch_free( (void **)&op->o_req_dn.bv_val );
440 if ( op->o_req_ndn.bv_val != NULL ) {
441 slapi_ch_free( (void **)&op->o_req_ndn.bv_val );
443 if ( op->o_callback != NULL ) {
444 slapi_ch_free( (void **)&op->o_callback );
446 if ( conn->c_sb != NULL ) {
447 ber_sockbuf_free( conn->c_sb );
450 slapi_pblock_set( pb, SLAPI_OPERATION, NULL );
451 slapi_pblock_set( pb, SLAPI_CONNECTION, NULL );
454 slapi_ch_free( (void **)&op );
457 slapi_ch_free( (void **)pConn );
461 * Function : values2obj
462 * Convert an array of strings into a BerVarray.
473 if ( ppValue == NULL ) {
478 for ( i = 0; ppValue[i] != NULL; i++ )
481 tmpberval = (BerVarray)slapi_ch_malloc( (i+1) * (sizeof(struct berval)) );
482 if ( tmpberval == NULL ) {
483 return LDAP_NO_MEMORY;
485 for ( i = 0; ppValue[i] != NULL; i++ ) {
486 size_t len = strlen( ppValue[i] );
488 tmpberval[i].bv_val = slapi_ch_malloc( len + 1 );
489 AC_MEMCPY( tmpberval[i].bv_val, ppValue[i], len + 1 );
490 tmpberval[i].bv_len = len;
492 tmpberval[i].bv_val = NULL;
493 tmpberval[i].bv_len = 0;
502 struct berval **bvptr,
508 if ( bvptr == NULL ) {
513 for ( i = 0; bvptr[i] != NULL; i++ )
516 tmpberval = (BerVarray)slapi_ch_malloc( (i + 1) * sizeof(struct berval));
517 if ( tmpberval == NULL ) {
518 return LDAP_NO_MEMORY;
521 for ( i = 0; bvptr[i] != NULL; i++ ) {
522 tmpberval[i].bv_val = slapi_ch_malloc( bvptr[i]->bv_len );
523 tmpberval[i].bv_len = bvptr[i]->bv_len;
524 AC_MEMCPY( tmpberval[i].bv_val, bvptr[i]->bv_val, bvptr[i]->bv_len );
527 tmpberval[i].bv_val = NULL;
528 tmpberval[i].bv_len = 0;
536 * Function : slapi_int_ldapmod_to_entry
537 * convert a dn plus an array of LDAPMod struct ptrs to an entry structure
538 * with a link list of the correspondent attributes.
539 * Return value : LDAP_SUCCESS
544 slapi_int_ldapmod_to_entry(
549 struct berval dn = BER_BVNULL;
555 Modifications *modlist = NULL;
556 Modifications **modtail = &modlist;
559 int rc = LDAP_SUCCESS;
562 const char *text = NULL;
564 op = (Operation *)pConn->c_pending_ops.stqh_first;
566 pEntry = (Entry *) ch_calloc( 1, sizeof(Entry) );
567 if ( pEntry == NULL) {
573 dn.bv_len = strlen( ldn );
575 rc = dnPrettyNormal( NULL, &dn, &pEntry->e_name, &pEntry->e_nname, NULL );
576 if ( rc != LDAP_SUCCESS ) {
580 if ( rc == LDAP_SUCCESS ) {
581 for ( i = 0, pMod = mods[0]; rc == LDAP_SUCCESS && pMod != NULL; pMod = mods[++i]) {
584 if ( (pMod->mod_op & LDAP_MOD_BVALUES) != 0 ) {
586 * Convert an array of pointers to bervals to
587 * an array of bervals. Note that we need to copy the
588 * values too, as the slap_mods_check() will free the
589 * original values after prettying; the modifications
590 * being passed in may not have been allocated on the
593 rc = bvptr2obj_copy( pMod->mod_bvalues, &bv );
594 if ( rc != LDAP_SUCCESS ) goto cleanup;
595 tmp.sml_type.bv_val = pMod->mod_type;
596 tmp.sml_type.bv_len = strlen( pMod->mod_type );
598 tmp.sml_nvalues = NULL;
600 mod = (Modifications *) ch_malloc( sizeof(Modifications) );
602 mod->sml_op = LDAP_MOD_ADD;
604 mod->sml_next = NULL;
605 mod->sml_desc = NULL;
606 mod->sml_type = tmp.sml_type;
607 mod->sml_values = tmp.sml_values;
608 mod->sml_nvalues = tmp.sml_nvalues;
611 modtail = &mod->sml_next;
614 /* attr values are in string format, need to be converted */
615 /* to an array of bervals */
616 if ( pMod->mod_values == NULL ) {
619 rc = values2obj_copy( pMod->mod_values, &bv );
620 if ( rc != LDAP_SUCCESS ) goto cleanup;
621 tmp.sml_type.bv_val = pMod->mod_type;
622 tmp.sml_type.bv_len = strlen( pMod->mod_type );
624 tmp.sml_nvalues = NULL;
626 mod = (Modifications *) ch_malloc( sizeof(Modifications) );
628 mod->sml_op = LDAP_MOD_ADD;
630 mod->sml_next = NULL;
631 mod->sml_desc = NULL;
632 mod->sml_type = tmp.sml_type;
633 mod->sml_values = tmp.sml_values;
634 mod->sml_nvalues = tmp.sml_nvalues;
637 modtail = &mod->sml_next;
640 } /* for each LDAPMod */
643 op->o_bd = select_backend( &pEntry->e_nname, 0, 0 );
644 if ( op->o_bd == NULL ) {
645 rc = LDAP_PARTIAL_RESULTS;
647 int repl_user = be_isupdate_dn( op->o_bd, &op->o_bd->be_rootdn );
648 if ( !op->o_bd->be_update_ndn.bv_len || repl_user ) {
649 int update = !BER_BVISNULL( &op->o_bd->be_update_ndn );
650 char textbuf[ SLAP_TEXT_BUFLEN ];
651 size_t textlen = sizeof( textbuf );
653 rc = slap_mods_check( modlist, &text,
654 textbuf, textlen, NULL );
656 if ( rc != LDAP_SUCCESS) {
661 rc = slap_mods_no_user_mod_check( op, modlist,
662 &text, textbuf, textlen );
663 if ( rc != LDAP_SUCCESS) {
669 rc = slap_mods_opattrs( op, modlist, modtail,
670 &text, textbuf, textlen, 1 );
671 if ( rc != LDAP_SUCCESS) {
676 rc = slap_mods2entry( modlist, &pEntry, repl_user,
677 0, &text, textbuf, textlen );
678 if (rc != LDAP_SUCCESS) {
688 if ( modlist != NULL )
689 slap_mods_free( modlist );
690 if ( rc != LDAP_SUCCESS ) {
691 if ( pEntry != NULL ) {
692 slapi_entry_free( pEntry );
701 slapi_delete_internal_pb( Slapi_PBlock *pb )
704 Connection *conn = NULL;
705 Operation *op = NULL;
706 int operation_flags = 0;
708 SlapReply rs = { REP_RESULT };
714 slapi_pblock_get( pb, SLAPI_X_INTOP_FLAGS, &operation_flags );
716 rs.sr_err = slapi_int_init_connection( pb, &rs, LDAP_REQ_DELETE, &conn );
717 if ( rs.sr_err != LDAP_SUCCESS ) {
721 op = conn->c_pending_ops.stqh_first;
723 if ( op->o_bd->be_delete != NULL ) {
724 int repl_user = be_isupdate( op );
725 if ( !op->o_bd->be_update_ndn.bv_len || repl_user ) {
726 slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
727 if ( operation_flags & SLAPI_OP_FLAG_LOG_CHANGE )
728 op->o_callback = &cb;
730 op->o_bd->be_delete( op, &rs );
732 rs.sr_err = LDAP_REFERRAL;
735 rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
739 slapi_pblock_set( pb, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs.sr_err );
740 slapi_int_connection_destroy( &conn );
745 #endif /* LDAP_SLAPI */
749 slapi_add_internal_pb( Slapi_PBlock *pb )
752 Connection *conn = NULL;
753 Slapi_Entry *entry = NULL;
754 Slapi_Entry *argEntry = NULL;
756 LDAPMod **mods = NULL;
757 int operation_flags = 0;
758 Operation *op = NULL;
761 SlapReply rs = { REP_RESULT };
767 slapi_pblock_get( pb, SLAPI_ADD_ENTRY, (void **)&argEntry );
768 slapi_pblock_get( pb, SLAPI_ADD_TARGET, (void **)&dn );
769 slapi_pblock_get( pb, SLAPI_MODIFY_MODS, (void **)&mods );
770 slapi_pblock_get( pb, SLAPI_X_INTOP_FLAGS, (void **)&operation_flags );
772 if ( argEntry != NULL ) {
774 * The caller can specify a new entry, or a target DN and set
775 * of modifications, but not both.
778 rs.sr_err = LDAP_PARAM_ERROR;
783 * Set the DN here so that slapi_int_init_backend() will select
786 dn = slapi_entry_get_dn( argEntry );
787 slapi_pblock_set( pb, SLAPI_ADD_TARGET, &entry->e_nname.bv_val );
790 rs.sr_err = slapi_int_init_connection( pb, &rs, LDAP_REQ_ADD, &conn );
791 if ( rs.sr_err != LDAP_SUCCESS ) {
795 if ( argEntry != NULL ) {
796 entry = slapi_entry_dup( argEntry );
798 if ( mods == NULL || dn == NULL ) {
799 rs.sr_err = LDAP_PARAM_ERROR;
803 for ( i = 0; mods[i] != NULL; i++ ) {
804 if ( (mods[i]->mod_op & LDAP_MOD_OP ) != LDAP_MOD_ADD ) {
805 rs.sr_err = LDAP_PARAM_ERROR;
810 entry = slapi_int_ldapmod_to_entry( conn, dn, mods );
811 if ( entry == NULL ) {
812 rs.sr_err = LDAP_OTHER;
817 op = (Operation *)conn->c_pending_ops.stqh_first;
818 op->oq_add.rs_e = entry;
820 if ( op->o_bd->be_add != NULL ) {
821 int repl_user = be_isupdate( op );
822 if ( !op->o_bd->be_update_ndn.bv_len || repl_user ) {
823 slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
825 if ( operation_flags & SLAPI_OP_FLAG_LOG_CHANGE )
826 op->o_callback = &cb;
828 if ( op->o_bd->be_add( op, &rs ) == LDAP_SUCCESS ) {
829 be_entry_release_w( op, entry );
833 rs.sr_err = LDAP_REFERRAL;
836 rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
840 slapi_pblock_set( pb, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs.sr_err );
842 if ( entry != NULL ) {
843 slapi_entry_free( entry );
845 if ( argEntry != NULL ) {
846 slapi_pblock_set( pb, SLAPI_ADD_TARGET, NULL );
849 slapi_int_connection_destroy( &conn );
854 #endif /* LDAP_SLAPI */
858 slapi_modrdn_internal_pb( Slapi_PBlock *pb )
861 struct berval dn = BER_BVNULL;
862 struct berval newrdn = BER_BVNULL;
863 struct berval newsupdn = BER_BVNULL;
864 struct berval newSuperiorPretty = BER_BVNULL;
865 struct berval newSuperiorNormalized = BER_BVNULL;
866 Connection *conn = NULL;
867 Operation *op = NULL;
868 int manageDsaIt = SLAP_CONTROL_NONE;
876 SlapReply rs = { REP_RESULT };
882 slapi_pblock_get( pb, SLAPI_MODRDN_NEWRDN, (void **)&lnewrdn );
883 slapi_pblock_get( pb, SLAPI_MODRDN_NEWSUPERIOR, (void **)&newsuperior );
884 slapi_pblock_get( pb, SLAPI_MODRDN_DELOLDRDN, (void **)&deloldrdn );
885 slapi_pblock_get( pb, SLAPI_X_INTOP_FLAGS, (void **)&operation_flags );
887 rs.sr_err = slapi_int_init_connection( pb, &rs, LDAP_REQ_MODRDN, &conn );
888 if ( rs.sr_err != LDAP_SUCCESS ) {
892 op = (Operation *)conn->c_pending_ops.stqh_first;
894 if ( op->o_req_dn.bv_len == 0 ) {
895 rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
899 newrdn.bv_val = lnewrdn;
900 newrdn.bv_len = strlen( lnewrdn );
902 rs.sr_err = dnPrettyNormal( NULL, &newrdn, &op->oq_modrdn.rs_newrdn, &op->oq_modrdn.rs_nnewrdn, NULL );
903 if ( rs.sr_err != LDAP_SUCCESS ) {
907 if ( rdn_validate( &op->oq_modrdn.rs_nnewrdn ) != LDAP_SUCCESS ) {
911 if ( newsuperior != NULL ) {
912 newsupdn.bv_val = (char *)newsuperior;
913 newsupdn.bv_len = strlen( newsuperior );
915 rs.sr_err = dnPrettyNormal( NULL, &newsupdn, &newSuperiorPretty, &newSuperiorNormalized, NULL );
916 if ( rs.sr_err != LDAP_SUCCESS )
919 op->oq_modrdn.rs_newSup = &newSuperiorPretty;
920 op->oq_modrdn.rs_nnewSup = &newSuperiorNormalized;
922 op->oq_modrdn.rs_newSup = NULL;
923 op->oq_modrdn.rs_nnewSup = NULL;
926 op->oq_modrdn.rs_deleteoldrdn = deloldrdn;
928 if ( op->o_bd->be_modrdn != NULL ) {
929 int repl_user = be_isupdate( op );
930 if ( !op->o_bd->be_update_ndn.bv_len || repl_user ) {
931 slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
933 if ( operation_flags & SLAPI_OP_FLAG_LOG_CHANGE )
934 op->o_callback = &cb;
936 op->o_bd->be_modrdn( op, &rs );
938 rs.sr_err = LDAP_REFERRAL;
941 rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
945 slapi_pblock_set( pb, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs.sr_err );
947 if ( op->oq_modrdn.rs_newrdn.bv_val != NULL )
948 slapi_ch_free_string( &op->oq_modrdn.rs_newrdn.bv_val );
949 if ( op->oq_modrdn.rs_nnewrdn.bv_val != NULL )
950 slapi_ch_free_string( &op->oq_modrdn.rs_nnewrdn.bv_val );
951 if ( newSuperiorPretty.bv_val != NULL )
952 slapi_ch_free_string( &newSuperiorPretty.bv_val );
953 if ( newSuperiorNormalized.bv_val != NULL )
954 slapi_ch_free_string( &newSuperiorNormalized.bv_val );
956 slapi_int_connection_destroy( &conn );
961 #endif /* LDAP_SLAPI */
964 int slapi_modify_internal_pb( Slapi_PBlock *pb )
968 Connection *conn = NULL;
969 Operation *op = NULL;
971 struct berval dn = BER_BVNULL;
973 int manageDsaIt = SLAP_CONTROL_NONE;
978 Modifications *modlist = NULL;
979 Modifications **modtail = &modlist;
982 LDAPMod **mods = NULL;
983 int operation_flags = 0;
985 SlapReply rs = { REP_RESULT };
991 slapi_pblock_get( pb, SLAPI_MODIFY_MODS, (void **)&mods );
992 slapi_pblock_get( pb, SLAPI_X_INTOP_FLAGS, (void **)&operation_flags );
994 if ( mods == NULL || mods[0] == NULL ) {
995 rs.sr_err = LDAP_PARAM_ERROR ;
999 rs.sr_err = slapi_int_init_connection( pb, &rs, LDAP_REQ_MODIFY, &conn );
1000 if ( rs.sr_err != LDAP_SUCCESS ) {
1004 for ( i = 0, pMod = mods[0];
1005 rs.sr_err == LDAP_SUCCESS && pMod != NULL;
1010 if ( (pMod->mod_op & LDAP_MOD_BVALUES) != 0 ) {
1012 * attr values are in berval format
1013 * convert an array of pointers to bervals
1014 * to an array of bervals
1016 rs.sr_err = bvptr2obj_copy( pMod->mod_bvalues, &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;
1034 rs.sr_err = values2obj_copy( pMod->mod_values, &bv );
1035 if ( rs.sr_err != LDAP_SUCCESS )
1037 tmp.sml_type.bv_val = pMod->mod_type;
1038 tmp.sml_type.bv_len = strlen( pMod->mod_type );
1039 tmp.sml_values = bv;
1040 tmp.sml_nvalues = NULL;
1042 mod = (Modifications *) ch_malloc( sizeof(Modifications) );
1044 mod->sml_op = pMod->mod_op & LDAP_MOD_OP;
1046 mod->sml_next = NULL;
1047 mod->sml_desc = NULL;
1048 mod->sml_type = tmp.sml_type;
1049 mod->sml_values = tmp.sml_values;
1050 mod->sml_nvalues = tmp.sml_nvalues;
1053 modtail = &mod->sml_next;
1055 switch( pMod->mod_op & LDAP_MOD_OP ) {
1057 if ( mod->sml_values == NULL ) {
1058 rs.sr_err = LDAP_PROTOCOL_ERROR;
1063 case LDAP_MOD_DELETE:
1064 case LDAP_MOD_REPLACE:
1065 case LDAP_MOD_INCREMENT:
1069 rs.sr_err = LDAP_PROTOCOL_ERROR;
1075 op = (Operation *)conn->c_pending_ops.stqh_first;
1077 if ( op->o_req_ndn.bv_len == 0 ) {
1078 rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
1082 op->oq_modify.rs_modlist = modlist;
1084 if ( op->o_bd->be_modify != NULL ) {
1085 int repl_user = be_isupdate( op );
1086 if ( !op->o_bd->be_update_ndn.bv_len || repl_user ) {
1087 int update = !BER_BVISEMPTY( &op->o_bd->be_update_ndn );
1088 const char *text = NULL;
1089 char textbuf[ SLAP_TEXT_BUFLEN ];
1090 size_t textlen = sizeof( textbuf );
1091 slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
1093 rs.sr_err = slap_mods_check( modlist,
1094 &text, textbuf, textlen, NULL );
1095 if ( rs.sr_err != LDAP_SUCCESS ) {
1100 rs.sr_err = slap_mods_no_user_mod_check( op, modlist,
1101 &text, textbuf, textlen );
1102 if ( rs.sr_err != LDAP_SUCCESS ) {
1108 rs.sr_err = slap_mods_opattrs( op, modlist,
1109 modtail, &text, textbuf,
1111 if ( rs.sr_err != LDAP_SUCCESS ) {
1116 if ( operation_flags & SLAPI_OP_FLAG_LOG_CHANGE )
1117 op->o_callback = &cb;
1119 op->o_bd->be_modify( op, &rs );
1121 rs.sr_err = LDAP_REFERRAL;
1124 rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
1128 slapi_pblock_set( pb, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs.sr_err );
1130 if ( modlist != NULL )
1131 slap_mods_free( modlist );
1133 slapi_int_connection_destroy( &conn );
1138 #endif /* LDAP_SLAPI */
1143 slapi_int_search_entry_callback( Slapi_Entry *entry, void *callback_data )
1145 int nentries = 0, i = 0;
1146 Slapi_Entry **head = NULL, **tp;
1147 Slapi_PBlock *pb = (Slapi_PBlock *)callback_data;
1149 entry = slapi_entry_dup( entry );
1150 if ( entry == NULL ) {
1154 slapi_pblock_get( pb, SLAPI_NENTRIES, &nentries );
1155 slapi_pblock_get( pb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, &head );
1158 if ( nentries == 0 ) {
1159 tp = (Slapi_Entry **)slapi_ch_malloc( 2 * sizeof(Slapi_Entry *) );
1161 slapi_entry_free( entry );
1167 tp = (Slapi_Entry **)slapi_ch_realloc( (char *)head,
1168 sizeof(Slapi_Entry *) * ( i + 1 ) );
1170 slapi_entry_free( entry );
1173 tp[ i - 1 ] = entry;
1177 slapi_pblock_set( pb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, (void *)tp );
1178 slapi_pblock_set( pb, SLAPI_NENTRIES, (void *)i );
1180 return LDAP_SUCCESS;
1182 #endif /* LDAP_SLAPI */
1184 int slapi_search_internal_pb( Slapi_PBlock *pb )
1187 return slapi_search_internal_callback_pb( pb,
1190 slapi_int_search_entry_callback,
1197 int slapi_search_internal_callback_pb( Slapi_PBlock *pb,
1198 void *callback_data,
1199 plugin_result_callback prc,
1200 plugin_search_entry_callback psec,
1201 plugin_referral_entry_callback prec )
1204 Connection *conn = NULL;
1205 Operation *op = NULL;
1206 struct berval dn = BER_BVNULL;
1207 Filter *filter = NULL;
1208 struct berval fstr = BER_BVNULL;
1209 AttributeName *an = NULL;
1210 const char *text = NULL;
1212 int manageDsaIt = SLAP_CONTROL_NONE;
1216 int scope = LDAP_SCOPE_BASE;
1217 char *filStr = NULL;
1218 LDAPControl **controls = NULL;
1219 char **attrs = NULL;
1220 char *uniqueid = NULL;
1222 int operation_flags = 0;
1225 SlapReply rs = { REP_RESULT };
1231 slapi_pblock_get( pb, SLAPI_SEARCH_SCOPE, (void **)&scope );
1232 slapi_pblock_get( pb, SLAPI_SEARCH_FILTER, (void **)&filter );
1233 slapi_pblock_get( pb, SLAPI_SEARCH_STRFILTER, (void **)&filStr );
1234 slapi_pblock_get( pb, SLAPI_SEARCH_ATTRS, (void **)&attrs );
1235 slapi_pblock_get( pb, SLAPI_SEARCH_ATTRSONLY, (void **)&attrsonly );
1236 slapi_pblock_get( pb, SLAPI_REQCONTROLS, (void **)&controls );
1237 slapi_pblock_get( pb, SLAPI_TARGET_UNIQUEID, (void **)&uniqueid );
1238 slapi_pblock_get( pb, SLAPI_X_INTOP_FLAGS, (void **)&operation_flags );
1240 rs.sr_err = slapi_int_init_connection( pb, &rs, LDAP_REQ_SEARCH, &conn );
1241 if ( rs.sr_err != LDAP_SUCCESS ) {
1245 /* search callback and arguments */
1246 slapi_pblock_set( pb, SLAPI_X_INTOP_RESULT_CALLBACK, (void *)prc );
1247 slapi_pblock_set( pb, SLAPI_X_INTOP_SEARCH_ENTRY_CALLBACK, (void *)psec );
1248 slapi_pblock_set( pb, SLAPI_X_INTOP_REFERRAL_ENTRY_CALLBACK, (void *)prec );
1249 slapi_pblock_set( pb, SLAPI_X_INTOP_CALLBACK_DATA, (void *)callback_data );
1251 op = (Operation *)conn->c_pending_ops.stqh_first;
1254 case LDAP_SCOPE_BASE:
1255 case LDAP_SCOPE_ONELEVEL:
1256 case LDAP_SCOPE_SUBTREE:
1257 #ifdef LDAP_SCOPE_SUBORDINATE
1258 case LDAP_SCOPE_SUBORDINATE:
1262 rs.sr_err = LDAP_PROTOCOL_ERROR;
1266 if ( filter == NULL ) {
1267 if ( filStr == NULL ) {
1268 rs.sr_err = LDAP_PARAM_ERROR;
1272 filter = slapi_str2filter( filStr );
1273 if ( filter == NULL ) {
1274 rs.sr_err = LDAP_PROTOCOL_ERROR;
1281 filter2bv( filter, &fstr );
1283 for ( i = 0; attrs != NULL && attrs[i] != NULL; i++ ) {
1284 ; /* count the number of attributes */
1288 an = (AttributeName *)slapi_ch_calloc( (i + 1), sizeof(AttributeName) );
1289 for (i = 0; attrs[i] != 0; i++) {
1290 an[i].an_desc = NULL;
1292 an[i].an_oc_exclude = 0;
1293 an[i].an_name.bv_val = slapi_ch_strdup(attrs[i]);
1294 an[i].an_name.bv_len = strlen(attrs[i]);
1295 slap_bv2ad( &an[i].an_name, &an[i].an_desc, &text );
1297 an[i].an_name.bv_val = NULL;
1300 rs.sr_type = REP_RESULT;
1301 rs.sr_err = LDAP_SUCCESS;
1302 rs.sr_entry = NULL; /* paranoia */
1304 if ( scope == LDAP_SCOPE_BASE ) {
1307 if ( op->o_req_ndn.bv_len == 0 ) {
1308 rs.sr_err = root_dse_info( conn, &rs.sr_entry, &rs.sr_text );
1311 if( rs.sr_err != LDAP_SUCCESS ) {
1312 send_ldap_result( op, &rs );
1314 } else if ( rs.sr_entry != NULL ) {
1315 rs.sr_err = test_filter( op, rs.sr_entry, filter );
1317 if ( rs.sr_err == LDAP_COMPARE_TRUE ) {
1318 rs.sr_type = REP_SEARCH;
1319 rs.sr_err = LDAP_SUCCESS;
1321 rs.sr_operational_attrs = NULL;
1322 rs.sr_flags = REP_ENTRY_MODIFIABLE;
1324 send_search_entry( op, &rs );
1327 entry_free( rs.sr_entry );
1329 rs.sr_type = REP_RESULT;
1330 rs.sr_err = LDAP_SUCCESS;
1332 send_ldap_result( op, &rs );
1338 op->oq_search.rs_scope = scope;
1339 op->oq_search.rs_deref = 0;
1340 op->oq_search.rs_slimit = SLAP_NO_LIMIT;
1341 op->oq_search.rs_tlimit = SLAP_NO_LIMIT;
1342 op->oq_search.rs_attrsonly = attrsonly;
1343 op->oq_search.rs_attrs = an;
1344 op->oq_search.rs_filter = filter;
1345 op->oq_search.rs_filterstr = fstr;
1347 if ( BER_BVISEMPTY( &op->o_req_ndn ) &&
1348 !BER_BVISEMPTY( &default_search_nbase ) ) {
1349 slapi_ch_free( (void **)&op->o_req_dn.bv_val );
1350 slapi_ch_free( (void **)&op->o_req_ndn.bv_val );
1352 ber_dupbv( &op->o_req_dn, &default_search_base );
1353 ber_dupbv( &op->o_req_ndn, &default_search_nbase );
1355 rs.sr_err = slapi_int_pblock_get_backend( pb, op );
1356 if ( rs.sr_err != LDAP_SUCCESS )
1360 if ( op->o_bd->be_search != NULL ) {
1361 (*op->o_bd->be_search)( op, &rs );
1363 rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
1367 slapi_pblock_set( pb, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs.sr_err );
1368 slapi_pblock_set( pb, SLAPI_X_INTOP_RESULT_CALLBACK, NULL );
1369 slapi_pblock_set( pb, SLAPI_X_INTOP_SEARCH_ENTRY_CALLBACK, NULL );
1370 slapi_pblock_set( pb, SLAPI_X_INTOP_REFERRAL_ENTRY_CALLBACK, NULL );
1371 slapi_pblock_set( pb, SLAPI_X_INTOP_CALLBACK_DATA, NULL );
1373 if ( freeFilter && filter != NULL )
1374 slapi_filter_free( filter, 1 );
1376 slapi_ch_free( (void **)&fstr.bv_val );
1378 slapi_ch_free( (void **)&an );
1380 slapi_int_connection_destroy( &conn );
1385 #endif /* LDAP_SLAPI */
1388 /* Wrappers for old API */
1390 void slapi_search_internal_set_pb( Slapi_PBlock *pb,
1396 LDAPControl **controls,
1397 const char *uniqueid,
1398 Slapi_ComponentId *plugin_identity,
1399 int operation_flags )
1402 slapi_pblock_set( pb, SLAPI_SEARCH_TARGET, (void *)base );
1403 slapi_pblock_set( pb, SLAPI_SEARCH_SCOPE, (void *)scope );
1404 slapi_pblock_set( pb, SLAPI_SEARCH_FILTER, NULL );
1405 slapi_pblock_set( pb, SLAPI_SEARCH_STRFILTER, (void *)filter );
1406 slapi_pblock_set( pb, SLAPI_SEARCH_ATTRS, (void *)attrs );
1407 slapi_pblock_set( pb, SLAPI_SEARCH_ATTRSONLY, (void *)attrsonly );
1408 slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
1409 slapi_pblock_set( pb, SLAPI_TARGET_UNIQUEID, (void *)uniqueid );
1410 slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
1411 slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)operation_flags );
1412 #endif /* LDAP_SLAPI */
1416 slapi_search_internal(
1420 LDAPControl **controls,
1427 pb = slapi_pblock_new();
1432 slapi_search_internal_set_pb( pb, ldn, scope, filStr, attrs, attrsonly,
1433 controls, NULL, NULL, 0 );
1435 slapi_search_internal_pb( pb );
1440 #endif /* LDAP_SLAPI */
1443 void slapi_modify_internal_set_pb( Slapi_PBlock *pb,
1446 LDAPControl **controls,
1447 const char *uniqueid,
1448 Slapi_ComponentId *plugin_identity,
1449 int operation_flags )
1452 slapi_pblock_set( pb, SLAPI_MODIFY_TARGET, (void *)dn );
1453 slapi_pblock_set( pb, SLAPI_MODIFY_MODS, (void *)mods );
1454 slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
1455 slapi_pblock_set( pb, SLAPI_TARGET_UNIQUEID, (void *)uniqueid );
1456 slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
1457 slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)operation_flags );
1458 #endif /* LDAP_SLAPI */
1461 /* Function : slapi_modify_internal
1463 * Description: Plugin functions call this routine to modify an entry
1464 * in the backend directly
1465 * Return values : LDAP_SUCCESS
1469 * LDAP_UNWILLING_TO_PERFORM
1472 slapi_modify_internal(
1475 LDAPControl **controls,
1481 pb = slapi_pblock_new();
1486 slapi_modify_internal_set_pb( pb, ldn, mods, controls, NULL, NULL,
1487 log_change ? SLAPI_OP_FLAG_LOG_CHANGE : 0 );
1489 slapi_modify_internal_pb( pb );
1494 #endif /* LDAP_SLAPI */
1497 int slapi_add_internal_set_pb( Slapi_PBlock *pb,
1500 LDAPControl **controls,
1501 Slapi_ComponentId *plugin_identity,
1502 int operation_flags )
1505 slapi_pblock_set( pb, SLAPI_ADD_TARGET, (void *)dn );
1506 slapi_pblock_set( pb, SLAPI_MODIFY_MODS, (void *)attrs );
1507 slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
1508 slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
1509 slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)operation_flags );
1514 #endif /* LDAP_SLAPI */
1517 Slapi_PBlock *slapi_add_internal(
1520 LDAPControl **controls,
1526 pb = slapi_pblock_new();
1530 slapi_add_internal_set_pb( pb, dn, attrs, controls, NULL,
1531 log_changes ? SLAPI_OP_FLAG_LOG_CHANGE : 0 );
1533 slapi_add_internal_pb( pb );
1538 #endif /* LDAP_SLAPI */
1541 void slapi_add_entry_internal_set_pb( Slapi_PBlock *pb,
1543 LDAPControl **controls,
1544 Slapi_ComponentId *plugin_identity,
1545 int operation_flags )
1548 slapi_pblock_set( pb, SLAPI_ADD_ENTRY, (void *)e );
1549 slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
1550 slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
1551 slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)operation_flags );
1552 #endif /* LDAP_SLAPI */
1556 slapi_add_entry_internal(
1558 LDAPControl **controls,
1564 pb = slapi_pblock_new();
1568 slapi_add_entry_internal_set_pb( pb, e, controls, NULL,
1569 log_changes ? SLAPI_OP_FLAG_LOG_CHANGE : 0 );
1571 slapi_add_internal_pb( pb );
1576 #endif /* LDAP_SLAPI */
1579 void slapi_rename_internal_set_pb( Slapi_PBlock *pb,
1582 const char *newsuperior,
1584 LDAPControl **controls,
1585 const char *uniqueid,
1586 Slapi_ComponentId *plugin_identity,
1587 int operation_flags )
1590 slapi_pblock_set( pb, SLAPI_MODRDN_TARGET, (void *)olddn );
1591 slapi_pblock_set( pb, SLAPI_MODRDN_NEWRDN, (void *)newrdn );
1592 slapi_pblock_set( pb, SLAPI_MODRDN_NEWSUPERIOR, (void *)newsuperior );
1593 slapi_pblock_set( pb, SLAPI_MODRDN_DELOLDRDN, (void *)deloldrdn );
1594 slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
1595 slapi_pblock_set( pb, SLAPI_TARGET_UNIQUEID, (void *)uniqueid );
1596 slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
1597 slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)operation_flags );
1598 #endif /* LDAP_SLAPI */
1601 /* Function : slapi_modrdn_internal
1603 * Description : Plugin functions call this routine to modify the rdn
1604 * of an entry in the backend directly
1605 * Return values : LDAP_SUCCESS
1609 * LDAP_UNWILLING_TO_PERFORM
1611 * NOTE: This function does not support the "newSuperior" option from LDAP V3.
1614 slapi_modrdn_internal(
1618 LDAPControl **controls,
1624 pb = slapi_pblock_new();
1629 slapi_rename_internal_set_pb( pb, olddn, lnewrdn, NULL,
1630 deloldrdn, controls, NULL, NULL,
1631 log_change ? SLAPI_OP_FLAG_LOG_CHANGE : 0 );
1633 slapi_modrdn_internal_pb( pb );
1638 #endif /* LDAP_SLAPI */
1641 void slapi_delete_internal_set_pb( Slapi_PBlock *pb,
1643 LDAPControl **controls,
1644 const char *uniqueid,
1645 Slapi_ComponentId *plugin_identity,
1646 int operation_flags )
1649 slapi_pblock_set( pb, SLAPI_TARGET_DN, (void *)dn );
1650 slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
1651 slapi_pblock_set( pb, SLAPI_TARGET_UNIQUEID, (void *)uniqueid );
1652 slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
1653 slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)operation_flags );
1654 #endif /* LDAP_SLAPI */
1657 /* Function : slapi_delete_internal
1659 * Description : Plugin functions call this routine to delete an entry
1660 * in the backend directly
1661 * Return values : LDAP_SUCCESS
1665 * LDAP_UNWILLING_TO_PERFORM
1668 slapi_delete_internal(
1670 LDAPControl **controls,
1676 pb = slapi_pblock_new();
1680 slapi_delete_internal_set_pb( pb, ldn, controls, NULL, NULL,
1681 log_change ? SLAPI_OP_FLAG_LOG_CHANGE : 0 );
1683 slapi_delete_internal_pb( pb );
1688 #endif /* LDAP_SLAPI */