mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
SLAPI cleanup
This commit is contained in:
parent
02028df6c6
commit
2fdbc55374
@ -524,10 +524,7 @@ slap_mods2entry(
|
||||
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 );
|
||||
|
@ -514,9 +514,7 @@ do_bind(
|
||||
}
|
||||
|
||||
#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 );
|
||||
|
@ -263,9 +263,7 @@ do_compare(
|
||||
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 );
|
||||
|
@ -151,9 +151,7 @@ do_delete(
|
||||
}
|
||||
|
||||
#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 );
|
||||
|
||||
|
@ -253,13 +253,7 @@ do_extended(
|
||||
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;
|
||||
|
@ -324,9 +324,7 @@ do_modify(
|
||||
}
|
||||
|
||||
#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 );
|
||||
|
@ -310,9 +310,7 @@ do_modrdn(
|
||||
}
|
||||
|
||||
#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,
|
||||
|
@ -431,9 +431,7 @@ static char **anlist2charray( AttributeName *an )
|
||||
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 );
|
||||
|
@ -204,9 +204,7 @@ extern int slapi_audit_init_header( Connection *conn, Operation *op,
|
||||
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 **);
|
||||
|
@ -1353,7 +1353,7 @@ slapi_send_ldap_result(
|
||||
char *extOID = NULL;
|
||||
struct berval *extValue = NULL;
|
||||
int rc;
|
||||
SlapReply rs;
|
||||
SlapReply rs = { REP_RESULT };
|
||||
|
||||
slapi_pblock_get( pb, SLAPI_OPERATION, &op );
|
||||
|
||||
@ -1396,11 +1396,8 @@ slapi_send_ldap_search_entry(
|
||||
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;
|
||||
@ -1432,14 +1429,11 @@ slapi_send_ldap_search_entry(
|
||||
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 */
|
||||
@ -2085,12 +2079,12 @@ slapi_free_search_results_internal( Slapi_PBlock *pb )
|
||||
#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 );
|
||||
@ -2104,12 +2098,8 @@ int slapi_x_backend_set_pb( Slapi_PBlock *pb, Backend *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
|
||||
@ -2151,14 +2141,12 @@ static char *Authorization2AuthType( AuthorizationInformation *authz, int is_tls
|
||||
|
||||
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;
|
||||
|
||||
@ -2220,31 +2208,33 @@ int slapi_x_connection_set_pb( Slapi_PBlock *pb, Connection *conn )
|
||||
}
|
||||
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user