static void initAddPlugin( Operation *op,
struct berval *dn, Entry *e, int manageDSAit )
{
- slapi_x_backend_set_pb( op->o_pb, op->o_bd );
- slapi_x_connection_set_pb( op->o_pb, op->o_conn );
- slapi_x_operation_set_pb( op->o_pb, op );
-
+ slapi_x_pblock_set_operation( op->o_pb, op );
slapi_pblock_set( op->o_pb, SLAPI_ADD_TARGET, (void *)dn->bv_val );
slapi_pblock_set( op->o_pb, SLAPI_ADD_ENTRY, (void *)e );
slapi_pblock_set( op->o_pb, SLAPI_MANAGEDSAIT, (void *)manageDSAit );
}
#if defined( LDAP_SLAPI )
- slapi_x_backend_set_pb( pb, op->o_bd );
- slapi_x_connection_set_pb( pb, op->o_conn );
- slapi_x_operation_set_pb( pb, op );
+ slapi_x_pblock_set_operation( pb, op );
slapi_pblock_set( pb, SLAPI_BIND_TARGET, (void *)dn.bv_val );
slapi_pblock_set( pb, SLAPI_BIND_METHOD, (void *)method );
slapi_pblock_set( pb, SLAPI_BIND_CREDENTIALS, (void *)&op->oq_bind.rb_cred );
ava.aa_desc->ad_cname.bv_val, 0 );
#if defined( LDAP_SLAPI )
- slapi_x_backend_set_pb( pb, op->o_bd );
- slapi_x_connection_set_pb( pb, op->o_conn );
- slapi_x_operation_set_pb( pb, op );
+ slapi_x_pblock_set_operation( pb, op );
slapi_pblock_set( pb, SLAPI_COMPARE_TARGET, (void *)dn.bv_val );
slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)manageDSAit );
slapi_pblock_set( pb, SLAPI_COMPARE_TYPE, (void *)desc.bv_val );
}
#if defined( LDAP_SLAPI )
- slapi_x_backend_set_pb( pb, op->o_bd );
- slapi_x_connection_set_pb( pb, op->o_conn );
- slapi_x_operation_set_pb( pb, op );
+ slapi_x_pblock_set_operation( pb, op );
slapi_pblock_set( pb, SLAPI_DELETE_TARGET, (void *)dn.bv_val );
slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)manageDSAit );
goto done;
}
- rs->sr_err = slapi_x_connection_set_pb( pb, op->o_conn );
- if ( rs->sr_err != LDAP_SUCCESS ) {
- rs->sr_err = LDAP_OTHER;
- goto done;
- }
-
- rs->sr_err = slapi_x_operation_set_pb( pb, op );
+ rs->sr_err = slapi_x_pblock_set_operation( pb, op );
if ( rs->sr_err != LDAP_SUCCESS ) {
rs->sr_err = LDAP_OTHER;
goto done;
}
#if defined( LDAP_SLAPI )
- slapi_x_backend_set_pb( pb, op->o_bd );
- slapi_x_connection_set_pb( pb, op->o_conn );
- slapi_x_operation_set_pb( pb, op );
+ slapi_x_pblock_set_operation( pb, op );
slapi_pblock_set( pb, SLAPI_MODIFY_TARGET, (void *)dn.bv_val );
slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)manageDSAit );
modv = slapi_x_modifications2ldapmods( &modlist );
}
#if defined( LDAP_SLAPI )
- slapi_x_backend_set_pb( pb, op->o_bd );
- slapi_x_connection_set_pb( pb, op->o_conn );
- slapi_x_operation_set_pb( pb, op );
+ slapi_x_pblock_set_operation( pb, op );
slapi_pblock_set( pb, SLAPI_MODRDN_TARGET, (void *)dn.bv_val );
slapi_pblock_set( pb, SLAPI_MODRDN_NEWRDN, (void *)newrdn.bv_val );
slapi_pblock_set( pb, SLAPI_MODRDN_NEWSUPERIOR,
static void initSearchPlugin( Operation *op,
char **attrs, int managedsait )
{
- slapi_x_backend_set_pb( op->o_pb, op->o_bd );
- slapi_x_connection_set_pb( op->o_pb, op->o_conn );
- slapi_x_operation_set_pb( op->o_pb, op );
+ slapi_x_pblock_set_operation( op->o_pb, op );
slapi_pblock_set( op->o_pb, SLAPI_SEARCH_TARGET, (void *)op->o_req_dn.bv_val );
slapi_pblock_set( op->o_pb, SLAPI_SEARCH_SCOPE, (void *)op->oq_search.rs_scope );
slapi_pblock_set( op->o_pb, SLAPI_SEARCH_DEREF, (void *)op->oq_search.rs_deref );
extern int slapi_audit_send_record( Slapi_PBlock *pb, Connection *conn,
Operation *op, int rc);
-extern int slapi_x_backend_set_pb( Slapi_PBlock *pb, Backend *be );
-extern int slapi_x_connection_set_pb( Slapi_PBlock *pb, Connection *conn );
-extern int slapi_x_operation_set_pb( Slapi_PBlock *pb, Operation *op );
+extern int slapi_x_pblock_set_operation( Slapi_PBlock *pb, Operation *op );
extern LDAPMod **slapi_x_modifications2ldapmods(Modifications **);
extern Modifications *slapi_x_ldapmods2modifications(LDAPMod **);
char *extOID = NULL;
struct berval *extValue = NULL;
int rc;
- SlapReply rs;
+ SlapReply rs = { REP_RESULT };
slapi_pblock_get( pb, SLAPI_OPERATION, &op );
int attrsonly )
{
#ifdef LDAP_SLAPI
- Backend *be;
- Connection *pConn;
Operation *pOp;
- int rc;
- SlapReply rs;
+ SlapReply rs = { REP_RESULT };
int i;
AttributeName *an = NULL;
const char *text;
rs.sr_entry = e;
rs.sr_v2ref = NULL;
- if ( rc = slapi_pblock_get( pb, SLAPI_OPERATION, (void *)&pOp) != 0 ) {
- rc = LDAP_OTHER;
- } else {
- rc = send_search_entry( pOp, &rs );
+ if ( slapi_pblock_get( pb, SLAPI_OPERATION, (void *)&pOp ) != 0 ) {
+ return LDAP_OTHER;
}
- return rc;
-
+ return send_search_entry( pOp, &rs );
#else /* LDAP_SLAPI */
return -1;
#endif /* LDAP_SLAPI */
#endif /* LDAP_SLAPI */
}
+#ifdef LDAP_SLAPI
/*
* Internal API to prime a Slapi_PBlock with a Backend.
*/
-int slapi_x_backend_set_pb( Slapi_PBlock *pb, Backend *be )
+static int initBackendPB( Slapi_PBlock *pb, Backend *be )
{
-#ifdef LDAP_SLAPI
int rc;
rc = slapi_pblock_set( pb, SLAPI_BACKEND, (void *)be );
}
return LDAP_SUCCESS;
-#else
- return -1;
-#endif /* LDAP_SLAPI */
}
-#ifdef LDAP_SLAPI
/*
* If oldStyle is TRUE, then a value suitable for setting to
* the deprecated SLAPI_CONN_AUTHTYPE value is returned
return authType;
}
-#endif
/*
* Internal API to prime a Slapi_PBlock with a Connection.
*/
-int slapi_x_connection_set_pb( Slapi_PBlock *pb, Connection *conn )
+static int initConnectionPB( Slapi_PBlock *pb, Connection *conn )
{
-#ifdef LDAP_SLAPI
char *connAuthType;
int rc;
}
return rc;
-#else
- return -1;
-#endif /* LDAP_SLAPI */
}
+#endif /* LDAP_SLAPI */
/*
* Internal API to prime a Slapi_PBlock with an Operation.
*/
-int slapi_x_operation_set_pb( Slapi_PBlock *pb, Operation *op )
+int slapi_x_pblock_set_operation( Slapi_PBlock *pb, Operation *op )
{
#ifdef LDAP_SLAPI
int isRoot = 0;
int isUpdateDn = 0;
int rc;
- Backend *be;
char *opAuthType;
- if ( slapi_pblock_get(pb, SLAPI_BACKEND, (void *)&be ) != 0 ) {
- be = NULL;
+ if ( op->o_bd != NULL ) {
+ isRoot = be_isroot( op->o_bd, &op->o_ndn );
+ isUpdateDn = be_isupdate( op->o_bd, &op->o_ndn );
}
- if (be != NULL) {
- isRoot = be_isroot( be, &op->o_ndn );
- isUpdateDn = be_isupdate( be, &op->o_ndn );
- }
-
+
+ rc = initBackendPB( pb, op->o_bd );
+ if ( rc != LDAP_SUCCESS )
+ return rc;
+
+ rc = initConnectionPB( pb, op->o_conn );
+ if ( rc != LDAP_SUCCESS )
+ return rc;
+
rc = slapi_pblock_set( pb, SLAPI_OPERATION, (void *)op );
if ( rc != LDAP_SUCCESS )
return rc;