Commit 516fd0ff authored by Luke Howard's avatar Luke Howard
Browse files

First round of SLAPI cleanups - use slapi_int_XXX for internal functions

(slapi_x_XXX is still reserved for exported functions that are not part
of the SLAPI specification)
parent 2d948c71
......@@ -198,7 +198,7 @@ access_allowed(
#ifdef LDAP_SLAPI
if ( op->o_pb &&
!slapi_x_access_allowed( op, e, desc, val, access, state )) {
!slapi_int_access_allowed( op, e, desc, val, access, state )) {
/* ACL plugin denied access */
goto done;
}
......
......@@ -655,7 +655,7 @@ slap_entry2mods(
static void initAddPlugin( Operation *op,
struct berval *dn, Entry *e, int manageDSAit )
{
slapi_x_pblock_set_operation( op->o_pb, op );
slapi_int_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 );
......
......@@ -190,7 +190,7 @@ monitor_back_add_plugin( Backend *be, Entry *e_database )
int i, rc = LDAP_SUCCESS;
struct monitorinfo *mi = ( struct monitorinfo * )be->be_private;
if ( slapi_x_pblock_get_first( be, &pCurrentPB ) != LDAP_SUCCESS ) {
if ( slapi_int_pblock_get_first( be, &pCurrentPB ) != LDAP_SUCCESS ) {
/*
* LDAP_OTHER is returned if no plugins are installed
*/
......@@ -228,7 +228,7 @@ monitor_back_add_plugin( Backend *be, Entry *e_database )
i++;
} while ( ( slapi_x_pblock_get_next( &pCurrentPB ) == LDAP_SUCCESS )
} while ( ( slapi_int_pblock_get_next( &pCurrentPB ) == LDAP_SUCCESS )
&& ( pCurrentPB != NULL ) );
done:
......
......@@ -751,7 +751,7 @@ backend_unbind( Operation *op, SlapReply *rs )
#if defined( LDAP_SLAPI )
if ( op->o_pb ) {
int rc;
if ( i == 0 ) slapi_x_pblock_set_operation( op->o_pb, op );
if ( i == 0 ) slapi_int_pblock_set_operation( op->o_pb, op );
slapi_pblock_set( op->o_pb, SLAPI_BACKEND, (void *)&backends[i] );
rc = doPluginFNs( &backends[i], SLAPI_PLUGIN_PRE_UNBIND_FN,
(Slapi_PBlock *)op->o_pb );
......
......@@ -368,7 +368,7 @@ do_bind(
* SASL bind.
*/
if ( pb ) {
slapi_x_pblock_set_operation( pb, op );
slapi_int_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->orb_cred );
......@@ -531,7 +531,7 @@ do_bind(
#if defined( LDAP_SLAPI )
if ( pb ) {
int rc;
slapi_x_pblock_set_operation( pb, op );
slapi_int_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->orb_cred );
......
......@@ -260,7 +260,7 @@ do_compare(
#if defined( LDAP_SLAPI )
#define pb op->o_pb
if ( pb ) {
slapi_x_pblock_set_operation( pb, op );
slapi_int_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 );
......
......@@ -162,7 +162,7 @@ int connections_destroy(void)
ldap_pvt_thread_cond_destroy( &connections[i].c_write_cv );
#ifdef LDAP_SLAPI
if ( slapi_plugins_used ) {
slapi_x_free_object_extensions( SLAPI_X_EXT_CONNECTION, &connections[i] );
slapi_int_free_object_extensions( SLAPI_X_EXT_CONNECTION, &connections[i] );
}
#endif
}
......@@ -496,7 +496,7 @@ long connection_init(
#ifdef LDAP_SLAPI
if ( slapi_plugins_used ) {
slapi_x_create_object_extensions( SLAPI_X_EXT_CONNECTION, c );
slapi_int_create_object_extensions( SLAPI_X_EXT_CONNECTION, c );
}
#endif
......@@ -734,7 +734,7 @@ connection_destroy( Connection *c )
#ifdef LDAP_SLAPI
/* call destructors, then constructors; avoids unnecessary allocation */
if ( slapi_plugins_used ) {
slapi_x_clear_object_extensions( SLAPI_X_EXT_CONNECTION, c );
slapi_int_clear_object_extensions( SLAPI_X_EXT_CONNECTION, c );
}
#endif
}
......
......@@ -164,7 +164,7 @@ do_delete(
#if defined( LDAP_SLAPI )
#define pb op->o_pb
if ( pb ) {
slapi_x_pblock_set_operation( pb, op );
slapi_int_pblock_set_operation( pb, op );
slapi_pblock_set( pb, SLAPI_DELETE_TARGET, (void *)dn.bv_val );
slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)manageDSAit );
......
......@@ -261,7 +261,7 @@ do_extended(
goto done;
}
rs->sr_err = slapi_x_pblock_set_operation( pb, op );
rs->sr_err = slapi_int_pblock_set_operation( pb, op );
if ( rs->sr_err != LDAP_SUCCESS ) {
rs->sr_err = LDAP_OTHER;
goto done;
......
......@@ -392,10 +392,10 @@ do_modify(
#if defined( LDAP_SLAPI )
#define pb op->o_pb
if ( pb ) {
slapi_x_pblock_set_operation( pb, op );
slapi_int_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 );
modv = slapi_int_modifications2ldapmods( &modlist );
slapi_pblock_set( pb, SLAPI_MODIFY_MODS, (void *)modv );
rs->sr_err = doPluginFNs( op->o_bd, SLAPI_PLUGIN_PRE_MODIFY_FN, pb );
......@@ -415,7 +415,7 @@ do_modify(
rs->sr_err == LDAP_SUCCESS ) {
rs->sr_err = LDAP_OTHER;
}
slapi_x_free_ldapmods( modv );
slapi_int_free_ldapmods( modv );
modv = NULL;
goto cleanup;
}
......@@ -425,11 +425,11 @@ do_modify(
* modification array, so we need to convert it back to
* a Modification list.
*
* Calling slapi_x_modifications2ldapmods() destroyed modlist so
* Calling slapi_int_modifications2ldapmods() destroyed modlist so
* we don't need to free it.
*/
slapi_pblock_get( pb, SLAPI_MODIFY_MODS, (void **)&modv );
modlist = slapi_x_ldapmods2modifications( modv );
modlist = slapi_int_ldapmods2modifications( modv );
}
/*
......@@ -437,7 +437,7 @@ do_modify(
* (for example, a plugin might store some attributes elsewhere
* and remove them from the modification list; if only those
* attribute types were included in the modification request,
* then slapi_x_ldapmods2modifications() above will return
* then slapi_int_ldapmods2modifications() above will return
* NULL).
*
* However, the post-operation plugin should still be
......@@ -566,7 +566,7 @@ cleanup:
op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx );
if ( modlist != NULL ) slap_mods_free( modlist );
#if defined( LDAP_SLAPI )
if ( modv != NULL ) slapi_x_free_ldapmods( modv );
if ( modv != NULL ) slapi_int_free_ldapmods( modv );
#endif
return rs->sr_err;
}
......
......@@ -316,7 +316,7 @@ do_modrdn(
#if defined( LDAP_SLAPI )
#define pb op->o_pb
if ( pb ) {
slapi_x_pblock_set_operation( pb, op );
slapi_int_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,
......
......@@ -101,7 +101,7 @@ slap_op_free( Operation *op )
#if defined( LDAP_SLAPI )
if ( op->o_pb != NULL ) {
slapi_pblock_destroy( (Slapi_PBlock *)op->o_pb );
slapi_x_free_object_extensions( SLAPI_X_EXT_OPERATION, op );
slapi_int_free_object_extensions( SLAPI_X_EXT_OPERATION, op );
}
#endif /* defined( LDAP_SLAPI ) */
......@@ -157,7 +157,7 @@ slap_op_alloc(
#if defined( LDAP_SLAPI )
if ( slapi_plugins_used ) {
op->o_pb = slapi_pblock_new();
slapi_x_create_object_extensions( SLAPI_X_EXT_OPERATION, op );
slapi_int_create_object_extensions( SLAPI_X_EXT_OPERATION, op );
}
#endif /* defined( LDAP_SLAPI ) */
......
......@@ -585,7 +585,7 @@ slap_send_ldap_result( Operation *op, SlapReply *rs )
* result if they wish to change the result.
*/
if ( op->o_pb ) {
slapi_x_pblock_set_operation( op->o_pb, op );
slapi_int_pblock_set_operation( op->o_pb, op );
slapi_pblock_set( op->o_pb, SLAPI_RESULT_CODE, (void *)rs->sr_err );
slapi_pblock_set( op->o_pb, SLAPI_RESULT_TEXT, (void *)rs->sr_text );
slapi_pblock_set( op->o_pb, SLAPI_RESULT_MATCHED, (void *)rs->sr_matched );
......@@ -1181,7 +1181,7 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
if ( rs->sr_attrs != NULL ) {
for ( anp = rs->sr_attrs; anp->an_name.bv_val != NULL; anp++ ) {
rc = compute_evaluator( &ctx, anp->an_name.bv_val,
rs->sr_entry, slapi_x_compute_output_ber );
rs->sr_entry, slapi_int_compute_output_ber );
if ( rc == 1 ) {
break;
}
......@@ -1193,7 +1193,7 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
* plugin decide whether to be naughty or not.
*/
rc = compute_evaluator( &ctx, "*",
rs->sr_entry, slapi_x_compute_output_ber );
rs->sr_entry, slapi_int_compute_output_ber );
}
if ( rc == 1 ) {
if ( op->o_res_ber == NULL ) ber_free_buf( ber );
......
......@@ -451,7 +451,7 @@ static char **anlist2charray( Operation *op, AttributeName *an )
static void initSearchPlugin( Operation *op,
char **attrs, int managedsait )
{
slapi_x_pblock_set_operation( op->o_pb, op );
slapi_int_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->ors_scope );
slapi_pblock_set( op->o_pb, SLAPI_SEARCH_DEREF, (void *)op->ors_deref );
......
......@@ -767,7 +767,7 @@ slapi_init(void)
return -1;
}
if ( slapi_x_init_object_extensions() != 0 ) {
if ( slapi_int_init_object_extensions() != 0 ) {
return -1;
}
......
......@@ -222,20 +222,20 @@ 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_pblock_set_operation( Slapi_PBlock *pb, Operation *op );
extern int slapi_int_pblock_set_operation( Slapi_PBlock *pb, Operation *op );
extern LDAPMod **slapi_x_modifications2ldapmods(Modifications **);
extern Modifications *slapi_x_ldapmods2modifications(LDAPMod **);
extern void slapi_x_free_ldapmods(LDAPMod **);
extern LDAPMod **slapi_int_modifications2ldapmods(Modifications **);
extern Modifications *slapi_int_ldapmods2modifications(LDAPMod **);
extern void slapi_int_free_ldapmods(LDAPMod **);
extern int slapi_compute_add_evaluator(slapi_compute_callback_t function);
extern int slapi_compute_add_search_rewriter(slapi_search_rewrite_callback_t function);
extern int compute_rewrite_search_filter(Slapi_PBlock *pb);
extern int compute_evaluator(computed_attr_context *c, char *type, Slapi_Entry *e, slapi_compute_output_t outputfn);
extern int slapi_x_compute_output_ber(computed_attr_context *c, Slapi_Attr *a, Slapi_Entry *e);
extern int slapi_int_compute_output_ber(computed_attr_context *c, Slapi_Attr *a, Slapi_Entry *e);
extern int slapi_x_compute_get_pblock(computed_attr_context *c, Slapi_PBlock **pb);
extern int slapi_x_access_allowed(Operation *op, Entry *entry, AttributeDescription *desc, struct berval *val, slap_access_t access, AccessControlState *state);
extern int slapi_int_access_allowed(Operation *op, Entry *entry, AttributeDescription *desc, struct berval *val, slap_access_t access, AccessControlState *state);
extern ldap_pvt_thread_mutex_t slapi_hn_mutex;
extern ldap_pvt_thread_mutex_t slapi_time_mutex;
......@@ -259,8 +259,8 @@ extern void slapi_pblock_clear( Slapi_PBlock *pb );
/*
* OpenLDAP extensions
*/
extern int slapi_x_pblock_get_first( Backend *be, Slapi_PBlock **pb );
extern int slapi_x_pblock_get_next( Slapi_PBlock **pb );
extern int slapi_int_pblock_get_first( Backend *be, Slapi_PBlock **pb );
extern int slapi_int_pblock_get_next( Slapi_PBlock **pb );
/*
......@@ -328,10 +328,10 @@ extern int slapi_modifyrdn_changelog(char *olddn, char *newRdn, int delRdn,
char *suffix, char *chNum, Operation* op);
extern Backend * slapi_cl_get_be(char *dn);
int slapi_x_init_object_extensions(void);
int slapi_x_free_object_extensions(int objecttype, void *object);
int slapi_x_create_object_extensions(int objecttype, void *object);
int slapi_x_clear_object_extensions(int objecttype, void *object);
int slapi_int_init_object_extensions(void);
int slapi_int_free_object_extensions(int objecttype, void *object);
int slapi_int_create_object_extensions(int objecttype, void *object);
int slapi_int_clear_object_extensions(int objecttype, void *object);
LDAP_END_DECL
......
......@@ -232,7 +232,7 @@ int slapi_register_object_extension(
#endif /* LDAP_SLAPI */
}
int slapi_x_create_object_extensions(int objecttype, void *object)
int slapi_int_create_object_extensions(int objecttype, void *object)
{
#ifdef LDAP_SLAPI
int i, rc;
......@@ -285,7 +285,7 @@ int slapi_x_create_object_extensions(int objecttype, void *object)
#endif
}
int slapi_x_free_object_extensions(int objecttype, void *object)
int slapi_int_free_object_extensions(int objecttype, void *object)
{
#ifdef LDAP_SLAPI
int i, rc;
......@@ -326,7 +326,7 @@ int slapi_x_free_object_extensions(int objecttype, void *object)
}
/* for reusable object types */
int slapi_x_clear_object_extensions(int objecttype, void *object)
int slapi_int_clear_object_extensions(int objecttype, void *object)
{
#ifdef LDAP_SLAPI
int i, rc;
......@@ -356,7 +356,7 @@ int slapi_x_clear_object_extensions(int objecttype, void *object)
#endif
}
int slapi_x_init_object_extensions(void)
int slapi_int_init_object_extensions(void)
{
#ifdef LDAP_SLAPI
memset( &registered_extensions, 0, sizeof( registered_extensions ) );
......
......@@ -516,7 +516,7 @@ slapi_pblock_check_params( Slapi_PBlock *pb, int flag )
* OpenLDAP extension
*/
int
slapi_x_pblock_get_first( Backend *be, Slapi_PBlock **pb )
slapi_int_pblock_get_first( Backend *be, Slapi_PBlock **pb )
{
#if defined(LDAP_SLAPI)
assert( pb );
......@@ -531,7 +531,7 @@ slapi_x_pblock_get_first( Backend *be, Slapi_PBlock **pb )
* OpenLDAP extension
*/
int
slapi_x_pblock_get_next( Slapi_PBlock **pb )
slapi_int_pblock_get_next( Slapi_PBlock **pb )
{
#if defined(LDAP_SLAPI)
assert( pb );
......
......@@ -2430,7 +2430,7 @@ static int initConnectionPB( Slapi_PBlock *pb, Connection *conn )
/*
* Internal API to prime a Slapi_PBlock with an Operation.
*/
int slapi_x_pblock_set_operation( Slapi_PBlock *pb, Operation *op )
int slapi_int_pblock_set_operation( Slapi_PBlock *pb, Operation *op )
{
#ifdef LDAP_SLAPI
int isRoot = 0;
......@@ -3308,7 +3308,7 @@ int slapi_acl_check_mods(Slapi_PBlock *pb, Slapi_Entry *e, LDAPMod **mods, char
return LDAP_PARAM_ERROR;
}
ml = slapi_x_ldapmods2modifications( mods );
ml = slapi_int_ldapmods2modifications( mods );
if ( ml == NULL ) {
return LDAP_OTHER;
}
......@@ -3347,7 +3347,7 @@ int slapi_acl_check_mods(Slapi_PBlock *pb, Slapi_Entry *e, LDAPMod **mods, char
*
* This function must also be called before slap_mods_check().
*/
LDAPMod **slapi_x_modifications2ldapmods(Modifications **pmodlist)
LDAPMod **slapi_int_modifications2ldapmods(Modifications **pmodlist)
{
#ifdef LDAP_SLAPI
Modifications *ml, *modlist;
......@@ -3407,9 +3407,9 @@ LDAPMod **slapi_x_modifications2ldapmods(Modifications **pmodlist)
*
* The returned Modification list contains pointers into the
* LDAPMods array; the latter MUST be freed with
* slapi_x_free_ldapmods() (see below).
* slapi_int_free_ldapmods() (see below).
*/
Modifications *slapi_x_ldapmods2modifications (LDAPMod **mods)
Modifications *slapi_int_ldapmods2modifications (LDAPMod **mods)
{
#ifdef LDAP_SLAPI
Modifications *modlist = NULL, **modtail;
......@@ -3472,10 +3472,10 @@ Modifications *slapi_x_ldapmods2modifications (LDAPMod **mods)
/*
* This function only frees the parts of the mods array that
* are not shared with the Modification list that was created
* by slapi_x_ldapmods2modifications().
* by slapi_int_ldapmods2modifications().
*
*/
void slapi_x_free_ldapmods (LDAPMod **mods)
void slapi_int_free_ldapmods (LDAPMod **mods)
{
#ifdef LDAP_SLAPI
int i, j;
......@@ -3515,7 +3515,7 @@ void slapi_x_free_ldapmods (LDAPMod **mods)
* op->o_callback->sc_sendentry, if you wish to make computed
* attributes available to it.
*/
int slapi_x_compute_output_ber(computed_attr_context *c, Slapi_Attr *a, Slapi_Entry *e)
int slapi_int_compute_output_ber(computed_attr_context *c, Slapi_Attr *a, Slapi_Entry *e)
{
#ifdef LDAP_SLAPI
Operation *op = NULL;
......@@ -3563,7 +3563,7 @@ int slapi_x_compute_output_ber(computed_attr_context *c, Slapi_Attr *a, Slapi_En
}
if ( !access_allowed( op, e, desc, NULL, ACL_READ, &c->cac_acl_state) ) {
slapi_log_error( SLAPI_LOG_ACL, "slapi_x_compute_output_ber",
slapi_log_error( SLAPI_LOG_ACL, "slapi_int_compute_output_ber",
"acl: access to attribute %s not allowed\n",
desc->ad_cname.bv_val );
return 0;
......@@ -3571,7 +3571,7 @@ int slapi_x_compute_output_ber(computed_attr_context *c, Slapi_Attr *a, Slapi_En
rc = ber_printf( ber, "{O[" /*]}*/ , &desc->ad_cname );
if (rc == -1 ) {
slapi_log_error( SLAPI_LOG_BER, "slapi_x_compute_output_ber",
slapi_log_error( SLAPI_LOG_BER, "slapi_int_compute_output_ber",
"ber_printf failed\n");
return 1;
}
......@@ -3580,7 +3580,7 @@ int slapi_x_compute_output_ber(computed_attr_context *c, Slapi_Attr *a, Slapi_En
for ( i = 0; a->a_vals[i].bv_val != NULL; i++ ) {
if ( !access_allowed( op, e,
desc, &a->a_vals[i], ACL_READ, &c->cac_acl_state)) {
slapi_log_error( SLAPI_LOG_ACL, "slapi_x_compute_output_ber",
slapi_log_error( SLAPI_LOG_ACL, "slapi_int_compute_output_ber",
"conn %lu "
"acl: access to %s, value %d not allowed\n",
op->o_connid, desc->ad_cname.bv_val, i );
......@@ -3588,7 +3588,7 @@ int slapi_x_compute_output_ber(computed_attr_context *c, Slapi_Attr *a, Slapi_En
}
if (( rc = ber_printf( ber, "O", &a->a_vals[i] )) == -1 ) {
slapi_log_error( SLAPI_LOG_BER, "slapi_x_compute_output_ber",
slapi_log_error( SLAPI_LOG_BER, "slapi_int_compute_output_ber",
"ber_printf failed\n");
return 1;
}
......@@ -3596,7 +3596,7 @@ int slapi_x_compute_output_ber(computed_attr_context *c, Slapi_Attr *a, Slapi_En
}
if (( rc = ber_printf( ber, /*{[*/ "]N}" )) == -1 ) {
slapi_log_error( SLAPI_LOG_BER, "slapi_x_compute_output_ber",
slapi_log_error( SLAPI_LOG_BER, "slapi_int_compute_output_ber",
"ber_printf failed\n" );
return 1;
}
......@@ -3883,7 +3883,7 @@ int slapi_notify_condvar( Slapi_CondVar *cvar, int notify_all )
#endif
}
int slapi_x_access_allowed( Operation *op,
int slapi_int_access_allowed( Operation *op,
Entry *entry,
AttributeDescription *desc,
struct berval *val,
......@@ -3922,7 +3922,7 @@ int slapi_x_access_allowed( Operation *op,
return 1;
}
slapi_x_pblock_set_operation( op->o_pb, op );
slapi_int_pblock_set_operation( op->o_pb, op );
rc = 1; /* default allow policy */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment