]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/overlays/dynlist.c
More VLV stuff
[openldap] / servers / slapd / overlays / dynlist.c
index deca8dce9fe035f2928b65a06b291e82322f500e..8e90185296e006ce264e23293aecc5dee631fae9 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2003-2008 The OpenLDAP Foundation.
+ * Copyright 2003-2009 The OpenLDAP Foundation.
  * Portions Copyright 2004-2005 Pierangelo Masarati.
  * Portions Copyright 2008 Emmanuel Dreyfus.
  * All rights reserved.
@@ -266,8 +266,8 @@ dynlist_sc_update( Operation *op, SlapReply *rs )
        }
 
 #ifndef SLAP_OPATTRS
-       opattrs = ( rs->sr_attrs == NULL ) ? 0 : an_find( rs->sr_attrs, &AllOper );
-       userattrs = ( rs->sr_attrs == NULL ) ? 1 : an_find( rs->sr_attrs, &AllUser );
+       opattrs = ( rs->sr_attrs == NULL ) ? 0 : an_find( rs->sr_attrs, slap_bv_operational_attrs );
+       userattrs = ( rs->sr_attrs == NULL ) ? 1 : an_find( rs->sr_attrs, slap_bv_user_attrs );
 #else /* SLAP_OPATTRS */
        opattrs = SLAP_OPATTRS( rs->sr_attr_flags );
        userattrs = SLAP_USERATTRS( rs->sr_attr_flags );
@@ -416,8 +416,8 @@ dynlist_prepare_entry( Operation *op, SlapReply *rs, dynlist_info_t *dli )
        }
 
 #ifndef SLAP_OPATTRS
-       opattrs = ( rs->sr_attrs == NULL ) ? 0 : an_find( rs->sr_attrs, &AllOper );
-       userattrs = ( rs->sr_attrs == NULL ) ? 1 : an_find( rs->sr_attrs, &AllUser );
+       opattrs = ( rs->sr_attrs == NULL ) ? 0 : an_find( rs->sr_attrs, slap_bv_operational_attrs );
+       userattrs = ( rs->sr_attrs == NULL ) ? 1 : an_find( rs->sr_attrs, slap_bv_user_attrs );
 #else /* SLAP_OPATTRS */
        opattrs = SLAP_OPATTRS( rs->sr_attr_flags );
        userattrs = SLAP_USERATTRS( rs->sr_attr_flags );
@@ -452,12 +452,13 @@ dynlist_prepare_entry( Operation *op, SlapReply *rs, dynlist_info_t *dli )
                o.o_groups = NULL;
        }
 
+       e_flags = rs->sr_flags;
        if ( !( rs->sr_flags & REP_ENTRY_MODIFIABLE ) ) {
                e = entry_dup( rs->sr_entry );
+               e_flags |= ( REP_ENTRY_MODIFIABLE | REP_ENTRY_MUSTBEFREED );
        } else {
                e = rs->sr_entry;
        }
-       e_flags = rs->sr_flags | ( REP_ENTRY_MODIFIABLE | REP_ENTRY_MUSTBEFREED );
 
        dlc.dlc_e = e;
        dlc.dlc_dli = dli;
@@ -855,6 +856,8 @@ done:;
 
                if ( r.sr_flags & REP_ENTRY_MUSTBEFREED ) {
                        entry_free( r.sr_entry );
+                       r.sr_entry = NULL;
+                       r.sr_flags ^= REP_ENTRY_MUSTBEFREED;
                }
        }
 
@@ -1259,8 +1262,8 @@ dl_cfgen( ConfigArgs *c )
                                }
 
                                *ptr++ = ' ';
-                               ptr = lutil_strncopy( ptr, dli->dli_oc->soc_cname.bv_val,
-                                       dli->dli_ad->ad_cname.bv_val );
+                               ptr = lutil_strncopy( ptr, dli->dli_ad->ad_cname.bv_val,
+                                       dli->dli_ad->ad_cname.bv_len );
 
                                for ( dlm = dli->dli_dlm; dlm; dlm = dlm->dlm_next ) {
                                        ptr[ 0 ] = ' ';