]> git.sur5r.net Git - openldap/commitdiff
guard against simultaneous REP_ENTRY_MUSTRELEASE and REP_ENTRY_MODIFIABLE (related...
authorPierangelo Masarati <ando@openldap.org>
Tue, 8 Dec 2009 20:53:39 +0000 (20:53 +0000)
committerPierangelo Masarati <ando@openldap.org>
Tue, 8 Dec 2009 20:53:39 +0000 (20:53 +0000)
servers/slapd/overlays/collect.c
servers/slapd/overlays/valsort.c

index 3e5ee67db38928b17481e8864f3b8cf53c45249c..90867fdc8b94d8622f4696d81170369f29e3aa54 100644 (file)
@@ -386,10 +386,18 @@ collect_response( Operation *op, SlapReply *rs )
                        * don't modify it directly. Make a copy and
                        * work with that instead.
                        */
-                       if ( !( rs->sr_flags & REP_ENTRY_MODIFIABLE )) {
-                               rs->sr_entry = entry_dup( rs->sr_entry );
-                               rs->sr_flags |= REP_ENTRY_MODIFIABLE |
-                                       REP_ENTRY_MUSTBEFREED;
+                       if ( !( rs->sr_flags & REP_ENTRY_MODIFIABLE ) ) {
+                               Entry *e;
+
+                               e = entry_dup( rs->sr_entry );
+                               if ( rs->sr_flags & REP_ENTRY_MUSTRELEASE ) {
+                                       overlay_entry_release_ov( op, rs->sr_entry, 0, on );
+                                       rs->sr_flags &= ~REP_ENTRY_MUSTRELEASE;
+                               } else if ( rs->sr_flags & REP_ENTRY_MUSTBEFREED ) {
+                                       entry_free( rs->sr_entry );
+                               }
+                               rs->sr_entry = e;
+                               rs->sr_flags |= REP_ENTRY_MODIFIABLE|REP_ENTRY_MUSTBEFREED;
                        }
 
                        /* Loop for each attribute in this collectinfo */
index c5716eee3e066cd9e983591bdc0e50c9711de8d8..53a2e9192535da475250b2de2277f6e8c8085861 100644 (file)
@@ -297,9 +297,19 @@ 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 );
+               if (( rs->sr_flags & ( REP_ENTRY_MODIFIABLE|REP_ENTRY_MUSTBEFREED ) ) !=
+                       ( REP_ENTRY_MODIFIABLE|REP_ENTRY_MUSTBEFREED ) )
+               {
+                       Entry *e;
+
+                       e = entry_dup( rs->sr_entry );
+                       if ( rs->sr_flags & REP_ENTRY_MUSTRELEASE ) {
+                               overlay_entry_release_ov( op, rs->sr_entry, 0, on );
+                               rs->sr_flags &= ~REP_ENTRY_MUSTRELEASE;
+                       } else if ( rs->sr_flags & REP_ENTRY_MUSTBEFREED ) {
+                               entry_free( rs->sr_entry );
+                       }
+                       rs->sr_entry = e;
                        rs->sr_flags |= REP_ENTRY_MODIFIABLE|REP_ENTRY_MUSTBEFREED;
                        a = attr_find( rs->sr_entry->e_attrs, vi->vi_ad );
                }