Fix db_open, delete unused variables. More cleanup is needed.

This commit is contained in:
Howard Chu 2009-07-24 06:47:05 +00:00
parent 048f24150f
commit c02131a8b8

View File

@ -196,8 +196,6 @@ autogroup_delete_member_from_group( Operation *op, BerValue *dn, BerValue *ndn,
static int
autogroup_member_search_cb( Operation *op, SlapReply *rs )
{
slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
assert( op->o_tag == LDAP_REQ_SEARCH );
if ( rs->sr_type == REP_SEARCH ) {
@ -238,20 +236,13 @@ autogroup_member_search_cb( Operation *op, SlapReply *rs )
static int
autogroup_member_search_modify_cb( Operation *op, SlapReply *rs )
{
slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
assert( op->o_tag == LDAP_REQ_SEARCH );
if ( rs->sr_type == REP_SEARCH ) {
autogroup_ga_t *agg = (autogroup_ga_t *)op->o_callback->sc_private;
autogroup_entry_t *age = agg->agg_group;
Operation o = *op;
Modifications *modlist;
SlapReply sreply = {REP_RESULT};
const char *text = NULL;
char textbuf[1024];
struct berval vals[ 2 ], nvals[ 2 ];
slap_callback cb = { NULL, slap_null_cb, NULL, NULL };
Debug(LDAP_DEBUG_TRACE, "==> autogroup_member_search_modify_cb <%s>\n",
rs->sr_entry ? rs->sr_entry->e_name.bv_val : "UNKNOWN_DN", 0, 0);
@ -508,11 +499,8 @@ cleanup:;
static int
autogroup_group_add_cb( Operation *op, SlapReply *rs )
{
slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
assert( op->o_tag == LDAP_REQ_SEARCH );
if ( rs->sr_type == REP_SEARCH ) {
autogroup_sc_t *ags = (autogroup_sc_t *)op->o_callback->sc_private;
@ -538,7 +526,6 @@ autogroup_add_entry( Operation *op, SlapReply *rs)
autogroup_def_t *agd = agi->agi_def;
autogroup_entry_t *age = agi->agi_entry;
autogroup_filter_t *agf;
Attribute *a;
int rc = 0;
Debug( LDAP_DEBUG_TRACE, "==> autogroup_add_entry <%s>\n",
@ -652,7 +639,6 @@ autogroup_delete_entry( Operation *op, SlapReply *rs)
{
slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
autogroup_info_t *agi = (autogroup_info_t *)on->on_bi.bi_private;
autogroup_def_t *agd = agi->agi_def;
autogroup_entry_t *age = agi->agi_entry,
*age_prev, *age_next;
autogroup_filter_t *agf;
@ -683,9 +669,6 @@ autogroup_delete_entry( Operation *op, SlapReply *rs)
dnMatch( &match, 0, NULL, NULL, &e->e_nname, &age->age_ndn );
if ( match == 0 ) {
autogroup_filter_t *agf = age->age_filter,
*agf_next;
autogroup_delete_group( agi, age );
break;
}
@ -1266,7 +1249,6 @@ ag_cfgen( ConfigArgs *c )
autogroup_entry_t *age_next, *age_prev;
autogroup_filter_t *agf,
*agf_next;
struct berval *bv;
ldap_pvt_thread_mutex_lock( &agi->agi_mutex );
@ -1446,8 +1428,7 @@ autogroup_db_open(
BackendDB *be,
ConfigReply *cr )
{
slap_overinst *on = (slap_overinst *) be->bd_info,
*on_bd;
slap_overinst *on = (slap_overinst *) be->bd_info;
autogroup_info_t *agi = on->on_bi.bi_private;
autogroup_def_t *agd;
autogroup_sc_t ags;
@ -1458,9 +1439,6 @@ autogroup_db_open(
void *thrctx = ldap_pvt_thread_pool_context();
Connection conn = { 0 };
OperationBuffer opbuf;
BerValue bv;
char *ptr;
int rc = 0;
Debug( LDAP_DEBUG_TRACE, "==> autogroup_db_open\n", 0, 0, 0);
@ -1482,31 +1460,28 @@ autogroup_db_open(
op->ors_slimit = SLAP_NO_LIMIT;
op->ors_attrs = slap_anlist_no_attrs;
op->o_bd = select_backend(&op->o_req_ndn, 0);
op->o_bd = be;
op->o_bd->bd_info = (BackendInfo *)on->on_info;
ags.ags_info = agi;
cb.sc_private = &ags;
cb.sc_response = autogroup_group_add_cb;
cb.sc_cleanup = NULL;
cb.sc_next = NULL;
op->o_callback = &cb;
ldap_pvt_thread_mutex_lock( &agi->agi_mutex );
for (agd = agi->agi_def ; agd ; agd = agd->agd_next) {
autogroup_build_def_filter(agd, op);
ags.ags_info = agi;
ags.ags_def = agd;
cb.sc_private = &ags;
cb.sc_response = autogroup_group_add_cb;
cb.sc_cleanup = NULL;
cb.sc_next = NULL;
op->o_callback = &cb;
op->o_bd->bd_info = (BackendInfo *)on->on_info;
op->o_bd->be_search( op, &rs );
op->o_bd->bd_info = (BackendInfo *)on;
filter_free_x( op, op->ors_filter, 1 );
op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
}
ldap_pvt_thread_mutex_unlock( &agi->agi_mutex );
return 0;
}