]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/overlays/valsort.c
Merge remote-tracking branch 'origin/mdb.master'
[openldap] / servers / slapd / overlays / valsort.c
index 0e4a83226245cca33c57a6d865e1e8345cf566ee..5d89eb0554c776d55c43969d259caf027671023a 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2005-2007 The OpenLDAP Foundation.
+ * Copyright 2005-2012 The OpenLDAP Foundation.
  * Portions copyright 2005 Symas Corporation.
  * All rights reserved.
  *
@@ -297,10 +297,7 @@ valsort_response( Operation *op, SlapReply *rs )
                a = attr_find( rs->sr_entry->e_attrs, vi->vi_ad );
                if ( !a ) continue;
 
-               if (( rs->sr_flags & ( REP_ENTRY_MODIFIABLE|REP_ENTRY_MUSTBEFREED )) !=
-                       ( REP_ENTRY_MODIFIABLE|REP_ENTRY_MUSTBEFREED )) {
-                       rs->sr_entry = entry_dup( rs->sr_entry );
-                       rs->sr_flags |= REP_ENTRY_MODIFIABLE|REP_ENTRY_MUSTBEFREED;
+               if ( rs_entry2modifiable( op, rs, on )) {
                        a = attr_find( rs->sr_entry->e_attrs, vi->vi_ad );
                }
 
@@ -493,6 +490,10 @@ valsort_destroy(
        slap_overinst *on = (slap_overinst *)be->bd_info;
        valsort_info *vi = on->on_bi.bi_private, *next;
 
+#ifdef SLAP_CONFIG_DELETE
+       overlay_unregister_control( be, LDAP_CONTROL_VALSORT );
+#endif /* SLAP_CONFIG_DELETE */
+
        for (; vi; vi = next) {
                next = vi->vi_next;
                ch_free( vi->vi_dn.bv_val );
@@ -558,7 +559,7 @@ int valsort_initialize( void )
                SLAP_CTRL_SEARCH | SLAP_CTRL_HIDE, NULL, valsort_parseCtrl,
                &valsort_cid );
        if ( rc != LDAP_SUCCESS ) {
-               fprintf( stderr, "Failed to register control %d\n", rc );
+               Debug( LDAP_DEBUG_ANY, "Failed to register control %d\n", rc, 0, 0 );
                return rc;
        }