]> git.sur5r.net Git - openldap/commitdiff
ITS#6227
authorQuanah Gibson-Mount <quanah@openldap.org>
Mon, 27 Jul 2009 20:26:41 +0000 (20:26 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Mon, 27 Jul 2009 20:26:41 +0000 (20:26 +0000)
CHANGES
contrib/slapd-modules/autogroup/autogroup.c

diff --git a/CHANGES b/CHANGES
index bc32a3f92ee0c305cb584860600e5040cb1133a6..7f08576d8fda90538757ed3caf52c96d35bf31b2 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -7,6 +7,7 @@ OpenLDAP 2.4.18 Engineering
        Fixed slapd tools to properly close database (ITS#6214)
        Fixed slapd-ndb startup (ITS#6203)
        Fixed tools resource leaks (ITS#6145)
+       Fixed contrib/autogroup with RE24 (ITS#6227)
        Build Environment
                Fixed test056-monitor with custom ports (ITS#6213)
 
index 9394cd677df6e177937626eb86a50a1cb8891a03..4d37f98fc63ab3d4a43b2c4392cf99b8cf5d79ed 100644 (file)
@@ -238,20 +238,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 +501,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 +528,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 +641,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 +671,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 +1251,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 +1430,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 +1441,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 +1462,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;
 }