]> git.sur5r.net Git - openldap/blobdiff - contrib/slapd-modules/autogroup/autogroup.c
Happy New Year
[openldap] / contrib / slapd-modules / autogroup / autogroup.c
index 98155e1a7514a3e9240c2d93f1aa242e549097f2..57100b144ad0a5da089821e5ae8533b3575cd3dc 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2007-2015 The OpenLDAP Foundation.
+ * Copyright 2007-2018 The OpenLDAP Foundation.
  * Portions Copyright 2007 Michał Szulczyński.
  * Portions Copyright 2009 Howard Chu.
  * All rights reserved.
@@ -38,6 +38,8 @@
 #define        SLAPD_MEMBEROF_ATTR     "memberOf"
 #endif
 
+static slap_overinst   autogroup;
+
 /* Filter represents the memberURL of a group. */
 typedef struct autogroup_filter_t {
        struct berval                   agf_dn; /* The base DN in memberURL */
@@ -111,6 +113,8 @@ autogroup_add_member_to_group( Operation *op, BerValue *dn, BerValue *ndn, autog
        BerValue        *vals, *nvals;
        slap_callback   cb = { NULL, slap_null_cb, NULL, NULL };
        Operation       o = *op;
+       unsigned long opid = op->o_opid;
+       OpExtra oex;
 
        assert( dn != NULL );
        assert( ndn != NULL );
@@ -133,6 +137,7 @@ autogroup_add_member_to_group( Operation *op, BerValue *dn, BerValue *ndn, autog
        modlist->sml_flags = SLAP_MOD_INTERNAL;
        modlist->sml_next = NULL;
 
+       o.o_opid = 0;   /* shared with op, saved above */
        o.o_tag = LDAP_REQ_MODIFY;
        o.o_callback = &cb;
        o.orm_modlist = modlist;
@@ -141,14 +146,22 @@ autogroup_add_member_to_group( Operation *op, BerValue *dn, BerValue *ndn, autog
        o.o_req_dn = age->age_dn;
        o.o_req_ndn = age->age_ndn;
        o.o_permissive_modify = 1;
+       o.o_dont_replicate = 1;
+       o.orm_no_opattrs = 1;
        o.o_managedsait = SLAP_CONTROL_CRITICAL;
        o.o_relax = SLAP_CONTROL_CRITICAL;
 
+       oex.oe_key = (void *)&autogroup;
+       LDAP_SLIST_INSERT_HEAD( &o.o_extra, &oex, oe_next );
+
        o.o_bd->bd_info = (BackendInfo *)on->on_info;
        (void)op->o_bd->be_modify( &o, &sreply );
        o.o_bd->bd_info = (BackendInfo *)on;
 
+       LDAP_SLIST_REMOVE( &o.o_extra, &oex, OpExtra, oe_next );
+
        slap_mods_free( modlist, 1 );
+       op->o_opid = opid;
 
        return sreply.sr_err;
 }
@@ -165,6 +178,8 @@ autogroup_add_member_values_to_group( Operation *op, struct berval *dn, autogrou
        SlapReply       sreply = {REP_RESULT};
        slap_callback   cb = { NULL, slap_null_cb, NULL, NULL };
        Operation       o = *op;
+       unsigned long opid = op->o_opid;
+       OpExtra oex;
 
        Debug(LDAP_DEBUG_TRACE, "==> autogroup_add_member_values_to_group adding <%s> to <%s>\n",
                dn->bv_val, age->age_dn.bv_val, 0);
@@ -178,6 +193,7 @@ autogroup_add_member_values_to_group( Operation *op, struct berval *dn, autogrou
        modlist.sml_flags = SLAP_MOD_INTERNAL;
        modlist.sml_next = NULL;
 
+       o.o_opid = 0;
        o.o_tag = LDAP_REQ_MODIFY;
        o.o_callback = &cb;
        o.orm_modlist = &modlist;
@@ -186,12 +202,19 @@ autogroup_add_member_values_to_group( Operation *op, struct berval *dn, autogrou
        o.o_req_dn = age->age_dn;
        o.o_req_ndn = age->age_ndn;
        o.o_permissive_modify = 1;
+       o.o_dont_replicate = 1;
+       o.orm_no_opattrs = 1;
        o.o_managedsait = SLAP_CONTROL_CRITICAL;
        o.o_relax = SLAP_CONTROL_CRITICAL;
 
+       oex.oe_key = (void *)&autogroup;
+       LDAP_SLIST_INSERT_HEAD( &o.o_extra, &oex, oe_next );
+
        o.o_bd->bd_info = (BackendInfo *)on->on_info;
        (void)op->o_bd->be_modify( &o, &sreply );
        o.o_bd->bd_info = (BackendInfo *)on;
+       op->o_opid = opid;
+       LDAP_SLIST_REMOVE( &o.o_extra, &oex, OpExtra, oe_next );
 
        return sreply.sr_err;
 }
@@ -210,6 +233,8 @@ autogroup_delete_member_from_group( Operation *op, BerValue *dn, BerValue *ndn,
        BerValue        *vals, *nvals;
        slap_callback   cb = { NULL, slap_null_cb, NULL, NULL };
        Operation       o = *op;
+       unsigned long opid = op->o_opid;
+       OpExtra oex;
 
        if ( dn == NULL || ndn == NULL ) {
                Debug(LDAP_DEBUG_TRACE, "==> autogroup_delete_member_from_group removing all members from <%s>\n",
@@ -241,6 +266,7 @@ autogroup_delete_member_from_group( Operation *op, BerValue *dn, BerValue *ndn,
        modlist->sml_flags = SLAP_MOD_INTERNAL;
        modlist->sml_next = NULL;
 
+       o.o_opid = 0;
        o.o_callback = &cb;
        o.o_tag = LDAP_REQ_MODIFY;
        o.orm_modlist = modlist;
@@ -251,13 +277,21 @@ autogroup_delete_member_from_group( Operation *op, BerValue *dn, BerValue *ndn,
        o.o_relax = SLAP_CONTROL_CRITICAL;
        o.o_managedsait = SLAP_CONTROL_CRITICAL;
        o.o_permissive_modify = 1;
+       o.o_dont_replicate = 1;
+       o.orm_no_opattrs = 1;
+
+       oex.oe_key = (void *)&autogroup;
+       LDAP_SLIST_INSERT_HEAD( &o.o_extra, &oex, oe_next );
 
        o.o_bd->bd_info = (BackendInfo *)on->on_info;
        (void)op->o_bd->be_modify( &o, &sreply );
        o.o_bd->bd_info = (BackendInfo *)on;
 
+       LDAP_SLIST_REMOVE( &o.o_extra, &oex, OpExtra, oe_next );
+
        slap_mods_free( modlist, 1 );
 
+       op->o_opid = opid;
        return sreply.sr_err;
 }
 
@@ -273,6 +307,8 @@ autogroup_delete_member_values_from_group( Operation *op, struct berval *dn, aut
         SlapReply       sreply = {REP_RESULT};
         slap_callback   cb = { NULL, slap_null_cb, NULL, NULL };
         Operation       o = *op;
+       unsigned long opid = op->o_opid;
+       OpExtra oex;
 
         Debug(LDAP_DEBUG_TRACE, "==> autogroup_delete_member_values_from_group removing <%s> from <%s>\n",
                        dn->bv_val, age->age_dn.bv_val, 0);
@@ -286,6 +322,7 @@ autogroup_delete_member_values_from_group( Operation *op, struct berval *dn, aut
         modlist.sml_flags = SLAP_MOD_INTERNAL;
         modlist.sml_next = NULL;
 
+       o.o_opid = 0;
         o.o_tag = LDAP_REQ_MODIFY;
         o.o_callback = &cb;
         o.orm_modlist = &modlist;
@@ -294,12 +331,20 @@ autogroup_delete_member_values_from_group( Operation *op, struct berval *dn, aut
         o.o_req_dn = age->age_dn;
         o.o_req_ndn = age->age_ndn;
         o.o_permissive_modify = 1;
+       o.o_dont_replicate = 1;
+       o.orm_no_opattrs = 1;
         o.o_managedsait = SLAP_CONTROL_CRITICAL;
         o.o_relax = SLAP_CONTROL_CRITICAL;
 
+       oex.oe_key = (void *)&autogroup;
+       LDAP_SLIST_INSERT_HEAD( &o.o_extra, &oex, oe_next );
+
         o.o_bd->bd_info = (BackendInfo *)on->on_info;
         (void)op->o_bd->be_modify( &o, &sreply );
         o.o_bd->bd_info = (BackendInfo *)on;
+       op->o_opid = opid;
+
+       LDAP_SLIST_REMOVE( &o.o_extra, &oex, OpExtra, oe_next );
 
         return sreply.sr_err;
 }
@@ -452,6 +497,7 @@ autogroup_add_members_from_filter( Operation *op, Entry *e, autogroup_entry_t *a
        slap_callback           cb = { 0 };
        slap_callback           null_cb = { NULL, slap_null_cb, NULL, NULL };
        autogroup_ga_t          agg;
+       OpExtra oex;
 
        Debug(LDAP_DEBUG_TRACE, "==> autogroup_add_members_from_filter <%s>\n",
                age->age_dn.bv_val, 0, 0);
@@ -473,6 +519,7 @@ autogroup_add_members_from_filter( Operation *op, Entry *e, autogroup_entry_t *a
        o.ors_tlimit = SLAP_NO_LIMIT;
        o.ors_slimit = SLAP_NO_LIMIT;
        o.ors_attrs =  agf->agf_anlist ? agf->agf_anlist : slap_anlist_no_attrs;
+       o.o_do_not_cache = 1;
 
        agg.agg_group = age;
        agg.agg_filter = agf;
@@ -497,9 +544,12 @@ autogroup_add_members_from_filter( Operation *op, Entry *e, autogroup_entry_t *a
        o.o_bd->bd_info = (BackendInfo *)on;    
 
        if ( modify == 1 && agg.agg_mod ) {
+               unsigned long opid = op->o_opid;
+
                rs_reinit( &rs, REP_RESULT );
 
                o = *op;
+               o.o_opid = 0;
                o.o_callback = &null_cb;
                o.o_tag = LDAP_REQ_MODIFY;
                o.orm_modlist = agg.agg_mod;
@@ -510,12 +560,20 @@ autogroup_add_members_from_filter( Operation *op, Entry *e, autogroup_entry_t *a
                o.o_relax = SLAP_CONTROL_CRITICAL;
                o.o_managedsait = SLAP_CONTROL_NONCRITICAL;
                o.o_permissive_modify = 1;
+               o.o_dont_replicate = 1;
+               o.orm_no_opattrs = 1;
+
+       oex.oe_key = (void *)&autogroup;
+       LDAP_SLIST_INSERT_HEAD( &o.o_extra, &oex, oe_next );
 
                o.o_bd->bd_info = (BackendInfo *)on->on_info;
                (void)op->o_bd->be_modify( &o, &rs );
                o.o_bd->bd_info = (BackendInfo *)on;    
 
+       LDAP_SLIST_REMOVE( &o.o_extra, &oex, OpExtra, oe_next );
+
                slap_mods_free(agg.agg_mod, 1);
+               op->o_opid = opid;
        }
 
        return 0;
@@ -523,7 +581,7 @@ autogroup_add_members_from_filter( Operation *op, Entry *e, autogroup_entry_t *a
 
 /* 
 ** Adds a group to the internal list from the passed entry.
-** scan specifies whether to add all maching members to the group.
+** scan specifies whether to add all matching members to the group.
 ** modify specifies whether to modify the given group entry (when modify == 0),
 **     or to modify the group entry in the database (when modify == 1 and e = NULL and ndn != NULL).
 ** agi - pointer to the groups and the attribute definitions
@@ -743,7 +801,15 @@ autogroup_add_entry_cb( Operation *op, SlapReply *rs )
        } else {
                autogroup_entry_t       *age;
                autogroup_filter_t      *agf;
+               struct berval odn, ondn;
                int rc;
+
+               /* must use rootdn when calling test_filter */
+               odn = op->o_dn;
+               ondn = op->o_ndn;
+               op->o_dn = op->o_bd->be_rootdn;
+               op->o_ndn = op->o_bd->be_rootndn;
+
                for ( age = agi->agi_entry; age ; age = age->age_next ) {
                        ldap_pvt_thread_mutex_lock( &age->age_mutex );
 
@@ -767,6 +833,8 @@ autogroup_add_entry_cb( Operation *op, SlapReply *rs )
                        }
                        ldap_pvt_thread_mutex_unlock( &age->age_mutex );
                }
+               op->o_dn = odn;
+               op->o_ndn = ondn;
        }
        ldap_pvt_thread_mutex_unlock( &agi->agi_mutex );
 
@@ -791,7 +859,6 @@ autogroup_add_entry( Operation *op, SlapReply *rs)
        autogroup_def_t         *agd = agi->agi_def;
        slap_callback   *sc = NULL;
        ag_addinfo      *aa = NULL;
-       int                     rc = 0;
 
        Debug( LDAP_DEBUG_TRACE, "==> autogroup_add_entry <%s>\n", 
                op->ora_e->e_name.bv_val, 0, 0);
@@ -897,6 +964,13 @@ autogroup_delete_entry( Operation *op, SlapReply *rs)
        autogroup_filter_t      *agf;
        Entry                   *e;
        int                     matched_group = 0, rc = 0;
+       struct berval odn, ondn;
+       OpExtra *oex;
+
+       LDAP_SLIST_FOREACH( oex, &op->o_extra, oe_next ) {
+               if ( oex->oe_key == (void *)&autogroup )
+                       return SLAP_CB_CONTINUE;
+       }
 
        Debug( LDAP_DEBUG_TRACE, "==> autogroup_delete_entry <%s>\n", op->o_req_dn.bv_val, 0, 0);
 
@@ -940,6 +1014,11 @@ autogroup_delete_entry( Operation *op, SlapReply *rs)
        /* Check if the entry matches any of the groups.
           If yes, we can delete the entry from that group. */
 
+       odn = op->o_dn;
+       ondn = op->o_ndn;
+       op->o_dn = op->o_bd->be_rootdn;
+       op->o_ndn = op->o_bd->be_rootndn;
+
        for ( age = agi->agi_entry ; age ; age = age->age_next ) {
                ldap_pvt_thread_mutex_lock( &age->age_mutex );          
 
@@ -963,6 +1042,8 @@ autogroup_delete_entry( Operation *op, SlapReply *rs)
                }
                ldap_pvt_thread_mutex_unlock( &age->age_mutex );
        }
+       op->o_dn = odn;
+       op->o_ndn = ondn;
 
        overlay_entry_release_ov( op, e, 0, on );
        ldap_pvt_thread_mutex_unlock( &agi->agi_mutex );                
@@ -982,10 +1063,16 @@ autogroup_response( Operation *op, SlapReply *rs )
        Entry                   *e, *group;
        Attribute               *a, *ea, *attrs;
        int                     is_olddn, is_newdn, is_value_refresh, dn_equal;
+       OpExtra *oex;
+
+       LDAP_SLIST_FOREACH( oex, &op->o_extra, oe_next ) {
+               if ( oex->oe_key == (void *)&autogroup )
+                       break;
+       }
 
        /* Handle all cases where a refresh of the group is needed */
        if ( op->o_tag == LDAP_REQ_DELETE || op->o_tag == LDAP_REQ_MODIFY ) {
-               if ( rs->sr_type == REP_RESULT && rs->sr_err == LDAP_SUCCESS && !get_manageDSAit( op ) ) {
+               if ( rs->sr_type == REP_RESULT && rs->sr_err == LDAP_SUCCESS && !oex ) {
 
                        ldap_pvt_thread_mutex_lock( &agi->agi_mutex );
 
@@ -1008,7 +1095,7 @@ autogroup_response( Operation *op, SlapReply *rs )
                        ldap_pvt_thread_mutex_unlock( &agi->agi_mutex );
                }
        } else if ( op->o_tag == LDAP_REQ_MODRDN ) {
-               if ( rs->sr_type == REP_RESULT && rs->sr_err == LDAP_SUCCESS && !get_manageDSAit( op )) {
+               if ( rs->sr_type == REP_RESULT && rs->sr_err == LDAP_SUCCESS && !oex ) {
 
                        Debug( LDAP_DEBUG_TRACE, "==> autogroup_response MODRDN from <%s>\n", op->o_req_dn.bv_val, 0, 0);
 
@@ -1080,8 +1167,8 @@ autogroup_response( Operation *op, SlapReply *rs )
                        }
 
                        /* For each group: 
-                          1. check if the orginal entry's DN is in the group.
-                          2. chceck if the any of the group filter's base DN is a suffix of the new DN 
+                          1. check if the original entry's DN is in the group.
+                          2. check if the any of the group filter's base DN is a suffix of the new DN
 
                           If 1 and 2 are both false, we do nothing.
                           If 1 and 2 is true, we remove the old DN from the group, and add the new DN.
@@ -1106,7 +1193,7 @@ autogroup_response( Operation *op, SlapReply *rs )
                                }
 
                                if ( age->age_modrdn_olddnmodified ) {
-                                       /* Resquest already marked this group to be updated */
+                                       /* Request already marked this group to be updated */
                                        is_olddn = 1;
                                        is_value_refresh = 1;
                                        age->age_modrdn_olddnmodified = 0;
@@ -1171,11 +1258,17 @@ autogroup_response( Operation *op, SlapReply *rs )
                                } else
                                if ( is_olddn == 0 && is_newdn == 1 ) {
                                        Entry etmp;
+                                       struct berval odn, ondn;
                                        etmp.e_name = op->o_req_dn;
                                        etmp.e_nname = op->o_req_ndn;
                                        etmp.e_attrs = attrs;
+                                       odn = op->o_dn;
+                                       ondn = op->o_ndn;
+                                       op->o_dn = op->o_bd->be_rootdn;
+                                       op->o_ndn = op->o_bd->be_rootndn;
+
                                        for ( agf = age->age_filter; agf; agf = agf->agf_next ) {
-                                               if ( test_filter( op, e, agf->agf_filter ) == LDAP_COMPARE_TRUE ) {
+                                               if ( test_filter( op, &etmp, agf->agf_filter ) == LDAP_COMPARE_TRUE ) {
                                                        if ( ea ) {
                                                                autogroup_add_member_values_to_group( op, &new_dn, age, ea );
                                                        } else
@@ -1183,6 +1276,8 @@ autogroup_response( Operation *op, SlapReply *rs )
                                                        break;
                                                }
                                        }
+                                       op->o_dn = odn;
+                                       op->o_ndn = ondn;
                                } else
                                if ( is_olddn == 1 && is_newdn == 1 && dn_equal != 0 ) {
                                        if ( ea ) {
@@ -1212,8 +1307,9 @@ autogroup_response( Operation *op, SlapReply *rs )
        }
 
        if ( op->o_tag == LDAP_REQ_MODIFY ) {
-               if ( rs->sr_type == REP_RESULT && rs->sr_err == LDAP_SUCCESS  && !get_manageDSAit( op ) ) {
+               if ( rs->sr_type == REP_RESULT && rs->sr_err == LDAP_SUCCESS  && !oex ) {
                        Entry etmp;
+                       struct berval odn, ondn;
                        Debug( LDAP_DEBUG_TRACE, "==> autogroup_response MODIFY <%s>\n", op->o_req_dn.bv_val, 0, 0);
 
                        ldap_pvt_thread_mutex_lock( &agi->agi_mutex );                  
@@ -1301,11 +1397,15 @@ autogroup_response( Operation *op, SlapReply *rs )
                        etmp.e_name = op->o_req_dn;
                        etmp.e_nname = op->o_req_ndn;
                        etmp.e_attrs = attrs;
+                       odn = op->o_dn;
+                       ondn = op->o_ndn;
+                       op->o_dn = op->o_bd->be_rootdn;
+                       op->o_ndn = op->o_bd->be_rootndn;
+
                        for ( age = agi->agi_entry ; age ; age = age->age_next ) {
                                is_olddn = 0;
                                is_newdn = 0;
 
-
                                ldap_pvt_thread_mutex_lock( &age->age_mutex );
 
                                if ( age->age_filter && age->age_filter->agf_anlist ) {
@@ -1323,6 +1423,8 @@ autogroup_response( Operation *op, SlapReply *rs )
                                        attrs_free( attrs );
                                        ldap_pvt_thread_mutex_unlock( &age->age_mutex );
                                        ldap_pvt_thread_mutex_unlock( &agi->agi_mutex );
+                                       op->o_dn = odn;
+                                       op->o_ndn = ondn;
                                        return SLAP_CB_CONTINUE;
                                }
 
@@ -1366,6 +1468,8 @@ autogroup_response( Operation *op, SlapReply *rs )
                                ldap_pvt_thread_mutex_unlock( &age->age_mutex );
                        }
 
+                       op->o_dn = odn;
+                       op->o_ndn = ondn;
                        attrs_free( attrs );
 
                        ldap_pvt_thread_mutex_unlock( &agi->agi_mutex );
@@ -1404,7 +1508,7 @@ autogroup_memberOf_filter( Filter *f, BerValue *dn, AttributeDescription *member
 }
 
 /*
-** When modifing a group, we must deny any modifications to the member attribute,
+** When modifying a group, we must deny any modifications to the member attribute,
 ** because the group would be inconsistent.
 */
 static int
@@ -1416,9 +1520,12 @@ autogroup_modify_entry( Operation *op, SlapReply *rs)
        autogroup_entry_t       *age;
        Entry                   *e;
        Attribute               *a;
+       struct berval odn, ondn;
+       OpExtra *oex;
 
-       if ( get_manageDSAit( op ) ) {
-               return SLAP_CB_CONTINUE;
+       LDAP_SLIST_FOREACH( oex, &op->o_extra, oe_next ) {
+               if ( oex->oe_key == (void *)&autogroup )
+                       return SLAP_CB_CONTINUE;
        }
 
        Debug( LDAP_DEBUG_TRACE, "==> autogroup_modify_entry <%s>\n", op->o_req_dn.bv_val, 0, 0);
@@ -1431,6 +1538,11 @@ autogroup_modify_entry( Operation *op, SlapReply *rs)
                return SLAP_CB_CONTINUE;
        }
 
+       odn = op->o_dn;
+       ondn = op->o_ndn;
+       op->o_dn = op->o_bd->be_rootdn;
+       op->o_ndn = op->o_bd->be_rootndn;
+
        /* Must refresh groups if a matching member value is modified OR filter contains memberOf=DN */
        for ( age = agi->agi_entry; age ; age = age->age_next ) {
                autogroup_filter_t      *agf;
@@ -1454,6 +1566,8 @@ autogroup_modify_entry( Operation *op, SlapReply *rs)
                        }
                }
        }
+       op->o_dn = odn;
+       op->o_ndn = ondn;
 
        a = attrs_find( e->e_attrs, slap_schema.si_ad_objectClass );
 
@@ -1494,9 +1608,8 @@ autogroup_modify_entry( Operation *op, SlapReply *rs)
                                }
                        }
 
-                       overlay_entry_release_ov( op, e, 0, on );
-                       ldap_pvt_thread_mutex_unlock( &agi->agi_mutex );
-                       return SLAP_CB_CONTINUE;
+                       /* an entry may only have one dynamic group class */
+                       break;
                }
        }
 
@@ -1515,9 +1628,12 @@ autogroup_modrdn_entry( Operation *op, SlapReply *rs)
        autogroup_info_t        *agi = (autogroup_info_t *)on->on_bi.bi_private;
        autogroup_entry_t       *age;
        Entry                   *e;
+       struct berval odn, ondn;
+       OpExtra *oex;
 
-       if ( get_manageDSAit( op ) ) {
-               return SLAP_CB_CONTINUE;
+       LDAP_SLIST_FOREACH( oex, &op->o_extra, oe_next ) {
+               if ( oex->oe_key == (void *)&autogroup )
+                       return SLAP_CB_CONTINUE;
        }
 
        Debug( LDAP_DEBUG_TRACE, "==> autogroup_modrdn_entry <%s>\n", op->o_req_dn.bv_val, 0, 0);
@@ -1530,6 +1646,11 @@ autogroup_modrdn_entry( Operation *op, SlapReply *rs)
                return SLAP_CB_CONTINUE;
        }
 
+       odn = op->o_dn;
+       ondn = op->o_ndn;
+       op->o_dn = op->o_bd->be_rootdn;
+       op->o_ndn = op->o_bd->be_rootndn;
+
        /* Must check if a dn is modified */
        for ( age = agi->agi_entry; age ; age = age->age_next ) {
                autogroup_filter_t      *agf;
@@ -1544,6 +1665,8 @@ autogroup_modrdn_entry( Operation *op, SlapReply *rs)
                        }
                }
        }
+       op->o_dn = odn;
+       op->o_ndn = ondn;
 
        overlay_entry_release_ov( op, e, 0, on );
        ldap_pvt_thread_mutex_unlock( &agi->agi_mutex );                        
@@ -1965,6 +2088,7 @@ autogroup_db_open(
        op->ors_tlimit = SLAP_NO_LIMIT;
        op->ors_slimit = SLAP_NO_LIMIT;
        op->ors_attrs =  slap_anlist_no_attrs;
+       op->o_do_not_cache = 1;
 
        op->o_bd = be;
        op->o_bd->bd_info = (BackendInfo *)on->on_info;
@@ -2075,8 +2199,6 @@ autogroup_db_destroy(
        return 0;
 }
 
-static slap_overinst   autogroup = { { NULL } };
-
 static
 int
 autogroup_initialize(void)