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://) */
43 struct slapi_internal_args {
46 plugin_result_callback result_callback;
47 plugin_search_entry_callback search_entry_callback;
48 plugin_referral_entry_callback referral_entry_callback;
52 slapi_int_send_ldap_result_shim(
56 struct slapi_internal_args *args;
58 args = (struct slapi_internal_args *)op->o_pb;
59 if ( args != NULL && args->result_callback != NULL ) {
60 (args->result_callback)( rs->sr_err, args->callback_data );
67 slapi_int_send_search_entry_shim(
71 struct slapi_internal_args *args;
73 args = (struct slapi_internal_args *)op->o_pb;
74 if ( args != NULL && args->search_entry_callback != NULL ) {
75 return (args->search_entry_callback)( rs->sr_entry, args->callback_data );
82 slapi_int_send_ldap_extended_shim(
90 slapi_int_send_search_reference_shim(
94 int i, rc = LDAP_SUCCESS;
95 struct slapi_internal_args *args;
97 args = (struct slapi_internal_args *)op->o_pb;
98 if ( args != NULL && args->referral_entry_callback != NULL ) {
99 for ( i = 0; rs->sr_ref[i].bv_val != NULL; i++ ) {
100 rc = (args->referral_entry_callback)( rs->sr_ref[i].bv_val, args->callback_data );
101 if ( rc != LDAP_SUCCESS ) {
111 slapi_int_init_connection(
117 ber_len_t max = sockbuf_max_incoming;
119 pConn = (Connection *) slapi_ch_calloc(1, sizeof(Connection));
121 LDAP_STAILQ_INIT( &pConn->c_pending_ops );
123 op = (Operation *) slapi_ch_calloc( 1, OPERATION_BUFFER_SIZE );
124 op->o_hdr = (Opheader *)(op + 1);
125 op->o_controls = (void **)(op->o_hdr + 1);
127 pConn->c_pending_ops.stqh_first = op;
128 pConn->c_pending_ops.stqh_first->o_pb = NULL;
129 pConn->c_pending_ops.stqh_first->o_extensions = NULL;
131 /* connection object */
132 pConn->c_authmech.bv_val = NULL;
133 pConn->c_authmech.bv_len = 0;
134 pConn->c_dn.bv_val = NULL;
135 pConn->c_dn.bv_len = 0;
136 pConn->c_ndn.bv_val = NULL;
137 pConn->c_ndn.bv_len = 0;
139 pConn->c_listener = &slap_unknown_listener;
140 ber_dupbv( &pConn->c_peer_domain, (struct berval *)&slap_unknown_bv );
141 ber_dupbv( &pConn->c_peer_name, (struct berval *)&slap_unknown_bv );
143 LDAP_STAILQ_INIT( &pConn->c_ops );
145 pConn->c_sasl_bind_mech.bv_val = NULL;
146 pConn->c_sasl_bind_mech.bv_len = 0;
147 pConn->c_sasl_authctx = NULL;
148 pConn->c_sasl_sockctx = NULL;
149 pConn->c_sasl_extra = NULL;
151 pConn->c_sb = ber_sockbuf_alloc( );
153 ber_sockbuf_ctrl( pConn->c_sb, LBER_SB_OPT_SET_MAX_INCOMING, &max );
155 pConn->c_currentber = NULL;
157 /* should check status of thread calls */
158 ldap_pvt_thread_mutex_init( &pConn->c_mutex );
159 ldap_pvt_thread_mutex_init( &pConn->c_write_mutex );
160 ldap_pvt_thread_cond_init( &pConn->c_write_cv );
162 ldap_pvt_thread_mutex_lock( &pConn->c_mutex );
164 pConn->c_n_ops_received = 0;
165 pConn->c_n_ops_executing = 0;
166 pConn->c_n_ops_pending = 0;
167 pConn->c_n_ops_completed = 0;
171 pConn->c_n_write = 0;
173 pConn->c_protocol = LDAP_VERSION3;
175 pConn->c_activitytime = pConn->c_starttime = slap_get_time();
178 * A real connection ID is required, because syncrepl associates
179 * pending CSNs with unique ( connection, operation ) tuples.
180 * Setting a fake connection ID will cause slap_get_commit_csn()
181 * to return a stale value.
183 connection_assign_nextid( pConn );
185 pConn->c_conn_state = 0x01; /* SLAP_C_ACTIVE */
186 pConn->c_struct_state = 0x02; /* SLAP_C_USED */
188 pConn->c_ssf = pConn->c_transport_ssf = 0;
189 pConn->c_tls_ssf = 0;
191 backend_connection_init( pConn );
193 pConn->c_send_ldap_result = slapi_int_send_ldap_result_shim;
194 pConn->c_send_search_entry = slapi_int_send_search_entry_shim;
195 pConn->c_send_ldap_extended = slapi_int_send_ldap_extended_shim;
196 pConn->c_send_search_reference = slapi_int_send_search_reference_shim;
198 /* operation object */
199 pConn->c_pending_ops.stqh_first->o_tag = OpType;
200 pConn->c_pending_ops.stqh_first->o_protocol = LDAP_VERSION3;
201 pConn->c_pending_ops.stqh_first->o_authmech.bv_val = NULL;
202 pConn->c_pending_ops.stqh_first->o_authmech.bv_len = 0;
203 pConn->c_pending_ops.stqh_first->o_time = slap_get_time();
204 pConn->c_pending_ops.stqh_first->o_do_not_cache = 1;
205 pConn->c_pending_ops.stqh_first->o_threadctx = ldap_pvt_thread_pool_context();
206 pConn->c_pending_ops.stqh_first->o_tmpmemctx = NULL;
207 pConn->c_pending_ops.stqh_first->o_tmpmfuncs = &ch_mfuncs;
208 pConn->c_pending_ops.stqh_first->o_conn = pConn;
209 pConn->c_pending_ops.stqh_first->o_connid = pConn->c_connid;
211 ldap_pvt_thread_mutex_unlock( &pConn->c_mutex );
216 void slapi_int_connection_destroy( Connection **pConn )
218 Connection *conn = *pConn;
221 if ( pConn == NULL ) {
225 op = (Operation *)conn->c_pending_ops.stqh_first;
227 slap_graduate_commit_csn( op );
229 if ( op->o_req_dn.bv_val != NULL ) {
230 slapi_ch_free( (void **)&op->o_req_dn.bv_val );
232 if ( op->o_req_ndn.bv_val != NULL ) {
233 slapi_ch_free( (void **)&op->o_req_ndn.bv_val );
236 if ( conn->c_sb != NULL ) {
237 ber_sockbuf_free( conn->c_sb );
240 slapi_ch_free( (void **)&op );
242 slapi_ch_free( (void **)pConn );
246 * Function : values2obj
247 * Convert an array of strings into a BerVarray.
258 if ( ppValue == NULL ) {
263 for ( i = 0; ppValue[i] != NULL; i++ )
266 tmpberval = (BerVarray)slapi_ch_malloc( (i+1) * (sizeof(struct berval)) );
267 if ( tmpberval == NULL ) {
268 return LDAP_NO_MEMORY;
270 for ( i = 0; ppValue[i] != NULL; i++ ) {
271 size_t len = strlen( ppValue[i] );
273 tmpberval[i].bv_val = slapi_ch_malloc( len + 1 );
274 AC_MEMCPY( tmpberval[i].bv_val, ppValue[i], len + 1 );
275 tmpberval[i].bv_len = len;
277 tmpberval[i].bv_val = NULL;
278 tmpberval[i].bv_len = 0;
287 struct berval **bvptr,
293 if ( bvptr == NULL ) {
298 for ( i = 0; bvptr[i] != NULL; i++ )
301 tmpberval = (BerVarray)slapi_ch_malloc( (i + 1) * sizeof(struct berval));
302 if ( tmpberval == NULL ) {
303 return LDAP_NO_MEMORY;
306 for ( i = 0; bvptr[i] != NULL; i++ ) {
307 tmpberval[i].bv_val = slapi_ch_malloc( bvptr[i]->bv_len );
308 tmpberval[i].bv_len = bvptr[i]->bv_len;
309 AC_MEMCPY( tmpberval[i].bv_val, bvptr[i]->bv_val, bvptr[i]->bv_len );
312 tmpberval[i].bv_val = NULL;
313 tmpberval[i].bv_len = 0;
321 * Function : slapi_int_ldapmod_to_entry
322 * convert a dn plus an array of LDAPMod struct ptrs to an entry structure
323 * with a link list of the correspondent attributes.
324 * Return value : LDAP_SUCCESS
329 slapi_int_ldapmod_to_entry(
334 struct berval dn = BER_BVNULL;
340 Modifications *modlist = NULL;
341 Modifications **modtail = &modlist;
344 int rc = LDAP_SUCCESS;
347 const char *text = NULL;
349 op = (Operation *)pConn->c_pending_ops.stqh_first;
351 pEntry = (Entry *) ch_calloc( 1, sizeof(Entry) );
352 if ( pEntry == NULL) {
358 dn.bv_len = strlen(ldn);
360 rc = dnPrettyNormal( NULL, &dn, &pEntry->e_name, &pEntry->e_nname, NULL );
361 if ( rc != LDAP_SUCCESS ) {
365 if ( rc == LDAP_SUCCESS ) {
366 for ( i = 0, pMod = mods[0]; rc == LDAP_SUCCESS && pMod != NULL; pMod = mods[++i]) {
369 if ( (pMod->mod_op & LDAP_MOD_BVALUES) != 0 ) {
371 * Convert an array of pointers to bervals to
372 * an array of bervals. Note that we need to copy the
373 * values too, as the slap_mods_check() will free the
374 * original values after prettying; the modifications
375 * being passed in may not have been allocated on the
378 rc = bvptr2obj_copy( pMod->mod_bvalues, &bv );
379 if ( rc != LDAP_SUCCESS ) goto cleanup;
380 tmp.sml_type.bv_val = pMod->mod_type;
381 tmp.sml_type.bv_len = strlen( pMod->mod_type );
383 tmp.sml_nvalues = NULL;
385 mod = (Modifications *) ch_malloc( sizeof(Modifications) );
387 mod->sml_op = LDAP_MOD_ADD;
389 mod->sml_next = NULL;
390 mod->sml_desc = NULL;
391 mod->sml_type = tmp.sml_type;
392 mod->sml_values = tmp.sml_values;
393 mod->sml_nvalues = tmp.sml_nvalues;
396 modtail = &mod->sml_next;
399 /* attr values are in string format, need to be converted */
400 /* to an array of bervals */
401 if ( pMod->mod_values == NULL ) {
404 rc = values2obj_copy( pMod->mod_values, &bv );
405 if ( rc != LDAP_SUCCESS ) goto cleanup;
406 tmp.sml_type.bv_val = pMod->mod_type;
407 tmp.sml_type.bv_len = strlen( pMod->mod_type );
409 tmp.sml_nvalues = NULL;
411 mod = (Modifications *) ch_malloc( sizeof(Modifications) );
413 mod->sml_op = LDAP_MOD_ADD;
415 mod->sml_next = NULL;
416 mod->sml_desc = NULL;
417 mod->sml_type = tmp.sml_type;
418 mod->sml_values = tmp.sml_values;
419 mod->sml_nvalues = tmp.sml_nvalues;
422 modtail = &mod->sml_next;
425 } /* for each LDAPMod */
428 op->o_bd = select_backend( &pEntry->e_nname, 0, 0 );
429 if ( op->o_bd == NULL ) {
430 rc = LDAP_PARTIAL_RESULTS;
432 int repl_user = be_isupdate_dn( op->o_bd, &op->o_bd->be_rootdn );
433 if ( !op->o_bd->be_update_ndn.bv_len || repl_user ) {
434 int update = !BER_BVISNULL( &op->o_bd->be_update_ndn );
435 char textbuf[ SLAP_TEXT_BUFLEN ];
436 size_t textlen = sizeof( textbuf );
438 rc = slap_mods_check( modlist, &text,
439 textbuf, textlen, NULL );
441 if ( rc != LDAP_SUCCESS) {
446 rc = slap_mods_no_user_mod_check( op, modlist,
447 &text, textbuf, textlen );
448 if ( rc != LDAP_SUCCESS) {
454 rc = slap_mods_opattrs( op, modlist, modtail,
455 &text, textbuf, textlen, 1 );
456 if ( rc != LDAP_SUCCESS) {
461 rc = slap_mods2entry( modlist, &pEntry, repl_user,
462 0, &text, textbuf, textlen );
463 if (rc != LDAP_SUCCESS) {
473 if ( modlist != NULL )
474 slap_mods_free( modlist );
475 if ( rc != LDAP_SUCCESS ) {
476 if ( pEntry != NULL ) {
477 slapi_entry_free( pEntry );
486 slapi_delete_internal_pb( Slapi_PBlock *pb )
489 Connection *pConn = NULL;
490 Operation *op = NULL;
491 SlapReply rs = { REP_RESULT };
492 struct berval dn = BER_BVNULL;
494 LDAPControl **controls = NULL;
495 int manageDsaIt = SLAP_CONTROL_NONE;
496 int operation_flags = 0;
503 slapi_pblock_get( pb, SLAPI_TARGET_DN, &ldn );
504 slapi_pblock_get( pb, SLAPI_REQCONTROLS, &controls );
505 slapi_pblock_get( pb, SLAPI_X_INTOP_FLAGS, &operation_flags );
508 rs.sr_err = LDAP_PARAM_ERROR;
512 pConn = slapi_int_init_connection( NULL, LDAP_REQ_DELETE );
514 rs.sr_err = LDAP_NO_MEMORY;
518 op = (Operation *)pConn->c_pending_ops.stqh_first;
519 op->o_ctrls = controls;
522 dn.bv_len = strlen(ldn);
524 rs.sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn, NULL );
525 if ( rs.sr_err != LDAP_SUCCESS )
528 if ( slapi_control_present( controls,
529 SLAPI_CONTROL_MANAGEDSAIT_OID, NULL, &isCritical) ) {
530 manageDsaIt = isCritical ? SLAP_CONTROL_CRITICAL : SLAP_CONTROL_NONCRITICAL;
533 op->o_bd = select_backend( &op->o_req_ndn, manageDsaIt, 1 );
534 if ( op->o_bd == NULL ) {
535 rs.sr_err = LDAP_PARTIAL_RESULTS;
539 op->o_dn = pConn->c_dn = op->o_bd->be_rootdn;
540 op->o_ndn = pConn->c_ndn = op->o_bd->be_rootndn;
542 if ( op->o_bd->be_delete ) {
543 int repl_user = be_isupdate( op );
544 if ( !op->o_bd->be_update_ndn.bv_len || repl_user ) {
545 slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
546 if ( operation_flags & SLAPI_OP_FLAG_LOG_CHANGE )
547 op->o_callback = &cb;
549 op->o_bd->be_delete( op, &rs );
551 rs.sr_err = LDAP_REFERRAL;
554 rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
558 slapi_pblock_set( pb, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs.sr_err );
559 slapi_pblock_set( pb, SLAPI_RESCONTROLS, (void *)rs.sr_ctrls );
561 slapi_int_connection_destroy( &pConn );
566 #endif /* LDAP_SLAPI */
570 slapi_add_internal_pb( Slapi_PBlock *pb )
573 Connection *pConn = NULL;
574 Slapi_Entry *entry = NULL;
575 Slapi_Entry *argEntry = NULL;
577 LDAPMod **mods = NULL;
578 LDAPControl **controls = NULL;
579 int operation_flags = 0;
580 Operation *op = NULL;
582 int manageDsaIt = SLAP_CONTROL_NONE;
586 SlapReply rs = { REP_RESULT };
592 pConn = slapi_int_init_connection( NULL, LDAP_REQ_ADD );
593 if ( pConn == NULL ) {
594 rs.sr_err = LDAP_OTHER;
598 slapi_pblock_get( pb, SLAPI_ADD_TARGET, &dn );
599 slapi_pblock_get( pb, SLAPI_ADD_ENTRY, &argEntry );
600 slapi_pblock_get( pb, SLAPI_MODIFY_MODS, &mods );
601 slapi_pblock_get( pb, SLAPI_REQCONTROLS, &controls );
602 slapi_pblock_get( pb, SLAPI_X_INTOP_FLAGS, &operation_flags );
604 if ( argEntry != NULL ) {
605 entry = slapi_entry_dup( argEntry );
606 dn = slapi_entry_get_dn( argEntry );
608 if ( mods == NULL || dn == NULL ) {
609 rs.sr_err = LDAP_PARAM_ERROR;
613 for ( i = 0; mods[i] != NULL; i++ ) {
614 if ( (mods[i]->mod_op & LDAP_MOD_OP ) != LDAP_MOD_ADD ) {
615 rs.sr_err = LDAP_OTHER;
620 entry = slapi_int_ldapmod_to_entry( pConn, dn, mods );
621 if ( entry == NULL ) {
622 rs.sr_err = LDAP_OTHER;
627 if ( slapi_control_present( controls, LDAP_CONTROL_MANAGEDSAIT,
628 NULL, &isCritical ) ) {
629 manageDsaIt = isCritical ? SLAP_CONTROL_CRITICAL : SLAP_CONTROL_NONCRITICAL;
632 op = (Operation *)pConn->c_pending_ops.stqh_first;
633 op->o_ctrls = controls;
635 op->o_bd = select_backend( &entry->e_nname, manageDsaIt, 1 );
636 if ( op->o_bd == NULL ) {
637 rs.sr_err = LDAP_PARTIAL_RESULTS;
641 op->o_dn = pConn->c_dn = op->o_bd->be_rootdn;
642 op->o_ndn = pConn->c_ndn = op->o_bd->be_rootndn;
643 op->oq_add.rs_e = entry;
645 if ( op->o_bd->be_add ) {
646 int repl_user = be_isupdate( op );
647 if ( !op->o_bd->be_update_ndn.bv_len || repl_user ) {
648 slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
650 if ( operation_flags & SLAPI_OP_FLAG_LOG_CHANGE )
651 op->o_callback = &cb;
653 if ( op->o_bd->be_add( op, &rs ) == LDAP_SUCCESS ) {
654 be_entry_release_w( op, entry );
658 rs.sr_err = LDAP_REFERRAL;
661 rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
665 slapi_pblock_set( pb, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs.sr_err );
666 slapi_pblock_set( pb, SLAPI_RESCONTROLS, (void *)rs.sr_ctrls );
668 if ( entry != NULL ) {
669 slapi_entry_free( entry );
672 slapi_int_connection_destroy( &pConn );
677 #endif /* LDAP_SLAPI */
681 slapi_modrdn_internal_pb( Slapi_PBlock *pb )
684 struct berval dn = BER_BVNULL;
685 struct berval newrdn = BER_BVNULL;
686 struct berval newsupdn = BER_BVNULL;
687 struct berval newSuperiorPretty = BER_BVNULL;
688 struct berval newSuperiorNormalized = BER_BVNULL;
689 Connection *pConn = NULL;
690 Operation *op = NULL;
691 int manageDsaIt = SLAP_CONTROL_NONE;
693 SlapReply rs = { REP_RESULT };
699 LDAPControl **controls;
706 slapi_pblock_get( pb, SLAPI_MODRDN_TARGET, &olddn );
707 slapi_pblock_get( pb, SLAPI_MODRDN_NEWRDN, &lnewrdn );
708 slapi_pblock_get( pb, SLAPI_MODRDN_NEWSUPERIOR, &newsuperior );
709 slapi_pblock_get( pb, SLAPI_MODRDN_DELOLDRDN, &deloldrdn );
710 slapi_pblock_get( pb, SLAPI_REQCONTROLS, &controls );
712 slapi_pblock_get( pb, SLAPI_TARGET_UNIQUEID, uniqueid );
713 slapi_pblock_get( pb, SLAPI_PLUGIN_IDENTITY, plugin_identity );
715 slapi_pblock_get( pb, SLAPI_X_INTOP_FLAGS, &operation_flags );
717 pConn = slapi_int_init_connection( NULL, LDAP_REQ_MODRDN );
718 if ( pConn == NULL) {
719 rs.sr_err = LDAP_NO_MEMORY;
723 op = (Operation *)pConn->c_pending_ops.stqh_first;
724 op->o_ctrls = controls;
726 if ( slapi_control_present( controls,
727 SLAPI_CONTROL_MANAGEDSAIT_OID, NULL, &isCritical ) ) {
728 manageDsaIt = isCritical ? SLAP_CONTROL_CRITICAL : SLAP_CONTROL_NONCRITICAL;
731 op->o_bd = select_backend( &op->o_req_ndn, manageDsaIt, 1 );
732 if ( op->o_bd == NULL ) {
733 rs.sr_err = LDAP_PARTIAL_RESULTS;
737 op->o_dn = pConn->c_dn = op->o_bd->be_rootdn;
738 op->o_ndn = pConn->c_ndn = op->o_bd->be_rootndn;
740 dn.bv_val = (char *)olddn;
741 dn.bv_len = strlen( olddn );
743 rs.sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn, NULL );
744 if ( rs.sr_err != LDAP_SUCCESS ) {
748 if ( op->o_req_dn.bv_len == 0 ) {
749 rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
753 newrdn.bv_val = (char *)lnewrdn;
754 newrdn.bv_len = strlen( lnewrdn );
756 rs.sr_err = dnPrettyNormal( NULL, &newrdn, &op->oq_modrdn.rs_newrdn, &op->oq_modrdn.rs_nnewrdn, NULL );
757 if ( rs.sr_err != LDAP_SUCCESS ) {
761 if ( rdn_validate( &op->oq_modrdn.rs_nnewrdn ) != LDAP_SUCCESS ) {
765 if ( newsuperior != NULL ) {
766 newsupdn.bv_val = (char *)newsuperior;
767 newsupdn.bv_len = strlen( newsuperior );
769 rs.sr_err = dnPrettyNormal( NULL, &newsupdn, &newSuperiorPretty, &newSuperiorNormalized, NULL );
770 if ( rs.sr_err != LDAP_SUCCESS )
773 op->oq_modrdn.rs_newSup = &newSuperiorPretty;
774 op->oq_modrdn.rs_nnewSup = &newSuperiorNormalized;
776 op->oq_modrdn.rs_newSup = NULL;
777 op->oq_modrdn.rs_nnewSup = NULL;
780 op->oq_modrdn.rs_deleteoldrdn = deloldrdn;
782 if ( op->o_bd->be_modrdn ) {
783 int repl_user = be_isupdate( op );
784 if ( !op->o_bd->be_update_ndn.bv_len || repl_user ) {
785 slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
787 if ( operation_flags & SLAPI_OP_FLAG_LOG_CHANGE )
788 op->o_callback = &cb;
790 op->o_bd->be_modrdn( op, &rs );
792 rs.sr_err = LDAP_REFERRAL;
795 rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
800 slapi_pblock_set( pb, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs.sr_err );
801 slapi_pblock_set( pb, SLAPI_RESCONTROLS, (void *)rs.sr_ctrls );
803 if ( op->oq_modrdn.rs_newrdn.bv_val != NULL )
804 slapi_ch_free( (void **)&op->oq_modrdn.rs_newrdn.bv_val );
805 if ( op->oq_modrdn.rs_nnewrdn.bv_val != NULL )
806 slapi_ch_free( (void **)&op->oq_modrdn.rs_nnewrdn.bv_val );
807 if ( newSuperiorPretty.bv_val != NULL )
808 slapi_ch_free( (void **)&newSuperiorPretty.bv_val );
809 if ( newSuperiorNormalized.bv_val != NULL )
810 slapi_ch_free( (void **)&newSuperiorNormalized.bv_val );
812 slapi_int_connection_destroy( &pConn );
817 #endif /* LDAP_SLAPI */
820 int slapi_modify_internal_pb( Slapi_PBlock *pb )
824 Connection *pConn = NULL;
825 Operation *op = NULL;
827 struct berval dn = BER_BVNULL;
829 int manageDsaIt = SLAP_CONTROL_NONE;
834 Modifications *modlist = NULL;
835 Modifications **modtail = &modlist;
838 SlapReply rs = { REP_RESULT };
841 LDAPMod **mods = NULL;
842 LDAPControl **controls = NULL;
843 int operation_flags = 0;
849 slapi_pblock_get( pb, SLAPI_MODIFY_TARGET, &ldn );
850 slapi_pblock_get( pb, SLAPI_MODIFY_MODS, &mods );
851 slapi_pblock_get( pb, SLAPI_REQCONTROLS, &controls );
853 slapi_pblock_get( pb, SLAPI_TARGET_UNIQUEID, uniqueid );
854 slapi_pblock_get( pb, SLAPI_PLUGIN_IDENTITY, plugin_identity );
856 slapi_pblock_get( pb, SLAPI_X_INTOP_FLAGS, &operation_flags );
858 if ( mods == NULL || *mods == NULL || ldn == NULL ) {
859 rs.sr_err = LDAP_PARAM_ERROR ;
863 pConn = slapi_int_init_connection( NULL, LDAP_REQ_MODIFY );
864 if ( pConn == NULL ) {
865 rs.sr_err = LDAP_NO_MEMORY;
869 op = (Operation *)pConn->c_pending_ops.stqh_first;
870 op->o_ctrls = controls;
873 dn.bv_len = strlen( ldn );
875 rs.sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn, NULL );
876 if ( rs.sr_err != LDAP_SUCCESS ) {
880 if ( slapi_control_present( controls,
881 SLAPI_CONTROL_MANAGEDSAIT_OID, NULL, &isCritical ) ) {
882 manageDsaIt = isCritical ? SLAP_CONTROL_CRITICAL : SLAP_CONTROL_NONCRITICAL;
885 op->o_bd = select_backend( &op->o_req_ndn, manageDsaIt, 1 );
886 if ( op->o_bd == NULL ) {
887 rs.sr_err = LDAP_PARTIAL_RESULTS;
891 op->o_dn = pConn->c_dn = op->o_bd->be_rootdn;
892 op->o_ndn = pConn->c_ndn = op->o_bd->be_rootndn;
894 for ( i = 0, pMod = mods[0];
895 rs.sr_err == LDAP_SUCCESS && pMod != NULL;
900 if ( (pMod->mod_op & LDAP_MOD_BVALUES) != 0 ) {
902 * attr values are in berval format
903 * convert an array of pointers to bervals
904 * to an array of bervals
906 rs.sr_err = bvptr2obj_copy( pMod->mod_bvalues, &bv );
907 if ( rs.sr_err != LDAP_SUCCESS )
909 tmp.sml_type.bv_val = pMod->mod_type;
910 tmp.sml_type.bv_len = strlen( pMod->mod_type );
912 tmp.sml_nvalues = NULL;
914 mod = (Modifications *)ch_malloc( sizeof(Modifications) );
916 mod->sml_op = pMod->mod_op & LDAP_MOD_OP;
918 mod->sml_next = NULL;
919 mod->sml_desc = NULL;
920 mod->sml_type = tmp.sml_type;
921 mod->sml_values = tmp.sml_values;
922 mod->sml_nvalues = tmp.sml_nvalues;
924 rs.sr_err = values2obj_copy( pMod->mod_values, &bv );
925 if ( rs.sr_err != LDAP_SUCCESS )
927 tmp.sml_type.bv_val = pMod->mod_type;
928 tmp.sml_type.bv_len = strlen( pMod->mod_type );
930 tmp.sml_nvalues = NULL;
932 mod = (Modifications *) ch_malloc( sizeof(Modifications) );
934 mod->sml_op = pMod->mod_op & LDAP_MOD_OP;
936 mod->sml_next = NULL;
937 mod->sml_desc = NULL;
938 mod->sml_type = tmp.sml_type;
939 mod->sml_values = tmp.sml_values;
940 mod->sml_nvalues = tmp.sml_nvalues;
943 modtail = &mod->sml_next;
945 switch( pMod->mod_op & LDAP_MOD_OP ) {
947 if ( mod->sml_values == NULL ) {
948 rs.sr_err = LDAP_PROTOCOL_ERROR;
953 case LDAP_MOD_DELETE:
954 case LDAP_MOD_REPLACE:
955 case LDAP_MOD_INCREMENT:
959 rs.sr_err = LDAP_PROTOCOL_ERROR;
965 if ( op->o_req_ndn.bv_len == 0 ) {
966 rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
970 op->oq_modify.rs_modlist = modlist;
972 if ( op->o_bd->be_modify ) {
973 int repl_user = be_isupdate( op );
974 if ( !op->o_bd->be_update_ndn.bv_len || repl_user ) {
975 int update = !BER_BVISEMPTY( &op->o_bd->be_update_ndn );
976 const char *text = NULL;
977 char textbuf[ SLAP_TEXT_BUFLEN ];
978 size_t textlen = sizeof( textbuf );
979 slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
981 rs.sr_err = slap_mods_check( modlist,
982 &text, textbuf, textlen, NULL );
983 if ( rs.sr_err != LDAP_SUCCESS ) {
988 rs.sr_err = slap_mods_no_user_mod_check( op, modlist,
989 &text, textbuf, textlen );
990 if ( rs.sr_err != LDAP_SUCCESS ) {
996 rs.sr_err = slap_mods_opattrs( op, modlist,
997 modtail, &text, textbuf,
999 if ( rs.sr_err != LDAP_SUCCESS ) {
1004 if ( operation_flags & SLAPI_OP_FLAG_LOG_CHANGE )
1005 op->o_callback = &cb;
1007 op->o_bd->be_modify( op, &rs );
1009 rs.sr_err = LDAP_REFERRAL;
1012 rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
1016 slapi_pblock_set( pb, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs.sr_err );
1017 slapi_pblock_set( pb, SLAPI_RESCONTROLS, (void *)rs.sr_ctrls );
1019 if ( modlist != NULL )
1020 slap_mods_free( modlist );
1022 slapi_int_connection_destroy( &pConn );
1027 #endif /* LDAP_SLAPI */
1032 slapi_int_search_entry_callback( Slapi_Entry *entry, void *callback_data )
1034 int nentries = 0, i = 0;
1035 Slapi_Entry **head = NULL, **tp;
1036 Slapi_PBlock *pb = (Slapi_PBlock *)callback_data;
1038 entry = slapi_entry_dup( entry );
1039 if ( entry == NULL ) {
1043 slapi_pblock_get( pb, SLAPI_NENTRIES, &nentries );
1044 slapi_pblock_get( pb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, &head );
1047 if ( nentries == 0 ) {
1048 tp = (Slapi_Entry **)slapi_ch_malloc( 2 * sizeof(Slapi_Entry *) );
1050 slapi_entry_free( entry );
1056 tp = (Slapi_Entry **)slapi_ch_realloc( (char *)head,
1057 sizeof(Slapi_Entry *) * ( i + 1 ) );
1059 slapi_entry_free( entry );
1062 tp[ i - 1 ] = entry;
1066 slapi_pblock_set( pb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, (void *)tp );
1067 slapi_pblock_set( pb, SLAPI_NENTRIES, (void *)i );
1069 return LDAP_SUCCESS;
1071 #endif /* LDAP_SLAPI */
1073 int slapi_search_internal_pb( Slapi_PBlock *pb )
1076 return slapi_search_internal_callback_pb( pb,
1079 slapi_int_search_entry_callback,
1086 int slapi_search_internal_callback_pb( Slapi_PBlock *pb,
1087 void *callback_data,
1088 plugin_result_callback prc,
1089 plugin_search_entry_callback psec,
1090 plugin_referral_entry_callback prec )
1094 Operation *op = NULL;
1095 struct berval dn = BER_BVNULL;
1096 Filter *filter=NULL;
1097 struct berval fstr = BER_BVNULL;
1098 AttributeName *an = NULL;
1099 const char *text = NULL;
1100 struct slapi_internal_args args;
1102 int manageDsaIt = SLAP_CONTROL_NONE;
1107 int scope = LDAP_SCOPE_BASE;
1108 char *filStr = NULL;
1109 LDAPControl **controls = NULL;
1110 char **attrs = NULL;
1111 char *uniqueid = NULL;
1113 int operation_flags = 0;
1116 SlapReply rs = { REP_RESULT };
1122 slapi_pblock_get( pb, SLAPI_SEARCH_TARGET, &ldn );
1123 slapi_pblock_get( pb, SLAPI_SEARCH_SCOPE, &scope );
1124 slapi_pblock_get( pb, SLAPI_SEARCH_FILTER, &filter );
1125 slapi_pblock_get( pb, SLAPI_SEARCH_STRFILTER, &filStr );
1126 slapi_pblock_get( pb, SLAPI_SEARCH_ATTRS, &attrs );
1127 slapi_pblock_get( pb, SLAPI_SEARCH_ATTRSONLY, &attrsonly );
1128 slapi_pblock_get( pb, SLAPI_REQCONTROLS, &controls );
1129 slapi_pblock_get( pb, SLAPI_TARGET_UNIQUEID, &uniqueid );
1130 slapi_pblock_get( pb, SLAPI_X_INTOP_FLAGS, &operation_flags );
1132 args.pb = pb; /* args pointer can be safely cast to Slapi_PBlock */
1133 args.callback_data = callback_data;
1134 args.result_callback = prc;
1135 args.search_entry_callback = psec;
1136 args.referral_entry_callback = prec;
1138 c = slapi_int_init_connection( NULL, LDAP_REQ_SEARCH );
1140 rs.sr_err = LDAP_NO_MEMORY;
1144 op = (Operation *)c->c_pending_ops.stqh_first;
1145 op->o_ctrls = controls;
1146 op->o_pb = (void *)&args;
1148 if ( ldn != NULL ) {
1150 dn.bv_len = strlen(ldn);
1153 rs.sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn, NULL );
1154 if ( rs.sr_err != LDAP_SUCCESS ) {
1158 if ( scope != LDAP_SCOPE_BASE &&
1159 scope != LDAP_SCOPE_ONELEVEL &&
1160 scope != LDAP_SCOPE_SUBTREE ) {
1161 rs.sr_err = LDAP_PROTOCOL_ERROR;
1165 if ( filter == NULL ) {
1166 if ( filStr == NULL ) {
1167 rs.sr_err = LDAP_PARAM_ERROR;
1171 filter = slapi_str2filter( filStr );
1172 if ( filter == NULL ) {
1173 rs.sr_err = LDAP_PROTOCOL_ERROR;
1180 filter2bv( filter, &fstr );
1182 for ( i = 0; attrs != NULL && attrs[i] != NULL; i++ ) {
1183 ; /* count the number of attributes */
1187 an = (AttributeName *)slapi_ch_calloc( (i + 1), sizeof(AttributeName) );
1188 for (i = 0; attrs[i] != 0; i++) {
1189 an[i].an_desc = NULL;
1191 an[i].an_oc_exclude = 0;
1192 an[i].an_name.bv_val = slapi_ch_strdup(attrs[i]);
1193 an[i].an_name.bv_len = strlen(attrs[i]);
1194 slap_bv2ad( &an[i].an_name, &an[i].an_desc, &text );
1196 an[i].an_name.bv_val = NULL;
1199 memset( &rs, 0, sizeof(rs) );
1200 rs.sr_type = REP_RESULT;
1201 rs.sr_err = LDAP_SUCCESS;
1202 rs.sr_entry = NULL; /* paranoia */
1204 if ( scope == LDAP_SCOPE_BASE ) {
1207 if ( op->o_req_ndn.bv_len == 0 ) {
1208 rs.sr_err = root_dse_info( c, &rs.sr_entry, &rs.sr_text );
1211 if( rs.sr_err != LDAP_SUCCESS ) {
1212 send_ldap_result( op, &rs );
1214 } else if ( rs.sr_entry != NULL ) {
1215 rs.sr_err = test_filter( op, rs.sr_entry, filter );
1217 if ( rs.sr_err == LDAP_COMPARE_TRUE ) {
1218 rs.sr_type = REP_SEARCH;
1219 rs.sr_err = LDAP_SUCCESS;
1221 rs.sr_operational_attrs = NULL;
1222 rs.sr_flags = REP_ENTRY_MODIFIABLE;
1224 send_search_entry( op, &rs );
1227 entry_free( rs.sr_entry );
1229 rs.sr_type = REP_RESULT;
1230 rs.sr_err = LDAP_SUCCESS;
1232 send_ldap_result( op, &rs );
1238 if ( !op->o_req_ndn.bv_len && default_search_nbase.bv_len ) {
1239 slapi_ch_free( (void **)&op->o_req_dn.bv_val );
1240 slapi_ch_free( (void **)&op->o_req_ndn.bv_val );
1242 ber_dupbv( &op->o_req_dn, &default_search_base );
1243 ber_dupbv( &op->o_req_ndn, &default_search_nbase );
1246 if ( slapi_control_present( controls,
1247 LDAP_CONTROL_MANAGEDSAIT, NULL, &isCritical ) ) {
1248 manageDsaIt = isCritical ? SLAP_CONTROL_CRITICAL : SLAP_CONTROL_NONCRITICAL;
1251 op->o_bd = select_backend( &op->o_req_ndn, manageDsaIt, 1 );
1252 if ( op->o_bd == NULL ) {
1253 if ( manageDsaIt > SLAP_CONTROL_NONE ) {
1254 rs.sr_err = LDAP_NO_SUCH_OBJECT;
1256 rs.sr_err = LDAP_PARTIAL_RESULTS;
1261 op->o_dn = c->c_dn = op->o_bd->be_rootdn;
1262 op->o_ndn = c->c_ndn = op->o_bd->be_rootndn;
1264 op->oq_search.rs_scope = scope;
1265 op->oq_search.rs_deref = 0;
1266 op->oq_search.rs_slimit = SLAP_NO_LIMIT;
1267 op->oq_search.rs_tlimit = SLAP_NO_LIMIT;
1268 op->oq_search.rs_attrsonly = attrsonly;
1269 op->oq_search.rs_attrs = an;
1270 op->oq_search.rs_filter = filter;
1271 op->oq_search.rs_filterstr = fstr;
1273 if ( op->o_bd->be_search != NULL ) {
1274 (*op->o_bd->be_search)( op, &rs );
1276 rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
1280 slapi_pblock_set( pb, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs.sr_err );
1281 slapi_pblock_set( pb, SLAPI_RESCONTROLS, (void *)rs.sr_ctrls );
1283 if ( freeFilter && filter != NULL )
1284 slapi_filter_free( filter, 1 );
1286 slapi_ch_free( (void **)&fstr.bv_val );
1288 slapi_ch_free( (void **)&an );
1290 slapi_int_connection_destroy( &c );
1295 #endif /* LDAP_SLAPI */
1298 /* Wrappers for old API */
1300 void slapi_search_internal_set_pb( Slapi_PBlock *pb,
1306 LDAPControl **controls,
1307 const char *uniqueid,
1308 Slapi_ComponentId *plugin_identity,
1309 int operation_flags )
1312 slapi_pblock_set( pb, SLAPI_SEARCH_TARGET, (void *)base );
1313 slapi_pblock_set( pb, SLAPI_SEARCH_SCOPE, (void *)scope );
1314 slapi_pblock_set( pb, SLAPI_SEARCH_FILTER, NULL );
1315 slapi_pblock_set( pb, SLAPI_SEARCH_STRFILTER, (void *)filter );
1316 slapi_pblock_set( pb, SLAPI_SEARCH_ATTRS, (void *)attrs );
1317 slapi_pblock_set( pb, SLAPI_SEARCH_ATTRSONLY, (void *)attrsonly );
1318 slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
1319 slapi_pblock_set( pb, SLAPI_TARGET_UNIQUEID, (void *)uniqueid );
1320 slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
1321 slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)operation_flags );
1322 #endif /* LDAP_SLAPI */
1326 slapi_search_internal(
1330 LDAPControl **controls,
1337 pb = slapi_pblock_new();
1342 slapi_search_internal_set_pb( pb, ldn, scope, filStr, attrs, attrsonly,
1343 controls, NULL, NULL, 0 );
1345 slapi_search_internal_pb( pb );
1350 #endif /* LDAP_SLAPI */
1353 void slapi_modify_internal_set_pb( Slapi_PBlock *pb,
1356 LDAPControl **controls,
1357 const char *uniqueid,
1358 Slapi_ComponentId *plugin_identity,
1359 int operation_flags )
1362 slapi_pblock_set( pb, SLAPI_MODIFY_TARGET, (void *)dn );
1363 slapi_pblock_set( pb, SLAPI_MODIFY_MODS, (void *)mods );
1364 slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
1365 slapi_pblock_set( pb, SLAPI_TARGET_UNIQUEID, (void *)uniqueid );
1366 slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
1367 slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)operation_flags );
1368 #endif /* LDAP_SLAPI */
1371 /* Function : slapi_modify_internal
1373 * Description: Plugin functions call this routine to modify an entry
1374 * in the backend directly
1375 * Return values : LDAP_SUCCESS
1379 * LDAP_UNWILLING_TO_PERFORM
1382 slapi_modify_internal(
1385 LDAPControl **controls,
1391 pb = slapi_pblock_new();
1396 slapi_modify_internal_set_pb( pb, ldn, mods, controls, NULL, NULL,
1397 log_change ? SLAPI_OP_FLAG_LOG_CHANGE : 0 );
1399 slapi_modify_internal_pb( pb );
1404 #endif /* LDAP_SLAPI */
1407 int slapi_add_internal_set_pb( Slapi_PBlock *pb,
1410 LDAPControl **controls,
1411 Slapi_ComponentId *plugin_identity,
1412 int operation_flags )
1415 slapi_pblock_set( pb, SLAPI_ADD_TARGET, (void *)dn );
1416 slapi_pblock_set( pb, SLAPI_MODIFY_MODS, (void *)attrs );
1417 slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
1418 slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
1419 slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)operation_flags );
1424 #endif /* LDAP_SLAPI */
1427 Slapi_PBlock *slapi_add_internal(
1430 LDAPControl **controls,
1436 pb = slapi_pblock_new();
1440 slapi_add_internal_set_pb( pb, dn, attrs, controls, NULL,
1441 log_changes ? SLAPI_OP_FLAG_LOG_CHANGE : 0 );
1443 slapi_add_internal_pb( pb );
1448 #endif /* LDAP_SLAPI */
1451 void slapi_add_entry_internal_set_pb( Slapi_PBlock *pb,
1453 LDAPControl **controls,
1454 Slapi_ComponentId *plugin_identity,
1455 int operation_flags )
1458 slapi_pblock_set( pb, SLAPI_ADD_ENTRY, (void *)e );
1459 slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
1460 slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
1461 slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)operation_flags );
1462 #endif /* LDAP_SLAPI */
1466 slapi_add_entry_internal(
1468 LDAPControl **controls,
1474 pb = slapi_pblock_new();
1478 slapi_add_entry_internal_set_pb( pb, e, controls, NULL,
1479 log_changes ? SLAPI_OP_FLAG_LOG_CHANGE : 0 );
1481 slapi_add_internal_pb( pb );
1486 #endif /* LDAP_SLAPI */
1489 void slapi_rename_internal_set_pb( Slapi_PBlock *pb,
1492 const char *newsuperior,
1494 LDAPControl **controls,
1495 const char *uniqueid,
1496 Slapi_ComponentId *plugin_identity,
1497 int operation_flags )
1500 slapi_pblock_set( pb, SLAPI_MODRDN_TARGET, (void *)olddn );
1501 slapi_pblock_set( pb, SLAPI_MODRDN_NEWRDN, (void *)newrdn );
1502 slapi_pblock_set( pb, SLAPI_MODRDN_NEWSUPERIOR, (void *)newsuperior );
1503 slapi_pblock_set( pb, SLAPI_MODRDN_DELOLDRDN, (void *)deloldrdn );
1504 slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
1505 slapi_pblock_set( pb, SLAPI_TARGET_UNIQUEID, (void *)uniqueid );
1506 slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
1507 slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)operation_flags );
1508 #endif /* LDAP_SLAPI */
1511 /* Function : slapi_modrdn_internal
1513 * Description : Plugin functions call this routine to modify the rdn
1514 * of an entry in the backend directly
1515 * Return values : LDAP_SUCCESS
1519 * LDAP_UNWILLING_TO_PERFORM
1521 * NOTE: This function does not support the "newSuperior" option from LDAP V3.
1524 slapi_modrdn_internal(
1528 LDAPControl **controls,
1534 pb = slapi_pblock_new();
1539 slapi_rename_internal_set_pb( pb, olddn, lnewrdn, NULL,
1540 deloldrdn, controls, NULL, NULL,
1541 log_change ? SLAPI_OP_FLAG_LOG_CHANGE : 0 );
1543 slapi_modrdn_internal_pb( pb );
1548 #endif /* LDAP_SLAPI */
1551 void slapi_delete_internal_set_pb( Slapi_PBlock *pb,
1553 LDAPControl **controls,
1554 const char *uniqueid,
1555 Slapi_ComponentId *plugin_identity,
1556 int operation_flags )
1559 slapi_pblock_set( pb, SLAPI_TARGET_DN, (void *)dn );
1560 slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
1561 slapi_pblock_set( pb, SLAPI_TARGET_UNIQUEID, (void *)uniqueid );
1562 slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
1563 slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)operation_flags );
1564 #endif /* LDAP_SLAPI */
1567 /* Function : slapi_delete_internal
1569 * Description : Plugin functions call this routine to delete an entry
1570 * in the backend directly
1571 * Return values : LDAP_SUCCESS
1575 * LDAP_UNWILLING_TO_PERFORM
1578 slapi_delete_internal(
1580 LDAPControl **controls,
1586 pb = slapi_pblock_new();
1590 slapi_delete_internal_set_pb( pb, ldn, controls, NULL, NULL,
1591 log_change ? SLAPI_OP_FLAG_LOG_CHANGE : 0 );
1593 slapi_delete_internal_pb( pb );
1598 #endif /* LDAP_SLAPI */